summaryrefslogtreecommitdiff
path: root/source4/lib/popt
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-09-06 10:50:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:44 -0500
commitd52b2fb7c4a7f2b2a700204236f29bbb97b0f1d6 (patch)
tree5408edd277ab33c06ddf0184e30ee7958bcf2763 /source4/lib/popt
parent70b6211c98a15faf95a917b454a5f33961248e88 (diff)
downloadsamba-d52b2fb7c4a7f2b2a700204236f29bbb97b0f1d6.tar.gz
samba-d52b2fb7c4a7f2b2a700204236f29bbb97b0f1d6.tar.bz2
samba-d52b2fb7c4a7f2b2a700204236f29bbb97b0f1d6.zip
r18157: Fix building with external popt.
(This used to be commit 72e71de3e591091d71e43a3c9efd1cafd82d6c89)
Diffstat (limited to 'source4/lib/popt')
-rw-r--r--source4/lib/popt/libpopt.m449
-rw-r--r--source4/lib/popt/samba.m49
2 files changed, 45 insertions, 13 deletions
diff --git a/source4/lib/popt/libpopt.m4 b/source4/lib/popt/libpopt.m4
index 19b99f2bd0..b6b8808a4e 100644
--- a/source4/lib/popt/libpopt.m4
+++ b/source4/lib/popt/libpopt.m4
@@ -1,14 +1,39 @@
-dnl find the popt sources. This is meant to work both for
-dnl popt standalone builds, and builds of packages using popt
-poptdir=""
-for d in "$srcdir" "$srcdir/lib/popt" "$srcdir/popt" "$srcdir/../popt"; do
- if test -f "$d/popt.c"; then
- poptdir="$d"
- AC_SUBST(poptdir)
- break;
+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"; then
+ INCLUDED_POPT=yes
+ POPT_CFLAGS=""
+ else
+ INCLUDED_POPT=no
fi
-done
-POPTOBJ="popt.o findme.o poptconfig.o popthelp.o poptparse.o"
-AC_SUBST(POPTOBJ)
+fi
-AC_CHECK_HEADERS([float.h alloca.h])
+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=""
+ for d in "$srcdir" "$srcdir/lib/popt" "$srcdir/popt" "$srcdir/../popt"; do
+ if test -f "$d/popt.c"; then
+ poptdir="$d"
+ POPT_CFLAGS="-I$d"
+ AC_SUBST(poptdir)
+ break
+ fi
+ done
+ POPTOBJ="popt.o findme.o poptconfig.o popthelp.o poptparse.o"
+ AC_SUBST(POPTOBJ)
+ AC_CHECK_HEADERS([float.h alloca.h])
+fi
diff --git a/source4/lib/popt/samba.m4 b/source4/lib/popt/samba.m4
index d940075f86..d9f62f28d7 100644
--- a/source4/lib/popt/samba.m4
+++ b/source4/lib/popt/samba.m4
@@ -1,3 +1,10 @@
m4_include(lib/popt/libpopt.m4)
-SMB_SUBSYSTEM(LIBPOPT,
+
+if test x"$POPTOBJ" = "x"; then
+ SMB_EXT_LIB(LIBPOPT, [${POPT_LIBS}])
+ SMB_ENABLE(LIBPOPT,YES)
+else
+ SMB_SUBSYSTEM(LIBPOPT,
[lib/popt/findme.o lib/popt/popt.o lib/popt/poptconfig.o lib/popt/popthelp.o lib/popt/poptparse.o], [], [-I$srcdir/lib/popt])
+fi
+