| 1 |
From: Florian Weimer <[email protected]> |
| 2 |
Date: Thu, 13 Apr 2023 13:26:29 +0200 |
| 3 |
Subject: cf: Do not use headers and argument lists in AC_FIND_FUNC_NO_LIBS2 |
| 4 |
|
| 5 |
The callers of this macro generally do not supply this information. |
| 6 |
Without it, the checks rely on compiler support for implicit function |
| 7 |
declarations. It would be possible to supply this information in |
| 8 |
the callers. But even then, with the existing macro interface, it |
| 9 |
would be necessary to pass eg. null pointers where they trigger |
| 10 |
undefined behavior. Therefore, use the same kludge that autoconf |
| 11 |
uses to make up prototypes, avoiding those implicit function |
| 12 |
declarations. |
| 13 |
|
| 14 |
The includes/arguments macro parameters are now ignored, but preserved |
| 15 |
for interface compatibility. |
| 16 |
--- |
| 17 |
cf/find-func-no-libs2.m4 | 2 +- |
| 18 |
1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 |
|
| 20 |
diff --git a/cf/find-func-no-libs2.m4 b/cf/find-func-no-libs2.m4 |
| 21 |
index 5e5ed0e..a6b3ad6 100644 |
| 22 |
--- a/cf/find-func-no-libs2.m4 |
| 23 |
+++ b/cf/find-func-no-libs2.m4 |
| 24 |
@@ -21,7 +21,7 @@ if eval "test \"\$ac_cv_func_$1\" != yes" ; then |
| 25 |
*) ac_lib="-l$ac_lib" ;; |
| 26 |
esac |
| 27 |
LIBS="$6 $ac_lib $5 $ac_save_LIBS" |
| 28 |
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$1($4)]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break]) |
| 29 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[char $1 (void);]],[[$1()]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break]) |
| 30 |
done |
| 31 |
eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}" |
| 32 |
LIBS="$ac_save_LIBS" |