])
-dnl check for a function in a library, but don't
+dnl Check for a function in a library, but don't
dnl keep adding the same library to the LIBS variable.
+dnl Check whether the function is available in the current
+dnl LIBS before adding the library. This prevents us spuriously
+dnl finding symbols that are in libc.
dnl AC_LIBTESTFUNC(lib,func)
AC_DEFUN(AC_LIBTESTFUNC,
-[case "$LIBS" in
- *-l$1*) AC_CHECK_FUNCS($2) ;;
- *) AC_CHECK_LIB($1, $2)
- AC_CHECK_FUNCS($2)
- ;;
- esac
+[
+ AC_CHECK_FUNCS($2, [],
+ [ case "$LIBS" in
+ *-l$1*) AC_CHECK_FUNCS($2) ;;
+ *) AC_CHECK_LIB($1, $2)
+ AC_CHECK_FUNCS($2)
+ ;;
+ esac
+ ])
])
# AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
jm_cv_lib_iconv=""
jm_cv_giconv=no
jm_save_LIBS="$LIBS"
- LIBS="$LIBS -lbiconv"
- AC_TRY_LINK([#include <stdlib.h>
-#include <biconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- jm_cv_func_iconv=yes
- jm_cv_biconv=yes
- jm_cv_include="biconv.h"
- jm_cv_lib_iconv="biconv")
- LIBS="$jm_save_LIBS"
dnl Check for include in funny place but no lib needed
if test "$jm_cv_func_iconv" != yes; then