Cosmetic fix for libpopt-checking test.
[ira/wip.git] / source3 / configure.in
index b9e8c94b42e2f84da4de5e3032e824efcdbff734..433665eeef81da3016519325980b6996447c2b33 100644 (file)
@@ -23,17 +23,24 @@ AC_SUBST(LIBSMBCLIENT_SHARED)
 # compile with optimisation and without debugging by default
 CFLAGS="-O ${CFLAGS}"
 
-AC_ARG_ENABLE(debug, [  --enable-debug        turn on debugging [default=no]],
+AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]],
     [if eval "test x$enable_debug = xyes"; then
        CFLAGS="${CFLAGS} -g"
     fi])
 
+AC_ARG_ENABLE(developer, [  --enable-developer      turn on developer warnings and debugging [default=no]],
+    [if eval "test x$enable_developer = xyes"; then
+       CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
+    fi])
 
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_AWK
 
+dnl needed before AC_TRY_COMPILE
+AC_ISC_POSIX
+
 dnl Check if C compiler understands -c and -o at the same time
 AC_PROG_CC_C_O
 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
@@ -301,8 +308,8 @@ AC_CHECK_LIB(cups,httpConnect)
 
 if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
         AC_CHECK_HEADERS(cups/cups.h cups/language.h)
-        if x"$ac_cv_header_cups_cups_h" = x"yes"; then
-                if x"$ac_cv_header_cups_language_h" = x"yes"; then
+        if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
+                if test x"$ac_cv_header_cups_language_h" = x"yes"; then
                         AC_DEFINE(HAVE_CUPS)
                 fi
         fi
@@ -313,7 +320,6 @@ fi
 AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
        AC_DEFINE(HAVE_LIBDL)])
 
-
 ############################################
 # check if the compiler can do immediate structures
 AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
@@ -530,7 +536,7 @@ fi
 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
-AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
+AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
@@ -603,16 +609,9 @@ if test x$ac_cv_func_fstat64 = xno ; then
   fi
 fi
 
-#
-# If no strcasecmp, check for it in some known places
-# It is in -lresolv on ReliantUNIX and UnixWare
-#   -lresolve *must* follow -lnsl for name resolution to work properly
-#
-
-if test x$ac_cv_func_strcasecmp = xno ; then
-       AC_CHECK_LIB(resolv,strcasecmp,[LIBS="$LIBS -lresolv"]
-               AC_DEFINE(HAVE_STRCASECMP))
-fi
+#####################################
+# we might need the resolv library on some systems
+AC_CHECK_LIB(resolv, dn_expand)
 
 #
 # Check for the functions putprpwnam, set_auth_parameters,
@@ -1543,10 +1542,10 @@ AC_ARG_WITH(smbwrapper,
 )
 
 #################################################
-# check for the AFS filesystem
-AC_MSG_CHECKING(whether to use AFS)
+# check for AFS clear-text auth support
+AC_MSG_CHECKING(whether to use AFS clear-text auth)
 AC_ARG_WITH(afs,
-[  --with-afs              Include AFS support (default=no) ],
+[  --with-afs              Include AFS clear-text auth support (default=no) ],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1561,10 +1560,10 @@ AC_ARG_WITH(afs,
 
 
 #################################################
-# check for the DFS auth system
-AC_MSG_CHECKING(whether to use DFS auth)
+# check for the DFS clear-text auth system
+AC_MSG_CHECKING(whether to use DFS clear-text auth)
 AC_ARG_WITH(dfs,
-[  --with-dce-dfs          Include DCE/DFS support (default=no)],
+[  --with-dce-dfs          Include DCE/DFS clear-text auth support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1577,49 +1576,41 @@ AC_ARG_WITH(dfs,
   AC_MSG_RESULT(no)
 )
 
-#################################################
-# check for Kerberos IV auth system
-AC_MSG_CHECKING(whether to use Kerberos IV)
-AC_ARG_WITH(krb4,
-[  --with-krb4=base-dir    Include Kerberos IV support (default=no)],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(KRB4_AUTH)
-    AC_CHECK_LIB(resolv, dn_expand)
-    LIBS="$LIBS -lkrb -ldes"
-    CFLAGS="$CFLAGS -I$withval/include"
-    LDFLAGS="$LDFLAGS -L$withval/lib"
-    AC_DEFINE_UNQUOTED(KRB4_DIR, ${withval})
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
 
 #################################################
-# check for Kerberos 5 auth system
-AC_MSG_CHECKING(whether to use Kerberos 5)
+# check for location of Kerberos 5 install
+AC_MSG_CHECKING(for kerberos 5 install path)
 AC_ARG_WITH(krb5,
-[  --with-krb5=base-dir    Include Kerberos 5 support (default=no)],
+[  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
 [ case "$withval" in
-  yes)
+  no)
+    AC_MSG_RESULT(no)
+    ;;
+  *)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(KRB5_AUTH)
-    LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
+    LIBS="$LIBS -lkrb5"
     CFLAGS="$CFLAGS -I$withval/include"
     LDFLAGS="$LDFLAGS -L$withval/lib"
-    AC_DEFINE_UNQUOTED(KRB5_DIR,${withval})
-    ;;
-  *)
-    AC_MSG_RESULT(no)
+    AC_DEFINE(HAVE_KRB5)
+    have_krb5=yes;
     ;;
   esac ],
   AC_MSG_RESULT(no)
 )
 
+
+########################################################
+# now see if we can find the krb5 libs in standard paths
+if test x$have_krb5 != xyes; then
+AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
+       AC_DEFINE(HAVE_KRB5)])
+fi
+
+##################################################################
+# we might need the k5crypto and com_err libraries on some systems
+AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
+AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
+
 #################################################
 # check for automount support
 AC_MSG_CHECKING(whether to use AUTOMOUNT)
@@ -1666,11 +1657,11 @@ AC_ARG_WITH(smbmount,
 
 
 #################################################
-# check for a PAM password database
+# check for a PAM clear-text auth, accounts, password and session support
 with_pam_for_crypt=no
-AC_MSG_CHECKING(whether to use PAM password database)
+AC_MSG_CHECKING(whether to use PAM)
 AC_ARG_WITH(pam,
-[  --with-pam              Include PAM password database support (default=no)],
+[  --with-pam              Include PAM support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1744,15 +1735,27 @@ fi
 fi
 
 
+
+########################################################################################
+##
+## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
+##
+########################################################################################
+
+## set the with_smbpasswd_sam as the default
+with_smbpasswd_sam=yes
+
+
 #################################################
 # check for a TDB password database
-AC_MSG_CHECKING(whether to use TDB password database)
+AC_MSG_CHECKING(whether to use TDB SAM database)
 AC_ARG_WITH(tdbsam,
-[  --with-tdbsam           Include experimental TDB password database (default=no)],
+[  --with-tdbsam           Include experimental TDB SAM support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_TDBSAM)
+    AC_DEFINE(WITH_TDB_SAM)
+    with_smbpasswd_sam=no
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -1763,14 +1766,15 @@ AC_ARG_WITH(tdbsam,
 
 #################################################
 # check for a LDAP password database
-AC_MSG_CHECKING(whether to use LDAP password database)
-AC_ARG_WITH(ldap,
-[  --with-ldapsam          Include Experimental LDAP-Sam support (default=no)],
+AC_MSG_CHECKING(whether to use LDAP SAM database)
+AC_ARG_WITH(ldapsam,
+[  --with-ldapsam          Include experimental LDAP SAM support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_LDAP)
-    AC_MSG_ERROR([LDAP password database not supported in this version.])
+    AC_DEFINE(WITH_LDAP_SAM)
+    LIBS="-lldap -llber $LIBS"
+    with_smbpasswd_sam=no
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -1780,22 +1784,40 @@ AC_ARG_WITH(ldap,
 )
 
 #################################################
-# commented out by --jerry
 # check for a NISPLUS password database
-#AC_MSG_CHECKING(whether to use NISPLUS password database)
-#AC_ARG_WITH(nisplus,
-#[  --with-nisplus     Include NISPLUS password database support
-#[ case "$withval" in
-#  yes)
-#    AC_MSG_RESULT(yes)
-#    AC_DEFINE(WITH_NISPLUS)
-#    ;;
-#  *)
-#    AC_MSG_RESULT(no)
-#    ;;
-#  esac ],
-#  AC_MSG_RESULT(no)
-#)
+AC_MSG_CHECKING(whether to use NISPLUS SAM database)
+AC_ARG_WITH(nisplussam,
+[  --with-nisplussam       Include NISPLUS SAM support (default=no)],
+[ case "$withval" in
+  yes)
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(WITH_NISPLUS_SAM)
+    with_smbpasswd_sam=no
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+################################################
+# This test should come last because the
+# smbpasswd SAM is only used if another format
+# has not been defined
+AC_MSG_CHECKING(whether to use traditional smbpasswd file)
+if test $with_smbpasswd_sam = yes; then
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(WITH_SMBPASSWD_SAM)
+else
+       AC_MSG_RESULT(no)
+fi
+
+########################################################################################
+##
+## END OF TESTS FOR SAM BACKENDS.  
+##
+########################################################################################
 
 #################################################
 # check for a NISPLUS_HOME support 
@@ -1819,7 +1841,8 @@ AC_ARG_WITH(nisplus-home,
 AC_MSG_CHECKING(whether to use SSL)
 AC_ARG_WITH(ssl,
 [  --with-ssl              Include SSL support (default=no)
-  --with-sslinc=DIR       Where the SSL includes are (defaults to /usr/local/ssl)],
+  --with-sslinc=DIR          Where the SSL includes are (defaults to /usr/local/ssl/include)
+  --with-ssllib=DIR          Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1833,31 +1856,43 @@ AC_ARG_WITH(ssl,
        yes|no)
          echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
          CFLAGS="-I/usr/local/ssl/include $CFLAGS"
-         LIBS="-lssl -lcrypto $LIBS"
-         LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
-         AC_DEFINE(SSL_DIR, "/usr/local/ssl")
        ;;
         * )
           CFLAGS="-I${withval} $CFLAGS"
-         LIBS="-lssl -lcrypto $LIBS"
-         LDFLAGS="-L${withval}/lib $LDFLAGS"
-         AC_DEFINE_UNQUOTED(SSL_DIR, "${withval}", Used for determining the compile time options)
        ;;
        esac
 
     else
 
        CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
-       LIBS="-lssl -lcrypto $LIBS"
+
+    fi
+
+    if test "${with_ssllib+set}" = set; then
+
+       withval="$with_ssllib"
+       case "$withval" in
+       yes|no)
+         echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
+         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
+       ;;
+        * )
+         LDFLAGS="-L${withval}/lib $LDFLAGS"
+       ;;
+       esac
+
+    else
+
        LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
-       AC_DEFINE(SSL_DIR, "/usr/local/ssl")
 
     fi
-    
-    if test ! -d ${withval}; then
-      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
-      exit 1
-    fi 
+
+    LIBS="-lssl -lcrypto $LIBS"
+
+#    if test ! -d ${withval}; then
+#      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
+#      exit 1
+#    fi 
 
     CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
 
@@ -2026,52 +2061,6 @@ AC_ARG_WITH(swatdir,
    AC_SUBST(swatdir)]
 )
 
-#################################################
-# check for i18n'ed SWAT compiling
-AC_MSG_CHECKING(whether to use i18n'ed SWAT)
-AC_ARG_WITH(i18n-swat,
-[  --with-i18n-swat        Use i18n'ed SWAT
-  --without-i18n-swat     Don't use i18n'ed SWAT (default)],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(I18N_SWAT)
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-#################################################
-# set SWAT default language for old web browsers.
-AC_MSG_CHECKING(whether to use default SWAT language)
-AC_ARG_WITH(swat-def-lang,
-[  --with-swat-def-lang=LN default SWAT language for old web browsers (empty)],
-[
-  default_pref_lang=""
-  case "$withval" in
-  yes)
-    AC_MSG_WARN([--with-swat-def-lang called without argument - will use default])
-  ;;
-  no)
-    AC_MSG_RESULT(no)
-  ;;
-  *)
-    default_pref_lang="$withval"
-    AC_MSG_RESULT($withval)
-    ;;
-  esac
-  AC_DEFINE_UNQUOTED(I18N_DEFAULT_PREF_LANG, "$default_pref_lang")
-],
-[
-  default_pref_lang=""
-  AC_MSG_RESULT(no)
-  AC_DEFINE_UNQUOTED(I18N_DEFAULT_PREF_LANG, "$default_pref_lang")
-]
-)
-
 #################################################
 # choose native language(s) of man pages
 AC_MSG_CHECKING(chosen man pages' language(s))
@@ -2088,7 +2077,7 @@ AC_ARG_WITH(manpages-langs,
   esac
 
   AC_MSG_RESULT($manlangs)
-  manlangs=${manlangs//,/ }   # replacing commas with spaces to produce a list
+  manlangs=`echo $manlangs | sed "s/,/ /"`   # replacing commas with spaces to produce a list
   AC_SUBST(manlangs)],
 
   [manlangs="en"
@@ -2464,13 +2453,35 @@ AC_SUBST(WINBIND_LTARGETS)
 AC_SUBST(WINBIND_PAM_PROGS)
 
 #################################################
-# Check for SWAT i18n support
+# Check to see if we should use the included popt 
+
+AC_ARG_WITH(included-popt,
+[  --with-included-popt    use bundled popt library, not from system],
+[ 
+  case "$withval" in
+       yes)
+               INCLUDED_POPT=yes
+               ;;
+        no)
+               INCLUDED_POPT=no
+                ;;
+  esac ],
+)
+if test x"$INCLUDED_POPT" != x"yes"; then
+    AC_CHECK_LIB(popt, poptGetContext,
+                INCLUDED_POPT=no, INCLUDED_POPT=yes)
+fi
 
-PACKAGE=i18n_swat
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_SUBST(PACKAGE)
-ALL_LINGUAS="en ja pl tr"
-AM_GNU_GETTEXT
+AC_MSG_CHECKING(whether to use included popt)
+if test x"$INCLUDED_POPT" = x"yes"; then
+    AC_MSG_RESULT($srcdir/popt)
+    BUILD_POPT='$(POPT_OBJS)'
+    CFLAGS="$CFLAGS -I$srcdir/popt"
+else
+    AC_MSG_RESULT(no)
+    LIBS="$LIBS -lpopt"
+fi
+AC_SUBST(BUILD_POPT)
 
 #################################################
 # final configure stuff
@@ -2483,4 +2494,4 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
 builddir=`pwd`
 AC_SUBST(builddir)
 
-AC_OUTPUT(include/stamp-h Makefile intl/Makefile po/Makefile.in)
+AC_OUTPUT(include/stamp-h Makefile)