summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-05-05 07:42:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:47 -0500
commit23a108c5cd3c0e60551af3cb039dc7290f721dfc (patch)
treec851b5aafd93d45629c43c212316d5ec46319c81 /source3
parent4d55a81958a67d5da3227d7af79a5c630f678424 (diff)
downloadsamba-23a108c5cd3c0e60551af3cb039dc7290f721dfc.tar.gz
samba-23a108c5cd3c0e60551af3cb039dc7290f721dfc.tar.bz2
samba-23a108c5cd3c0e60551af3cb039dc7290f721dfc.zip
r15451: Rewrite AC_LIBTESTFUNC so that it works like the callers
of it expect. (This used to be commit 7a0c4f4997f359645a9113e19a8831bde7f9ec58)
Diffstat (limited to 'source3')
-rw-r--r--source3/aclocal.m436
1 files changed, 24 insertions, 12 deletions
diff --git a/source3/aclocal.m4 b/source3/aclocal.m4
index 67b7017a91..459e4d5c7a 100644
--- a/source3/aclocal.m4
+++ b/source3/aclocal.m4
@@ -104,20 +104,32 @@ AC_DEFUN(AC_HAVE_DECL,
])
-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)
+dnl Check for a function in a library, but don't keep adding the same library
+dnl to the LIBS variable. Check whether the function is available in the
+dnl current LIBS before adding the library which prevents us spuriously
+dnl adding libraries for symbols that are in libc. On success, this ensures that
+dnl HAVE_FOO is defined.
+AC_LIBTESTFUNC(lib,func)
AC_DEFUN(AC_LIBTESTFUNC,
[
- AC_CHECK_FUNCS($2, [],
- [ case "$LIBS" in
- *-l$1*) AC_CHECK_FUNCS($2) ;;
- *) AC_CHECK_LIB($1, $2)
- AC_CHECK_FUNCS($2)
- ;;
+ AC_CHECK_FUNCS($2,
+ [
+ # $2 was found in libc or existing $LIBS
+ AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
+ [Whether $2 is available])
+ ],
+ [
+ # $2 was not found, try adding lib$1
+ case " $LIBS " in
+ *\ -l$1\ *) ;;
+ *) AC_CHECK_LIB($1, $2,
+ [
+ AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
+ [Whether $2 is available])
+ LIBS="-l$1 $LIBS"
+ ],
+ [])
+ ;;
esac
])
])