ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/pxys2-2.1.0/pxyscand/acinclude.m4
Revision: 3253
Committed: Wed Apr 2 20:46:18 2014 UTC (10 years ago) by michael
File size: 5735 byte(s)
Log Message:
- Imported pxys2-2.1.0

File Contents

# Content
1 AC_DEFUN([AC_PATH_GENERIC],
2 [dnl
3 dnl we're going to need uppercase, lowercase and user-friendly versions of the
4 dnl string `LIBRARY'
5 pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
6 pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
7
8 dnl
9 dnl Get the cflags and libraries from the LIBRARY-config script
10 dnl
11 AC_ARG_WITH(DOWN-prefix,[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
12 DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
13 AC_ARG_WITH(DOWN-exec-prefix,[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
14 DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
15
16 if test x$DOWN[]_config_exec_prefix != x ; then
17 DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
18 if test x${UP[]_CONFIG+set} != xset ; then
19 UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
20 fi
21 fi
22 if test x$DOWN[]_config_prefix != x ; then
23 DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
24 if test x${UP[]_CONFIG+set} != xset ; then
25 UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
26 fi
27 fi
28
29 AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
30 ifelse([$2], ,
31 AC_MSG_CHECKING(for $1),
32 AC_MSG_CHECKING(for $1 - version >= $2)
33 )
34 no_[]DOWN=""
35 if test "$UP[]_CONFIG" = "no" ; then
36 no_[]DOWN=yes
37 else
38 UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
39 UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
40 ifelse([$2], , ,[
41 DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
42 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
43 DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
44 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
45 DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
46 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
47 DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
48 DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
49 DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
50
51 # Compare wanted version to what config script returned.
52 # If I knew what library was being run, i'd probably also compile
53 # a test program at this point (which also extracted and tested
54 # the version in some library-specific way)
55 if test "$DOWN[]_config_major_version" -lt \
56 "$DOWN[]_wanted_major_version" \
57 -o \( "$DOWN[]_config_major_version" -eq \
58 "$DOWN[]_wanted_major_version" \
59 -a "$DOWN[]_config_minor_version" -lt \
60 "$DOWN[]_wanted_minor_version" \) \
61 -o \( "$DOWN[]_config_major_version" -eq \
62 "$DOWN[]_wanted_major_version" \
63 -a "$DOWN[]_config_minor_version" -eq \
64 "$DOWN[]_wanted_minor_version" \
65 -a "$DOWN[]_config_micro_version" -lt \
66 "$DOWN[]_wanted_micro_version" \) ; then
67 # older version found
68 no_[]DOWN=yes
69 echo -n "*** An old version of $1 "
70 echo -n "($DOWN[]_config_major_version"
71 echo -n ".$DOWN[]_config_minor_version"
72 echo ".$DOWN[]_config_micro_version) was found."
73 echo -n "*** You need a version of $1 newer than "
74 echo -n "$DOWN[]_wanted_major_version"
75 echo -n ".$DOWN[]_wanted_minor_version"
76 echo ".$DOWN[]_wanted_micro_version."
77 echo "***"
78 echo "*** If you have already installed a sufficiently new version, this error"
79 echo "*** probably means that the wrong copy of the DOWN-config shell script is"
80 echo "*** being found. The easiest way to fix this is to remove the old version"
81 echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
82 echo "*** correct copy of DOWN-config. (In this case, you will have to"
83 echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
84 echo "*** so that the correct libraries are found at run-time)"
85 fi
86 ])
87 fi
88 if test "x$no_[]DOWN" = x ; then
89 AC_MSG_RESULT(yes)
90 ifelse([$3], , :, [$3])
91 else
92 AC_MSG_RESULT(no)
93 if test "$UP[]_CONFIG" = "no" ; then
94 echo "*** The DOWN-config script installed by $1 could not be found"
95 echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
96 echo "*** your path, or set the UP[]_CONFIG environment variable to the"
97 echo "*** full path to DOWN-config."
98 fi
99 UP[]_CFLAGS=""
100 UP[]_LIBS=""
101 ifelse([$4], , :, [$4])
102 fi
103 AC_SUBST(UP[]_CFLAGS)
104 AC_SUBST(UP[]_LIBS)
105
106 popdef([UP])
107 popdef([DOWN])
108 ])
109
110 dnl XIPH_VAR_APPEND
111 dnl Karl Heyes
112 dnl
113 # XIPH_VAR_APPEND(shell-var, list)
114 # Append each item in list to shell-var iff shell-var doesn't already have it
115 # eg XIPH_VAR_APPEND([CFLAGS], [-O2 -I/opt/packages/include])
116 AC_DEFUN([XIPH_VAR_APPEND],
117 [dnl
118 AC_REQUIRE([AC_PROG_FGREP])
119 for arg in $2
120 do
121 if { cat <<EOF
122 $$1 x
123 EOF
124 } | $FGREP -v -e " $arg " > /dev/null
125 then
126 $1="$$1 $arg"
127 fi
128 done
129 ])dnl XIPH_VAR_APPEND
130
131 dnl XIPH_VAR_PREPEND
132 dnl Karl Heyes
133 dnl
134 # XIPH_VAR_PREPEND(shell-var, list)
135 # see XIPH_VAR_APPEND
136 AC_DEFUN([XIPH_VAR_PREPEND],
137 [dnl
138 AC_REQUIRE([AC_PROG_FGREP])
139 xt_compare="$$1"
140 xt_filtered=""
141 for arg in $2
142 do
143 if { cat <<EOF
144 $xt_compare x
145 EOF
146 } | $FGREP -v -e " $arg " > /dev/null
147 then
148 xt_compare="$arg $xt_compare"
149 xt_filtered="$xt_filtered $arg"
150 fi
151 done
152 $1="$xt_filtered $$1"
153 ])dnl XIPH_VAR_PREPEND
154