cf: Do not use headers and argument lists in AC_FIND_FUNC_NO_LIBS2

The callers of this macro generally do not supply this information.
Without it, the checks rely on compiler support for implicit function
declarations.  It would be possible to supply this information in
the callers.  But even then, with the existing macro interface, it
would be necessary to pass eg. null pointers where they trigger
undefined behavior.  Therefore, use the same kludge that autoconf
uses to make up prototypes, avoiding those implicit function
declarations.

The includes/arguments macro parameters are now ignored, but preserved
for interface compatibility.
This commit is contained in:
Florian Weimer 2023-04-13 13:26:29 +02:00 committed by Jeffrey Altman
parent c711cbf7cc
commit 323d555c82

@ -21,7 +21,7 @@ if eval "test \"\$ac_cv_func_$1\" != yes" ; then
*) ac_lib="-l$ac_lib" ;;
esac
LIBS="$6 $ac_lib $5 $ac_save_LIBS"
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])
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])
done
eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
LIBS="$ac_save_LIBS"