Push most work of ts.addInstall() over to python
[platform/upstream/rpm.git] / configure.ac
index 098b69d..fbaf5c2 100644 (file)
@@ -1,17 +1,17 @@
 AC_PREREQ(2.61)
-AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org)
+AC_INIT(rpm, 4.7.90, rpm-maint@lists.rpm.org)
 
 AC_CONFIG_SRCDIR([rpmqv.c])
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects])
+AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc])
 
 AC_CONFIG_TESTDIR(tests)
 
-AC_DISABLE_STATIC
+AC_USE_SYSTEM_EXTENSIONS
 
-AC_AIX
-AC_MINIX
+AC_DISABLE_STATIC
 
 dnl Checks for programs.
 AC_PROG_CXX
@@ -24,110 +24,36 @@ AC_PROG_MAKE_SET
 AC_PROG_LIBTOOL
 AC_PROG_YACC
 
+AC_SUBST(__CC, $CC)
+AC_PROG_CC_C99
+if test "$ac_cv_prog_cc_c99" = no; then
+    AC_MSG_ERROR([ISO C99 capable compiler required])
+fi
+
 AS=${AS-as}
 AC_SUBST(AS)
 if test "$GCC" = yes; then
-    CFLAGS="$CFLAGS -fPIC -DPIC -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
-    cflags_to_try="-fno-strict-aliasing"
+    CFLAGS="$CFLAGS -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts"
+    # XXX disabled for now due to noise from NSPR headers
+    # CFLAGS="$CFLAGS -Wstrict-prototypes"
+    cflags_to_try="-fno-strict-aliasing -fstack-protector -Wempty-body"
     AC_MSG_CHECKING([supported compiler flags])
     old_cflags=$CFLAGS
     echo
     for flag in $cflags_to_try; do
         CFLAGS="$CFLAGS $flag"
-        AC_TRY_COMPILE(, [return 0;], [
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[
                 echo "   $flag"
                 RPMCFLAGS="$RPMCFLAGS $flag"
-        ])
+        ],[])
         CFLAGS=$old_cflags
     done
     CFLAGS="$CFLAGS $RPMCFLAGS"
 fi
 export CFLAGS
 
-AC_PROG_GCC_TRADITIONAL
 AC_SYS_LARGEFILE
 
-dnl Does this platform require array notation to assign to a va_list?
-dnl If cross-compiling, we assume va_list is "normal".  If this breaks
-dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
-dnl also just to be sure.
-AC_MSG_CHECKING(whether va_list assignments need array notation)
-AC_CACHE_VAL(ac_cv_valistisarray,
-       [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
-                    #include <stdarg.h>
-                    void foo(int i, ...) {
-                       va_list ap1, ap2;
-                       va_start(ap1, i);
-                       ap2 = ap1;
-                       if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123)
-                           { exit(1); }
-                       va_end(ap1); va_end(ap2);
-                    }
-                    int main() { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
-
-if test "$ac_cv_valistisarray" = true ; then
-       AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1,
-               [Define as 1 if your va_list type is an array])
-       AC_MSG_RESULT(yes)
-else
-       AC_MSG_RESULT(no)
-fi
-
-RPMUSER=rpm
-RPMUID=37
-RPMGROUP=rpm
-RPMGID=37
-export RPMUSER RPMUID RPMGROUP RPMGID
-AC_SUBST(RPMUSER)
-AC_SUBST(RPMUID)
-AC_SUBST(RPMGROUP)
-AC_SUBST(RPMGID)
-
-dnl
-dnl This now uses libtool. Put
-dnl    LDFLAGS_STATIC="-all"
-dnl to attempt static executables using libtool. Otherwise
-dnl    LDFLAGS_STATIC=""
-dnl
-AC_MSG_CHECKING(flag used by libtool to link rpm)
-if test X"$GCC" = Xyes ; then
-       case "$host" in
-               *-*-linux*)     LDFLAGS_STATIC="-all-static" ;;
-               *-*-solaris*)   LDFLAGS_STATIC="-static";;
-               *-*-hpux*)      LDFLAGS_STATIC="-static";;
-               *-*-darwin*)    LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
-               *-*-sysv5uw*)   LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
-               *-*-*)          LDFLAGS_STATIC="";;
-       esac
-elif test X"$CC" = Xcc ; then
-       case "$host" in
-               *-*-linux*)     LDFLAGS_STATIC="-all-static";;
-               *-*-freebsd*)   LDFLAGS_STATIC="-all-static";;
-               *-*-osf*)       LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
-               *-*-aix*)       LDFLAGS_STATIC="-static";;  # -Wl,-bnso doesn't seem to work...
-               *-*-hpux*)      LDFLAGS_STATIC="-static";;
-               *-*-solaris*)   LDFLAGS_STATIC="-static";;
-               *-*-irix*)      LDFLAGS_STATIC="-static";;  #should be -non_shared, but can't
-                                                                                       # link because of crt1.o then.
-               *-*-ultrix*)    LDFLAGS_STATIC="-all-static";;  #ultrix doesn't have shared libs.
-               *-*-*)          LDFLAGS_STATIC=""
-AC_MSG_WARN([
-
-Unable to guess what option to pass to $CC to generate a static
-executable.  You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
-the appropriate argument(s) if you want to build a static rpm executable.
-
-])
-               ;;
-       esac
-else
-       # just link it dynamically
-       LDFLAGS_STATIC=""
-fi
-LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"  # libtool format
-AC_MSG_RESULT($LDFLAGS_STATIC)
-AC_SUBST(LDFLAGS_STATIC)
-
 dnl
 dnl look for POSIX chmod attributes
 dnl
@@ -185,13 +111,6 @@ AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
    directory and all necessary parent directories, ala 'mkdir -p'])
 AC_SUBST(RPM_MKDIR_P)
 
-AC_ISC_POSIX
-
-dnl This test must precede tests of compiler characteristics like
-dnl that for the inline keyword, since it may change the degree to
-dnl which the compiler supports such features.
-AM_C_PROTOTYPES
-
 dnl AM_DISABLE_SHARED
 AM_PROG_LIBTOOL
 
@@ -236,6 +155,7 @@ AC_SUBST(__ID_U)
 
 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
+AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH)
 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
@@ -265,15 +185,7 @@ AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
-
-addlib() {
-  l=$1
-  shift
-  case "$host" in 
-    *-*-solaris*)      LIBS="$LIBS -L$l -R$l $*";;
-    *)         LIBS="$LIBS -L$l $*";;
-  esac
-}
+AC_PATH_PROG(__FAKECHROOT, fakechroot, /usr/bin/fakechroot, $MYPATH)
 
 #=================
 # Check for zlib library. 
@@ -311,19 +223,14 @@ AC_CHECK_HEADERS([bzlib.h],[
 AC_SUBST(WITH_BZ2_LIB)
 
 #=================
+# Check for lzma library.
 
-AC_MSG_CHECKING(for /usr/ucblib in LIBS)
-if test -d /usr/ucblib ; then
-       if test "$build" = "mips-sni-sysv4" ; then
-               addlib /usr/ccs/lib -lc
-       fi
+AC_CHECK_HEADERS([lzma.h],[
+  AC_CHECK_LIB(lzma, lzma_easy_encoder, [WITH_LZMA_LIB=-llzma])
+])
+AC_SUBST(WITH_LZMA_LIB)
 
-       addlib /usr/ucblib
-       
-       AC_MSG_RESULT(yes)
-else
-       AC_MSG_RESULT(no)
-fi
+#=================
 
 dnl
 dnl Check for features
@@ -362,9 +269,6 @@ AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
 
 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
 
-dnl Better not use fchmod at all.
-AC_CHECK_FUNC(fchmod)
-
 AC_CHECK_FUNCS(vsnprintf snprintf)
 
 dnl Temporary hack for MiNT.  Some functions (writev, snprintf) are
@@ -396,22 +300,22 @@ AC_CHECK_HEADERS([dwarf.h], [
 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
 
 #=================
-# Check for beecrypt library.
-WITH_BEECRYPT_INCLUDE=
-WITH_BEECRYPT_LIB=
-AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
-  AC_CHECK_LIB(beecrypt, mpfprintln, [
-    AC_CHECK_HEADERS([beecrypt/api.h])
-    WITH_BEECRYPT_INCLUDE=
-    WITH_BEECRYPT_LIB="-lbeecrypt"
-  ],[
-    AC_MSG_ERROR([missing required library beecrypt])
-  ])
-],[
-  AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
+# Check for NSS library.
+# We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS 
+# have a header named nss.h... so make extra check for NSS's sechash.h 
+# which we use too and hopefully is slightly more unique to NSS.
+WITH_NSS_INCLUDE=
+WITH_NSS_LIB=
+AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [
+  AC_MSG_ERROR([missing required NSPR / NSS header])
 ])
-AC_SUBST(WITH_BEECRYPT_INCLUDE)
-AC_SUBST(WITH_BEECRYPT_LIB)
+AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
+  WITH_NSS_LIB=-lnss3
+], [
+  AC_MSG_ERROR([missing required NSS library 'nss3'])
+])
+AC_SUBST(WITH_NSS_INCLUDE)
+AC_SUBST(WITH_NSS_LIB)
 
 #=================
 # Check for magic library.
@@ -485,9 +389,12 @@ yes )
     AC_MSG_ERROR([missing required header db.h])
   ])
   ;;
-* ) # Fall back to internal db
-  # XXX for now we always have in-tree BDB available...
-  AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
+* ) # Fall back to internal db if available
+  if [ test -x db/dist/configure ]; then
+    AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
+  else
+    AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
+  fi
   ;;
 esac
 
@@ -543,6 +450,8 @@ AC_HEADER_MAJOR
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 
+AC_CHECK_HEADERS(locale.h)
+AC_CHECK_HEADERS(limits.h)
 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
 
 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
@@ -556,7 +465,6 @@ AC_CHECK_HEADERS(libio.h)
 AC_CHECK_HEADERS(err.h mcheck.h)
 
 AC_CHECK_HEADERS(glob.h)
-AC_CHECK_HEADERS(locale.h)
 
 dnl statfs portability fiddles.
 dnl
@@ -712,10 +620,6 @@ if test $HAS_S_ISSOCK = yes; then
        AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
 fi
 
-AC_MSG_CHECKING(if timezone is defined)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
-AC_MSG_RESULT($HAS_TIMEZONE)
-
 dnl Check for missing typedefs
 AC_TYPE_MODE_T
 AC_TYPE_OFF_T
@@ -723,17 +627,20 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 
 dnl Checks for library functions.
-AC_FUNC_ALLOCA
 AC_FUNC_VPRINTF
 dnl XXX don't want to re-enable code that's been unused for years at this
 dnl point, but should offer good performance improvements, check after
 dnl 4.4.2.1...
 dnl AC_FUNC_MMAP
 
-AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton)
-AC_CHECK_FUNCS(mtrace putenv realpath setenv)
-AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
-AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr)
+AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton)
+AC_CHECK_FUNCS(mtrace)
+AC_CHECK_FUNCS(strndup strerror)
+
+AC_REPLACE_FUNCS(basename getcwd getwd)
+AC_REPLACE_FUNCS(putenv realpath setenv)
+AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
+AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
 
 AC_CHECK_FUNCS(__secure_getenv)
 
@@ -741,7 +648,7 @@ AC_CHECK_FUNCS(regcomp)
 
 AC_CHECK_FUNCS(ftok)
 
-AC_CHECK_FUNCS(mkstemp)
+AC_CHECK_FUNCS([mkstemp], [], [AC_MSG_ERROR([mkstemp() is required by rpm])])
 
 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
 dnl %files gets something like
@@ -793,19 +700,19 @@ AC_SUBST(WITH_PYTHON_LIB)
 
 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
 
-AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
+AC_PATH_PROG(DOXYGEN, doxygen, no)
 dnl
-dnl Auto-detect whether doxygen generated API docs should be included.
+dnl Only build internal API + source hacking docs on request
 dnl
-AC_ARG_WITH(apidocs, [  --with-apidocs          build rpm API docs ],,[with_apidocs=auto])
+AC_ARG_WITH(hackingdocs, [  --with-hackingdocs         build rpm hacking docs ],,[with_hackingdocs=no])
 
-case "$with_apidocs" in
+case "$with_hackingdocs" in
 auto)
-  AS_IF([test "$__DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
+  AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
   ;;
 yes)
-  AS_IF([test "$__DOXYGEN" = no],
-    [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
+  AS_IF([test "$DOXYGEN" = no],
+    [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
   ;;
 esac
 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
@@ -835,25 +742,87 @@ AS_IF([test "$with_selinux" = yes],[
 AC_SUBST(WITH_SELINUX_LIB)
 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
 
+# libcap
+WITH_CAP_LIB=
+AC_ARG_WITH(cap, [  --with-cap              build with capability support ],
+[case "$with_cap" in
+yes|no) ;;
+*) AC_MSG_ERROR([invalid argument to --with-cap])
+  ;;
+esac],
+[with_cap=no])
+
+AS_IF([test "$with_cap" = yes],[
+  AC_CHECK_HEADER([sys/capability.h],[
+    AC_CHECK_LIB(cap,[cap_get_file], [
+      with_cap=yes
+      save_LIBS="$LIBS"
+      AC_CHECK_LIB(cap,[cap_compare], [
+        AC_DEFINE(HAVE_CAP_COMPARE, 1, [Have cap_compare function?])
+      ])
+      LIBS="$save_LIBS"
+    ],[
+      AC_MSG_ERROR([--with-cap given, but libcap not found])])
+  ],[
+    AC_MSG_ERROR([--with-cap given, but sys/capability.h not found])
+  ])
+])
+
+AS_IF([test "$with_cap" = yes],[
+  AC_DEFINE(WITH_CAP, 1, [Build with capability support?])
+  WITH_CAP_LIB="-lcap"
+])
+AC_SUBST(WITH_CAP_LIB)
+AM_CONDITIONAL(CAP,[test "$with_cap" = yes])
+
+WITH_ACL_LIB=
+AC_ARG_WITH(acl, [  --with-acl              build with acl support ],
+[case "$with_acl" in
+yes|no) ;;
+*) AC_MSG_ERROR([invalid argument to --with-acl])
+  ;;
+esac],
+[with_acl=no])
+
+AS_IF([test "$with_acl" = yes],[
+  dnl verification uses non-portable acl_equiv_mode() 
+  AC_CHECK_HEADER([acl/libacl.h],[
+    AC_CHECK_LIB(acl,[acl_equiv_mode],[with_acl=yes],[
+      AC_MSG_ERROR([--with-acl given, but libacl not found or not suitable])])
+  ],[
+    AC_MSG_ERROR([--with-acl given, but acl/libacl.h not found])
+  ])
+])
+
+AS_IF([test "$with_acl" = yes],[
+  AC_DEFINE(WITH_ACL, 1, [Build with acl support?])
+  WITH_ACL_LIB="-lacl"
+])
+AC_SUBST(WITH_ACL_LIB)
+AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
+
 WITH_LUA_LIB=
 WITH_LUA_INCLUDE=
 AC_ARG_WITH(lua, [  --with-lua              build with lua support ],,[with_lua=yes])
 AS_IF([test "$with_lua" = yes],[
+  AC_CHECK_HEADER([lua.h],[
+    AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
+      AC_MSG_ERROR([--with-lua given, but liblua not found])
+    ], 
+    [-lm])
+  ],[
+      AC_MSG_ERROR([--with-lua given, but lua.h not found])
+  ])
+])
+
+AS_IF([test "$with_lua" = yes],[
   AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
-  WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
-  WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
+  WITH_LUA_INCLUDE=
+  WITH_LUA_LIB="-llua -lm" 
 ])
 AC_SUBST(WITH_LUA_LIB)
 AC_SUBST(WITH_LUA_INCLUDE)
-
-AS_IF([test "$with_apidocs" = yes],[
-  WITH_APIDOCS_TARGET=apidocs
-  WITH_APIDOCS=1
-],[
-  WITH_APIDOCS=0
-])
-AC_SUBST(WITH_APIDOCS_TARGET)
-AC_SUBST(WITH_APIDOCS)
+AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
 
 with_dmalloc=no
 AC_ARG_WITH(dmalloc, [  --with-dmalloc          build with dmalloc debugging support ])
@@ -890,9 +859,9 @@ AC_CHECK_FUNC(lchown,
     AC_ARG_ENABLE([broken-chown],
     [  --enable-broken-chown   this system's chown follows symbolic links], 
            result=$enableval, result=unknown)
-    if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
+    if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
        result=yes
-    elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
+    elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
        result=no
     fi
     if test $result = unknown; then
@@ -920,46 +889,12 @@ AC_CHECK_FUNC(lchown,
 AC_SUBST(__CHOWN_RHF)
 AC_SUBST(__CHGRP_RHF)
 
-dnl
-dnl figure out what root's primary group is
-dnl
-AC_MSG_CHECKING(root's primary group)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-int main()
-{
-       struct passwd *root = NULL;
-       struct group *roots_group = NULL;
-       FILE * tempfile = NULL;
-
-       root = getpwuid( (uid_t) 0 );
-       if (root != NULL) {
-               roots_group = getgrgid(root->pw_gid);
-               if (roots_group != NULL) {
-                       tempfile = fopen("conftest_rootg", "w");
-                       if (tempfile != NULL) {
-                               fprintf(tempfile, "%s\n", roots_group->gr_name);
-                               fclose(tempfile);
-                               exit(0);
-                       }
-               }
-       }
-
-       exit(1);
-}]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
-])
-AC_MSG_RESULT($ROOT_GROUP)
-AC_SUBST(ROOT_GROUP)
-
-if echo "$build_os" | grep sco > /dev/null; then
+if echo "$host_os" | grep sco > /dev/null; then
        echo "hacking things up for sco"
        AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
        AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
        [Define as 1 if you have "struct mnttab" (only sco?)])
-elif echo "$build_os" | grep sunos > /dev/null; then
+elif echo "$host_os" | grep sunos > /dev/null; then
        echo "hacking things up for sunos"
        CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
        AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
@@ -968,66 +903,64 @@ elif echo "$build_os" | grep sunos > /dev/null; then
 fi
 
 #
-# get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
+# get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
 #
-build_os_gnu=-gnu
-if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
-       build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
+host_os_gnu=-gnu
+if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
+       host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
 fi
-if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
-       build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
-       build_os_gnu=-gnueabi
+if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
+       host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
+       host_os_gnu=-gnueabi
 fi
-if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
-       build_os=`echo "${build_os}" | sed 's/-gnu$//'`
+if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
+       host_os=`echo "${host_os}" | sed 's/-gnu$//'`
 fi
 
 changequote(<, >)
-build_os_exact="${build_os}"
-build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
-build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
+host_os_exact="${host_os}"
+host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
+host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
 changequote([, ])
 
 rm -f ./find-provides
-if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
-       echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
-    ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
-elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
-       echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
-    ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
-elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
-       echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
-    ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
-elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
-       echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
-    ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
+if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
+       echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
+    ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
+elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
+       echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
+    ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
+elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
+       echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
+    ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
+elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
+       echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
+    ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
 else
-    echo "*** no default provides information is available for ${build_os_noversion}"
+    echo "*** no default provides information is available for ${host_os_noversion}"
     ln -s ${srcdir}/autodeps/none ./find-provides
 fi
 
 rm -f ./find-requires
-if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
-       echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
-    ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
-elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
-       echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
-    ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
-elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
-       echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
-    ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
-elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
-       echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
-    ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
+if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
+       echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
+    ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
+elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
+       echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
+    ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
+elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
+       echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
+    ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
+elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
+       echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
+    ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
 else
-    echo "*** no default requires information is available for ${build_os_noversion}"
+    echo "*** no default requires information is available for ${host_os_noversion}"
     ln -s ${srcdir}/autodeps/none ./find-requires
 fi
 
-dnl Determine the canonical arch-vendor-os for the build machine
-autorelocate_path='%{nil}'
-autorelocate_dcolor='0'
-case "${build_cpu}" in
+dnl Determine the canonical arch-vendor-os for the host machine
+case "${host_cpu}" in
 *86)           RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
 ia32e*)                RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
 amd64*)                RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
@@ -1035,9 +968,7 @@ x86_64*)   RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
 alpha*)                RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
 sparc64*)      RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
 sparc*)                RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
-ia64*)         RPMCANONCOLOR=2; RPMCANONARCH=ia64;
-               autorelocate_path='/emul/%%{ARCH}-%%{OS}'
-               autorelocate_dcolor='1' ;;
+ia64*)         RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;;
 s390x*)                RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
 s390*)         RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
 powerpc64*|ppc64*)     RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
@@ -1046,15 +977,18 @@ arm*)            RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
 mipsel*)       RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
 mips*)         RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
 m68k*)         RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
+sh3*)          RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
+sh4*)          RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
 *)             RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
 esac
-case "${build_os_noversion}" in
+case "${host_os_noversion}" in
 mint)          RPMCANONARCH=m68kmint ;;
 esac
 RPMCANONVENDOR="$build_vendor"
 case "${build_vendor}" in
-unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
+unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos|suse)
        test -f /etc/redhat-release &&          RPMCANONVENDOR=redhat
+       test -f /etc/SuSE-release &&            RPMCANONVENDOR=suse
        test -f /etc/pld-release &&             RPMCANONVENDOR=pld
        test -f /etc/mandrake-release &&        RPMCANONVENDOR=mandrake
        test -f /etc/conectiva-release &&       RPMCANONVENDOR=conectiva
@@ -1063,11 +997,9 @@ unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
        test -f /etc/caos-release &&            RPMCANONVENDOR=caos
        ;;
 esac
-RPMCANONOS="$build_os_noversion"
-RPMCANONGNU="$build_os_gnu"
+RPMCANONOS="$host_os_noversion"
+RPMCANONGNU="$host_os_gnu"
 AC_SUBST(RPMCANONCOLOR)
-AC_SUBST(autorelocate_path)
-AC_SUBST(autorelocate_dcolor)
 AC_SUBST(RPMCANONARCH)
 AC_SUBST(RPMCANONVENDOR)
 AC_SUBST(RPMCANONOS)
@@ -1085,19 +1017,29 @@ AC_SUBST(RPMCONFIGDIR)
 
 AC_SUBST(OBJDUMP)
 
-AC_CONFIG_SUBDIRS(db3)
+if test "$with_external_db" = no; then
+    AC_CONFIG_SUBDIRS(db3)
+fi
 
 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
+AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
+AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
 
 AC_PATH_PROG(AUTOM4TE,autom4te,:)
 
-AC_CONFIG_FILES([ Doxyfile Makefile
-       rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
+AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
+AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
+])
+
+AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
+
+AC_CONFIG_FILES([Makefile
+       rpmio/Makefile lib/Makefile build/Makefile
        po/Makefile.in scripts/Makefile 
        misc/Makefile 
        doc/Makefile
        python/Makefile
-       lua/Makefile
+       luaext/Makefile
        tests/Makefile
   ])
 AC_OUTPUT