summaryrefslogtreecommitdiff
path: root/packages/mythtv/mythtv-0.20/configure.patch
blob: 03281eb7e5376b7765a765a700f3a990e5609b21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--- mythtv-0.20/configure	2006-08-28 17:18:08.000000000 +0100
+++ mythtv-0.20/configure	2007-01-16 14:42:18.000000000 +0000
@@ -1225,49 +1225,50 @@
 
 has_library()
 {
-    if test -f /etc/ld.so.conf ; then
-        LIBPATHS=`cat /etc/ld.so.conf | grep -v "#" | grep -v "include"`
+    lib=`echo $1 | sed 's/^lib//'`
+    tmpfile=/tmp/conftest.$$
+    rm -f $tmpfile $tmpfile.c
+    cat >$tmpfile.c <<EOF
+int main() { return 0; }
+EOF
+    echo "cc=$cc $LDFLAGS"
+    echo -n "checking for lib$lib... "
+    if $cc $LDFLAGS -o $tmpfile $tmpfile.c -l$lib; then
+      echo "yes"
+      result=0
     else
-        LIBPATHS=''
+      echo "no"
+      result=1
     fi
-    LIBPATHS="$LIBPATHS `echo $LD_LIBRARY_PATH | sed s/':'/' '/g` "
-    # Mac OS X has a different variable for this:
-    LIBPATHS="$LIBPATHS `echo $DYLD_LIBRARY_PATH | sed s/':'/' '/g` "
-
-    # recurse down just one level, should be enough in most cases
-    if test -f /etc/ld.so.conf ; then
-        INCL=`cat /etc/ld.so.conf | grep -v "#" | grep  "^include"`
-        SRCH=`echo "$INCL" | sed '{ s/^include \//\//; s/^include /\/etc\//}'`
-        for x in $SRCH ; do
-            LP_APPEND=`cat $x | grep -v "#" | grep -v "^include"`
-            LIBPATHS="$LIBPATHS $LP_APPEND"
-        done
-    fi
-
-    LIBPATHS="`echo $LIBPATHS /$libdir_name /usr/$libdir_name /usr/local/$libdir_name /usr/X11R6/$libdir_name | sed s/'\/ '/' '/g` "
-
-    HAS_IT="no"
-    for LIBPATH in $LIBPATHS ; do
-        if test x`ls $LIBPATH/$1* 2> /dev/null | head -n 1` != x"" ; then
-            HAS_IT="yes"
-        fi
-    done
-    expr $HAS_IT : "yes" > /dev/null
+    rm -f $tmpfile $tmpfile.c
+    return $result
 }
 
 has_header()
 {
-    HPATHS="/usr/local/include /usr/include /usr/include/g++-v3 /usr/X11R6/include"
-    INCL=`echo $DYLD_LIBRARY_PATH $LD_LIBRARY_PATH | sed s/':'/' '/g`
-    HPATHS="$HPATHS `echo $INCL | sed s/$libdir_name/include/g` "
-
-    HAS_IT="no"
-    for HPATH in $HPATHS ; do
-        if test x`ls $HPATH/$1* 2> /dev/null | head -n 1` != x"" ; then
-            HAS_IT="yes"
-        fi
-    done
-    expr $HAS_IT : "yes" > /dev/null
+    header=$1
+    tmpfile=/tmp/conftest.$$
+    rm -f $tmpfile.o $tmpfile.c
+    case $header in
+    X11/*) extra_incs="#include <X11/Xlib.h>" ;;
+    *) extra_incs="" ;;
+    esac
+    cat >$tmpfile.c <<EOF
+$extra_incs
+#include <$header>
+int main() { return 0; }
+EOF
+    echo "cc=$cc $CPPFLAGS $CFLAGS"
+    echo -n "checking for <$header>... "
+    if $cc $CPPFLAGS $CFLAGS -c -o $tmpfile.o $tmpfile.c; then
+      echo "yes"
+      result=0
+    else
+      echo "no"
+      result=1
+    fi
+    rm -f $tmpfile.o $tmpfile.c
+    return $result
 }
 
 CCONFIG="$CCONFIG $compile_type"