]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/autoconf/configure.in
Tweak configure.in to generate updatedb upgrade script 12 to 14
[bacula/bacula] / bacula / autoconf / configure.in
index 7fd0cce512e0e4674173d4b4cfa30ab02d9c9705..47d45dee923f7f7a17da312b366c753d8fbe8dce 100644 (file)
@@ -2,7 +2,11 @@ dnl
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
-AC_INIT(src/version.h)
+dnl require a recent autoconf
+AC_PREREQ(2.61)
+AC_INIT([bacula], m4_esyscmd([sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ../src/version.h src/version.h 2> /dev/null | tr -d '\n']))
+AC_CONFIG_SRCDIR(src/version.h)
+
 BUILD_DIR=`pwd`
 cd ..
 TOP_DIR=`pwd`
 BUILD_DIR=`pwd`
 cd ..
 TOP_DIR=`pwd`
@@ -10,19 +14,7 @@ cd ${BUILD_DIR}
 AC_SUBST(BUILD_DIR)
 AC_SUBST(TOP_DIR)
 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
 AC_SUBST(BUILD_DIR)
 AC_SUBST(TOP_DIR)
 AC_CONFIG_AUX_DIR(${BUILD_DIR}/autoconf)
-AC_CONFIG_HEADER(src/config.h:autoconf/config.h.in)
-
-dnl minimal Win32 stuff for "make clean"
-WIN32BUILDDIR=${BUILD_DIR}/src/win32
-WIN32MAINDIR=${BUILD_DIR}
-WIN32TOPDIR=${TOP_DIR}   
-AC_SUBST(WIN32BUILDDIR)
-AC_SUBST(WIN32MAINDIR)
-AC_SUBST(WIN32TOPDIR)
-
-dnl require a recent autoconf
-AC_PREREQ(2.61)
-
+AC_CONFIG_HEADERS(src/config.h:autoconf/config.h.in)
 
 dnl search for true and false programs.
 AC_PATH_PROGS(TRUEPRG, true, :)
 
 dnl search for true and false programs.
 AC_PATH_PROGS(TRUEPRG, true, :)
@@ -35,16 +27,57 @@ if test "x$BACULA" != x; then
    post_host=`echo -${BACULA} | tr 'A-Z ' 'a-z-'`
 fi
 BACULA=${BACULA:-Bacula}
    post_host=`echo -${BACULA} | tr 'A-Z ' 'a-z-'`
 fi
 BACULA=${BACULA:-Bacula}
-VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
-DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
-LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
-AC_SUBST(VERSION)dnl 
-AC_SUBST(DATE)dnl 
-AC_SUBST(LSMDATE)dnl 
+VERSION=`sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+RELEASE=`sed -n -e 's/^#define RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+DATE=`sed -n -e 's/^#define BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+LSMDATE=`sed -n -e 's/^#define LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+BDB_VERSION=`sed -n -e 's/^#define BDB_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
+DEPKGS_VERSION=`sed -n -e 's/^#define DEPKGS_VERSION \(.*\)$/\1/p' ${srcdir}/src/cats/cats.h`
+DEPKGS_QT_VERSION=`sed -n -e 's/^#define DEPKGS_QT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+BQT_VERSION=`sed -n -e 's/^#define BQT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+AC_SUBST(VERSION)dnl
+AC_SUBST(DATE)dnl
+AC_SUBST(LSMDATE)dnl
 AC_SUBST(BACULA)dnl
 AC_SUBST(post_host)dnl
 AC_SUBST(BACULA)dnl
 AC_SUBST(post_host)dnl
+AC_SUBST(BDB_VERSION)dnl
+AC_SUBST(DEPKGS_QT_VERSION)dnl
+AC_SUBST(DEPKGS_VERSION)dnl
+AC_SUBST(BQT4_VERSION)dnl
+
+dnl src/lib
+dnl can be overwritten by specific values from version.h
+LIBBAC_LT_RELEASE=`sed -n -e 's/^#.*LIBBAC_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+LIBBACCFG_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCFG_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+
+LIBBAC_LT_RELEASE=${LIBBAC_LT_RELEASE:-$VERSION}
+LIBBACCFG_LT_RELEASE=${LIBBACCFG_LT_RELEASE:-$VERSION}
+
+AC_SUBST(LIBBAC_LT_RELEASE)dnl
+AC_SUBST(LIBBACCFG_LT_RELEASE)dnl
+
+dnl src/cats
+dnl can be overwritten by specific values from version.h
+LIBBACSQL_LT_RELEASE=`sed -n -e 's/^#.*LIBBACSQL_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+LIBBACCATS_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCATS_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+
+LIBBACSQL_LT_RELEASE=${LIBBACSQL_LT_RELEASE:-$VERSION}
+LIBBACCATS_LT_RELEASE=${LIBBACCATS_LT_RELEASE:-$VERSION}
+
+AC_SUBST(LIBBACSQL_LT_RELEASE)dnl
+AC_SUBST(LIBBACCATS_LT_RELEASE)dnl
+
+dnl src/findlib
+dnl can be overwritten by specific values from version.h
+LIBBACFIND_LT_RELEASE=`sed -n -e 's/^#.*LIBBACFIND_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+
+LIBBACFIND_LT_RELEASE=${LIBBACFIND_LT_RELEASE:-$VERSION}
+
+AC_SUBST(LIBBACFIND_LT_RELEASE)dnl
+
 echo "configuring for ${BACULA} $VERSION ($DATE)"
 
 echo "configuring for ${BACULA} $VERSION ($DATE)"
 
+
 dnl -------------------------------------------------------
 dnl Check for compiler.
 dnl ------------------------------------------------------
 dnl -------------------------------------------------------
 dnl Check for compiler.
 dnl ------------------------------------------------------
@@ -92,25 +125,18 @@ AC_PATH_PROG(DVDRWMEDIAINFO, dvd+rw-mediainfo, dvd+rw-mediainfo)
 AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
 AC_PATH_PROG(QMAKE, qmake, none)
 AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
 AC_PATH_PROG(QMAKE, qmake, none)
-AC_PATH_PROG(QMAKEQT4, qmake-qt4, none)
 AC_PATH_PROG(GMAKE, gmake, none)
 AC_PATH_PROG(GMAKE, gmake, none)
-AC_ARG_VAR(WXCONFIG, [wx-config command. On some systems, you must set it to wx-config-2.6 to use wxWidgets 2.6.])
-if test "x$WXCONFIG" = x; then
-   WXCONFIG=wx-config
-fi
-AC_PATH_PROG(WXCONFIG, ${WXCONFIG}, ${WXCONFIG})
-AC_ARG_VAR(WXFLAGS, [Parameters to pass to wx-config (e.g. --unicode=no).])
 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
 AC_PATH_PROG(PIDOF, pidof, pidof)
 AC_PROG_AWK
 # Some AWK programs fail, so test it and warn the user
 AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
 AC_PATH_PROG(PIDOF, pidof, pidof)
 AC_PROG_AWK
 # Some AWK programs fail, so test it and warn the user
-if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 } 
+if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 }
       { if ((prog == $2) || (("(" prog ")") == $2) ||
       (("[" prog "]") == $2) ||
       ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
 else
   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
       { if ((prog == $2) || (("(" prog ")") == $2) ||
       (("[" prog "]") == $2) ||
       ((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
 else
   AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
-   The regex engine of $AWK is too broken to be used you 
+   The regex engine of $AWK is too broken to be used you
    might want to install GNU AWK.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
 fi
    might want to install GNU AWK.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
 fi
@@ -142,6 +168,7 @@ AC_ARG_ENABLE(libtool,
    ]
 )
 LT_INIT([shared disable-static])
    ]
 )
 LT_INIT([shared disable-static])
+LT_LIB_DLLOAD
 LT_LANG([C++])
 
 if test x$use_libtool != xno; then
 LT_LANG([C++])
 
 if test x$use_libtool != xno; then
@@ -281,7 +308,7 @@ libdir=`eval echo ${libdir}`
 includedir=`eval echo ${includedir}`
 localedir=`eval echo ${datarootdir}/locale`
 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
 includedir=`eval echo ${includedir}`
 localedir=`eval echo ${datarootdir}/locale`
 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir")
-AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir") 
+AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir")
 
 dnl ------------------------------------------------------------------
 dnl If the user has not set --sbindir, we set our default as /sbin
 
 dnl ------------------------------------------------------------------
 dnl If the user has not set --sbindir, we set our default as /sbin
@@ -301,18 +328,18 @@ fi
 dnl -------------------------------------------------------------------------
 dnl  If the user has not set --htmldir, we default to /usr/share/doc/bacula/html
 dnl -------------------------------------------------------------------------
 dnl -------------------------------------------------------------------------
 dnl  If the user has not set --htmldir, we default to /usr/share/doc/bacula/html
 dnl -------------------------------------------------------------------------
-if test x$htmldir = x${docdir} ; then
-   htmldir=`eval echo ${docdir}bacula/html`
+if test x$htmldir = x'/usr/share/doc/bacula/' ; then
+   htmldir=`eval echo ${docdir}html`
 fi
 
 dnl -------------------------------------------------------------------------
 fi
 
 dnl -------------------------------------------------------------------------
-dnl  If the user has not set --docdir, we default to /usr/share/doc/
+dnl  If the user has not set --docdir, we default to /usr/share/doc/bacula
 dnl -------------------------------------------------------------------------
 if test x$docdir = x'/usr/share/doc/' ; then
    docdir=`eval echo ${docdir}bacula`
 fi
 
 dnl -------------------------------------------------------------------------
 if test x$docdir = x'/usr/share/doc/' ; then
    docdir=`eval echo ${docdir}bacula`
 fi
 
-           
+       
 AC_PATH_PROGS(MSGFMT, msgfmt, no)
 if test "$MSGFMT" = "no"
 then
 AC_PATH_PROGS(MSGFMT, msgfmt, no)
 if test "$MSGFMT" = "no"
 then
@@ -323,60 +350,29 @@ then
    AM_GNU_GETTEXT
 fi
 
    AM_GNU_GETTEXT
 fi
 
-support_mysql=no
-support_sqlite=no
-support_sqlite3=no
-support_postgresql=no
-support_ingres=no
-support_dbi=no
 support_smartalloc=yes
 support_readline=yes
 support_smartalloc=yes
 support_readline=yes
+support_lzo=yes
 support_conio=yes
 support_conio=yes
-support_gnome=no
 support_bat=no
 support_bat=no
-support_wx_console=no
-support_tray_monitor=no
 support_tls=no
 support_crypto=no
 support_tls=no
 support_crypto=no
-gnome_version=
-wx_version=
 support_static_tools=no
 support_static_fd=no
 support_static_sd=no
 support_static_dir=no
 support_static_cons=no
 support_static_tools=no
 support_static_fd=no
 support_static_sd=no
 support_static_dir=no
 support_static_cons=no
-support_python=no
 build_client_only=no
 build_dird=yes
 build_stored=yes
 build_client_only=no
 build_dird=yes
 build_stored=yes
-cats=
-db_type=Internal
+db_backends=""
+batch_insert_db_backends=""
 support_lockmgr=no
 support_lockmgr=no
-DB_TYPE=bdb
 
 dnl --------------------------------------------------------------------------
 dnl CHECKING COMMAND LINE OPTIONS
 dnl --------------------------------------------------------------------------
 
 
 dnl --------------------------------------------------------------------------
 dnl CHECKING COMMAND LINE OPTIONS
 dnl --------------------------------------------------------------------------
 
-dnl -------------------------------------------
-dnl gnome (default off)
-dnl -------------------------------------------
-AC_ARG_ENABLE(gnome,
-   AC_HELP_STRING([--enable-gnome], [enable build of bgnome-console GUI @<:@default=no@:>@]),
-   [
-       if test x$enableval = xyes; then
-         support_gnome=yes
-       fi
-   ]
-)
-
-GNOME_DIR=
-if test x$support_gnome = xyes; then
-   AC_MSG_ERROR(bgnome-console no longer supported)
-   AC_MSG_ERROR(--enable-gnome option no longer supported)
-fi
-# AC_SUBST(GNOME_DIR)
-
 dnl -------------------------------------------
 dnl bat (default off)
 dnl -------------------------------------------
 dnl -------------------------------------------
 dnl bat (default off)
 dnl -------------------------------------------
@@ -384,7 +380,7 @@ AC_ARG_ENABLE(bat,
    AC_HELP_STRING([--enable-bat], [enable build of bat Qt4 GUI @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
    AC_HELP_STRING([--enable-bat], [enable build of bat Qt4 GUI @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
-         AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled]) 
+         AC_DEFINE(HAVE_BAT, 1, [Set if Bacula bat Qt4 GUI support enabled])
          support_bat=yes
        fi
    ]
          support_bat=yes
        fi
    ]
@@ -401,9 +397,9 @@ if test x$support_bat = xyes; then
    fi
 fi
 
    fi
 fi
 
-dnl 
+dnl
 dnl  The qwt library was used with bat, but that is no longer the case
 dnl  The qwt library was used with bat, but that is no longer the case
-dnl 
+dnl
 got_qwt=no
 QWT_INC=
 QWT_LDFLAGS=
 got_qwt=no
 QWT_INC=
 QWT_LDFLAGS=
@@ -428,13 +424,13 @@ dnl                   QWT="qwt"
 dnl             fi
 dnl             ;;
 dnl          esac
 dnl             fi
 dnl             ;;
 dnl          esac
-dnl      ]    
+dnl      ]
 dnl    )
 
 dnl    dnl
 dnl    dnl Search in standard places, or --with-qwt not specified
 dnl    dnl
 dnl    )
 
 dnl    dnl
 dnl    dnl Search in standard places, or --with-qwt not specified
 dnl    dnl
-dnl    if test $no_qwt = no; then 
+dnl    if test $no_qwt = no; then
 dnl      if test x$QWT_INC = x; then
 dnl         for root in /usr /usr/local; do
 dnl            for ver in qwt qwt5 qwt-qt4; do
 dnl      if test x$QWT_INC = x; then
 dnl         for root in /usr /usr/local; do
 dnl            for ver in qwt qwt5 qwt-qt4; do
@@ -470,69 +466,6 @@ AC_SUBST(QWT_LDFLAGS)
 AC_SUBST(QWT_LIB)
 AC_SUBST(QWT)
 
 AC_SUBST(QWT_LIB)
 AC_SUBST(QWT)
 
-dnl -------------------------------------------
-dnl bwx-console (default off)
-dnl -------------------------------------------
-AC_ARG_ENABLE(bwx-console,
-   AC_HELP_STRING([--enable-bwx-console], [enable build of wxWidgets console @<:@default=no@:>@]),
-   [
-       if test x$enableval = xyes; then
-         support_wx_console=yes
-       fi
-   ]
-)
-
-WX_DIR=
-if test x$support_wx_console = xyes; then
-   abc=`$WXCONFIG $WXFLAGS --cppflags`
-   pkg=$?
-   if test $pkg = 0; then
-      wx_version="wxWidgets `$WXCONFIG $WXFLAGS --release`"
-      WXCONS_CPPFLAGS=`$WXCONFIG $WXFLAGS --cppflags`
-      WXCONS_LDFLAGS=`$WXCONFIG $WXFLAGS --libs`
-
-      AC_SUBST(WXCONS_CPPFLAGS)
-      AC_SUBST(WXCONS_LDFLAGS)
-      WX_DIR="src/wx-console"
-   else
-      echo " "
-      echo "wx-config program not found. bwx-console disabled."
-      echo " "
-      support_wx_console=no
-   fi
-fi
-AC_SUBST(WX_DIR)
-
-dnl -------------------------------------------
-dnl tray-monitor (default off)
-dnl -------------------------------------------
-AC_ARG_ENABLE(tray-monitor,
-   AC_HELP_STRING([--enable-tray-monitor], [enable build of Gnome tray monitor (compatible with KDE @<:@default=no@:>@]),
-   [
-       if test x$enableval = xyes; then
-         support_tray_monitor=yes
-       fi
-   ]
-)
-
-TRAY_MONITOR_DIR=
-if test x$support_tray_monitor = xyes; then
-   abc=`$PKGCONFIG --exists gtk+-2.0`
-   pkg=$?
-   if test $pkg = 0; then
-      TRAY_MONITOR_CPPFLAGS=`$PKGCONFIG --cflags gtk+-2.0`
-      TRAY_MONITOR_LDFLAGS=`$PKGCONFIG --libs gtk+-2.0`
-      AC_SUBST(TRAY_MONITOR_CPPFLAGS)
-      AC_SUBST(TRAY_MONITOR_LDFLAGS)
-      TRAY_MONITOR_DIR=src/tray-monitor
-      abc=`$PKGCONFIG --atleast-version=2.4 gtk+-2.0`
-      pkg=$?
-      if test $pkg = 0; then
-        AC_DEFINE(HAVE_GTK_2_4, 1, [Set if you have GTK 4.2 or greater loaded])
-      fi
-   fi
-fi
-AC_SUBST(TRAY_MONITOR_DIR)
 
 dnl -------------------------------------------
 dnl smartalloc (default off)
 
 dnl -------------------------------------------
 dnl smartalloc (default off)
@@ -575,7 +508,7 @@ AC_ARG_ENABLE(static-tools,
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
-            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
+            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
   please rerun configure with --disable-libtool])
          fi
          support_static_tools=yes
   please rerun configure with --disable-libtool])
          fi
          support_static_tools=yes
@@ -597,7 +530,7 @@ AC_ARG_ENABLE(static-fd,
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
-            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
+            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
   please rerun configure with --disable-libtool])
          fi
          support_static_fd=yes
   please rerun configure with --disable-libtool])
          fi
          support_static_fd=yes
@@ -619,7 +552,7 @@ AC_ARG_ENABLE(static-sd,
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
-            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
+            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
   please rerun configure with --disable-libtool])
          fi
          support_static_sd=yes
   please rerun configure with --disable-libtool])
          fi
          support_static_sd=yes
@@ -641,7 +574,7 @@ AC_ARG_ENABLE(static-dir,
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
-            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
+            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
   please rerun configure with --disable-libtool])
          fi
          support_static_dir=yes
   please rerun configure with --disable-libtool])
          fi
          support_static_dir=yes
@@ -663,7 +596,7 @@ AC_ARG_ENABLE(static-cons,
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
    [
        if test x$enableval = xyes; then
          if test x$use_libtool = xyes; then
-            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools, 
+            AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
   please rerun configure with --disable-libtool])
          fi
          support_static_cons=yes
   please rerun configure with --disable-libtool])
          fi
          support_static_cons=yes
@@ -672,16 +605,10 @@ AC_ARG_ENABLE(static-cons,
 )
 
 STATIC_CONS=
 )
 
 STATIC_CONS=
-STATIC_GNOME_CONS=
-STATIC_WX_CONS=
 if test x$support_static_cons = xyes; then
    STATIC_CONS="static-bconsole"
 if test x$support_static_cons = xyes; then
    STATIC_CONS="static-bconsole"
-   STATIC_GNOME_CONS="static-bgnome-console"
-   STATIC_WX_CONS="static-bwx-console"
 fi
 AC_SUBST(STATIC_CONS)
 fi
 AC_SUBST(STATIC_CONS)
-AC_SUBST(STATIC_GNOME_CONS)
-AC_SUBST(STATIC_WX_CONS)
 
 dnl -------------------------------------------
 dnl client_only  (default off)
 
 dnl -------------------------------------------
 dnl client_only  (default off)
@@ -691,8 +618,8 @@ AC_ARG_ENABLE(client-only,
    [
        if test x$enableval = xyes; then
          build_client_only=yes
    [
        if test x$enableval = xyes; then
          build_client_only=yes
-         db_type=None
-         DB_TYPE=none
+         db_backends="None"
+         DB_BACKENDS="none"
        fi
    ]
 )
        fi
    ]
 )
@@ -754,18 +681,18 @@ AC_ARG_ENABLE(conio,
        fi
    ]
 )
        fi
    ]
 )
-  
+
 
 dnl ---------------------------------------------------
 dnl Check for IPv6 support
 dnl ---------------------------------------------------
 dnl this allows you to turn it completely off
 support_ipv6=yes
 
 dnl ---------------------------------------------------
 dnl Check for IPv6 support
 dnl ---------------------------------------------------
 dnl this allows you to turn it completely off
 support_ipv6=yes
-AC_ARG_ENABLE(ipv6,   
+AC_ARG_ENABLE(ipv6,
    AC_HELP_STRING([--enable-ipv6], [enable ipv6 support @<:@default=yes@:>@]),
    [
        if test x$enableval = xno; then
    AC_HELP_STRING([--enable-ipv6], [enable ipv6 support @<:@default=yes@:>@]),
    [
        if test x$enableval = xno; then
-         support_ipv6=no  
+         support_ipv6=no
        fi
    ]
 )
        fi
    ]
 )
@@ -781,45 +708,34 @@ if test x$support_ipv6 = xyes; then
    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
 fi
 
    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
 fi
 
+TERM_LIB=""
+AC_CHECK_HEADER(curses.h, [
+    AC_CHECK_LIB(tinfo, tgetent, [ TERM_LIB="-ltinfo" ], [
+      AC_CHECK_LIB(ncurses, tgetent, [ TERM_LIB="-lncurses" ], [
+       AC_CHECK_LIB(termcap, tgetent, [ TERM_LIB="-ltermcap" ])
+    ])
+  ])
+  ],
+  [  AC_CHECK_HEADERS(curses.h)
+     AC_CHECK_HEADER(term.h,
+       [ AC_CHECK_LIB(curses, tgetent,
+        [ TERM_LIB="-lcurses" ] )
+       ])
+  ])
+
+
 got_conio="no"
 if test x$support_conio = xyes; then
 got_conio="no"
 if test x$support_conio = xyes; then
-   AC_CHECK_HEADER(termcap.h, 
-     [ AC_CHECK_LIB(termcap, tgetent, 
-       [ CONS_LIBS="-ltermcap"
-    CONS_OBJ="conio.o"
-    CONS_SRC="conio.c"
-    got_conio="yes"
-    support_readline=no
-    AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-       ],   
-       [ AC_CHECK_LIB(ncurses, tgetent,
-    [ CONS_LIBS="-lncurses"
+   if test x$TERM_LIB != x; then
+      CONS_LIBS=$TERM_LIB
       CONS_OBJ="conio.o"
       CONS_SRC="conio.c"
       got_conio="yes"
       support_readline=no
       CONS_OBJ="conio.o"
       CONS_SRC="conio.c"
       got_conio="yes"
       support_readline=no
-      AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-    ])
-       ])
-     ],
-     [
-    AC_CHECK_HEADERS(curses.h)
-    AC_CHECK_HEADER(term.h,
-         [ AC_CHECK_LIB(curses, tgetent, 
-       [ CONS_LIBS="-lcurses"
-        CONS_OBJ="conio.o"
-        CONS_SRC="conio.c"
-        got_conio="yes"
-        support_readline=no
-        AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled]) 
-       ])
-         ],
-         [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
-[#if HAVE_CURSES_H
-#include <curses.h>
-#endif
-])
-     ])
+      AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
+   else
+      echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "
+   fi
 fi
 
 
 fi
 
 
@@ -855,14 +771,14 @@ if test x$support_readline = xyes; then
                CONS_LDFLAGS="-L${with_readline}/lib"
                with_readline="${with_readline}/include/readline"
             else
                CONS_LDFLAGS="-L${with_readline}/lib"
                with_readline="${with_readline}/include/readline"
             else
-               with_readline="/usr/include/readline" 
+               with_readline="/usr/include/readline"
             fi
 
             fi
 
-            AC_CHECK_HEADER(${with_readline}/readline.h, 
+            AC_CHECK_HEADER(${with_readline}/readline.h,
                [
                    AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                [
                    AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
-                   CONS_LIBS="-lreadline -lhistory -ltermcap"
-                   got_readline="yes"   
+                   CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
+                   got_readline="yes"  
                ], [
                    echo " "
                    echo "readline.h not found. readline turned off ..."
                ], [
                    echo " "
                    echo "readline.h not found. readline turned off ..."
@@ -873,20 +789,20 @@ if test x$support_readline = xyes; then
          esac
       ],[
         dnl check for standard readline library
          esac
       ],[
         dnl check for standard readline library
-        AC_CHECK_HEADER(/usr/include/readline/readline.h, 
+        AC_CHECK_HEADER(/usr/include/readline/readline.h,
            [
                AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                got_readline="yes"
                CONS_INC="-I/usr/include/readline"
            [
                AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                got_readline="yes"
                CONS_INC="-I/usr/include/readline"
-               CONS_LIBS="-lreadline -ltermcap"
+               CONS_LIBS="-lreadline ${TERM_LIB}"
            ], [
                dnl Did not find standard library, so try Bacula's default
            ], [
                dnl Did not find standard library, so try Bacula's default
-               AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h, 
+               AC_CHECK_HEADER(${TOP_DIR}/depkgs/readline/readline.h,
                    [
                        AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
                    [
                        AC_DEFINE(HAVE_READLINE, 1, [Set to enable readline support])
-                       got_readline="yes"   
+                       got_readline="yes"
                        CONS_INC="-I${TOP_DIR}/depkgs/readline"
                        CONS_INC="-I${TOP_DIR}/depkgs/readline"
-                       CONS_LIBS="-lreadline -lhistory -ltermcap"
+                       CONS_LIBS="-lreadline -lhistory ${TERM_LIB}"
                        CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
                        PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
                    ], [
                        CONS_LDFLAGS="-L${TOP_DIR}/depkgs/readline"
                        PRTREADLINE_SRC="${TOP_DIR}/depkgs/readline"
                    ], [
@@ -897,7 +813,7 @@ if test x$support_readline = xyes; then
                )
            ]
         )
                )
            ]
         )
-      ]    
+      ]
    )
 fi
 
    )
 fi
 
@@ -913,102 +829,14 @@ MAKE_SHELL=/bin/sh
 AC_SUBST(MAKE_SHELL)
 AC_HEADER_STAT
 AC_HEADER_DIRENT
 AC_SUBST(MAKE_SHELL)
 AC_HEADER_STAT
 AC_HEADER_DIRENT
-AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr lstat lchown)
+AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr)
+AC_CHECK_FUNCS(lstat lchown lchmod futimes fchmod fchown)
 AC_CHECK_FUNCS(nanosleep nl_langinfo)
 AC_CHECK_HEADERS(varargs.h)
 
 dnl End of readline/conio stuff
 dnl -----------------------------------------------------------------------
 
 AC_CHECK_FUNCS(nanosleep nl_langinfo)
 AC_CHECK_HEADERS(varargs.h)
 
 dnl End of readline/conio stuff
 dnl -----------------------------------------------------------------------
 
-dnl -----------------------------------------------------------------------
-dnl  Check for Python support
-dnl
-AC_MSG_CHECKING(for Python support)
-AC_ARG_WITH(python,
-   AC_HELP_STRING([--with-python@<:@=DIR@:>@], [Include Python support. DIR is the Python base install directory, default is to search through a number of common places for the Python files.]),
-   [
-       PYTHON_INCDIR= 
-       PYTHON_LIBS=
-       if test "$withval" != "no"; then
-         if test "$withval" = "yes"; then
-            if test -e /usr/bin/python-config ; then
-               PYTHON_INCDIR=`/usr/bin/python-config --includes`
-               PYTHON_LIBS=`/usr/bin/python-config --libs`
-            else
-               for python_root in /usr /usr/local /usr/sfw; do
-                  for ver in python2.2 python2.3 python2.4 python2.5 python2.6 python3; do
-                     if test -f $python_root/include/${ver}/Python.h; then
-                        PYTHON_INCDIR=-I$python_root/include/${ver}
-                        if test -d $python_root/lib64/${ver}/config; then
-                           PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
-                        else
-                           PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
-                        fi
-                        break 
-                     fi
-                  done
-               done
-
-               if test x$PYTHON_INCDIR = x; then
-                  if test -f $prefix/include/Python.h; then
-                     PYTHON_INCDIR=-I$prefix/include
-                     if test -d $prefix/lib64/config; then
-                        PYTHON_LIBS="-L$prefix/lib64/config -lpython"
-                     else
-                        PYTHON_LIBS="-L$prefix/lib/config -lpython"
-                     fi
-                  else
-                     AC_MSG_RESULT(no)
-                     AC_MSG_ERROR(Unable to find Python.h in standard locations)
-                  fi
-               fi
-            fi
-         else
-            if test -e $withval/bin/python-config ; then
-               PYTHON_INCDIR=`$withval/bin/python-config --includes`
-               PYTHON_LIBS=`$withval/bin/python-config --libs`
-            elif test -f $withval/Python.h; then
-               PYTHON_INCDIR=-I$withval
-               PYTHON_LIBS="-L$withval/config -lpython"
-            elif test -f $withval/include/Python.h; then
-               PYTHON_INCDIR=-I$withval/include
-               if test -d $withval/lib64/config; then
-                  PYTHON_LIBS="-L$withval/lib64/config -lpython"
-               else
-                  PYTHON_LIBS="-L$withval/lib/config -lpython"
-               fi
-            elif test -f $withval/include/python/Python.h; then
-               PYTHON_INCDIR=-I$withval/include/python
-               if test -d $withval/lib64/python/config; then
-                  PYTHON_LIBS="-L$withval/lib64/python/config -lpython"
-               else
-                  PYTHON_LIBS="-L$withval/lib/python/config -lpython"
-               fi
-            else
-               AC_MSG_RESULT(no)
-               AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
-            fi
-         fi
-
-         AC_DEFINE([HAVE_PYTHON], 1)
-         AC_MSG_RESULT(yes)
-         support_python=yes
-         AC_MSG_NOTICE(checking for more Python libs)
-         saved_LIBS="$LIBS"; LIBS=
-         AC_SEARCH_LIBS(shm_open, [rt])
-         AC_CHECK_LIB(util, openpty)
-         PYTHON_LIBS="$PYTHON_LIBS $LIBS"
-         LIBS="$saved_LIBS"
-       else
-         AC_MSG_RESULT(no)
-       fi
-   ],[
-       AC_MSG_RESULT(no)
-   ]
-)
-AC_SUBST(PYTHON_LIBS)
-AC_SUBST(PYTHON_INCDIR)
-
 dnl
 dnl Find where sockets are (especially for Solaris)
 dnl Do this before the TCP Wrappers test since tcp wrappers
 dnl
 dnl Find where sockets are (especially for Solaris)
 dnl Do this before the TCP Wrappers test since tcp wrappers
@@ -1023,7 +851,7 @@ AC_CHECK_FUNC(socket,
 dnl -----------------------------------------------------------
 dnl Check whether user wants TCP wrappers support (default off)
 dnl -----------------------------------------------------------
 dnl -----------------------------------------------------------
 dnl Check whether user wants TCP wrappers support (default off)
 dnl -----------------------------------------------------------
-TCPW_MSG="no" 
+TCPW_MSG="no"
 WRAPLIBS=""
 AC_ARG_WITH(tcp-wrappers,
    AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
 WRAPLIBS=""
 AC_ARG_WITH(tcp-wrappers,
    AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
@@ -1034,7 +862,7 @@ AC_ARG_WITH(tcp-wrappers,
          AC_SEARCH_LIBS(nanosleep, [rt])
          AC_MSG_CHECKING(for libwrap)
          AC_TRY_LINK(
          AC_SEARCH_LIBS(nanosleep, [rt])
          AC_MSG_CHECKING(for libwrap)
          AC_TRY_LINK(
-            [ 
+            [
               #include <sys/types.h>
               #include <tcpd.h>
               int deny_severity = 0;
               #include <sys/types.h>
               #include <tcpd.h>
               int deny_severity = 0;
@@ -1045,7 +873,7 @@ AC_ARG_WITH(tcp-wrappers,
             ], [
                 AC_MSG_RESULT(yes)
                 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
             ], [
                 AC_MSG_RESULT(yes)
                 AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
-                TCPW_MSG="yes" 
+                TCPW_MSG="yes"
                 LIBS="$saved_LIBS"
                 WRAPLIBS="-lwrap"
             ], [
                 LIBS="$saved_LIBS"
                 WRAPLIBS="-lwrap"
             ], [
@@ -1063,7 +891,7 @@ AC_ARG_WITH(tcp-wrappers,
                   ], [
                      AC_MSG_RESULT(yes)
                      AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
                   ], [
                      AC_MSG_RESULT(yes)
                      AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
-                     TCPW_MSG="yes" 
+                     TCPW_MSG="yes"
                      LIBS="$saved_LIBS"
                      WRAPLIBS="-lwrap"
                   ], [
                      LIBS="$saved_LIBS"
                      WRAPLIBS="-lwrap"
                   ], [
@@ -1076,6 +904,7 @@ AC_ARG_WITH(tcp-wrappers,
    ]
 )
 
    ]
 )
 
+
 dnl -----------------------------------------------------------
 dnl Check whether OpenSSL is available
 dnl -----------------------------------------------------------
 dnl -----------------------------------------------------------
 dnl Check whether OpenSSL is available
 dnl -----------------------------------------------------------
@@ -1151,9 +980,7 @@ if test "x$with_openssl_directory" != "xno"; then
       ]
    )
 
       ]
    )
 
-   LIBS="${saved_LIBS}"
-   CFLAGS="${saved_CFLAGS}"
-
+   AC_MSG_RESULT([$support_tls])
    if test "$support_tls" = "yes"; then
       AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
       AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
    if test "$support_tls" = "yes"; then
       AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
       AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
@@ -1167,23 +994,24 @@ if test "x$with_openssl_directory" != "xno"; then
    if test "$ac_cv_openssl_export" = "yes"; then
       AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
    fi
    if test "$ac_cv_openssl_export" = "yes"; then
       AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
    fi
+
+   if test "$support_crypto" = "yes"; then
+      AC_CHECK_LIB(crypto, EVP_PKEY_encrypt_old, AC_DEFINE(HAVE_OPENSSLv1, 1, [Set if have OpenSSL version 1.x]))
+   fi
+
+   LIBS="${saved_LIBS}"
+   CFLAGS="${saved_CFLAGS}"
 else
    support_tls="no"
    support_crypto="no"
 else
    support_tls="no"
    support_crypto="no"
-   OPENSSL_LIBS=""
-   OPENSSL_INC=""
+   AC_MSG_RESULT([$support_tls])
 fi
 
 fi
 
-if test "$support_tls" = "no"; then
-   OPENSSL_LIBS=""
-   OPENSSL_INC=""
-fi  
-if test "$support_crypto" = "no"; then
+if test "$support_tls" = "no" -o "$support_crypto" = "no"; then
    OPENSSL_LIBS=""
    OPENSSL_INC=""
    OPENSSL_LIBS=""
    OPENSSL_INC=""
-fi  
+fi
 
 
-AC_MSG_RESULT([$support_tls])
 AC_SUBST(OPENSSL_LIBS)
 AC_SUBST(OPENSSL_INC)
 
 AC_SUBST(OPENSSL_LIBS)
 AC_SUBST(OPENSSL_INC)
 
@@ -1195,11 +1023,11 @@ AC_SEARCH_LIBS(dlopen, [dl])
 dnl ------------------------------------------
 dnl Where to place working dir
 dnl ------------------------------------------
 dnl ------------------------------------------
 dnl Where to place working dir
 dnl ------------------------------------------
-working_dir=`eval echo ${prefix}/var/bacula/working`
+working_dir=`eval echo /opt/bacula/working`
 AC_ARG_WITH(working-dir,
    AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
    [
 AC_ARG_WITH(working-dir,
    AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
         working_dir=$withval
        fi
    ]
         working_dir=$withval
        fi
    ]
@@ -1214,7 +1042,7 @@ archivedir=/tmp
 AC_ARG_WITH(archivedir,
    AC_HELP_STRING([--with-archivedir=PATH], [specify path of SD archive directory]),
    [
 AC_ARG_WITH(archivedir,
    AC_HELP_STRING([--with-archivedir=PATH], [specify path of SD archive directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          archivedir=$withval
        fi
    ]
          archivedir=$withval
        fi
    ]
@@ -1229,7 +1057,7 @@ basename=`hostname`
 AC_ARG_WITH(basename,
    AC_HELP_STRING([--with-basename=RESNAME], [specify base resource name for daemons]),
    [
 AC_ARG_WITH(basename,
    AC_HELP_STRING([--with-basename=RESNAME], [specify base resource name for daemons]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          basename=$withval
        fi
    ]
          basename=$withval
        fi
    ]
@@ -1244,6 +1072,11 @@ hostname=`uname -n | cut -d '.' -f 1`
 if test x${hostname} = x ; then
   hostname="localhost"
 fi
 if test x${hostname} = x ; then
   hostname="localhost"
 fi
+dnl Make sure hostname is resolved
+ping -c 1 $hostname 2>/dev/null 1>/dev/null
+if test ! $? = 0; then
+  hostname="localhost"
+fi
 AC_ARG_WITH(hostname,
    AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
    [
 AC_ARG_WITH(hostname,
    AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
    [
@@ -1263,7 +1096,7 @@ scriptdir=`eval echo ${sysconfdir}`
 AC_ARG_WITH(scriptdir,
    AC_HELP_STRING([--with-scriptdir=PATH], [specify path of Bacula scripts directory]),
    [
 AC_ARG_WITH(scriptdir,
    AC_HELP_STRING([--with-scriptdir=PATH], [specify path of Bacula scripts directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          scriptdir=$withval
        fi
    ]
          scriptdir=$withval
        fi
    ]
@@ -1275,11 +1108,11 @@ AC_SUBST(scriptdir)
 dnl ------------------------------------------
 dnl Where to place bsrdir (bsr files)
 dnl ------------------------------------------
 dnl ------------------------------------------
 dnl Where to place bsrdir (bsr files)
 dnl ------------------------------------------
-bsrdir=/tmp
+bsrdir=`eval echo /opt/bacula/bsr`
 AC_ARG_WITH(bsrdir,
    AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
    [
 AC_ARG_WITH(bsrdir,
    AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          bsrdir=$withval
        fi
    ]
          bsrdir=$withval
        fi
    ]
@@ -1288,13 +1121,13 @@ AC_ARG_WITH(bsrdir,
 AC_SUBST(bsrdir)
 
 dnl ------------------------------------------
 AC_SUBST(bsrdir)
 
 dnl ------------------------------------------
-dnl Where to place logdir (bsr files)
+dnl Where to place logdir
 dnl ------------------------------------------
 dnl ------------------------------------------
-logdir=/tmp
+logdir=`eval echo /opt/bacula/log`
 AC_ARG_WITH(logdir,
    AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
    [
 AC_ARG_WITH(logdir,
    AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          logdir=$withval
        fi
    ]
          logdir=$withval
        fi
    ]
@@ -1310,7 +1143,7 @@ plugindir=`eval echo ${libdir}`
 AC_ARG_WITH(plugindir,
    AC_HELP_STRING([--with-plugindir=PATH], [specify path of Bacula plugins directory]),
    [
 AC_ARG_WITH(plugindir,
    AC_HELP_STRING([--with-plugindir=PATH], [specify path of Bacula plugins directory]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          plugindir=$withval
        fi
    ]
          plugindir=$withval
        fi
    ]
@@ -1325,7 +1158,7 @@ dump_email=root@localhost
 AC_ARG_WITH(dump-email,
    AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
    [
 AC_ARG_WITH(dump-email,
    AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          dump_email=$withval
        fi
    ]
          dump_email=$withval
        fi
    ]
@@ -1340,7 +1173,7 @@ job_email=root@localhost
 AC_ARG_WITH(job-email,
    AC_HELP_STRING([--with-job-email=EMAIL], [job output email address]),
    [
 AC_ARG_WITH(job-email,
    AC_HELP_STRING([--with-job-email=EMAIL], [job output email address]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          job_email=$withval
        fi
    ]
          job_email=$withval
        fi
    ]
@@ -1355,7 +1188,7 @@ smtp_host=localhost
 AC_ARG_WITH(smtp_host,
    AC_HELP_STRING([--with-smtp-host=HOST], [SMTP mail host address]),
    [
 AC_ARG_WITH(smtp_host,
    AC_HELP_STRING([--with-smtp-host=HOST], [SMTP mail host address]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          smtp_host=$withval
        fi
    ]
          smtp_host=$withval
        fi
    ]
@@ -1370,7 +1203,7 @@ piddir=/var/run
 AC_ARG_WITH(pid-dir,
    AC_HELP_STRING([--with-pid-dir=PATH], [specify location of Bacula pid files]),
    [
 AC_ARG_WITH(pid-dir,
    AC_HELP_STRING([--with-pid-dir=PATH], [specify location of Bacula pid files]),
    [
-       if test "x$withval" != "xno" ; then   
+       if test "x$withval" != "xno" ; then
          piddir=$withval
        fi
    ]
          piddir=$withval
        fi
    ]
@@ -1393,7 +1226,7 @@ fi
 AC_ARG_WITH(subsys-dir,
    AC_HELP_STRING([--with-subsys-dir=PATH], [specify location of Bacula subsys file]),
    [
 AC_ARG_WITH(subsys-dir,
    AC_HELP_STRING([--with-subsys-dir=PATH], [specify location of Bacula subsys file]),
    [
-       if test "x$withval" != "xno" ; then   
+       if test "x$withval" != "xno" ; then
          subsysdir=$withval
        fi
    ]
          subsysdir=$withval
        fi
    ]
@@ -1408,7 +1241,7 @@ baseport=9101
 AC_ARG_WITH(baseport,
    AC_HELP_STRING([--with-baseport=PORT], [specify base port address for daemons]),
    [
 AC_ARG_WITH(baseport,
    AC_HELP_STRING([--with-baseport=PORT], [specify base port address for daemons]),
    [
-       if test "x$withval" != "xno" ; then   
+       if test "x$withval" != "xno" ; then
          baseport=$withval
        fi
    ]
          baseport=$withval
        fi
    ]
@@ -1430,7 +1263,7 @@ dir_password=
 AC_ARG_WITH(dir-password,
    AC_HELP_STRING([--with-dir-password=PASSWORD], [specify Director's password]),
    [
 AC_ARG_WITH(dir-password,
    AC_HELP_STRING([--with-dir-password=PASSWORD], [specify Director's password]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          dir_password=$withval
        fi
    ]
          dir_password=$withval
        fi
    ]
@@ -1449,7 +1282,7 @@ fd_password=
 AC_ARG_WITH(fd-password,
    AC_HELP_STRING([--with-fd-password=PASSWORD], [specify Client's password]),
    [
 AC_ARG_WITH(fd-password,
    AC_HELP_STRING([--with-fd-password=PASSWORD], [specify Client's password]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          fd_password=$withval
        fi
    ]
          fd_password=$withval
        fi
    ]
@@ -1468,7 +1301,7 @@ sd_password=
 AC_ARG_WITH(sd-password,
    AC_HELP_STRING([--with-sd-password=PASSWORD], [specify Storage daemon's password]),
    [
 AC_ARG_WITH(sd-password,
    AC_HELP_STRING([--with-sd-password=PASSWORD], [specify Storage daemon's password]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          sd_password=$withval
        fi
    ]
          sd_password=$withval
        fi
    ]
@@ -1487,7 +1320,7 @@ mon_dir_password=
 AC_ARG_WITH(mon-dir-password,
    AC_HELP_STRING([--with-mon-dir-password=PASSWORD], [specify Director's password used by the monitor]),
    [
 AC_ARG_WITH(mon-dir-password,
    AC_HELP_STRING([--with-mon-dir-password=PASSWORD], [specify Director's password used by the monitor]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          mon_dir_password=$withval
        fi
    ]
          mon_dir_password=$withval
        fi
    ]
@@ -1506,7 +1339,7 @@ mon_fd_password=
 AC_ARG_WITH(mon-fd-password,
    AC_HELP_STRING([--with-mon-fd-password=PASSWORD], [specify Client's password used by the monitor]),
    [
 AC_ARG_WITH(mon-fd-password,
    AC_HELP_STRING([--with-mon-fd-password=PASSWORD], [specify Client's password used by the monitor]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          mon_fd_password=$withval
        fi
    ]
          mon_fd_password=$withval
        fi
    ]
@@ -1525,7 +1358,7 @@ mon_sd_password=
 AC_ARG_WITH(mon-sd-password,
    AC_HELP_STRING([--with-mon-sd-password=PASSWORD], [specify Storage daemon's password used by the monitor]),
    [
 AC_ARG_WITH(mon-sd-password,
    AC_HELP_STRING([--with-mon-sd-password=PASSWORD], [specify Storage daemon's password used by the monitor]),
    [
-       if test "x$withval" != "xno" ; then     
+       if test "x$withval" != "xno" ; then
          mon_sd_password=$withval
        fi
    ]
          mon_sd_password=$withval
        fi
    ]
@@ -1554,7 +1387,7 @@ db_name=bacula
 AC_ARG_WITH(db_name,
    AC_HELP_STRING([--with-db-name=DBNAME], [specify database name @<:@default=bacula@:>@]),
    [
 AC_ARG_WITH(db_name,
    AC_HELP_STRING([--with-db-name=DBNAME], [specify database name @<:@default=bacula@:>@]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          db_name=$withval
        fi
    ]
          db_name=$withval
        fi
    ]
@@ -1565,7 +1398,7 @@ db_user=bacula
 AC_ARG_WITH(db_user,
    AC_HELP_STRING([--with-db-user=UNAME], [specify database user @<:@default=bacula@:>@]),
    [
 AC_ARG_WITH(db_user,
    AC_HELP_STRING([--with-db-user=UNAME], [specify database user @<:@default=bacula@:>@]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          db_user=$withval
        fi
    ]
          db_user=$withval
        fi
    ]
@@ -1576,7 +1409,7 @@ db_password=
 AC_ARG_WITH(db_password,
    AC_HELP_STRING([--with-db-password=PWD], [specify database password @<:@default=*none*@:>@]),
    [
 AC_ARG_WITH(db_password,
    AC_HELP_STRING([--with-db-password=PWD], [specify database password @<:@default=*none*@:>@]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          db_password=$withval
        fi
    ]
          db_password=$withval
        fi
    ]
@@ -1604,7 +1437,7 @@ dir_user=
 AC_ARG_WITH(dir_user,
    AC_HELP_STRING([--with-dir-user=USER], [specify user for Director daemon]),
    [
 AC_ARG_WITH(dir_user,
    AC_HELP_STRING([--with-dir-user=USER], [specify user for Director daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
           dir_user=$withval
        fi
    ]
           dir_user=$withval
        fi
    ]
@@ -1614,7 +1447,7 @@ dir_group=
 AC_ARG_WITH(dir_group,
    AC_HELP_STRING([--with-dir-group=GROUP], [specify group for Director daemon]),
    [
 AC_ARG_WITH(dir_group,
    AC_HELP_STRING([--with-dir-group=GROUP], [specify group for Director daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          dir_group=$withval
        fi
    ]
          dir_group=$withval
        fi
    ]
@@ -1624,7 +1457,7 @@ sd_user=
 AC_ARG_WITH(sd_user,
    AC_HELP_STRING([--with-sd-user=USER], [specify user for Storage daemon]),
    [
 AC_ARG_WITH(sd_user,
    AC_HELP_STRING([--with-sd-user=USER], [specify user for Storage daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          sd_user=$withval
        fi
    ]
          sd_user=$withval
        fi
    ]
@@ -1634,7 +1467,7 @@ sd_group=
 AC_ARG_WITH(sd_group,
    AC_HELP_STRING([--with-sd-group=GROUP], [specify group for Storage daemon]),
    [
 AC_ARG_WITH(sd_group,
    AC_HELP_STRING([--with-sd-group=GROUP], [specify group for Storage daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          sd_group=$withval
        fi
    ]
          sd_group=$withval
        fi
    ]
@@ -1644,7 +1477,7 @@ fd_user=
 AC_ARG_WITH(fd_user,
    AC_HELP_STRING([--with-fd-user=USER], [specify user for File daemon]),
    [
 AC_ARG_WITH(fd_user,
    AC_HELP_STRING([--with-fd-user=USER], [specify user for File daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          fd_user=$withval
        fi
    ]
          fd_user=$withval
        fi
    ]
@@ -1654,7 +1487,7 @@ fd_group=
 AC_ARG_WITH(fd_group,
    AC_HELP_STRING([--with-fd-group=GROUP], [specify group for File daemon]),
    [
 AC_ARG_WITH(fd_group,
    AC_HELP_STRING([--with-fd-group=GROUP], [specify group for File daemon]),
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          fd_group=$withval
        fi
    ]
          fd_group=$withval
        fi
    ]
@@ -1670,11 +1503,11 @@ AC_SUBST(fd_group)
 dnl
 dnl allow setting default executable permissions
 dnl
 dnl
 dnl allow setting default executable permissions
 dnl
-SBINPERM=0754
+SBINPERM=0750
 AC_ARG_WITH(sbin-perm,
 AC_ARG_WITH(sbin-perm,
-   AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0754@:>@]),
+   AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0750@:>@]),
    [
    [
-       if test "x$withval" != "x" ; then   
+       if test "x$withval" != "x" ; then
          SBINPERM=$withval
        fi
    ]
          SBINPERM=$withval
        fi
    ]
@@ -1682,101 +1515,123 @@ AC_ARG_WITH(sbin-perm,
 
 AC_SUBST(SBINPERM)
 
 
 AC_SUBST(SBINPERM)
 
+dnl -------------------------------------------
+dnl enable batch attribute DB insert (default on)
+dnl -------------------------------------------
+support_batch_insert=yes
+AC_ARG_ENABLE(batch-insert,
+   AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=yes@:>@]),
+   [
+       if test x$enableval = xno; then
+         support_batch_insert=no
+       fi
+   ]
+)
+
+if test x$support_batch_insert = xyes; then
+   AC_DEFINE(USE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
+fi
+
 dnl ------------------------------------------------
 dnl Bacula check for various SQL database engines
 dnl ------------------------------------------------
 dnl ------------------------------------------------
 dnl Bacula check for various SQL database engines
 dnl ------------------------------------------------
-SQL_LIB=
+
+dnl
+dnl Set uncomment_dbi by default to '#' if DBI is enabled this will get reset
+dnl
+uncomment_dbi="#"
+
 BA_CHECK_POSTGRESQL_DB
 
 BA_CHECK_MYSQL_DB
 
 BA_CHECK_POSTGRESQL_DB
 
 BA_CHECK_MYSQL_DB
 
-BA_CHECK_INGRES_DB
-
 BA_CHECK_SQLITE3_DB
 
 BA_CHECK_SQLITE3_DB
 
-# BA_CHECK_SQLITE_DB
-
-BA_CHECK_DBI_DB
-
-BA_CHECK_DBI_DRIVER
-
-AC_SUBST(cats)
-AC_SUBST(DB_TYPE)
-
 dnl -------------------------------------------
 dnl -------------------------------------------
-dnl enable batch attribute DB insert (default on)
+dnl If no batch insert backend are enable set
+dnl variable to None
 dnl -------------------------------------------
 dnl -------------------------------------------
-support_batch_insert=no
-A=`test -f $SQL_LIB && nm $SQL_LIB | grep pthread_mutex_lock`
-pkg=$?
-if test $pkg = 0; then
-   support_batch_insert=yes
-   AC_ARG_ENABLE(batch-insert,
-      AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=no@:>@]),
-      [
-         if test x$enableval = xno; then
-            support_batch_insert=no
-         else
-            support_batch_insert=yes
-         fi
-      ]
-   )
-fi
-   
-dnl Check if postgresql can support batch mode  
-if test x$DB_TYPE = xpostgresql; then
-   AC_CHECK_LIB(pq, PQisthreadsafe, AC_DEFINE(HAVE_PQISTHREADSAFE, 1, [Set if have PQisthreadsafe]))
-   AC_CHECK_LIB(pq, PQputCopyData, AC_DEFINE(HAVE_PQ_COPY, 1, [Set if have PQputCopyData]))
-   if test "x$ac_cv_lib_pq_PQputCopyData" != "xyes"
-    then
-       support_batch_insert=no
-   fi
+if test -z "${batch_insert_db_backends}"; then
+   batch_insert_db_backends="None"
 fi
 
 fi
 
-if test x$DB_TYPE = xdbi; then
-   DB_TYPE=$DB_PROG
-   db_type=$DB_PROG
-   pkg=1
-   dnl Check for batch insert
-   if test $DB_PROG = postgresql; then
-      AC_CHECK_LIB(pq, PQisthreadsafe, AC_DEFINE(HAVE_PQISTHREADSAFE))
-      AC_CHECK_LIB(pq, PQputCopyData, AC_DEFINE(HAVE_PQ_COPY))
-      test "x$ac_cv_lib_pq_PQputCopyData" != "xyes"
-      pkg=$?
-   fi
+dnl -------------------------------------------
+dnl Make sure at least one database backend is found
+dnl -------------------------------------------
+if test "x${db_backends}" = "x" ; then
+   echo " "
+   echo " "
+   echo "You have not specified either --enable-client-only or one of the"
+   echo "supported databases: MySQL, PostgreSQL, or SQLite3."
+   echo "This is not permitted. Please reconfigure."
+   echo " "
+   echo "Aborting the configuration ..."
+   echo " "
+   echo " "
+   exit 1
+fi
 
 
-   if test $DB_PROG = mysql; then
-      A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock`
-      pkg=$?   
-   fi
+dnl -------------------------------------------
+dnl See how many catalog backends are configured.
+dnl -------------------------------------------
+case `echo $DB_BACKENDS | wc -w | sed -e 's/^ *//'` in
+   1)
+      DEFAULT_DB_TYPE="${DB_BACKENDS}"
+      if test x$use_libtool = xno; then
+        SHARED_CATALOG_TARGETS=""
+      else
+        SHARED_CATALOG_TARGETS="libbaccats-${DEFAULT_DB_TYPE}.la"
+      fi
+      ;;
+   *)
+      dnl ------------------------------------------------
+      dnl Set the default backend to the first backend found
+      dnl ------------------------------------------------
+      DEFAULT_DB_TYPE=`echo ${DB_BACKENDS} | cut -d' ' -f1`
+
+      dnl ------------------------------------------------
+      dnl For multiple backend we need libtool support.
+      dnl ------------------------------------------------
+      if test x$use_libtool = xno; then
+        echo " "
+        echo " "
+        echo "You have specified two or more of the"
+        echo "supported databases: MySQL, PostgreSQL, or SQLite3."
+        echo "This is not permitted when not using libtool Please reconfigure."
+        echo " "
+        echo "Aborting the configuration ..."
+        echo " "
+        echo " "
+        exit 1
+      fi
 
 
-   if test $DB_PROG = sqlite3; then
-      A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock`
-      pkg=$?
-   fi
+      SHARED_CATALOG_TARGETS=""
+      for db_type in ${DB_BACKENDS}
+      do
+        if test -z "${SHARED_CATALOG_TARGETS}"; then
+           SHARED_CATALOG_TARGETS="libbaccats-${db_type}.la"
+        else
+           SHARED_CATALOG_TARGETS="${SHARED_CATALOG_TARGETS} libbaccats-${db_type}.la"
+        fi
+      done
+      ;;
+esac
 
 
-   if test $pkg = 0; then
-      AC_ARG_ENABLE(batch-insert,
-        AC_HELP_STRING([--enable-batch-insert], [enable the DB batch insert code @<:@default=no@:>@]),
-        [
-            if test x$enableval = xno; then
-               support_batch_insert=no
-            else
-               support_batch_insert=yes
-            fi
-        ]
-      )
-   fi
-else 
-   dnl If dbi was not chosen, let the comment in file
-   uncomment_dbi="#"  
+dnl -------------------------------------------
+dnl Unset DB_LIBS when using libtool as we link the
+dnl shared library using the right database lib no need to
+dnl set DB_LIBS which is only used for non shared versions
+dnl of the backends.
+dnl -------------------------------------------
+if test x$use_libtool = xyes; then
+   DB_LIBS=""
 fi
 
 AC_SUBST(uncomment_dbi)
 fi
 
 AC_SUBST(uncomment_dbi)
-
-if test $support_batch_insert = yes ; then
-   AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
-fi
+AC_SUBST(DB_BACKENDS)
+AC_SUBST(DB_LIBS)
+AC_SUBST(DEFAULT_DB_TYPE)
+AC_SUBST(SHARED_CATALOG_TARGETS)
 
 AC_DEFINE(PROTOTYPES)
 
 
 AC_DEFINE(PROTOTYPES)
 
@@ -1790,7 +1645,7 @@ if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O2"; then
    CFLAGS="$CCOPTS"
 fi
 
    CFLAGS="$CCOPTS"
 fi
 
-dnl A few others 
+dnl A few others
 AC_EXEEXT
 
 dnl See if we can use 64 bit file addresses
 AC_EXEEXT
 
 dnl See if we can use 64 bit file addresses
@@ -1812,6 +1667,7 @@ AC_CHECK_HEADERS( \
    stdarg.h \
    stdlib.h \
    stdint.h \
    stdarg.h \
    stdlib.h \
    stdint.h \
+   inttypes.h \
    string.h \
    strings.h \
    termios.h \
    string.h \
    strings.h \
    termios.h \
@@ -1844,7 +1700,7 @@ AC_STRUCT_ST_BLOCKS
 AC_STRUCT_TIMEZONE
 
 dnl --------------------------------------------------------------------------
 AC_STRUCT_TIMEZONE
 
 dnl --------------------------------------------------------------------------
-dnl Check for utime.h structure 
+dnl Check for utime.h structure
 dnl --------------------------------------------------------------------------
 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
    [
 dnl --------------------------------------------------------------------------
 AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
    [
@@ -1911,7 +1767,7 @@ test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [
 
 dnl Note: it is more correct to use AC_LANG(C++) but some of the older
 dnl   *BSD systems still use old style C prototypes, which are wrong with
 
 dnl Note: it is more correct to use AC_LANG(C++) but some of the older
 dnl   *BSD systems still use old style C prototypes, which are wrong with
-dnl   compiled with a C++ compiler. 
+dnl   compiled with a C++ compiler.
 AC_LANG(C)
 
 dnl --------------------------------------------------------------------------
 AC_LANG(C)
 
 dnl --------------------------------------------------------------------------
@@ -1938,6 +1794,8 @@ AC_LANG_POP(C++)
 
 AC_C_CONST
 
 
 AC_C_CONST
 
+AC_C_BIGENDIAN([AC_DEFINE([HAVE_BIG_ENDIAN], [1], [Big Endian])], [AC_DEFINE([HAVE_LITTLE_ENDIAN], [1], [Little Endian])])
+
 dnl --------------------------------------------------------------------------
 dnl CHECKING FOR FILESYSTEM TYPE
 dnl --------------------------------------------------------------------------
 dnl --------------------------------------------------------------------------
 dnl CHECKING FOR FILESYSTEM TYPE
 dnl --------------------------------------------------------------------------
@@ -1969,7 +1827,7 @@ if test $fstype = no; then
       AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX
    )
 fi
       AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX
    )
 fi
-if test $fstype = no; then  
+if test $fstype = no; then
    AC_TRY_CPP(
       [
          #include <mntent.h>
    AC_TRY_CPP(
       [
          #include <mntent.h>
@@ -1977,10 +1835,10 @@ if test $fstype = no; then
       AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD
    )
 fi
       AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD
    )
 fi
-if test $fstype = no; then  
+if test $fstype = no; then
    AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
 fi
    AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF1)
 fi
-if test $fstype = no; then  
+if test $fstype = no; then
    AC_TRY_CPP(
       [
          #include <sys/mount.h>
    AC_TRY_CPP(
       [
          #include <sys/mount.h>
@@ -1993,6 +1851,10 @@ AC_MSG_RESULT($fstype)
 
 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
 
 
 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
 
+AC_LANG_PUSH(C++)
+AC_CHECK_FUNCS(backtrace)
+AC_LANG_POP(C++)
+
 dnl --------------------------------------------------------------------------
 dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
 dnl --------------------------------------------------------------------------
 dnl --------------------------------------------------------------------------
 dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
 dnl --------------------------------------------------------------------------
@@ -2053,7 +1915,7 @@ AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
              intmax_t a; a = 1;
          ], [
              ac_cv_have_intmax_t="yes"
              intmax_t a; a = 1;
          ], [
              ac_cv_have_intmax_t="yes"
-         ], [ 
+         ], [
              AC_TRY_COMPILE(
                 [
                     #include <stdint.h>
              AC_TRY_COMPILE(
                 [
                     #include <stdint.h>
@@ -2066,7 +1928,7 @@ AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
                 ]
              )
          ]
                 ]
              )
          ]
-       )       
+       )
    ]
 )
 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
    ]
 )
 if test "x$ac_cv_have_intmax_t" = "xyes" ; then
@@ -2083,7 +1945,7 @@ AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t,
              u_intmax_t a; a = 1;
          ], [
              ac_cv_have_u_intmax_t="yes"
              u_intmax_t a; a = 1;
          ], [
              ac_cv_have_u_intmax_t="yes"
-         ], [ 
+         ], [
              AC_TRY_COMPILE(
                 [
                     #include <stdint.h>
              AC_TRY_COMPILE(
                 [
                     #include <stdint.h>
@@ -2123,7 +1985,7 @@ if test "x$ac_cv_have_intxx_t" = "xyes" ; then
    AC_DEFINE(HAVE_INTXX_T)
    have_intxx_t=1
 fi
    AC_DEFINE(HAVE_INTXX_T)
    have_intxx_t=1
 fi
-   
+
 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
    [
        AC_TRY_COMPILE(
 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
    [
        AC_TRY_COMPILE(
@@ -2143,7 +2005,7 @@ if test "x$ac_cv_have_int64_t" = "xyes" ; then
    AC_DEFINE(HAVE_INT64_T)
    have_int64_t=1
 fi
    AC_DEFINE(HAVE_INT64_T)
    have_int64_t=1
 fi
-   
+
 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
    [
        AC_TRY_COMPILE(
 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
    [
        AC_TRY_COMPILE(
@@ -2203,7 +2065,7 @@ then
       ], [
          AC_MSG_RESULT(no)
       ]
       ], [
          AC_MSG_RESULT(no)
       ]
-   ) 
+   )
 fi
 
 if test -z "$have_u_intxx_t" ; then
 fi
 
 if test -z "$have_u_intxx_t" ; then
@@ -2213,7 +2075,7 @@ if test -z "$have_u_intxx_t" ; then
             [
                 #include <sys/types.h>
             ], [
             [
                 #include <sys/types.h>
             ], [
-                uint8_t a; uint16_t b; 
+                uint8_t a; uint16_t b;
                 uint32_t c; a = b = c = 1;
             ], [
                ac_cv_have_uintxx_t="yes"
                 uint32_t c; a = b = c = 1;
             ], [
                ac_cv_have_uintxx_t="yes"
@@ -2236,7 +2098,7 @@ then
       [
          #include <sys/bitypes.h>
       ], [
       [
          #include <sys/bitypes.h>
       ], [
-         int64_t a; u_int64_t b; 
+         int64_t a; u_int64_t b;
          a = b = 1;
       ], [
          AC_DEFINE(HAVE_U_INT64_T)
          a = b = 1;
       ], [
          AC_DEFINE(HAVE_U_INT64_T)
@@ -2245,7 +2107,7 @@ then
       ], [
          AC_MSG_RESULT(no)
       ]
       ], [
          AC_MSG_RESULT(no)
       ]
-   ) 
+   )
 fi
 
 if (test -z "$have_uintxx_t" && \
 fi
 
 if (test -z "$have_uintxx_t" && \
@@ -2256,7 +2118,7 @@ then
       [
          #include <sys/bitypes.h>
       ], [
       [
          #include <sys/bitypes.h>
       ], [
-         uint8_t a; uint16_t b; 
+         uint8_t a; uint16_t b;
          uint32_t c; a = b = c = 1;
       ], [
          AC_DEFINE(HAVE_UINTXX_T)
          uint32_t c; a = b = c = 1;
       ], [
          AC_DEFINE(HAVE_UINTXX_T)
@@ -2264,7 +2126,7 @@ then
       ], [
          AC_MSG_RESULT(no)
       ]
       ], [
          AC_MSG_RESULT(no)
       ]
-   ) 
+   )
 fi
 
 dnl --------------------------------------------------------------------------
 fi
 
 dnl --------------------------------------------------------------------------
@@ -2288,12 +2150,23 @@ AC_CHECK_FUNCS( \
    [echo 'configure: cannot find needed function.'; exit 1]
 )
 
    [echo 'configure: cannot find needed function.'; exit 1]
 )
 
+AC_CHECK_DECL(
+    F_CLOSEM,
+    AC_DEFINE(HAVE_FCNTL_F_CLOSEM, 1, [Set if you have 'F_CLOSEM' fcntl flag]),
+    ,
+    [#include <fcntl.h>]
+)
+
+AC_CHECK_FUNC(closefrom, [AC_DEFINE(HAVE_CLOSEFROM, 1, [Define to 1 if you have the 'closefrom' function.])])
+AC_CHECK_FUNCS(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE, 1, [Set if have getpagesize])])
+AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_trim])])
+
 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
 AC_CHECK_FUNCS(posix_fadvise)
 AC_CHECK_FUNCS(fdatasync)
 
 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
 AC_CHECK_FUNCS(posix_fadvise)
 AC_CHECK_FUNCS(fdatasync)
 
-AC_CHECK_FUNCS(chflags) 
+AC_CHECK_FUNCS(chflags)
 
 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
 
 
 AC_CHECK_FUNCS(snprintf vsnprintf gethostid fseeko)
 
@@ -2307,7 +2180,7 @@ AC_CACHE_CHECK(for va_copy, ba_cv_va_copy,
          ], [
              call_use_va_copy(1,2,3)
          ], [
          ], [
              call_use_va_copy(1,2,3)
          ], [
-             ba_cv_va_copy=yes,
+             ba_cv_va_copy=yes
          ], [
              ba_cv_va_copy=no
          ]
          ], [
              ba_cv_va_copy=no
          ]
@@ -2330,6 +2203,8 @@ AC_CHECK_FUNC(gethostbyname_r,
 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
 AC_CHECK_FUNCS(inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
 AC_CHECK_FUNCS(inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
 AC_CHECK_FUNCS(gethostbyname2, [AC_DEFINE(HAVE_GETHOSTBYNAME2)])
+AC_CHECK_FUNCS(getnameinfo, [AC_DEFINE(HAVE_GETNAMEINFO)])
+
 
 dnl ----------------------------
 dnl check sa_len of sockaddr
 
 dnl ----------------------------
 dnl check sa_len of sockaddr
@@ -2353,10 +2228,63 @@ if test $ac_cv_struct_sockaddr_sa_len = yes; then
   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
 fi
 
   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
 fi
 
+dnl
+dnl check for working getaddrinfo()
+dnl
+dnl Note that if the system doesn't have gai_strerror(), we
+dnl can't use getaddrinfo() because we can't get strings
+dnl describing the error codes.
+dnl
+AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,
+   [
+       AC_TRY_RUN(
+         [
+             #include <netdb.h>
+             #include <string.h>
+             #include <sys/types.h>
+             #include <sys/socket.h>
+
+             void main(void) {
+                 struct addrinfo hints, *ai;
+                 int error;
+
+                 memset(&hints, 0, sizeof(hints));
+                 hints.ai_family = AF_UNSPEC;
+                 hints.ai_socktype = SOCK_STREAM;
+                 error = getaddrinfo("127.0.0.1", NULL, &hints, &ai);
+                 if (error) {
+                     exit(1);
+                 }
+                 if (ai->ai_addr->sa_family != AF_INET) {
+                     exit(1);
+                 }
+                 exit(0);
+             }
+         ],[
+             ac_cv_working_getaddrinfo="yes"
+         ],[
+             ac_cv_working_getaddrinfo="no"
+         ],[
+             ac_cv_working_getaddrinfo="yes"
+         ]
+       )
+   ]
+)
+AC_CHECK_FUNC(gai_strerror, [AC_DEFINE(HAVE_GAI_STRERROR, 1, [Define to 1 if you have the 'gai_strerror' function.])])
+
+if test "$ac_cv_working_getaddrinfo" = "yes"; then
+  if test "$ac_cv_func_gai_strerror" != "yes"; then
+    ac_cv_working_getaddrinfo="no"
+  else
+    AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if getaddrinfo exists and works])
+  fi
+fi
+
 AC_FUNC_STRFTIME
 AC_FUNC_VPRINTF
 AC_FUNC_ALLOCA
 AC_FUNC_GETMNTENT
 AC_FUNC_STRFTIME
 AC_FUNC_VPRINTF
 AC_FUNC_ALLOCA
 AC_FUNC_GETMNTENT
+AC_CHECK_FUNCS(getmntinfo, [AC_DEFINE(HAVE_GETMNTINFO)])
 AC_FUNC_CLOSEDIR_VOID
 AC_FUNC_SETPGRP            dnl check for BSD setpgrp.
 # AC_FUNC_FNMATCH    dnl use local version
 AC_FUNC_CLOSEDIR_VOID
 AC_FUNC_SETPGRP            dnl check for BSD setpgrp.
 # AC_FUNC_FNMATCH    dnl use local version
@@ -2366,12 +2294,189 @@ AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
 AC_CHECK_LIB(sun, getpwnam)
 
 AC_CHECK_HEADERS(zlib.h)
 AC_CHECK_LIB(sun, getpwnam)
 
 AC_CHECK_HEADERS(zlib.h)
-AC_CHECK_LIB(z, deflate, [FDLIBS="-lz"])
+AC_CHECK_LIB(z, deflate, [ZLIBS="-lz"])
 have_zlib=no
 have_zlib=no
-if test x$FDLIBS = x-lz; then
+if test x$ZLIBS = x-lz; then
    AC_DEFINE(HAVE_LIBZ)
    have_zlib=yes
 fi
    AC_DEFINE(HAVE_LIBZ)
    have_zlib=yes
 fi
+AC_SUBST(ZLIBS)
+
+dnl
+dnl Check if we have AFS on this system
+dnl
+AFS_CFLAGS=""
+AFS_LIBS=""
+support_afs=auto
+AC_ARG_ENABLE(afs,
+   AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]),
+   [
+       if test x$enableval = xyes; then
+         support_afs=yes
+       elif test x$enableval = xno; then
+         support_afs=no
+       fi
+   ]
+)
+
+have_afs=no
+if test x$support_afs = xyes -o x$support_afs = xauto; then
+   AC_ARG_WITH(afsdir,
+      AC_HELP_STRING([--with-afsdir@<:@=DIR@:>@], [Directory holding AFS includes/libs]),
+      with_afsdir=$withval
+   )
+
+   dnl
+   dnl Search in standard places, or --with-afsdir not specified
+   dnl
+   if test x$with_afsdir = x; then
+      for root in /usr /usr/local; do
+        if test -d ${root}/include/afs/ ; then
+           with_afsdir=${root}
+           break
+        fi
+        if test -d ${root}/include/openafs/afs/ ; then
+           with_afsdir=${root}
+           break
+        fi
+      done
+   fi
+
+   if test -d ${with_afsdir}/include/afs/ ; then
+      AFS_CFLAGS="-I${with_afsdir}/include"
+   else
+      if test -d ${with_afsdir}/include/openafs/afs/ ; then
+        AFS_CFLAGS="-I${with_afsdir}/include/openafs"
+      fi
+   fi
+
+   saved_CFLAGS="${CFLAGS}"
+   saved_CPPFLAGS="${CPPFLAGS}"
+   CFLAGS="${AFS_CFLAGS} ${saved_CFLAGS}"
+   CPPFLAGS="${AFS_CFLAGS} ${saved_CPPFLAGS}"
+
+   AC_CHECK_HEADERS(afs/afsint.h)
+   AC_TRY_CPP(
+       [
+         #include <afs/afsint.h>
+         #include <afs/venus.h>
+       ],
+       AC_DEFINE(HAVE_AFS_VENUS_H,1,[Define to 1 if you have the <afs/venus.h> header file.])
+   )
+
+   CFLAGS="${saved_CFLAGS}"
+   CPPFLAGS="${saved_CPPFLAGS}"
+
+   dnl
+   dnl See if we can find a libsys with the pioctl symbol in there
+   dnl
+   AC_MSG_CHECKING(for pioctl in AFS libsys)
+   for dir in ${with_afsdir}/lib \
+             ${with_afsdir}/lib/afs \
+             ${with_afsdir}/lib/openafs \
+             ${with_afsdir}/lib64 \
+             ${with_afsdir}/lib64/afs \
+             ${with_afsdir}/lib64/openafs
+   do
+      for arch_type in .a .so
+      do
+        A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} 2>/dev/null | grep pioctl`
+        pkg=$?
+        if test $pkg = 0; then
+           have_afs=yes
+           AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util${arch_type}"
+           break
+        fi
+      done
+   done
+
+   if test $have_afs = yes; then
+      AC_MSG_RESULT(yes)
+   else
+      AC_MSG_RESULT(no)
+   fi
+
+   if test x$support_afs = xyes -a $have_afs != yes; then
+      AC_MSG_ERROR([afs support explicitly enabled but no supported afs implementation found,
+  please either load the afs libraries or rerun configure without --enable-afs])
+   else
+      if test $have_afs = yes; then
+        AC_DEFINE(HAVE_AFS,1,[Define to 1 if your system has AFS support])
+        AC_DEFINE(HAVE_AFS_ACL,1,[Andrew FileSystem ACL support])
+      fi
+   fi
+fi
+AC_SUBST(AFS_CFLAGS)
+AC_SUBST(AFS_LIBS)
+
+dnl ---------------------------------------------------
+dnl Check for lzo support/directory (default on)
+dnl ---------------------------------------------------
+dnl this allows you to turn it completely off
+
+AC_ARG_ENABLE(lzo,
+   AC_HELP_STRING([--disable-lzo], [disable lzo support @<:@default=yes@:>@]),
+   [
+       if test x$enableval = xno; then
+         support_lzo=no
+       fi
+   ]
+)
+
+LZO_INC=
+LZO_LIBS=
+LZO_LDFLAGS=
+
+have_lzo="no"
+if test x$support_lzo = xyes; then
+   AC_ARG_WITH(lzo,
+      AC_HELP_STRING([--with-lzo@<:@=DIR@:>@], [specify lzo library directory]),
+      [
+         case "$with_lzo" in
+         no)
+            :
+            ;;
+         yes|*)
+            if test -f ${with_lzo}/include/lzo/lzoconf.h; then
+               LZO_INC="-I${with_lzo}/include"
+               LZO_LDFLAGS="-L${with_lzo}/lib"
+               with_lzo="${with_lzo}/include"
+            else
+               with_lzo="/usr/include"
+            fi
+
+            AC_CHECK_HEADER(${with_lzo}/lzo/lzoconf.h,
+               [
+                   AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have LZO compression])
+                   LZO_LIBS="${LZO_LDFLAGS} -lzo2"
+                   have_lzo="yes"      
+               ], [
+                   echo " "
+                   echo "lzoconf.h not found. lzo turned off ..."
+                   echo " "
+               ]
+            )
+            ;;
+         esac
+      ],[
+        AC_CHECK_HEADER(lzo/lzoconf.h,
+        [
+           AC_CHECK_HEADER(lzo/lzo1x.h,
+           [
+              AC_CHECK_LIB(lzo2, lzo1x_1_compress,
+              [
+                LZO_LIBS="-llzo2"
+                AC_DEFINE(HAVE_LZO,1,[Define to 1 if you have LZO compression])
+                have_lzo=yes
+              ])
+           ])
+        ])
+      ])
+fi
+
+AC_SUBST(LZO_INC)
+AC_SUBST(LZO_LIBS)
+
 
 dnl
 dnl Check for ACL support and libraries
 
 dnl
 dnl Check for ACL support and libraries
@@ -2392,41 +2497,131 @@ have_acl=no
 have_extended_acl=no
 if test x$support_acl = xyes -o x$support_acl = xauto; then
    AC_CHECK_HEADER(sys/acl.h, [ AC_DEFINE(HAVE_SYS_ACL_H,1,[Defines if your system have the sys/acl.h header file])] , )
 have_extended_acl=no
 if test x$support_acl = xyes -o x$support_acl = xauto; then
    AC_CHECK_HEADER(sys/acl.h, [ AC_DEFINE(HAVE_SYS_ACL_H,1,[Defines if your system have the sys/acl.h header file])] , )
+
+   dnl
+   dnl First check for acl_get_file in libc
+   dnl
    AC_CHECK_FUNC(acl_get_file,
       [
          have_acl=yes
    AC_CHECK_FUNC(acl_get_file,
       [
          have_acl=yes
-      ], [
-         AC_CHECK_LIB(acl, acl_get_file,
-            [
-                have_acl=yes;
-                FDLIBS="-lacl $FDLIBS"
-            ], [
-                AC_CHECK_LIB(pacl, acl_get_file,
-                   [
-                       have_acl=yes;
-                       FDLIBS="-lpacl $FDLIBS"
-                   ], [
-                       AC_CHECK_LIB(sec, acltotext,
-                          [
-                              have_acl=yes;
-                              FDLIBS="-lsec $FDLIBS"
-
-                              AC_CHECK_LIB(sec, acl_totext,
-                                 [
-                                     have_extended_acl=yes
-                                 ]
-                              )
-                          ]
-                       )
-                   ]
-                )
-            ]
-         )
       ]
    )
 
       ]
    )
 
+   dnl
+   dnl Check for acl_get_file in libacl (Linux)
+   dnl
+   if test $have_acl = no; then
+      AC_CHECK_LIB(acl, acl_get_file,
+        [
+            have_acl=yes
+            if test $have_afs = yes; then
+               dnl
+               dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!!
+               dnl
+               if test -d /usr/lib64/; then
+                  FDLIBS="-L/usr/lib64 -lacl $FDLIBS"
+               else
+                  FDLIBS="-L/usr/lib -lacl $FDLIBS"
+               fi
+            else
+               FDLIBS="-lacl $FDLIBS"
+            fi
+        ]
+      )
+   fi
+
+   dnl
+   dnl Check for acl_get_file in libpacl (OSF1)
+   dnl and if ACL_TYPE_DEFAULT_DIR is defined.
+   dnl
+   if test $have_acl = no -a \
+          x${HAVE_OSF1_OS_TRUE} = x; then
+      AC_CHECK_LIB(pacl, acl_get_file,
+        [
+            have_acl=yes
+            FDLIBS="-lpacl $FDLIBS"
+        ]
+      )
+
+      AC_MSG_CHECKING(for ACL_TYPE_DEFAULT_DIR in acl.h include file)
+      grep ACL_TYPE_DEFAULT_DIR /usr/include/sys/acl.h > /dev/null 2>&1
+      if test $? = 0; then
+        AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type])
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+      fi
+   fi
+
+   dnl
+   dnl On OSX check for availability of ACL_TYPE_EXTENDED
+   dnl
+   if test $have_acl = yes -a \
+          x${HAVE_DARWIN_OS_TRUE} = x; then
+      AC_MSG_CHECKING(for ACL_TYPE_EXTENDED in acl.h include file)
+      grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1
+      if test $? = 0; then
+        AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type])
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+      fi
+   fi
+
+   dnl
+   dnl On FreeBSD check for availability of ACL_TYPE_NFS4
+   dnl
+   if test $have_acl = yes -a \
+          x${HAVE_FREEBSD_OS_TRUE} = x; then
+      AC_MSG_CHECKING(for ACL_TYPE_NFS4 in acl.h include file)
+      grep ACL_TYPE_NFS4 /usr/include/sys/acl.h > /dev/null 2>&1
+      if test $? = 0; then
+        AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type])
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+      fi
+   fi
+
+   dnl
+   dnl Check for acltotext and acl_totext (Solaris)
+   dnl
+   if test $have_acl = no -a \
+          x${HAVE_SUN_OS_TRUE} = x; then
+      AC_CHECK_LIB(sec, acltotext,
+        [
+            have_acl=yes
+            FDLIBS="-lsec $FDLIBS"
+
+            AC_CHECK_LIB(sec, acl_totext,
+               [
+                   have_extended_acl=yes
+               ]
+            )
+        ]
+      )
+   fi
+
+   dnl
+   dnl Check for acl_get and aclx_get (AIX)
+   dnl
+   if test $have_acl = no -a \
+          x${HAVE_AIX_OS_TRUE} = x; then
+      AC_CHECK_FUNC(acl_get,
+        [
+            have_acl=yes
+
+            AC_CHECK_FUNC(aclx_get,
+               [
+                   have_extended_acl=yes
+               ]
+            )
+        ]
+      )
+   fi
+
    if test x$support_acl = xyes -a $have_acl != yes; then
    if test x$support_acl = xyes -a $have_acl != yes; then
-      AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found, 
+      AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found,
   please either load the acl libraries or rerun configure without --enable-acl])
    else
       if test $have_acl = yes; then
   please either load the acl libraries or rerun configure without --enable-acl])
    else
       if test $have_acl = yes; then
@@ -2458,83 +2653,111 @@ have_xattr=no
 if test x$support_xattr = xyes -o x$support_xattr = xauto; then
    dnl
    dnl First check for *BSD support
 if test x$support_xattr = xyes -o x$support_xattr = xauto; then
    dnl
    dnl First check for *BSD support
+   dnl When running on a BSD variant
    dnl
    dnl
-   AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , )
-   AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , )
-   AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link,
-      [
-         have_xattr=yes
-         AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the 'extattr_get_link' function.])
-         AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the 'extattr_set_link' function.])
-         AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the 'extattr_list_link' function.])
-      ]
-   )
-   
-   if test $have_xattr = no; then
-      AC_CHECK_FUNCS(extattr_get_file extattr_set_file extattr_list_file,
+   if test x${HAVE_FREEBSD_OS_TRUE} = x -o \
+          x${HAVE_NETBSD_OS_TRUE} = x -o \
+          x${HAVE_OPENBSD_OS_TRUE} = x; then
+      AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , )
+      AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , )
+      AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link,
         [
             have_xattr=yes
         [
             have_xattr=yes
-            AC_DEFINE([HAVE_EXTATTR_GET_FILE],1,[Define to 1 if you have the 'extattr_get_file' function.])
-            AC_DEFINE([HAVE_EXTATTR_SET_FILE],1,[Define to 1 if you have the 'extattr_set_file' function.])
-            AC_DEFINE([HAVE_EXTATTR_LIST_FILE],1,[Define to 1 if you have the 'extattr_list_file' function.])
-        ]
-      )
-   fi
-   
-   if test $have_xattr = yes; then
-      have_extattr_string_in_libc=no
-      AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace,
-        [
-            have_extattr_string_in_libc=yes
-            AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
-            AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
+            AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the 'extattr_get_link' function.])
+            AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the 'extattr_set_link' function.])
+            AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the 'extattr_list_link' function.])
         ]
       )
 
         ]
       )
 
-      dnl
-      dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil
-      dnl
-      if test $have_extattr_string_in_libc = no; then
-        AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace,
+      if test $have_xattr = no; then
+        AC_CHECK_FUNCS(extattr_get_file extattr_set_file extattr_list_file,
            [
            [
+               have_xattr=yes
+               AC_DEFINE([HAVE_EXTATTR_GET_FILE],1,[Define to 1 if you have the 'extattr_get_file' function.])
+               AC_DEFINE([HAVE_EXTATTR_SET_FILE],1,[Define to 1 if you have the 'extattr_set_file' function.])
+               AC_DEFINE([HAVE_EXTATTR_LIST_FILE],1,[Define to 1 if you have the 'extattr_list_file' function.])
+           ]
+        )
+      fi
+
+      if test $have_xattr = yes; then
+        have_extattr_string_in_libc=no
+        AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace,
+           [
+               have_extattr_string_in_libc=yes
                AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
                AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
                AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
                AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
-               FDLIBS="-lutil $FDLIBS"
            ]
         )
            ]
         )
+
+        dnl
+        dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil
+        dnl
+        if test $have_extattr_string_in_libc = no; then
+           AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace,
+              [
+                  AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the 'extattr_namespace_to_string' function.])
+                  AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the 'extattr_string_to_namespace' function.])
+                  FDLIBS="-lutil $FDLIBS"
+              ]
+           )
+        fi
       fi
    fi
 
    dnl
       fi
    fi
 
    dnl
-   dnl If we failed to find *BSD support try the Linux or OSX implementation of xattr
+   dnl If we failed to find *BSD support try the AIX implementation of extented attributes (EA)
+   dnl When running on AIX
    dnl
    dnl
-   if test $have_xattr = no; then
-      AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , )
-      AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr,
+   if test $have_xattr = no -a \
+          x${HAVE_AIX_OS_TRUE} = x; then
+      AC_CHECK_HEADER(sys/ea.h, [ AC_DEFINE(HAVE_SYS_EA_H,1,[Defines if your system have the sys/ea.h header file])] , )
+      AC_CHECK_FUNCS(llistea lgetea lsetea,
         [
             have_xattr=yes
         [
             have_xattr=yes
-            AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the 'llistxattr' function.])
-            AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the 'lgetxattr' function.])
-            AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the 'lsetxattr' function.])
+            AC_DEFINE([HAVE_LLISTEA],1,[Define to 1 if you have the 'llistea' function.])
+            AC_DEFINE([HAVE_LGETEA],1,[Define to 1 if you have the 'lgetea' function.])
+            AC_DEFINE([HAVE_LSETEA],1,[Define to 1 if you have the 'lsetea' function.])
         ]
       )
 
       if test $have_xattr = no; then
         ]
       )
 
       if test $have_xattr = no; then
-        AC_CHECK_FUNCS(listxattr getxattr setxattr,
+        AC_CHECK_FUNCS(listea getea setea,
            [
                have_xattr=yes
            [
                have_xattr=yes
-               AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the 'listxattr' function.])
-               AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the 'getxattr' function.])
-               AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the 'setxattr' function.])
+               AC_DEFINE([HAVE_LISTEA],1,[Define to 1 if you have the 'listea' function.])
+               AC_DEFINE([HAVE_GETEA],1,[Define to 1 if you have the 'getea' function.])
+               AC_DEFINE([HAVE_SETEA],1,[Define to 1 if you have the 'setea' function.])
            ]
         )
       fi
    fi
 
    dnl
            ]
         )
       fi
    fi
 
    dnl
-   dnl If we failed to find *BSD support and the Linux or OSX implementation of xattr try the Solaris xattr implementation
+   dnl If we failed to find AIX support try the TRU64 implementation of extented attributes
+   dnl when running on a TRU64 OS.
    dnl
    dnl
-   if test $have_xattr = no; then
+   if test $have_xattr = no -a \
+          x${HAVE_OSF1_OS_TRUE} = x; then
+      AC_CHECK_HEADER(sys/proplist.h, [ AC_DEFINE(HAVE_SYS_PROPLIST_H,1,[Defines if your system have the sys/proplist.h header file])] , )
+      AC_CHECK_FUNCS(getproplist get_proplist_entry sizeof_proplist_entry add_proplist_entry setproplist,
+        [
+            have_xattr=yes
+            AC_DEFINE([HAVE_GETPROPLIST],1,[Define to 1 if you have the 'getproplist' function.])
+            AC_DEFINE([HAVE_GET_PROPLIST_ENTRY],1,[Define to 1 if you have the 'get_proplist_entry' function.])
+            AC_DEFINE([HAVE_SIZEOF_PROPLIST_ENTRY],1,[Define to 1 if you have the 'sizeof_proplist_entry' function.])
+            AC_DEFINE([HAVE_ADD_PROPLIST_ENTRY],1,[Define to 1 if you have the 'add_proplist_entry' function.])
+            AC_DEFINE([HAVE_SETPROPLIST],1,[Define to 1 if you have the 'setproplist' function.])
+        ]
+      )
+   fi
+
+   dnl
+   dnl If we failed to find TRU64 support try the SOLARIS implementation of extented and extensible attributes
+   dnl when running on a Solaris.
+   dnl
+   if test $have_xattr = no -a \
+          x${HAVE_SUN_OS_TRUE} = x; then
       AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , )
       AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , )
       AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , )
       AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , )
       AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , )
       AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , )
@@ -2560,8 +2783,34 @@ if test x$support_xattr = xyes -o x$support_xattr = xauto; then
       fi
    fi
 
       fi
    fi
 
+   dnl
+   dnl If we failed to find Solaris support try the generic xattr support code
+   dnl
+   if test $have_xattr = no; then
+      AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , )
+      AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr,
+        [
+            have_xattr=yes
+            AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the 'llistxattr' function.])
+            AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the 'lgetxattr' function.])
+            AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the 'lsetxattr' function.])
+        ]
+      )
+
+      if test $have_xattr = no; then
+        AC_CHECK_FUNCS(listxattr getxattr setxattr,
+           [
+               have_xattr=yes
+               AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the 'listxattr' function.])
+               AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the 'getxattr' function.])
+               AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the 'setxattr' function.])
+           ]
+        )
+      fi
+   fi
+
    if test x$support_xattr = xyes -a $have_xattr != yes; then
    if test x$support_xattr = xyes -a $have_xattr != yes; then
-      AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found, 
+      AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found,
   please either load the xattr libraries or rerun configure without --enable-xattr])
    else
       if test $have_xattr = yes; then
   please either load the xattr libraries or rerun configure without --enable-xattr])
    else
       if test $have_xattr = yes; then
@@ -2610,7 +2859,6 @@ if test x$have_gcc = xyes ; then
    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
 fi
 LDFLAGS=${LDFLAGS--O}
    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti"
 fi
 LDFLAGS=${LDFLAGS--O}
-DB_LIBS="${SQL_LFLAGS}"
 CPPFLAGS="$CPPFLAGS"
 CFLAGS="$CFLAGS"
 AC_SUBST(DEBUG)
 CPPFLAGS="$CPPFLAGS"
 CFLAGS="$CFLAGS"
 AC_SUBST(DEBUG)
@@ -2622,7 +2870,6 @@ AC_SUBST(X_CFLAGS)
 AC_SUBST(DEFS)
 AC_SUBST(LIBS)
 AC_SUBST(DLIB)
 AC_SUBST(DEFS)
 AC_SUBST(LIBS)
 AC_SUBST(DLIB)
-AC_SUBST(DB_LIBS)
 AC_SUBST(X_LIBS)
 AC_SUBST(X_EXTRA_LIBS)
 AC_SUBST(WCFLAGS)
 AC_SUBST(X_LIBS)
 AC_SUBST(X_EXTRA_LIBS)
 AC_SUBST(WCFLAGS)
@@ -2646,18 +2893,8 @@ dnl
 dnl PFILES are platform specific files
 PFILES="platforms/Makefile"
 PSCMD="ps -e"
 dnl PFILES are platform specific files
 PFILES="platforms/Makefile"
 PSCMD="ps -e"
-WIN32=
 MACOSX=
 MACOSX=
-
-hostname=`uname -n | cut -d '.' -f 1`
-if test x${hostname} = x ; then
-   hostname="localhost"
-fi
-dnl Make sure hostname is resolved
-ping -c 1 $hostname 2>/dev/null 1>/dev/null
-if test ! $? = 0; then
-  hostname="localhost"
-fi
+COMPRESS_MANPAGES=yes
 
 case "$DISTNAME" in
 aix)
 
 case "$DISTNAME" in
 aix)
@@ -2665,8 +2902,8 @@ aix)
    PSCMD="ps -e -o pid,comm"
    PFILES="${PFILES} \
       platforms/aix/Makefile"
    PSCMD="ps -e -o pid,comm"
    PFILES="${PFILES} \
       platforms/aix/Makefile"
-   TAPEDRIVE="/dev/rmt0.1" 
-  ;;    
+   TAPEDRIVE="/dev/rmt0.1"
+  ;;   
 alpha)
    DISTVER=`uname -r`
    PTHREAD_LIB="-lpthread -lexc"
 alpha)
    DISTVER=`uname -r`
    PTHREAD_LIB="-lpthread -lexc"
@@ -2694,13 +2931,6 @@ bsdi)
        platforms/bsdi/bacula-dir"
    largefile_support="yes"
   ;;
        platforms/bsdi/bacula-dir"
    largefile_support="yes"
   ;;
-cygwin)
-   DISTVER=`uname -a |awk '{print $3}'`
-   TAPEDRIVE="/dev/nrst0"
-   WIN32=win32
-   WCFLAGS="-mwindows"
-   WLDFLAGS="-mwindows"
-  ;;
 darwin)
    DISTVER=`uname -r`
    TAPEDRIVE="/dev/nst0"
 darwin)
    DISTVER=`uname -r`
    TAPEDRIVE="/dev/nst0"
@@ -2742,7 +2972,7 @@ debian)
         platforms/ubuntu/bacula-fd \
         platforms/ubuntu/bacula-sd \
         platforms/ubuntu/bacula-dir"
         platforms/ubuntu/bacula-fd \
         platforms/ubuntu/bacula-sd \
         platforms/ubuntu/bacula-dir"
-   else 
+   else
       PFILES="${PFILES} \
         platforms/debian/Makefile \
         platforms/debian/bacula-fd \
       PFILES="${PFILES} \
         platforms/debian/Makefile \
         platforms/debian/bacula-fd \
@@ -2768,6 +2998,16 @@ freebsd)
        platforms/freebsd/bacula-dir"
    largefile_support="yes"
   ;;
        platforms/freebsd/bacula-dir"
    largefile_support="yes"
   ;;
+hurd)
+   DISTVER=`uname -r`
+   TAPEDRIVE="/dev/nst0"
+   PSCMD="ps -e -o pid,command"
+   PFILES="${PFILES} \
+       platforms/hurd/Makefile \
+       platforms/hurd/bacula-fd \
+       platforms/hurd/bacula-sd \
+       platforms/hurd/bacula-dir"
+  ;;
 hpux)
    PSCMD="UNIX95=1; ps -e -o pid,comm"
    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
 hpux)
    PSCMD="UNIX95=1; ps -e -o pid,comm"
    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE_EXTENDED=1"
@@ -2842,7 +3082,6 @@ mandrake)
        platforms/mandrake/bacula-fd \
        platforms/mandrake/bacula-sd \
        platforms/mandrake/bacula-dir \
        platforms/mandrake/bacula-fd \
        platforms/mandrake/bacula-sd \
        platforms/mandrake/bacula-dir \
-       platforms/mandrake/bacula.spec \
        "
   ;;
 gentoo)
        "
   ;;
 gentoo)
@@ -2876,10 +3115,19 @@ solaris)
        platforms/solaris/bacula-fd \
        platforms/solaris/bacula-sd \
        platforms/solaris/bacula-dir"
        platforms/solaris/bacula-fd \
        platforms/solaris/bacula-sd \
        platforms/solaris/bacula-dir"
-   if test x$DISTVER = x5.6 ; then
-       AC_DEFINE(HAVE_OLD_SOCKOPT)
-   fi
-   LIBS="$LIBS -lresolv"
+   COMPRESS_MANPAGES=
+   case ${DISTVER} in
+   5.5|5.6)
+      AC_DEFINE(HAVE_OLD_SOCKOPT)
+      AC_DEFINE(USE_THR_SETCONCURRENCY)
+      ;;
+   5.7|5.8)
+      AC_DEFINE(USE_THR_SETCONCURRENCY)
+      ;;
+   *)
+      ;;
+   esac
+   LIBS="$LIBS -lresolv -lrt"
   ;;
 suse)
    DISTVER=`cat /etc/SuSE-release |grep VERSION|\
   ;;
 suse)
    DISTVER=`cat /etc/SuSE-release |grep VERSION|\
@@ -2891,8 +3139,7 @@ suse)
        platforms/suse/bacula-fd \
        platforms/suse/bacula-sd \
        platforms/suse/bacula-dir \
        platforms/suse/bacula-fd \
        platforms/suse/bacula-sd \
        platforms/suse/bacula-dir \
-       platforms/suse/bacula \
-       platforms/suse/bacula.spec"
+       platforms/suse/bacula"
   ;;
 suse5)
    DISTNAME=suse
   ;;
 suse5)
    DISTNAME=suse
@@ -2912,7 +3159,41 @@ unknown)
 *)
   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
   ;;
 *)
   echo " === Something went wrong. Unknown DISTNAME $DISTNAME ==="
   ;;
-esac  
+esac
+
+dnl -------------------------------------------
+dnl systemd (default off)
+dnl -------------------------------------------
+AC_MSG_CHECKING(for systemd support)
+AC_ARG_WITH(systemd,
+   AC_HELP_STRING([--with-systemd@<:@=UNITDIR@:>@], [Include systemd support. UNITDIR is where systemd system .service files are located, default is to ask systemctl.]),
+   [
+       if test "$withval" != "no"; then
+          if test "$withval" = "yes"; then
+              SYSTEMD_UNITDIR="`systemctl show | grep UnitPath | cut -d " " -f2`"
+          else
+              SYSTEMD_UNITDIR="${withval}"
+          fi
+
+          PFILES="${PFILES} \
+                  platforms/systemd/Makefile \
+                  platforms/systemd/bacula.conf \
+                  platforms/systemd/bacula-dir.service \
+                  platforms/systemd/bacula-fd.service \
+                  platforms/systemd/bacula-sd.service"
+          AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd support should be enabled])
+          AC_MSG_RESULT(yes)
+          support_systemd="yes"
+       else
+          AC_MSG_RESULT(no)
+          support_systemd="no"
+       fi
+   ],[
+       support_systemd="no"
+       AC_MSG_RESULT(no)
+   ]
+)
+AC_SUBST(SYSTEMD_UNITDIR)
 
 AC_SUBST(hostname)
 
 
 AC_SUBST(hostname)
 
@@ -2922,10 +3203,10 @@ AC_DEFINE_UNQUOTED(lld, "$lld")
 AC_DEFINE_UNQUOTED(llu, "$llu")
 AC_SUBST(TAPEDRIVE)
 AC_SUBST(PSCMD)
 AC_DEFINE_UNQUOTED(llu, "$llu")
 AC_SUBST(TAPEDRIVE)
 AC_SUBST(PSCMD)
-AC_SUBST(WIN32)
 AC_SUBST(MACOSX)
 AC_SUBST(DISTNAME)
 AC_SUBST(DISTVER)
 AC_SUBST(MACOSX)
 AC_SUBST(DISTNAME)
 AC_SUBST(DISTVER)
+AC_SUBST(COMPRESS_MANPAGES)
 
 dnl common parts of the Makefile
 MCOMMON=./autoconf/Make.common
 
 dnl common parts of the Makefile
 MCOMMON=./autoconf/Make.common
@@ -2943,18 +3224,13 @@ if test "x${subsysdir}" = "x${sbindir}" ; then
    echo " "
    echo " "
    exit 1
    echo " "
    echo " "
    exit 1
-fi 
+fi
 
 AC_OUTPUT([autoconf/Make.common \
           Makefile \
           manpages/Makefile \
 
 AC_OUTPUT([autoconf/Make.common \
           Makefile \
           manpages/Makefile \
-          scripts/startmysql \
-          scripts/stopmysql \
           scripts/btraceback \
           scripts/btraceback \
-          scripts/startit \
-          scripts/stopit \
           scripts/bconsole \
           scripts/bconsole \
-          scripts/gconsole \
           scripts/bacula \
           scripts/bacula-ctl-dir \
           scripts/bacula-ctl-fd \
           scripts/bacula \
           scripts/bacula-ctl-dir \
           scripts/bacula-ctl-fd \
@@ -2962,23 +3238,12 @@ AC_OUTPUT([autoconf/Make.common \
           scripts/devel_bacula \
           scripts/Makefile \
           scripts/logrotate \
           scripts/devel_bacula \
           scripts/Makefile \
           scripts/logrotate \
-          scripts/bacula.desktop.gnome1 \
-          scripts/bacula.desktop.gnome2 \
-          scripts/bacula.desktop.gnome1.consolehelper \
-          scripts/bacula.desktop.gnome2.consolehelper \
-          scripts/bacula.desktop.gnome1.xsu \
-          scripts/bacula.desktop.gnome2.xsu \
-          scripts/bgnome-console.console_apps \
           scripts/mtx-changer \
           scripts/disk-changer \
           scripts/dvd-handler \
           scripts/dvd-simulator \
           scripts/mtx-changer \
           scripts/disk-changer \
           scripts/dvd-handler \
           scripts/dvd-simulator \
-          scripts/bacula-tray-monitor.desktop \
           scripts/logwatch/Makefile \
           scripts/logwatch/logfile.bacula.conf \
           scripts/logwatch/Makefile \
           scripts/logwatch/logfile.bacula.conf \
-          scripts/wxconsole.console_apps \
-          scripts/wxconsole.desktop.consolehelper \
-          scripts/wxconsole.desktop.xsu \
           scripts/bat.desktop \
           scripts/bat.desktop.xsu \
           scripts/bat.desktop.consolehelper \
           scripts/bat.desktop \
           scripts/bat.desktop.xsu \
           scripts/bat.desktop.consolehelper \
@@ -2991,10 +3256,6 @@ AC_OUTPUT([autoconf/Make.common \
           src/qt-console/bat.pro \
           src/qt-console/bat.pro.mingw32 \
           src/qt-console/install_conf_file \
           src/qt-console/bat.pro \
           src/qt-console/bat.pro.mingw32 \
           src/qt-console/install_conf_file \
-          src/wx-console/Makefile \
-          src/wx-console/bwx-console.conf \
-          src/tray-monitor/Makefile \
-          src/tray-monitor/tray-monitor.conf \
           src/dird/Makefile \
           src/dird/bacula-dir.conf \
           src/lib/Makefile \
           src/dird/Makefile \
           src/dird/bacula-dir.conf \
           src/lib/Makefile \
@@ -3003,7 +3264,7 @@ AC_OUTPUT([autoconf/Make.common \
           src/filed/Makefile \
           src/filed/bacula-fd.conf \
           src/cats/Makefile \
           src/filed/Makefile \
           src/filed/bacula-fd.conf \
           src/cats/Makefile \
-           src/cats/make_catalog_backup.pl \
+          src/cats/make_catalog_backup.pl \
           src/cats/make_catalog_backup \
           src/cats/delete_catalog_backup \
           src/cats/create_postgresql_database \
           src/cats/make_catalog_backup \
           src/cats/delete_catalog_backup \
           src/cats/create_postgresql_database \
@@ -3024,32 +3285,20 @@ AC_OUTPUT([autoconf/Make.common \
           src/cats/grant_sqlite3_privileges \
           src/cats/drop_sqlite3_tables \
           src/cats/drop_sqlite3_database \
           src/cats/grant_sqlite3_privileges \
           src/cats/drop_sqlite3_tables \
           src/cats/drop_sqlite3_database \
-          src/cats/create_ingres_database \
-          src/cats/update_ingres_tables \
-          src/cats/make_ingres_tables \
-          src/cats/grant_ingres_privileges \
-          src/cats/drop_ingres_tables \
-          src/cats/drop_ingres_database \
           src/cats/sqlite \
           src/cats/mysql \
           src/cats/sqlite \
           src/cats/mysql \
-          src/cats/create_bdb_database \
-          src/cats/update_bdb_tables \
-          src/cats/make_bdb_tables \
-          src/cats/grant_bdb_privileges \
-          src/cats/drop_bdb_tables \
-          src/cats/drop_bdb_database \
           src/cats/create_bacula_database \
           src/cats/update_bacula_tables \
           src/cats/grant_bacula_privileges \
           src/cats/make_bacula_tables \
           src/cats/drop_bacula_tables \
           src/cats/drop_bacula_database \
           src/cats/create_bacula_database \
           src/cats/update_bacula_tables \
           src/cats/grant_bacula_privileges \
           src/cats/make_bacula_tables \
           src/cats/drop_bacula_tables \
           src/cats/drop_bacula_database \
+          src/cats/install-default-backend \
           src/findlib/Makefile \
           src/tools/Makefile \
           src/plugins/fd/Makefile \
           src/plugins/sd/Makefile \
           src/plugins/dir/Makefile \
           src/findlib/Makefile \
           src/tools/Makefile \
           src/plugins/fd/Makefile \
           src/plugins/sd/Makefile \
           src/plugins/dir/Makefile \
-          src/win32/Makefile.inc \
           po/Makefile.in \
           updatedb/update_mysql_tables_9_to_10 \
           updatedb/update_sqlite3_tables_9_to_10 \
           po/Makefile.in \
           updatedb/update_mysql_tables_9_to_10 \
           updatedb/update_sqlite3_tables_9_to_10 \
@@ -3057,27 +3306,37 @@ AC_OUTPUT([autoconf/Make.common \
           updatedb/update_mysql_tables_10_to_11 \
           updatedb/update_sqlite3_tables_10_to_11 \
           updatedb/update_postgresql_tables_10_to_11 \
           updatedb/update_mysql_tables_10_to_11 \
           updatedb/update_sqlite3_tables_10_to_11 \
           updatedb/update_postgresql_tables_10_to_11 \
+          updatedb/update_mysql_tables_11_to_12 \
+          updatedb/update_sqlite3_tables_11_to_12 \
+          updatedb/update_postgresql_tables_11_to_12 \
+          updatedb/update_mysql_tables_12_to_14 \
+          updatedb/update_sqlite3_tables_12_to_14 \
+          updatedb/update_postgresql_tables_12_to_14 \
           examples/nagios/check_bacula/Makefile \
           examples/nagios/check_bacula/Makefile \
-          $PFILES ],  
+          platforms/rpms/redhat/bacula.spec \
+          platforms/rpms/redhat/bacula-bat.spec \
+          platforms/rpms/redhat/bacula-docs.spec \
+          platforms/rpms/redhat/bacula-mtx.spec \
+          platforms/rpms/suse/bacula.spec \
+          platforms/rpms/suse/bacula-bat.spec \
+          platforms/rpms/suse/bacula-docs.spec \
+          platforms/rpms/suse/bacula-mtx.spec \
+          $PFILES ],
      [ ]
 )
 
 if test "${support_bat}" = "yes" ; then
      [ ]
 )
 
 if test "${support_bat}" = "yes" ; then
-   if test "x$QMAKE" = "xnone" && test "x$QMAKEQT4" = "xnone"; then
-      AC_MSG_ERROR([Could not find qmake or qmake-qt4 in $PATH. Check your Qt installation])
+   if test "x$QMAKE" = "xnone"; then
+      AC_MSG_ERROR([Could not find qmake $PATH. Check your Qt installation])
    fi
 
    fi
 
-   QMAKEBIN="qmake"
-
-   if test "x$QMAKEQT4" != "xnone"; then
-       QMAKEBIN=qmake-qt4
-   fi
-  
    cd src/qt-console
    echo "Creating bat Makefile"
    touch bat
    chmod 755 bat
    cd src/qt-console
    echo "Creating bat Makefile"
    touch bat
    chmod 755 bat
-   $QMAKEBIN
+   rm -f Makefile
+   rm -rf moc32 obj32
+   $QMAKE
    ${MAKE:-make} clean
    cd ${BUILD_DIR}
 fi
    ${MAKE:-make} clean
    cd ${BUILD_DIR}
 fi
@@ -3096,23 +3355,23 @@ chmod 755 install_conf_file build-depkgs-qt-console
 cd ${BUILD_DIR}
 
 cd scripts
 cd ${BUILD_DIR}
 
 cd scripts
-chmod 755 startmysql stopmysql bacula startit stopit btraceback mtx-changer
+chmod 755 bacula btraceback mtx-changer storage-ctl bsg_persist
 chmod 755 dvd-handler dvd-simulator
 chmod 755 dvd-handler dvd-simulator
-chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
+chmod 755 bconsole disk-changer devel_bacula logrotate
 cd ..
 
 c=updatedb
 chmod 755 $c/update_mysql_tables_10_to_11   $c/update_sqlite3_tables_10_to_11
 chmod 755 $c/update_postgresql_tables_10_to_11
 cd ..
 
 c=updatedb
 chmod 755 $c/update_mysql_tables_10_to_11   $c/update_sqlite3_tables_10_to_11
 chmod 755 $c/update_postgresql_tables_10_to_11
+chmod 755 $c/update_mysql_tables_11_to_12   $c/update_sqlite3_tables_11_to_12
+chmod 755 $c/update_postgresql_tables_11_to_12
+
 
 c=src/cats
 
 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
 
 
 c=src/cats
 
 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
 chmod 755 $c/grant_bacula_privileges  $c/drop_bacula_tables    $c/drop_bacula_database
 
-chmod 755 $c/create_bdb_database      $c/update_bdb_tables     $c/make_bdb_tables
-chmod 755 $c/grant_bdb_privileges     $c/drop_bdb_tables       $c/drop_bdb_database
-
 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
 
 chmod 755 $c/create_mysql_database    $c/update_mysql_tables   $c/make_mysql_tables
 chmod 755 $c/grant_mysql_privileges   $c/drop_mysql_tables     $c/drop_mysql_database
 
@@ -3122,15 +3381,15 @@ chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables    $c/drop_sqlite3_d
 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
 
 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
 
-chmod 755 $c/create_ingres_database  $c/update_ingres_tables $c/make_ingres_tables
-chmod 755 $c/grant_ingres_privileges $c/drop_ingres_tables   $c/drop_ingres_database
+#chmod 755 $c/create_ingres_database  $c/update_ingres_tables $c/make_ingres_tables
+#chmod 755 $c/grant_ingres_privileges $c/drop_ingres_tables   $c/drop_ingres_database
 
 
 
 
-chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  make_catalog_backup.pl
+chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
 chmod 755 $c/sqlite
 chmod 755 $c/mysql
 
 chmod 755 $c/sqlite
 chmod 755 $c/mysql
 
-chmod 755 src/win32/build-depkgs-mingw32
+chmod 755 $c/install-default-backend
 
 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
    largefile_support="yes"
 
 if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
    largefile_support="yes"
@@ -3158,19 +3417,6 @@ echo "Cleaning up"
 echo " "
 ${MAKE:-make} clean
 
 echo " "
 ${MAKE:-make} clean
 
-if test "x${db_type}" = "xInternal" ; then
-   echo " "
-   echo " "
-   echo "You have not specified either --enable-client-only or one of the"
-   echo "  supported databases: MySQL, PostgreSQL, Ingres, SQLite3 or DBI."
-   echo "  This is not permitted. Please reconfigure."
-   echo " "
-   echo "Aborting the configuration ..."
-   echo " "
-   echo " "
-   exit 1
-fi
-
 echo "
 Configuration on `date`:
 
 echo "
 Configuration on `date`:
 
@@ -3190,7 +3436,7 @@ Configuration on `date`:
    Plugin directory:       ${plugindir}
    C Compiler:             ${CC} ${CCVERSION}
    C++ Compiler:           ${CXX} ${CXXVERSION}
    Plugin directory:       ${plugindir}
    C Compiler:             ${CC} ${CCVERSION}
    C++ Compiler:           ${CXX} ${CXXVERSION}
-   Compiler flags:         ${WCFLAGS} ${CFLAGS} 
+   Compiler flags:         ${WCFLAGS} ${CFLAGS}
    Linker flags:           ${WLDFLAGS} ${LDFLAGS}
    Libraries:              ${LIBS}
    Statically Linked Tools: ${support_static_tools}
    Linker flags:           ${WLDFLAGS} ${LDFLAGS}
    Libraries:              ${LIBS}
    Statically Linked Tools: ${support_static_tools}
@@ -3198,50 +3444,46 @@ Configuration on `date`:
    Statically Linked SD:    ${support_static_sd}
    Statically Linked DIR:   ${support_static_dir}
    Statically Linked CONS:  ${support_static_cons}
    Statically Linked SD:    ${support_static_sd}
    Statically Linked DIR:   ${support_static_dir}
    Statically Linked CONS:  ${support_static_cons}
-   Database type:          ${db_type}
+   Database backends:      ${db_backends}
    Database port:          ${db_port}
    Database port:          ${db_port}
-   Database lib:           ${DB_LIBS}
    Database name:          ${db_name}
    Database user:          ${db_user}
    Database name:          ${db_name}
    Database user:          ${db_user}
+
    Job Output Email:       ${job_email}
    Traceback Email:        ${dump_email}
    SMTP Host Address:      ${smtp_host}
    Job Output Email:       ${job_email}
    Traceback Email:        ${dump_email}
    SMTP Host Address:      ${smtp_host}
+
    Director Port:          ${dir_port}
    File daemon Port:       ${fd_port}
    Storage daemon Port:     ${sd_port}
    Director Port:          ${dir_port}
    File daemon Port:       ${fd_port}
    Storage daemon Port:     ${sd_port}
+
    Director User:          ${dir_user}
    Director Group:         ${dir_group}
    Storage Daemon User:     ${sd_user}
    Storage DaemonGroup:     ${sd_group}
    File Daemon User:       ${fd_user}
    File Daemon Group:      ${fd_group}
    Director User:          ${dir_user}
    Director Group:         ${dir_group}
    Storage Daemon User:     ${sd_user}
    Storage DaemonGroup:     ${sd_group}
    File Daemon User:       ${fd_user}
    File Daemon Group:      ${fd_group}
-   SQL binaries Directory   ${SQL_BINDIR}
+
    Large file support:     $largefile_support
    Bacula conio support:    ${got_conio} ${CONS_LIBS}
    readline support:       ${got_readline} ${PRTREADLINE_SRC}
    TCP Wrappers support:    ${TCPW_MSG} ${WRAPLIBS}
    TLS support:            ${support_tls}
    Large file support:     $largefile_support
    Bacula conio support:    ${got_conio} ${CONS_LIBS}
    readline support:       ${got_readline} ${PRTREADLINE_SRC}
    TCP Wrappers support:    ${TCPW_MSG} ${WRAPLIBS}
    TLS support:            ${support_tls}
-   Encryption support:     ${support_crypto} 
+   Encryption support:     ${support_crypto}
    ZLIB support:           ${have_zlib}
    ZLIB support:           ${have_zlib}
-   enable-smartalloc:      ${support_smartalloc} 
+   LZO support:            ${have_lzo}
+   enable-smartalloc:      ${support_smartalloc}
    enable-lockmgr:         ${support_lockmgr}
    bat support:            ${support_bat}
    enable-lockmgr:         ${support_lockmgr}
    bat support:            ${support_bat}
-   enable-gnome:           ${support_gnome} ${gnome_version}
-   enable-bwx-console:     ${support_wx_console} ${wx_version}
-   enable-tray-monitor:     ${support_tray_monitor}
    client-only:            ${build_client_only}
    build-dird:             ${build_dird}
    build-stored:           ${build_stored}
    Plugin support:         ${have_plugins}
    client-only:            ${build_client_only}
    build-dird:             ${build_dird}
    build-stored:           ${build_stored}
    Plugin support:         ${have_plugins}
+   AFS support:            ${have_afs}
    ACL support:            ${have_acl}
    XATTR support:          ${have_xattr}
    ACL support:            ${have_acl}
    XATTR support:          ${have_xattr}
-   Python support:         ${support_python} ${PYTHON_LIBS}
-   Batch insert enabled:    ${support_batch_insert}
+   systemd support:        ${support_systemd} ${SYSTEMD_UNITDIR}
+   Batch insert enabled:    ${batch_insert_db_backends}
 
   " > config.out
 
 
   " > config.out
 
@@ -3257,13 +3499,3 @@ echo __EOC__ >> scripts/bacula_config
 chmod 755 scripts/bacula_config
 
 cat config.out
 chmod 755 scripts/bacula_config
 
 cat config.out
-
-# Display a warning message if postgresql client lib is <= 8.1
-if test x$DB_TYPE = xpostgresql -a x$ac_cv_lib_pq_PQisthreadsafe != xyes \
-       -a x$support_batch_insert = xyes
-then
-       echo "WARNING: Your PostgreSQL client library is too old to detect "
-       echo " if it was compiled with --enable-thread-safety, consider to"
-       echo " upgrade it in order to avoid problems with Batch insert mode"
-       echo
-fi