r665: merge over the new build system from my tmp branch
[jelmer/samba4-debian.git] / source / lib / popt / config.m4
1 #################################################
2 # Check to see if we should use the included popt
3
4 INCLUDED_POPT=auto
5 AC_ARG_WITH(included-popt,
6 [  --with-included-popt    use bundled popt library, not from system],
7
8 case "$withval" in
9         yes)
10                 INCLUDED_POPT=yes
11                 ;;
12         no)
13                 INCLUDED_POPT=no
14                 ;;
15 esac ],
16 )
17 if test x"$INCLUDED_POPT" != x"yes"; then
18         AC_CHECK_HEADERS(popt.h)
19         AC_CHECK_LIB_EXT(popt, TMP_LIBPOPT_LIBS, poptGetContext, [], [], INCLUDED_POPT=no)
20         if test x"$ac_cv_header_popt_h" = x"no"; then
21                 INCLUDED_POPT=yes
22                 TMP_LIBPOPT_LIBS=""
23         fi
24 fi
25
26 AC_MSG_CHECKING(whether to use included popt)
27 if test x"$INCLUDED_POPT" != x"no"; then
28         TMP_LIBPOPT_OBJS="lib/popt/findme.o lib/popt/popt.o lib/popt/poptconfig.o \
29                                 lib/popt/popthelp.o lib/popt/poptparse.o"
30         CPPFLAGS="$CPPFLAGS -I$srcdir/lib/popt"
31         AC_MSG_RESULT(yes)
32 else
33         AC_MSG_RESULT(no)
34 fi
35
36 #hack
37 LIBS="$LIBS ${TMP_LIBPOPT_LIBS}"
38
39 SMB_SUBSYSTEM(LIBPOPT,[],
40                 [${TMP_LIBPOPT_OBJS}],
41                 [])