From c1d3afc64f3ce5f7902e54dd9d2881ad5be45610 Mon Sep 17 00:00:00 2001 From: Henning Geinitz Date: Sun, 10 Feb 2002 18:35:29 +0000 Subject: [PATCH] Link to functions in lib/ only if they are not available on the system. Use AC_PROG_LIBTOOL instead of the deprecated AM_PROG_LIBTOOL. Henning Meier-Geinitz --- configure | 111 +++++++++++++++++++++++++++++++++++++++------------ configure.in | 12 +++--- 2 files changed, 92 insertions(+), 31 deletions(-) diff --git a/configure b/configure index c2a0ab676..c5ef976c2 100755 --- a/configure +++ b/configure @@ -3819,18 +3819,17 @@ EOF fi -for ac_func in atexit ioperm mkdir scsireq_enter sigprocmask \ - strdup strndup strftime strstr strsep strtod snprintf \ - cfmakeraw tcsendbreak usleep strcasecmp strncasecmp _portaccess \ - getenv isfdtype vsyslog inet_ntop +for ac_func in atexit ioperm mkdir scsireq_enter \ + strftime strstr strtod \ + cfmakeraw tcsendbreak strcasecmp strncasecmp _portaccess do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3829: checking for $ac_func" >&5 +echo "configure:3828: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3878,8 +3877,67 @@ fi done +for ac_func in getenv inet_ntop isfdtype sigprocmask snprintf \ + strdup strndup strsep usleep vsyslog +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3885: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" +fi +done + + + echo $ac_n "checking linker parameter to set runtime link path""... $ac_c" 1>&6 -echo "configure:3883: checking linker parameter to set runtime link path" >&5 +echo "configure:3941: checking linker parameter to set runtime link path" >&5 if eval "test \"`echo '$''{'LINKER_RPATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3972,7 +4030,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3976: checking for $ac_word" >&5 +echo "configure:4034: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4000,7 +4058,7 @@ else fi echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:4004: checking for BSD-compatible nm" >&5 +echo "configure:4062: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4036,7 +4094,7 @@ NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:4040: checking whether ln -s works" >&5 +echo "configure:4098: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4090,8 +4148,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4094 "configure"' > conftest.$ac_ext - if { (eval echo configure:4095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 4152 "configure"' > conftest.$ac_ext + if { (eval echo configure:4153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -4112,19 +4170,19 @@ case "$lt_target" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:4116: checking whether the C compiler needs -belf" >&5 +echo "configure:4174: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -4147,7 +4205,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4151: checking for $ac_word" >&5 +echo "configure:4209: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4179,7 +4237,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4183: checking for $ac_word" >&5 +echo "configure:4241: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4214,7 +4272,7 @@ fi # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4218: checking for $ac_word" >&5 +echo "configure:4276: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4246,7 +4304,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4250: checking for $ac_word" >&5 +echo "configure:4308: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4281,7 +4339,7 @@ fi # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4285: checking for $ac_word" >&5 +echo "configure:4343: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4313,7 +4371,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4317: checking for $ac_word" >&5 +echo "configure:4375: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4587,7 +4645,7 @@ fi # Extract the first word of "sane-config", so it can be a program name with args. set dummy sane-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4591: checking for $ac_word" >&5 +echo "configure:4649: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SANE_CONFIG_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4621,7 +4679,7 @@ else fi echo $ac_n "checking for sane_init in -lsane""... $ac_c" 1>&6 -echo "configure:4625: checking for sane_init in -lsane" >&5 +echo "configure:4683: checking for sane_init in -lsane" >&5 ac_lib_var=`echo sane'_'sane_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4629,7 +4687,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsane $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4825,6 +4883,7 @@ s%@CPP@%$CPP%g s%@DL_LIB@%$DL_LIB%g s%@HAVE_GPHOTO2@%$HAVE_GPHOTO2%g s%@ALLOCA@%$ALLOCA%g +s%@LIBOBJS@%$LIBOBJS%g s%@LINKER_RPATH@%$LINKER_RPATH%g s%@RANLIB@%$RANLIB%g s%@LN_S@%$LN_S%g diff --git a/configure.in b/configure.in index 337fcac8e..48bef2a7c 100644 --- a/configure.in +++ b/configure.in @@ -203,16 +203,18 @@ fi dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_MMAP -AC_CHECK_FUNCS(atexit ioperm mkdir scsireq_enter sigprocmask \ - strdup strndup strftime strstr strsep strtod snprintf \ - cfmakeraw tcsendbreak usleep strcasecmp strncasecmp _portaccess \ - getenv isfdtype vsyslog inet_ntop) +AC_CHECK_FUNCS(atexit ioperm mkdir scsireq_enter \ + strftime strstr strtod \ + cfmakeraw tcsendbreak strcasecmp strncasecmp _portaccess) + +AC_REPLACE_FUNCS(getenv inet_ntop isfdtype sigprocmask snprintf \ + strdup strndup strsep usleep vsyslog) SANE_LINKER_RPATH dnl initialize libtool AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL +AC_PROG_LIBTOOL AC_SUBST(INCLUDES)