TODO: tests: add test for bug #1283103 -- selinux mount vs security xattrs
[obnox/glusterfs.git] / configure.ac
index c16695e735f0e662887f036a944e4e405b8bf9eb..a345b88078bf263e3f08553255a7caef71d6f338 100644 (file)
@@ -13,7 +13,7 @@ AC_INIT([glusterfs],
 AC_SUBST([PACKAGE_RELEASE],
          [m4_esyscmd([build-aux/pkg-version --release])])
 
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE(tar-pax)
 
 # Removes warnings when using automake 1.14 around (...but option 'subdir-objects' is disabled )
 #but libglusterfs fails to build with contrib (Then are not set up that way?)
@@ -128,6 +128,7 @@ AC_CONFIG_FILES([Makefile
                 xlators/features/glupy/src/Makefile
                 xlators/features/glupy/src/setup.py
                 xlators/features/glupy/src/__init__.py
+                xlators/features/glupy/src/glupy/Makefile
                 xlators/features/locks/Makefile
                 xlators/features/locks/src/Makefile
                 xlators/features/quota/Makefile
@@ -185,6 +186,7 @@ AC_CONFIG_FILES([Makefile
                 xlators/mgmt/Makefile
                 xlators/mgmt/glusterd/Makefile
                 xlators/mgmt/glusterd/src/Makefile
+                xlators/experimental/Makefile
                 cli/Makefile
                 cli/src/Makefile
                 doc/Makefile
@@ -210,6 +212,7 @@ AC_CONFIG_FILES([Makefile
                 extras/ocf/volume
                 extras/LinuxRPM/Makefile
                 extras/geo-rep/Makefile
+                extras/firewalld/Makefile
                 extras/hook-scripts/add-brick/Makefile
                 extras/hook-scripts/add-brick/pre/Makefile
                 extras/hook-scripts/add-brick/post/Makefile
@@ -386,15 +389,12 @@ AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sy
 
 AC_CHECK_HEADERS([sys/extattr.h])
 
+AC_CHECK_HEADERS([openssl/dh.h])
+
+AC_CHECK_HEADERS([openssl/ecdh.h])
+
 dnl Math library
-case $host_os in
-     linux*)
-        MATH_LIB=''
-        ;;
-     *)
-        MATH_LIB='-lm'
-        ;;
-esac
+AC_CHECK_LIB([m], [pow], [MATH_LIB='-lm'], [MATH_LIB=''])
 AC_SUBST(MATH_LIB)
 
 dnl use libuuid.so or fall-back to contrib/uuid
@@ -405,6 +405,16 @@ PKG_CHECK_MODULES([UUID], [uuid],
         [HAVE_LIBUUID=no
          UUID_CFLAGS='-I$(CONTRIBDIR)/uuid'])
 AM_CONDITIONAL([HAVE_LIBUUID], [test x$HAVE_LIBUUID = xyes])
+
+dnl older version of libuuid (from e2fsprogs) require including uuid/uuid.h
+saved_CFLAGS=${CFLAGS}
+CFLAGS="${CFLAGS} ${UUID_CFLAGS}"
+AC_CHECK_HEADER([uuid.h], [], [AC_CHECK_HEADER([uuid/uuid.h])])
+CFLAGS=${saved_CFLAGS}
+if test "x$ac_cv_header_uuid_uuid_h" = "xyes"; then
+    UUID_CFLAGS="${UUID_CFLAGS} -I$(pkg-config --variable=includedir uuid)/uuid"
+fi
+
 dnl libglusterfs needs uuid.h, practically everything depends on it
 GF_CPPFLAGS="${GF_CPPFLAGS} ${UUID_CFLAGS}"
 dnl PKGCONFIG_UUID is used for the dependency in *.pc.in files
@@ -412,8 +422,8 @@ AC_SUBST(PKGCONFIG_UUID)
 
 dnl NetBSD does not support POSIX ACLs :-(
 case $host_os in
-     *netbsd*)
-        AC_MSG_WARN([NetBSD does not support POSIX ACLs... disabling them])
+     *netbsd* | darwin*)
+        AC_MSG_WARN([platform does not support POSIX ACLs... disabling them])
         ACL_LIBS=''
         USE_POSIX_ACLS='0'
         BUILD_POSIX_ACLS='no'
@@ -529,6 +539,11 @@ fi
 
 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
 
+dnl check for old openssl
+AC_CHECK_LIB([crypto], CRYPTO_THREADID_set_callback, [AC_DEFINE([HAVE_CRYPTO_THREADID], [1], [use new OpenSSL functions])])
+
+AC_CHECK_LIB([ssl], TLSv1_2_method, [AC_DEFINE([HAVE_TLSV1_2_METHOD], [1], [use new OpenSSL functions])])
+
 # start encryption/crypt section
 
 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
@@ -704,6 +719,7 @@ if test "x$enable_georeplication" != "xno"; then
   GEOREP_EXTRAS_SUBDIR=geo-rep
 fi
 AC_SUBST(GEOREP_EXTRAS_SUBDIR)
+AM_CONDITIONAL(USE_GEOREP, test "x$enable_georeplication" != "xno")
 
 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
 BUILD_CDC=yes
@@ -721,57 +737,49 @@ AC_SUBST(ZLIB_CFLAGS)
 AC_SUBST(ZLIB_LIBS)
 # end CDC xlator secion
 
+#start firewalld section
+BUILD_FIREWALLD="no"
+AC_ARG_ENABLE([firewalld],
+              AC_HELP_STRING([--enable-firewalld],
+                             [enable installation configuration for firewalld]),
+              [BUILD_FIREWALLD="${enableval}"], [BUILD_FIREWALLD="no"])
+
+if test "x${BUILD_FIREWALLD}" = "xyes"; then
+        if !(which firewalld 1>/dev/null 2>&1) ; then
+                BUILD_FIREWALLD="no (firewalld not installed)"
+        fi
+fi
+AM_CONDITIONAL([USE_FIREWALLD],test ["x${BUILD_FIREWALLD}" =  "xyes"])
+
+#endof firewald section
+
 # Data tiering requires sqlite
 AC_ARG_ENABLE([tiering],
                AC_HELP_STRING([--disable-tiering],
                              [Disable data classification/tiering]),
               [BUILD_GFDB="${enableval}"], [BUILD_GFDB="yes"])
 
-if test "x${BUILD_GFDB}" = "xyes"; then
-  PKG_CHECK_MODULES([SQLITE], [sqlite3],
-                    AC_DEFINE(USE_GFDB, 1),
-                    AC_MSG_ERROR([pass --disable-tiering to build without sqlite]))
-else
-  AC_DEFINE(USE_GFDB, 0, [no sqlite, gfdb is disabled])
-fi
+case $host_os in
+  darwin*)
+    SQLITE_LIBS="-lsqlite3"
+    AC_CHECK_HEADERS([sqlite3.h], AC_DEFINE(USE_GFDB, 1))
+    ;;
+  *)
+    if test "x${BUILD_GFDB}" = "xyes"; then
+      PKG_CHECK_MODULES([SQLITE], [sqlite3],
+                        AC_DEFINE(USE_GFDB, 1),
+                        AC_MSG_ERROR([pass --disable-tiering to build without sqlite]))
+    else
+      AC_DEFINE(USE_GFDB, 0, [no sqlite, gfdb is disabled])
+    fi
+    ;;
+esac
 
 AC_SUBST(SQLITE_CFLAGS)
 AC_SUBST(SQLITE_LIBS)
 AM_CONDITIONAL(BUILD_GFDB, test "x${BUILD_GFDB}" = "xyes")
 AM_CONDITIONAL(USE_GFDB, test "x${BUILD_GFDB}" = "xyes")
 
-# check for systemtap/dtrace
-BUILD_SYSTEMTAP=no
-AC_MSG_CHECKING([whether to include systemtap tracing support])
-AC_ARG_ENABLE([systemtap],
-              [AS_HELP_STRING([--enable-systemtap],
-              [Enable inclusion of systemtap trace support])],
-              [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
-
-AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
-AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
-
-if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
-    AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
-    AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
-                    [SDT_H_FOUND="no"])
-fi
-
-if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
-    if test "x${DTRACE}" = "xno"; then
-        AC_MSG_ERROR([dtrace not found])
-    elif test "$x{SDT_H_FOUND}" = "xno"; then
-        AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
-    fi
-fi
-
-if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
-    AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
-    AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using  probes.])
-    BUILD_SYSTEMTAP=yes
-fi
-# end of systemtap/dtrace
-
 # xml-output
 AC_ARG_ENABLE([xml-output],
               AC_HELP_STRING([--disable-xml-output],
@@ -807,11 +815,8 @@ AC_SUBST(HAVE_BACKTRACE)
 
 if test "x${have_backtrace}" != "xyes"; then
 AC_TRY_COMPILE([#include <math.h>], [double x=0.0; x=ceil(0.0);],
-   [have_math_h=yes],
+   [],
    AC_MSG_ERROR([need math library for libexecinfo]))
-if test "x${have_math_h}" = "xyes"; then
-   LIBS="$LIBS -lm"
-fi
 fi
 
 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
@@ -859,6 +864,17 @@ AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
 AC_SUBST(ARGP_STANDALONE_LDADD)
 AC_SUBST(ARGP_STANDALONE_DIR)
 
+# Check for atomic operation support
+echo -n "checking for atomic operation support... "
+AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { long int a = 4; __sync_fetch_and_add_8 (&a, 1); }]])],
+                   [have_sync_fetch_and_add_8=yes], [have_sync_fetch_and_add_8=no])
+if test "x${have_sync_fetch_and_add_8}" = "xyes"; then
+  echo "yes"
+  AC_DEFINE(HAVE_ATOMIC_BUILTINS, 1, [have atomic builtins])
+else
+  echo "no"
+fi
+
 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
 
 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
@@ -904,26 +920,29 @@ GF_HOST_OS=""
 GF_LDFLAGS="-rdynamic"
 
 dnl check for gcc -Werror=format-security
-saved_GF_CFLAGS="-Wformat -Werror=format-security"
+saved_CFLAGS=$CFLAGS
+CFLAGS="-Wformat -Werror=format-security"
 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
 echo $cc_werror_format_security
 if test "x$cc_werror_format_security" = "xno"; then
-    GF_CFLAGS="$GF_CFLAGS"
+    CFLAGS="$saved_CFLAGS"
 else
-    GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
+    CFLAGS="$saved_CFLAGS $CFLAGS"
+    GF_CFLAGS="$GF_CFLAGS $CFLAGS"
 fi
 
 dnl check for gcc -Werror=implicit-function-declaration
-saved_GF_CFLAGS=$GF_CFLAGS
-GF_CFLAGS="-Werror=implicit-function-declaration"
+saved_CFLAGS=$CFLAGS
+CFLAGS="-Werror=implicit-function-declaration"
 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
 echo $cc_werror_implicit
 if test "x$cc_werror_implicit" = "xno"; then
-    GF_CFLAGS="$saved_GF_CFLAGS"
+    CFLAGS="$saved_CFLAGS"
 else
-    GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
+    CFLAGS="$saved_CFLAGS $CFLAGS"
+    GF_CFLAGS="$GF_CFLAGS $CFLAGS"
 fi
 
 dnl clang is mostly GCC-compatible, but its version is much lower,
@@ -1128,9 +1147,12 @@ saved_CFLAGS=$CFLAGS
 saved_CPPFLAGS=$CPPFLAGS
 saved_LDFLAGS=$LDFLAGS
 
+# Use pkg-config to get runtime search patch missing from ${PYTHON}-config
+# Just do "true" on failure so that configure does not bail out
+PKG_CHECK_MODULES([PYTHON], "python-$PYTHON_VERSION",,true)
 CFLAGS="`${PYTHON}-config --cflags`"
 CPPFLAGS=$CFLAGS
-LDFLAGS="-L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
+LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
 
 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
 AC_ARG_ENABLE([glupy],
@@ -1238,6 +1260,23 @@ AC_SUBST(UNITTEST_LDFLAGS)
 AC_SUBST(CFLAGS)
 # end enable debug section
 
+# experimental section
+AC_ARG_ENABLE([experimental],
+              AC_HELP_STRING([--disable-experimental],
+                             [Disable building experimental xlators]))
+
+BUILD_EXPERIMENTAL="yes"
+if test "x$enable_experimental" == "xno"; then
+  BUILD_EXPERIMENTAL="no"
+fi
+AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test x$BUILD_EXPERIMENTAL = xyes])
+#end experimental section
+
+dnl libglusterfs.so uses math functions
+GF_LDADD="${GF_LDADD} ${MATH_LIB}"
+
+GF_XLATOR_DEFAULT_LDFLAGS='-module -avoid-version -export-symbols $(top_srcdir)/xlators/xlator.sym'
+
 AC_SUBST(GF_HOST_OS)
 AC_SUBST(GF_CFLAGS)
 AC_SUBST(GF_LDFLAGS)
@@ -1248,12 +1287,13 @@ AC_SUBST(RLLIBS)
 AC_SUBST(LIBAIO)
 AC_SUBST(AM_MAKEFLAGS)
 AC_SUBST(AM_LIBTOOLFLAGS)
+AC_SUBST(GF_XLATOR_DEFAULT_LDFLAGS)
 
 CONTRIBDIR='$(top_srcdir)/contrib'
 AC_SUBST(CONTRIBDIR)
 
 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
-GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src'
+GF_CPPINCLUDES='-include $(top_builddir)/config.h -I$(top_srcdir)/libglusterfs/src'
 GF_CPPFLAGS="$GF_CPPFLAGS $GF_CPPDEFINES $GF_CPPINCLUDES"
 AC_SUBST([GF_CPPFLAGS])
 
@@ -1317,7 +1357,6 @@ echo "readline             : $BUILD_READLINE"
 echo "georeplication       : $BUILD_SYNCDAEMON"
 echo "Linux-AIO            : $BUILD_LIBAIO"
 echo "Enable Debug         : $BUILD_DEBUG"
-## echo "systemtap            : $BUILD_SYSTEMTAP"
 echo "Block Device xlator  : $BUILD_BD_XLATOR"
 echo "glupy                : $BUILD_GLUPY"
 echo "Use syslog           : $USE_SYSLOG"
@@ -1327,4 +1366,6 @@ echo "Encryption xlator    : $BUILD_CRYPT_XLATOR"
 echo "Unit Tests           : $BUILD_UNITTEST"
 echo "POSIX ACLs           : $BUILD_POSIX_ACLS"
 echo "Data Classification  : $BUILD_GFDB"
+echo "firewalld-config     : $BUILD_FIREWALLD"
+echo "Experimental xlators : $BUILD_EXPERIMENTAL"
 echo