1 dnl Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
2 dnl This file is part of GlusterFS.
4 dnl This file is licensed to you under your choice of the GNU Lesser
5 dnl General Public License, version 3 or any later version (LGPLv3 or
6 dnl later), or the GNU General Public License, version 2 (GPLv2), in all
7 dnl cases as published by the Free Software Foundation.
9 AC_INIT([glusterfs],[3git],[gluster-users@gluster.org],,[https://github.com/gluster/glusterfs.git])
13 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
15 if make --help 2>&1 | grep -q no-print-directory; then
16 AM_MAKEFLAGS="$AM_MAKEFLAGS --no-print-directory";
19 if make --help 2>&1 | grep -q quiet; then
20 AM_MAKEFLAGS="$AM_MAKEFLAGS --quiet"
23 if libtool --help 2>&1 | grep -q quiet; then
24 AM_LIBTOOLFLAGS="--quiet";
27 AC_CONFIG_HEADERS([config.h])
29 AC_CONFIG_FILES([Makefile
31 libglusterfs/src/Makefile
32 geo-replication/src/peer_gsec_create
33 geo-replication/src/peer_add_secret_pub
35 glusterfsd/src/Makefile
38 rpc/rpc-lib/src/Makefile
39 rpc/rpc-transport/Makefile
40 rpc/rpc-transport/socket/Makefile
41 rpc/rpc-transport/socket/src/Makefile
42 rpc/rpc-transport/rdma/Makefile
43 rpc/rpc-transport/rdma/src/Makefile
47 xlators/mount/Makefile
48 xlators/mount/fuse/Makefile
49 xlators/mount/fuse/src/Makefile
50 xlators/mount/fuse/utils/mount.glusterfs
51 xlators/mount/fuse/utils/mount_glusterfs
52 xlators/mount/fuse/utils/Makefile
53 xlators/storage/Makefile
54 xlators/storage/posix/Makefile
55 xlators/storage/posix/src/Makefile
56 xlators/storage/bd/Makefile
57 xlators/storage/bd/src/Makefile
58 xlators/cluster/Makefile
59 xlators/cluster/afr/Makefile
60 xlators/cluster/afr/src/Makefile
61 xlators/cluster/stripe/Makefile
62 xlators/cluster/stripe/src/Makefile
63 xlators/cluster/dht/Makefile
64 xlators/cluster/dht/src/Makefile
65 xlators/performance/Makefile
66 xlators/performance/write-behind/Makefile
67 xlators/performance/write-behind/src/Makefile
68 xlators/performance/read-ahead/Makefile
69 xlators/performance/read-ahead/src/Makefile
70 xlators/performance/readdir-ahead/Makefile
71 xlators/performance/readdir-ahead/src/Makefile
72 xlators/performance/io-threads/Makefile
73 xlators/performance/io-threads/src/Makefile
74 xlators/performance/io-cache/Makefile
75 xlators/performance/io-cache/src/Makefile
76 xlators/performance/symlink-cache/Makefile
77 xlators/performance/symlink-cache/src/Makefile
78 xlators/performance/quick-read/Makefile
79 xlators/performance/quick-read/src/Makefile
80 xlators/performance/open-behind/Makefile
81 xlators/performance/open-behind/src/Makefile
82 xlators/performance/md-cache/Makefile
83 xlators/performance/md-cache/src/Makefile
84 xlators/debug/Makefile
85 xlators/debug/trace/Makefile
86 xlators/debug/trace/src/Makefile
87 xlators/debug/error-gen/Makefile
88 xlators/debug/error-gen/src/Makefile
89 xlators/debug/io-stats/Makefile
90 xlators/debug/io-stats/src/Makefile
91 xlators/protocol/Makefile
92 xlators/protocol/auth/Makefile
93 xlators/protocol/auth/addr/Makefile
94 xlators/protocol/auth/addr/src/Makefile
95 xlators/protocol/auth/login/Makefile
96 xlators/protocol/auth/login/src/Makefile
97 xlators/protocol/client/Makefile
98 xlators/protocol/client/src/Makefile
99 xlators/protocol/server/Makefile
100 xlators/protocol/server/src/Makefile
101 xlators/features/Makefile
102 xlators/features/changelog/Makefile
103 xlators/features/changelog/src/Makefile
104 xlators/features/changelog/lib/Makefile
105 xlators/features/changelog/lib/src/Makefile
106 xlators/features/glupy/Makefile
107 xlators/features/glupy/src/Makefile
108 xlators/features/locks/Makefile
109 xlators/features/locks/src/Makefile
110 xlators/features/quota/Makefile
111 xlators/features/quota/src/Makefile
112 xlators/features/marker/Makefile
113 xlators/features/marker/src/Makefile
114 xlators/features/read-only/Makefile
115 xlators/features/read-only/src/Makefile
116 xlators/features/compress/Makefile
117 xlators/features/compress/src/Makefile
118 xlators/features/mac-compat/Makefile
119 xlators/features/mac-compat/src/Makefile
120 xlators/features/quiesce/Makefile
121 xlators/features/quiesce/src/Makefile
122 xlators/features/index/Makefile
123 xlators/features/index/src/Makefile
124 xlators/features/protect/Makefile
125 xlators/features/protect/src/Makefile
126 xlators/features/gfid-access/Makefile
127 xlators/features/gfid-access/src/Makefile
128 xlators/playground/Makefile
129 xlators/playground/template/Makefile
130 xlators/playground/template/src/Makefile
131 xlators/encryption/Makefile
132 xlators/encryption/rot-13/Makefile
133 xlators/encryption/rot-13/src/Makefile
134 xlators/encryption/crypt/Makefile
135 xlators/encryption/crypt/src/Makefile
136 xlators/features/qemu-block/Makefile
137 xlators/features/qemu-block/src/Makefile
138 xlators/system/Makefile
139 xlators/system/posix-acl/Makefile
140 xlators/system/posix-acl/src/Makefile
142 xlators/nfs/server/Makefile
143 xlators/nfs/server/src/Makefile
144 xlators/mgmt/Makefile
145 xlators/mgmt/glusterd/Makefile
146 xlators/mgmt/glusterd/src/Makefile
151 extras/init.d/Makefile
152 extras/init.d/glusterd.plist
153 extras/init.d/glusterd-Debian
154 extras/init.d/glusterd-Redhat
155 extras/init.d/glusterd-SuSE
156 extras/systemd/Makefile
157 extras/systemd/glusterd.service
158 extras/benchmarking/Makefile
159 extras/hook-scripts/Makefile
163 extras/LinuxRPM/Makefile
164 extras/geo-rep/Makefile
165 extras/hook-scripts/add-brick/Makefile
166 extras/hook-scripts/add-brick/pre/Makefile
167 extras/hook-scripts/add-brick/post/Makefile
168 contrib/fuse-util/Makefile
169 contrib/uuid/uuid_types.h
174 api/examples/Makefile
175 api/examples/setup.py
176 geo-replication/Makefile
177 geo-replication/src/Makefile
178 geo-replication/syncdaemon/Makefile
187 # Initialize CFLAGS before usage
188 AC_ARG_ENABLE([debug],
189 AC_HELP_STRING([--enable-debug],
190 [Enable debug build options.]))
191 if test "x$enable_debug" = "xyes"; then
193 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
196 CFLAGS="${CFLAGS} -g -O2"
199 AC_ARG_WITH(pkgconfigdir,
200 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
201 [pkgconfigdir=$withval],
202 [pkgconfigdir='${libdir}/pkgconfig'])
203 AC_SUBST(pkgconfigdir)
205 AC_ARG_WITH(mountutildir,
206 [ --with-mountutildir=DIR mount helper utility in DIR @<:@/sbin@:>@],
207 [mountutildir=$withval],
208 [mountutildir='/sbin'])
209 AC_SUBST(mountutildir)
211 AC_ARG_WITH(systemddir,
212 [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
213 [systemddir=$withval],
214 [systemddir='/usr/lib/systemd/system'])
218 [ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
220 [initdir='/etc/init.d'])
223 AC_ARG_WITH(launchddir,
224 [ --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
225 [launchddir=$withval],
226 [launchddir='/Library/LaunchDaemons'])
230 [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
238 if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
239 AC_MSG_ERROR([Flex or lex required to build glusterfs.])
245 AC_CHECK_SIZEOF(short)
247 AC_CHECK_SIZEOF(long)
248 AC_CHECK_SIZEOF(long long)
249 SIZEOF_SHORT=$ac_cv_sizeof_short
250 SIZEOF_INT=$ac_cv_sizeof_int
251 SIZEOF_LONG=$ac_cv_sizeof_long
252 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
253 AC_SUBST(SIZEOF_SHORT)
255 AC_SUBST(SIZEOF_LONG)
256 AC_SUBST(SIZEOF_LONG_LONG)
260 if test "x${YACC}" = "xbyacc" -o "x${YACC}" = "xyacc" -o "x${YACC}" = "x"; then
261 AC_MSG_ERROR([GNU Bison required to build glusterfs.])
264 AC_CHECK_TOOL([LD],[ld])
266 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
268 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
270 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
272 AC_CHECK_FUNC([gettext], [has_gettext=yes], AC_CHECK_LIB([intl], [gettext], , AC_MSG_ERROR([gettext support is required to build glusterfs])))
274 AC_CHECK_HEADERS([sys/xattr.h])
276 AC_CHECK_HEADERS([sys/extattr.h])
278 AC_CHECK_HEADERS([openssl/md5.h])
280 AC_CHECK_HEADERS([linux/falloc.h])
284 if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 5; then
285 AC_MSG_ERROR([You need at least OS X 10.5 (Leopard) to build Glusterfs])
290 dnl Mac OS X does not have spinlocks
291 AC_CHECK_FUNC([pthread_spin_init], [have_spinlock=yes])
292 if test "x${have_spinlock}" = "xyes"; then
293 AC_DEFINE(HAVE_SPINLOCK, 1, [define if found spinlock])
295 AC_SUBST(HAVE_SPINLOCK)
297 dnl some os may not have GNU defined strnlen function
298 AC_CHECK_FUNC([strnlen], [have_strnlen=yes])
299 if test "x${have_strnlen}" = "xyes"; then
300 AC_DEFINE(HAVE_STRNLEN, 1, [define if found strnlen])
302 AC_SUBST(HAVE_STRNLEN)
305 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
306 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
308 if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
309 AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
314 AC_ARG_ENABLE([fuse-client],
315 AC_HELP_STRING([--disable-fuse-client],
316 [Do not build the fuse client. NOTE: you cannot mount glusterfs without the client]))
319 if test "x$enable_fuse_client" != "xno"; then
320 FUSE_CLIENT_SUBDIR=fuse
321 BUILD_FUSE_CLIENT="yes"
324 AC_ARG_ENABLE([bd-xlator],
325 AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
327 if test "x$enable_bd_xlator" != "xno"; then
328 AC_CHECK_LIB([lvm2app],
329 [lvm_init,lvm_lv_from_name],
333 if test "x$HAVE_BD_LIB" = "xyes"; then
334 # lvm_lv_from_name() has been made public with lvm2-2.02.79
337 [NEED_LVM_LV_FROM_NAME_DECL="no"],
338 [NEED_LVM_LV_FROM_NAME_DECL="yes"],
339 [[#include <lvm2app.h>]])
343 if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
344 echo "BD xlator requested but required lvm2 development library not found."
349 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
351 AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
353 if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
354 AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
355 was not found in the lvm2app.h header, but can be linked])
359 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
361 # start encryption/crypt section
363 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
365 AC_ARG_ENABLE([crypt-xlator],
366 AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
368 if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
369 echo "Encryption xlator requires OpenSSL with cmac.h"
373 BUILD_CRYPT_XLATOR=no
374 if test "x$enable_crypt_xlator" != "xno" -a "x$have_cmac_h" = "xyes"; then
375 BUILD_CRYPT_XLATOR=yes
376 AC_DEFINE(HAVE_CRYPT_XLATOR, 1, [enable building crypt encryption xlator])
379 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
381 AC_SUBST(FUSE_CLIENT_SUBDIR)
386 AC_ARG_ENABLE([fusermount],
387 AC_HELP_STRING([--disable-fusermount],
388 [Use system's fusermount]))
390 BUILD_FUSERMOUNT="yes"
391 if test "x$enable_fusermount" = "xno"; then
392 BUILD_FUSERMOUNT="no"
394 AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
395 FUSERMOUNT_SUBDIR="contrib/fuse-util"
398 AC_SUBST(FUSERMOUNT_SUBDIR)
399 #end FUSERMOUNT section
403 AC_ARG_ENABLE([qemu-block],
404 AC_HELP_STRING([--enable-qemu-block],
405 [Build QEMU Block formats translator]))
407 if test "x$enable_qemu_block" != "xno"; then
408 PKG_CHECK_MODULES([GLIB], [glib-2.0],
413 if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then
414 echo "QEMU Block formats translator requires libglib-2.0, but missing."
419 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
421 AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
422 Block translator enabled])
425 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
427 # end QEMU_BLOCK section
430 AC_ARG_ENABLE([epoll],
431 AC_HELP_STRING([--disable-epoll],
432 [Use poll instead of epoll.]))
435 if test "x$enable_epoll" != "xno"; then
436 AC_CHECK_HEADERS([sys/epoll.h],
444 AC_ARG_ENABLE([ibverbs],
445 AC_HELP_STRING([--disable-ibverbs],
446 [Do not build the ibverbs transport]))
448 if test "x$enable_ibverbs" != "xno"; then
449 AC_CHECK_LIB([ibverbs],
450 [ibv_get_device_list],
451 [HAVE_LIBIBVERBS="yes"],
452 [HAVE_LIBIBVERBS="no"])
453 AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"])
456 if test "x$enable_ibverbs" = "xyes"; then
457 if test "x$HAVE_LIBIBVERBS" = "xno"; then
458 echo "ibverbs-transport requested, but libibverbs is not present."
462 if test "x$HAVE_RDMACM" = "xno"; then
463 echo "ibverbs-transport requested, but librdmacm is not present."
470 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
471 IBVERBS_SUBDIR=ib-verbs
477 AC_SUBST(IBVERBS_SUBDIR)
478 AC_SUBST(RDMA_SUBDIR)
479 # end IBVERBS section
483 AC_ARG_ENABLE([georeplication],
484 AC_HELP_STRING([--disable-georeplication],
485 [Do not install georeplication components]))
496 #disabling geo replication for non-linux platforms
497 enable_georeplication=no
501 if test "x$enable_georeplication" != "xno"; then
502 SYNCDAEMON_SUBDIR=geo-replication
505 BUILD_SYNCDAEMON="yes"
506 AM_PATH_PYTHON([2.4])
507 echo -n "checking if python is python 2.x... "
508 if echo $PYTHON_VERSION | grep ^2; then
512 AC_MSG_ERROR([only python 2.x is supported])
514 echo -n "checking if python has ctypes support... "
515 if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
519 AC_MSG_ERROR([python does not have ctypes support])
522 AC_SUBST(SYNCDAEMON_COMPILE)
523 AC_SUBST(SYNCDAEMON_SUBDIR)
524 # end SYNCDAEMON section
526 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
527 echo -n "checking if libz is present... "
529 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],
530 [echo "yes (features requiring zlib enabled)" AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])],
533 AC_SUBST(LIBZ_CFLAGS)
535 # end CDC xlator secion
537 # check for systemtap/dtrace
539 AC_MSG_CHECKING([whether to include systemtap tracing support])
540 AC_ARG_ENABLE([systemtap],
541 [AS_HELP_STRING([--enable-systemtap],
542 [Enable inclusion of systemtap trace support])],
543 [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
545 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
546 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
548 if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
549 AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
550 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
554 if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
555 if test "x${DTRACE}" = "xno"; then
556 AC_MSG_ERROR([dtrace not found])
557 elif test "$x{SDT_H_FOUND}" = "xno"; then
558 AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
562 if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
563 AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
564 AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
567 # end of systemtap/dtrace
570 AC_ARG_ENABLE([xml-output],
571 AC_HELP_STRING([--disable-xml-output],
572 [Disable the xml output]))
573 BUILD_XML_OUTPUT="yes"
574 if test "x$enable_xml_output" != "xno"; then
575 #check if libxml is present if so enable HAVE_LIB_XML
576 m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes])
577 if test "x${no_xml}" = "x"; then
578 AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.])
580 if test "x$enable_georeplication" != "xno"; then
581 AC_MSG_ERROR([libxml2 devel libraries not found])
583 AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
584 BUILD_XML_OUTPUT="no"
589 if test "x$enable_georeplication" != "xno"; then
590 AC_MSG_ERROR([geo-replication requires xml output])
592 BUILD_XML_OUTPUT="no"
596 dnl FreeBSD > 5 has execinfo as a Ported library for giving a workaround
597 dnl solution to GCC backtrace functionality
599 AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes],
600 AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace=yes]))
601 dnl AC_MSG_ERROR([libexecinfo not found libexecinfo required.])))
603 if test "x${have_backtrace}" = "xyes"; then
604 AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace])
606 AC_SUBST(HAVE_BACKTRACE)
608 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
609 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
610 if test "x${have_malloc_stats}" = "xyes"; then
611 AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
613 AC_SUBST(HAVE_MALLOC_STATS)
615 dnl Linux, Solaris, Cygwin
616 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
618 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
621 CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063"
624 AC_CHECK_FUNC([linkat], [have_linkat=yes])
625 if test "x${have_linkat}" = "xyes"; then
626 AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
628 AC_SUBST(HAVE_LINKAT)
630 dnl check for Monotonic clock
631 AC_CHECK_FUNC([clock_gettime], [has_monotonic_clock=yes], AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_WARN([System doesn't have monotonic clock using contrib])))
633 dnl Add cmockery2 for unit testing
634 AC_CONFIG_SUBDIRS([cmockery2])
635 UNITTEST_CFLAGS='-g -Wall -DUNIT_TESTING=1 -DDEBUG -Werror -O0 --coverage'
636 UNITTEST_CPPFLAGS='-I$(top_srcdir)/cmockery2/src'
637 UNITTEST_LDADD='$(top_builddir)/cmockery2/libcmockery.la'
638 UNITTEST_LDFLAGS=-lgcov
639 CFLAGS="$CFLAGS ${UNITTEST_CPPFLAGS}"
640 AC_SUBST(UNITTEST_CFLAGS)
641 AC_SUBST(UNITTEST_CPPFLAGS)
642 AC_SUBST(UNITTEST_LDADD)
643 AC_SUBST(UNITTEST_LDFLAGS)
646 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
647 AC_CONFIG_SUBDIRS(argp-standalone)
649 BUILD_ARGP_STANDALONE=no
650 if test "x${ac_cv_header_argp_h}" = "xno"; then
651 BUILD_ARGP_STANDALONE=yes
652 ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/argp-standalone'
653 ARGP_STANDALONE_LDADD='${top_builddir}/argp-standalone/libargp.a'
656 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
657 AC_SUBST(ARGP_STANDALONE_LDADD)
659 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
661 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
662 if test "x${have_llistxattr}" = "xyes"; then
663 AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
666 AC_CHECK_FUNC([fdatasync], [have_fdatasync=yes])
667 if test "x${have_fdatasync}" = "xyes"; then
668 AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
671 AC_CHECK_FUNC([fallocate], [have_fallocate=yes])
672 if test "x${have_fallocate}" = "xyes"; then
673 AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists])
676 AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes])
677 if test "x${have_posix_fallocate}" = "xyes"; then
678 AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists])
682 # Check the distribution where you are compiling glusterfs on
685 AC_CHECK_FILE([/etc/debian_version])
686 AC_CHECK_FILE([/etc/SuSE-release])
687 AC_CHECK_FILE([/etc/redhat-release])
689 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
690 GF_DISTRIBUTION=Debian
692 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
695 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
696 GF_DISTRIBUTION=Redhat
699 AC_SUBST(GF_DISTRIBUTION)
702 GF_LDFLAGS="-rdynamic"
704 # check for gcc -Werror=format-security
706 CFLAGS="-Wformat -Werror=format-security"
707 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
708 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
709 echo $cc_werror_format_security
710 if test "x$cc_werror_format_security" = "xno"; then
711 CFLAGS="$saved_CFLAGS"
713 CFLAGS="$saved_CFLAGS $CFLAGS"
716 # check for gcc -Werror=implicit-function-declaration
718 CFLAGS="-Werror=implicit-function-declaration"
719 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
720 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
721 echo $cc_werror_implicit
722 if test "x$cc_werror_implicit" = "xno"; then
723 CFLAGS="$saved_CFLAGS"
725 CFLAGS="$saved_CFLAGS $CFLAGS"
730 GF_HOST_OS="GF_LINUX_HOST_OS"
731 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
732 GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
733 GF_LDADD="${ARGP_STANDALONE_LDADD}"
734 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
737 GF_HOST_OS="GF_SOLARIS_HOST_OS"
738 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
740 GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
741 GF_LDADD="${ARGP_STANDALONE_LDADD}"
742 GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
744 FUSE_CLIENT_SUBDIR=""
747 GF_HOST_OS="GF_BSD_HOST_OS"
748 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
749 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
750 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
751 GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
752 GF_LDADD="${ARGP_STANDALONE_LDADD}"
753 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
754 GF_GLUSTERFS_LIBS="-lexecinfo"
756 GF_FUSE_LDADD="-lperfuse"
757 BUILD_FUSE_CLIENT=yes
761 GF_HOST_OS="GF_BSD_HOST_OS"
762 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
763 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
764 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
765 GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
766 GF_LDADD="${ARGP_STANDALONE_LDADD}"
767 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
768 GF_GLUSTERFS_LIBS="-lexecinfo"
773 GF_HOST_OS="GF_DARWIN_HOST_OS"
775 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE"
776 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
777 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
778 GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace"
779 GF_LDADD="${ARGP_STANDALONE_LDADD}"
780 GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
784 # enable debug section
785 AC_ARG_ENABLE([debug],
786 AC_HELP_STRING([--enable-debug],
787 [Enable debug build options.]))
790 AC_ARG_ENABLE([syslog],
791 AC_HELP_STRING([--disable-syslog],
792 [Disable syslog for logging]))
795 if test "x$enable_syslog" != "xno"; then
796 AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
800 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
804 AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
805 AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
806 AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
808 if test "x$RLLIBS" != "x"; then
809 AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
814 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
816 if test "x$LIBAIO" != "x"; then
817 AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
827 if echo $PYTHON_VERSION | grep ^2; then
831 # Save flags before testing python
833 saved_CPPFLAGS=$CPPFLAGS
834 saved_LDFLAGS=$LDFLAGS
835 CFLAGS=`${PYTHON}-config --cflags`
837 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
838 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
839 AC_ARG_ENABLE([glupy],
840 AS_HELP_STRING([--enable-glupy],
842 case x$enable_glupy in
844 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
846 PYTHONDEV_CFLAGS="$CFLAGS"
847 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
848 PYTHONDEV_LDFLAGS="$LDFLAGS"
849 AC_SUBST(PYTHONDEV_CFLAGS)
850 AC_SUBST(PYTHONDEV_CPPFLAGS)
851 AC_SUBST(PYTHONDEV_LDFLAGS)
853 AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
859 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
861 PYTHONDEV_CFLAGS="$CFLAGS"
862 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
863 PYTHONDEV_LDFLAGS="$LDFLAGS"
864 AC_SUBST(PYTHONDEV_CFLAGS)
865 AC_SUBST(PYTHONDEV_CPPFLAGS)
866 AC_SUBST(PYTHONDEV_LDFLAGS)
869 ---------------------------------------------------------------------------------
870 cannot build glupy. python 2.x and python-devel/python-dev package are required.
871 ---------------------------------------------------------------------------------])
877 CPPFLAGS=$saved_CPPFLAGS
878 LDFLAGS=$saved_LDFLAGS
880 if test "x$BUILD_GLUPY" = "xyes"; then
881 BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
882 BUILD_PYTHON_LIB=python$PYTHON_VERSION
884 GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
885 GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
886 echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
887 AC_SUBST(BUILD_PYTHON_INC)
888 AC_SUBST(BUILD_PYTHON_LIB)
889 AC_SUBST(GLUPY_SUBDIR)
890 AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
891 AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
896 # end enable debug section
899 AC_SUBST([GF_GLUSTERFS_LIBS])
900 AC_SUBST(GF_GLUSTERFS_CFLAGS)
904 AC_SUBST(GF_FUSE_LDADD)
905 AC_SUBST(GF_FUSE_CFLAGS)
908 AC_SUBST(AM_MAKEFLAGS)
909 AC_SUBST(AM_LIBTOOLFLAGS)
911 CONTRIBDIR='$(top_srcdir)/contrib'
914 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
915 GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid $(UNITTEST_CPPFLAGS)'
916 GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
917 AC_SUBST([GF_CPPFLAGS])
919 AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS")
921 AM_CONDITIONAL([GF_INSTALL_VAR_LIB_GLUSTERD], test ! -d ${localstatedir}/lib/glusterd && test -d ${sysconfdir}/glusterd )
923 dnl pkg-config versioning
924 GFAPI_VERSION="6.0.0"
925 LIBGFCHANGELOG_VERSION="0.0.1"
926 AC_SUBST(GFAPI_VERSION)
927 AC_SUBST(LIBGFCHANGELOG_VERSION)
929 dnl libtool versioning
930 LIBGFXDR_LT_VERSION="0:1:0"
931 LIBGFRPC_LT_VERSION="0:1:0"
932 LIBGLUSTERFS_LT_VERSION="0:1:0"
933 LIBGFCHANGELOG_LT_VERSION="0:1:0"
934 GFAPI_LT_VERSION="6:0:0"
935 AC_SUBST(LIBGFXDR_LT_VERSION)
936 AC_SUBST(LIBGFRPC_LT_VERSION)
937 AC_SUBST(LIBGLUSTERFS_LT_VERSION)
938 AC_SUBST(LIBGFCHANGELOG_LT_VERSION)
939 AC_SUBST(GFAPI_LT_VERSION)
944 echo "GlusterFS configure summary"
945 echo "==========================="
946 echo "FUSE client : $BUILD_FUSE_CLIENT"
947 echo "Infiniband verbs : $BUILD_IBVERBS"
948 echo "epoll IO multiplex : $BUILD_EPOLL"
949 echo "argp-standalone : $BUILD_ARGP_STANDALONE"
950 echo "fusermount : $BUILD_FUSERMOUNT"
951 echo "readline : $BUILD_READLINE"
952 echo "georeplication : $BUILD_SYNCDAEMON"
953 echo "Linux-AIO : $BUILD_LIBAIO"
954 echo "Enable Debug : $BUILD_DEBUG"
955 echo "systemtap : $BUILD_SYSTEMTAP"
956 echo "Block Device xlator : $BUILD_BD_XLATOR"
957 echo "glupy : $BUILD_GLUPY"
958 echo "Use syslog : $USE_SYSLOG"
959 echo "XML output : $BUILD_XML_OUTPUT"
960 echo "QEMU Block formats : $BUILD_QEMU_BLOCK"
961 echo "Encryption xlator : $BUILD_CRYPT_XLATOR"