]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/autoconf/configure.in
Fix bug #1870 GNU binutils-gold build failure.
[bacula/bacula] / bacula / autoconf / configure.in
index 7980e73d2469328f8388fe89fec4767c4e409b6d..9fd2f3975583993286f7261fc5de618babc08974 100644 (file)
@@ -178,6 +178,7 @@ AC_ARG_ENABLE(libtool,
    ]
 )
 LT_INIT([shared disable-static])
+LT_LIB_DLLOAD
 LT_LANG([C++])
 
 if test x$use_libtool != xno; then
@@ -1264,6 +1265,11 @@ 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
 AC_ARG_WITH(hostname,
    AC_HELP_STRING([--with-hostname=RESNAME], [specify host name for daemons]),
    [
@@ -1860,6 +1866,7 @@ AC_CHECK_HEADERS( \
    stdarg.h \
    stdlib.h \
    stdint.h \
+   inttypes.h \
    string.h \
    strings.h \
    termios.h \
@@ -2342,6 +2349,14 @@ AC_CHECK_FUNCS( \
    [echo 'configure: cannot find needed function.'; exit 1]
 )
 
+AC_CHECK_DECL(
+    F_CLOSEM,
+    AC_DEFINE(HAVE_FCNTL_F_CLOSEM),
+    ,
+    [#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])])
 
@@ -2410,6 +2425,58 @@ 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
 
+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
@@ -2435,14 +2502,19 @@ AC_SUBST(ZLIBS)
 dnl
 dnl Check for lzo
 dnl
-AC_CHECK_HEADERS(lzo/lzoconf.h)
-AC_CHECK_HEADERS(lzo/lzo1x.h)
-AC_CHECK_LIB(lzo2, lzo1x_1_compress, [LZOLIBS="-llzo2"])
 have_lzo=no
-if test x$LZOLIBS = x-llzo2; then
-   AC_DEFINE(HAVE_LZO)
-   have_lzo=yes
-fi
+AC_CHECK_HEADER(lzo/lzoconf.h, 
+[
+   AC_CHECK_HEADER(lzo/lzo1x.h,
+   [
+      AC_CHECK_LIB(lzo2, lzo1x_1_compress,
+      [
+        LZOLIBS="-llzo2"
+        AC_DEFINE(HAVE_LZO,1,[Define to 1 if you have LZO compression])
+        have_lzo=yes
+      ])
+   ])
+])
 AC_SUBST(LZOLIBS)
 
 dnl
@@ -2853,16 +2925,6 @@ WIN32=
 MACOSX=
 COMPRESS_MANPAGES=yes
 
-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
-
 case "$DISTNAME" in
 aix)
    DISTVER=`uname -r`
@@ -3125,6 +3187,39 @@ unknown)
   ;;
 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-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)
 
 LIBS="$PTHREAD_LIB $LIBS"
@@ -3261,6 +3356,10 @@ AC_OUTPUT([autoconf/Make.common \
           updatedb/update_sqlite3_tables_12_to_14 \
           updatedb/update_postgresql_tables_12_to_14 \
           examples/nagios/check_bacula/Makefile \
+          platforms/rpms/redhat/bacula.spec \
+          platforms/rpms/redhat/bacula-bat.spec \
+          platforms/rpms/redhat/bacula-docs.spec \
+          platforms/rpms/redhat/bacula-mtx.spec \
           $PFILES ],  
      [ ]
 )
@@ -3426,6 +3525,7 @@ Configuration on `date`:
    ACL support:             ${have_acl}
    XATTR support:           ${have_xattr}
    Python support:          ${support_python} ${PYTHON_LIBS}
+   systemd support:         ${support_systemd} ${SYSTEMD_UNITDIR}
    Batch insert enabled:     ${batch_insert_db_backends}
 
   " > config.out