2 # a library of shell routines for simple autoconf system
7 rm -f conftest* config.log
10 This file contains any messages produced by compilers etc while
11 running configure, to aid debugging if configure script makes a mistake.
16 *c*) ac_en=-n ac_ec= ;;
17 *) ac_en= ac_ec='\c' ;;
22 echo $ac_en "$*... $ac_ec"
26 echo $ac_en "checking $*... $ac_ec"
27 echo ">>> checking $*" >&5
34 echo "configure: fatal: $*" >&2
35 echo "=== FATAL: $*" >&5
39 echo "configure: warning: $*" >&2
40 echo "=== WARNING: $*" >&5
47 # captures output in conftest.out
49 # apparently UnixWare (for one) /bin/sh optimizes the following "if"
50 # "away", by checking if there's such a command BEFORE redirecting
51 # output. So error message (like "gcc: command not found") goes
52 # to stderr instead of to conftest.out, and `cat conftest.out' below
54 if "$@" >conftest.out 2>&1; then
57 echo "==== Command invocation failed. Command line was:" >&5
59 echo "==== compiler input was:" >&5
61 echo "==== output was:" >&5
68 # common case for ac_verbose: yes/no result
82 ac_substitutes="$ac_substitutes $*"
86 CDEFS="$CDEFS -D$1=${2:-1}"
92 ac_define HAVE_$ac_what
93 eval ac_have_$ac_what=yes
96 eval ac_have_$ac_what=no
101 ##### Compiling, linking
105 rm -f conftest*; cat >conftest.c
106 ac_run $CC $CFLAGS $CDEFS "$@" conftest.c
114 ac_run_compiler -o conftest $LIBS "$@"
118 ac_run_compiler -E "$@"
121 ### check for C compiler. Set $CC, $CFLAGS etc
122 ac_prog_c_compiler_v() {
123 ac_checking "for C compiler"
125 echo 'int main(int argc, char **argv) { return 0; }' >conftest.c
127 if [ -n "$CC" ]; then
128 if ac_run $CC -o conftest conftest.c && ac_run ./conftest; then
129 ac_result "\$CC ($CC)"
132 ac_fatal "\$CC ($CC) is not a working compiler"
135 for cc in gcc cc ; do
136 if ac_run $cc -o conftest conftest.c && ac_run ./conftest; then
142 if [ -z "$CC" ]; then
144 ac_fatal "no working C compiler found in \$PATH. please set \$CC variable"
147 if [ -z "$CFLAGS" ]; then
148 if ac_yesno "whenever C compiler ($CC) is GNU CC" \
149 ac_grep_cpp yEs_mAsTeR <<EOF
155 CFLAGS="-Wall -W -O2 -pipe"
162 if [ -n "$LDFLAGS" ]; then ccld="$ccld $LDFLAGS"; fi
163 if [ -n "$LIBS" ]; then ccld="$ccld $LIBS"; fi
164 if ac_yesno "whenever the C compiler ($ccld)
165 can produce executables" \
167 int main() { return 0; }
171 ac_fatal "no working C compiler found"
174 [ -n "$AR" ] || AR=ar
175 [ -n "$ARFLAGS" ] || ARFLAGS=rv
176 [ -n "$AWK" ] || AWK=awk
177 ac_substitutes="$ac_substitutes CC CFLAGS CDEFS LD LDFLAGS LIBS AR ARFLAGS AWK"
182 ac_checking "for ranlib"
183 if [ -n "$RANLIB" ]; then
184 ac_result "\$RANLIB ($RANLIB)"
189 [ -n "$dir" ] || dir=.
190 if [ -f $dir/ranlib ]; then
196 if [ -z "$RANLIB" ]; then ac_result no; RANLIB=:
197 else ac_result "$RANLIB"
200 ac_substitutes="$ac_substitutes RANLIB"
203 ac_library_find_v() {
204 ac_checking "for libraries needed for $1"
207 rm -f conftest*; cat >conftest.c
209 if ac_run $CC $CFLAGS $LDFLAGS conftest.c -o conftest $LIBS $lib; then
214 if [ ! "$found" ]; then
215 ac_result "not found"
218 if [ -z "$lib" ]; then
219 ac_result "ok (none needed)"
221 ac_result "ok ($lib)"
227 ac_link "$@" && ac_run ./conftest
232 ac_cpp "$@" && grep "$pattern" conftest.out >/dev/null
236 for var in $ac_substitutes; do
237 eval echo "\"s|@$var@|\$$var|\""
240 ac_msg "creating $file"
241 if [ -f $file.in ]; then
242 sed -f conftest.sed $file.in > $file.tmp
243 mv -f $file.tmp $file
247 ac_fatal "$file.in not found"
257 echo "/* automatically generated by configure. */" > $h.tmp
258 echo "$CDEFS" | tr ' ' '
259 ' | sed -e 's/^-D/#define /' -e 's/=/ /' >> $h.tmp
260 if [ -f $h ] && cmp -s $h.tmp $h ; then
267 CDEFS=-DHAVE_CONFIG_H