]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Wed Mar 20 09:37:31 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
authorRoland McGrath <roland@gnu.org>
Wed, 20 Mar 1996 15:08:48 +0000 (15:08 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 20 Mar 1996 15:08:48 +0000 (15:08 +0000)
* acgeneral.m4 (AC_CHECK_LIB): Omit `char $2' decl when $2 is `main'.

acgeneral.m4
lib/autoconf/general.m4

index a1ea9a0127fec3b9fc1cef5c079a63a071cc763c..4a3b9c9d9dbd2ed840852621d51bc160a4c64a83 100644 (file)
@@ -1408,17 +1408,21 @@ dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
 dnl may have different results.
-ac_lib_var=`echo $1['_']$2 | tr '.-/+' '___p'`
+ac_lib_var=`echo $1['_']$2 | tr '.\055/+' '___p'`
 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
 [ac_save_LIBS="$LIBS"
 LIBS="-l$1 $5 $LIBS"
-AC_TRY_LINK([/* Override any gcc2 internal prototype to avoid an error.  */
+AC_TRY_LINK(dnl
+ifelse([$2], [main], , dnl Avoid conflicting decl of main.
+[/* Override any gcc2 internal prototype to avoid an error.  */
 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
 extern "C"
 #endif
 ])dnl
-[char $2();
-],
+[/* We use `char' because `int' might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $2();
+]),
            [$2()],
            eval "ac_cv_lib_$ac_lib_var=yes",
            eval "ac_cv_lib_$ac_lib_var=no")dnl
@@ -1685,7 +1689,9 @@ dnl select.  Similarly for bzero.
 extern "C"
 #endif
 ])dnl
-[char $1();
+[/* We use `char' because `int' might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $1();
 ], [
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
index a1ea9a0127fec3b9fc1cef5c079a63a071cc763c..4a3b9c9d9dbd2ed840852621d51bc160a4c64a83 100644 (file)
@@ -1408,17 +1408,21 @@ dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
 dnl may have different results.
-ac_lib_var=`echo $1['_']$2 | tr '.-/+' '___p'`
+ac_lib_var=`echo $1['_']$2 | tr '.\055/+' '___p'`
 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
 [ac_save_LIBS="$LIBS"
 LIBS="-l$1 $5 $LIBS"
-AC_TRY_LINK([/* Override any gcc2 internal prototype to avoid an error.  */
+AC_TRY_LINK(dnl
+ifelse([$2], [main], , dnl Avoid conflicting decl of main.
+[/* Override any gcc2 internal prototype to avoid an error.  */
 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
 extern "C"
 #endif
 ])dnl
-[char $2();
-],
+[/* We use `char' because `int' might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $2();
+]),
            [$2()],
            eval "ac_cv_lib_$ac_lib_var=yes",
            eval "ac_cv_lib_$ac_lib_var=no")dnl
@@ -1685,7 +1689,9 @@ dnl select.  Similarly for bzero.
 extern "C"
 #endif
 ])dnl
-[char $1();
+[/* We use `char' because `int' might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $1();
 ], [
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named