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 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#!/bin/sh
# We can't use the AC_ macros here
# (no expansion is provided, these are shell scripts, remember?)
# But, we don't usually test the results of the expansion either...
# So we have a function which is an abreviated version of the expansion
# that would occur if we did this in configure.in
# Invoke: test_library(-lname, functionname)
test_library()
{
ce_status=0
# In case this isn't from ./configure, set the key items to 'reasonable'
# defaults
if test ".$CC" = "."; then
CC=gcc
fi
if test ".$ac_ext" = "."; then
ac_ext=c
fi
if test ".$ac_objext" = "."; then
ac_objext=o
fi
if test ".$ac_exeext" = "."; then
ac_exeext=
fi
if test ".$ac_link" = "."; then
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS'
fi
echo ""
echo -n "checking for $2 in -l$1..."
ac_check_lib_save_LIBS=$LIBS
LIBS="-l$1 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
// Test program from configureextra/HPUX
/* begin confdefs.h. */
_ACEOF
if test -f confdefs.h; then
cat confdefs.h >>conftest.$ac_ext
fi
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $2 ();
int
main ()
{
$2 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext conftest.msg
eval $ac_link 2> conftest.msg
ce_status=$?
if [ $ce_status -eq 0 ]; then
ac_try='test -s conftest$ac_exeext'
eval $ac_try
ce_status=$?
fi
if [ $ce_status -eq 0 ]; then
echo "ok"
ac_set='export ac_cv_lib_$1_$2=yes'
eval $ac_set
have=`echo $1 | awk '{ print toupper($0) }'`
cat >>confdefs.h <<_ACEOF
#define HAVE_LIB$have 1
_ACEOF
else
echo "failed, message(s) are:"
echo ""
cat conftest.msg
echo ""
if [ ".${ac_debug}" = ".yes" ]; then
echo "test program was:"
echo ""
sed 's/^/| /' conftest.$ac_ext
echo ""
fi
ac_set='export ac_cv_lib_$1_$2=no'
eval $ac_set
LIBS=$ac_check_lib_save_LIBS
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext conftest.msg
echo ""
}
|