summaryrefslogtreecommitdiff
path: root/lib/popt/libpopt.m4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-18 20:29:05 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-18 20:29:05 +0200
commit729ffbae086309992d7433a296fca64f6800f8fa (patch)
tree6c133d2b91ab9313da11bf8bad15f497e1b5c61f /lib/popt/libpopt.m4
parent88ad1a936ccd2451d6dbf542a0a746ad71a3e968 (diff)
parentfc7050e54c69919d754ca0adf3f2f741a501fec4 (diff)
downloadsamba-729ffbae086309992d7433a296fca64f6800f8fa.tar.gz
samba-729ffbae086309992d7433a296fca64f6800f8fa.tar.bz2
samba-729ffbae086309992d7433a296fca64f6800f8fa.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into noejs
Conflicts: source4/main.mk
Diffstat (limited to 'lib/popt/libpopt.m4')
-rw-r--r--lib/popt/libpopt.m443
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/popt/libpopt.m4 b/lib/popt/libpopt.m4
new file mode 100644
index 0000000000..cfa2eaad23
--- /dev/null
+++ b/lib/popt/libpopt.m4
@@ -0,0 +1,43 @@
+dnl Check to see if we should use the included popt
+
+INCLUDED_POPT=auto
+AC_ARG_WITH(included-popt,
+[ --with-included-popt use bundled popt library, not from system],
+[ INCLUDED_POPT=$withval ])
+
+AC_SUBST(POPT_LIBS)
+AC_SUBST(POPT_CFLAGS)
+
+if test x"$INCLUDED_POPT" != x"yes"; then
+ AC_CHECK_HEADERS(popt.h)
+ AC_CHECK_LIB(popt, poptGetContext, [ POPT_LIBS="-lpopt" ])
+ if test x"$ac_cv_header_popt_h" = x"no" -o x"$ac_cv_lib_popt_poptGetContext" = x"no"; then
+ INCLUDED_POPT=yes
+ POPT_CFLAGS=""
+ else
+ INCLUDED_POPT=no
+ fi
+fi
+
+AC_MSG_CHECKING(whether to use included popt)
+AC_MSG_RESULT($INCLUDED_POPT)
+if test x"$INCLUDED_POPT" != x"no"; then
+ dnl find the popt sources. This is meant to work both for
+ dnl popt standalone builds, and builds of packages using popt
+ poptdir=""
+ poptpaths="$srcdir $srcdir/lib/popt $srcdir/popt $srcdir/../popt $srcdir/../lib/popt"
+ for d in $poptpaths; do
+ if test -f "$d/popt.c"; then
+ poptdir="$d"
+ POPT_CFLAGS="-I$d"
+ AC_SUBST(poptdir)
+ break
+ fi
+ done
+ if test x"$poptdir" = "x"; then
+ AC_MSG_ERROR([cannot find popt source in $poptpaths])
+ fi
+ POPT_OBJ="popt.o findme.o poptconfig.o popthelp.o poptparse.o"
+ AC_SUBST(POPT_OBJ)
+ AC_CHECK_HEADERS([float.h alloca.h])
+fi