]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (AC_LANG_FUNC_LINK_TRY, AC_LANG_FUNC_LINK_TRY(C),
authorAkim Demaille <akim@epita.fr>
Wed, 24 May 2000 14:22:39 +0000 (14:22 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 24 May 2000 14:22:39 +0000 (14:22 +0000)
AC_LANG_FUNC_LINK_TRY(C++)): New macros.
(AC_CHECK_FUNC): Use it, together with AC_LINK_ELSE.

ChangeLog
acgeneral.m4
aclang.m4
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4

index 3c3be8d62167c157cea979f639afa047cfeaa9a4..363d816fec640daddce125e0c5833531947d8569 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-05-24  Akim Demaille  <akim@epita.fr>
+
+       * acgeneral.m4 (AC_LANG_FUNC_LINK_TRY, AC_LANG_FUNC_LINK_TRY(C),
+       AC_LANG_FUNC_LINK_TRY(C++)): New macros.
+       (AC_CHECK_FUNC): Use it, together with AC_LINK_ELSE.
+
 2000-05-24  Akim Demaille  <akim@epita.fr>
 
        * acspecific.m4 (AC_FUNC_VFORK): Quote properly.
index 5069ee716aaa2ebde46eb05b9432c688c8e4da79..96ac36b14581cddf93c460b0f46bf7d714946e19 100644 (file)
@@ -3095,31 +3095,9 @@ $3],
 AC_DEFUN([AC_CHECK_FUNC],
 [AC_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
 AC_CACHE_CHECK([for $1], ac_var,
-[AC_TRY_LINK(
-dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
-dnl which includes <sys/select.h> which contains a prototype for
-dnl select.  Similarly for bzero.
-[/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $1(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $1();
-char (*f)();
-], [
-/* 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_$1) || defined (__stub___$1)
-choke me
-#else
-f = $1;
-#endif
-], AC_VAR_SET(ac_var, yes), AC_VAR_SET(ac_var, no))])
+[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
+                [AC_VAR_SET(ac_var, yes)],
+                [AC_VAR_SET(ac_var, no)])])
 AC_SHELL_IFELSE([test AC_VAR_GET(ac_var) = yes],
                [$2], [$3])dnl
 AC_VAR_POPDEF([ac_var])dnl
index 905aed1257d2e001cc878319d1ae0fc13054ccec..8e3fa5624558128a806aaab2fa946161a871884b 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -256,6 +256,13 @@ AC_DEFUN([AC_LANG_CALL],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 
+# AC_LANG_FUNC_LINK_TRY(FUNCTION)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
 
 # --------------- #
 # 2b. C sources.  #
@@ -301,6 +308,35 @@ extern "C"
 char $2 ();])], [$2 ();])])
 
 
+# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select.  Similarly for bzero.
+define([AC_LANG_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $1 (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $1 ();
+char (*f) ();
+],
+[/* 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_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
 
 # ----------------- #
 # 2c. C++ sources.  #
@@ -329,6 +365,12 @@ define([AC_LANG_PROGRAM(C++)], defn([AC_LANG_PROGRAM(C)]))
 define([AC_LANG_CALL(C++)], defn([AC_LANG_CALL(C)]))
 
 
+# AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+# Same as C.
+define([AC_LANG_FUNC_LINK_TRY(C++)], defn([AC_LANG_FUNC_LINK_TRY(C)]))
+
+
 
 # ------------------------ #
 # 1d. Fortran 77 sources.  #
index 905aed1257d2e001cc878319d1ae0fc13054ccec..8e3fa5624558128a806aaab2fa946161a871884b 100644 (file)
@@ -256,6 +256,13 @@ AC_DEFUN([AC_LANG_CALL],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 
+# AC_LANG_FUNC_LINK_TRY(FUNCTION)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
 
 # --------------- #
 # 2b. C sources.  #
@@ -301,6 +308,35 @@ extern "C"
 char $2 ();])], [$2 ();])])
 
 
+# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select.  Similarly for bzero.
+define([AC_LANG_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $1 (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $1 ();
+char (*f) ();
+],
+[/* 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_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
 
 # ----------------- #
 # 2c. C++ sources.  #
@@ -329,6 +365,12 @@ define([AC_LANG_PROGRAM(C++)], defn([AC_LANG_PROGRAM(C)]))
 define([AC_LANG_CALL(C++)], defn([AC_LANG_CALL(C)]))
 
 
+# AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+# Same as C.
+define([AC_LANG_FUNC_LINK_TRY(C++)], defn([AC_LANG_FUNC_LINK_TRY(C)]))
+
+
 
 # ------------------------ #
 # 1d. Fortran 77 sources.  #
index 905aed1257d2e001cc878319d1ae0fc13054ccec..8e3fa5624558128a806aaab2fa946161a871884b 100644 (file)
@@ -256,6 +256,13 @@ AC_DEFUN([AC_LANG_CALL],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 
+# AC_LANG_FUNC_LINK_TRY(FUNCTION)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
 
 # --------------- #
 # 2b. C sources.  #
@@ -301,6 +308,35 @@ extern "C"
 char $2 ();])], [$2 ();])])
 
 
+# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select.  Similarly for bzero.
+define([AC_LANG_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $1 (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $1 ();
+char (*f) ();
+],
+[/* 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_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
 
 # ----------------- #
 # 2c. C++ sources.  #
@@ -329,6 +365,12 @@ define([AC_LANG_PROGRAM(C++)], defn([AC_LANG_PROGRAM(C)]))
 define([AC_LANG_CALL(C++)], defn([AC_LANG_CALL(C)]))
 
 
+# AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+# Same as C.
+define([AC_LANG_FUNC_LINK_TRY(C++)], defn([AC_LANG_FUNC_LINK_TRY(C)]))
+
+
 
 # ------------------------ #
 # 1d. Fortran 77 sources.  #
index 5069ee716aaa2ebde46eb05b9432c688c8e4da79..96ac36b14581cddf93c460b0f46bf7d714946e19 100644 (file)
@@ -3095,31 +3095,9 @@ $3],
 AC_DEFUN([AC_CHECK_FUNC],
 [AC_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
 AC_CACHE_CHECK([for $1], ac_var,
-[AC_TRY_LINK(
-dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
-dnl which includes <sys/select.h> which contains a prototype for
-dnl select.  Similarly for bzero.
-[/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $1(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $1();
-char (*f)();
-], [
-/* 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_$1) || defined (__stub___$1)
-choke me
-#else
-f = $1;
-#endif
-], AC_VAR_SET(ac_var, yes), AC_VAR_SET(ac_var, no))])
+[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
+                [AC_VAR_SET(ac_var, yes)],
+                [AC_VAR_SET(ac_var, no)])])
 AC_SHELL_IFELSE([test AC_VAR_GET(ac_var) = yes],
                [$2], [$3])dnl
 AC_VAR_POPDEF([ac_var])dnl
index 905aed1257d2e001cc878319d1ae0fc13054ccec..8e3fa5624558128a806aaab2fa946161a871884b 100644 (file)
@@ -256,6 +256,13 @@ AC_DEFUN([AC_LANG_CALL],
 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
 
 
+# AC_LANG_FUNC_LINK_TRY(FUNCTION)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+
 
 # --------------- #
 # 2b. C sources.  #
@@ -301,6 +308,35 @@ extern "C"
 char $2 ();])], [$2 ();])])
 
 
+# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select.  Similarly for bzero.
+define([AC_LANG_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $1 (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $1 ();
+char (*f) ();
+],
+[/* 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_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
 
 # ----------------- #
 # 2c. C++ sources.  #
@@ -329,6 +365,12 @@ define([AC_LANG_PROGRAM(C++)], defn([AC_LANG_PROGRAM(C)]))
 define([AC_LANG_CALL(C++)], defn([AC_LANG_CALL(C)]))
 
 
+# AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+# Same as C.
+define([AC_LANG_FUNC_LINK_TRY(C++)], defn([AC_LANG_FUNC_LINK_TRY(C)]))
+
+
 
 # ------------------------ #
 # 1d. Fortran 77 sources.  #