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.
10 [m4_esyscmd([build-aux/pkg-version --version])],
11 [gluster-users@gluster.org],,[https://github.com/gluster/glusterfs.git])
13 AC_SUBST([PACKAGE_RELEASE],
14 [m4_esyscmd([build-aux/pkg-version --release])])
18 # Removes warnings when using automake 1.14 around (...but option 'subdir-objects' is disabled )
19 #but libglusterfs fails to build with contrib (Then are not set up that way?)
20 #AM_INIT_AUTOMAKE([subdir-objects])
22 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
24 if make --help 2>&1 | grep -q no-print-directory; then
25 AM_MAKEFLAGS="$AM_MAKEFLAGS --no-print-directory";
28 if make --help 2>&1 | grep -q quiet; then
29 AM_MAKEFLAGS="$AM_MAKEFLAGS --quiet"
32 if libtool --help 2>&1 | grep -q quiet; then
33 AM_LIBTOOLFLAGS="--quiet";
36 AC_CONFIG_HEADERS([config.h])
38 AC_CONFIG_FILES([Makefile
40 libglusterfs/src/Makefile
41 geo-replication/src/peer_gsec_create
42 geo-replication/src/peer_add_secret_pub
43 geo-replication/syncdaemon/configinterface.py
45 glusterfsd/src/Makefile
48 rpc/rpc-lib/src/Makefile
49 rpc/rpc-transport/Makefile
50 rpc/rpc-transport/socket/Makefile
51 rpc/rpc-transport/socket/src/Makefile
52 rpc/rpc-transport/rdma/Makefile
53 rpc/rpc-transport/rdma/src/Makefile
58 xlators/meta/src/Makefile
59 xlators/mount/Makefile
60 xlators/mount/fuse/Makefile
61 xlators/mount/fuse/src/Makefile
62 xlators/mount/fuse/utils/mount.glusterfs
63 xlators/mount/fuse/utils/mount_glusterfs
64 xlators/mount/fuse/utils/Makefile
65 xlators/storage/Makefile
66 xlators/storage/posix/Makefile
67 xlators/storage/posix/src/Makefile
68 xlators/storage/bd/Makefile
69 xlators/storage/bd/src/Makefile
70 xlators/cluster/Makefile
71 xlators/cluster/afr/Makefile
72 xlators/cluster/afr/src/Makefile
73 xlators/cluster/stripe/Makefile
74 xlators/cluster/stripe/src/Makefile
75 xlators/cluster/dht/Makefile
76 xlators/cluster/dht/src/Makefile
77 xlators/cluster/ec/Makefile
78 xlators/cluster/ec/src/Makefile
79 xlators/performance/Makefile
80 xlators/performance/write-behind/Makefile
81 xlators/performance/write-behind/src/Makefile
82 xlators/performance/read-ahead/Makefile
83 xlators/performance/read-ahead/src/Makefile
84 xlators/performance/readdir-ahead/Makefile
85 xlators/performance/readdir-ahead/src/Makefile
86 xlators/performance/io-threads/Makefile
87 xlators/performance/io-threads/src/Makefile
88 xlators/performance/io-cache/Makefile
89 xlators/performance/io-cache/src/Makefile
90 xlators/performance/symlink-cache/Makefile
91 xlators/performance/symlink-cache/src/Makefile
92 xlators/performance/quick-read/Makefile
93 xlators/performance/quick-read/src/Makefile
94 xlators/performance/open-behind/Makefile
95 xlators/performance/open-behind/src/Makefile
96 xlators/performance/md-cache/Makefile
97 xlators/performance/md-cache/src/Makefile
98 xlators/debug/Makefile
99 xlators/debug/trace/Makefile
100 xlators/debug/trace/src/Makefile
101 xlators/debug/error-gen/Makefile
102 xlators/debug/error-gen/src/Makefile
103 xlators/debug/io-stats/Makefile
104 xlators/debug/io-stats/src/Makefile
105 xlators/protocol/Makefile
106 xlators/protocol/auth/Makefile
107 xlators/protocol/auth/addr/Makefile
108 xlators/protocol/auth/addr/src/Makefile
109 xlators/protocol/auth/login/Makefile
110 xlators/protocol/auth/login/src/Makefile
111 xlators/protocol/client/Makefile
112 xlators/protocol/client/src/Makefile
113 xlators/protocol/server/Makefile
114 xlators/protocol/server/src/Makefile
115 xlators/features/Makefile
116 xlators/features/changelog/Makefile
117 xlators/features/changelog/src/Makefile
118 xlators/features/changelog/lib/Makefile
119 xlators/features/changelog/lib/src/Makefile
120 xlators/features/glupy/Makefile
121 xlators/features/glupy/examples/Makefile
122 xlators/features/glupy/src/Makefile
123 xlators/features/glupy/src/setup.py
124 xlators/features/glupy/src/__init__.py
125 xlators/features/locks/Makefile
126 xlators/features/locks/src/Makefile
127 xlators/features/quota/Makefile
128 xlators/features/quota/src/Makefile
129 xlators/features/marker/Makefile
130 xlators/features/marker/src/Makefile
131 xlators/features/read-only/Makefile
132 xlators/features/read-only/src/Makefile
133 xlators/features/compress/Makefile
134 xlators/features/compress/src/Makefile
135 xlators/features/mac-compat/Makefile
136 xlators/features/mac-compat/src/Makefile
137 xlators/features/quiesce/Makefile
138 xlators/features/quiesce/src/Makefile
139 xlators/features/barrier/Makefile
140 xlators/features/barrier/src/Makefile
141 xlators/features/index/Makefile
142 xlators/features/index/src/Makefile
143 xlators/features/protect/Makefile
144 xlators/features/protect/src/Makefile
145 xlators/features/gfid-access/Makefile
146 xlators/features/gfid-access/src/Makefile
147 xlators/features/snapview-server/Makefile
148 xlators/features/snapview-server/src/Makefile
149 xlators/features/snapview-client/Makefile
150 xlators/features/snapview-client/src/Makefile
151 xlators/playground/Makefile
152 xlators/playground/template/Makefile
153 xlators/playground/template/src/Makefile
154 xlators/encryption/Makefile
155 xlators/encryption/rot-13/Makefile
156 xlators/encryption/rot-13/src/Makefile
157 xlators/encryption/crypt/Makefile
158 xlators/encryption/crypt/src/Makefile
159 xlators/features/qemu-block/Makefile
160 xlators/features/qemu-block/src/Makefile
161 xlators/system/Makefile
162 xlators/system/posix-acl/Makefile
163 xlators/system/posix-acl/src/Makefile
165 xlators/nfs/server/Makefile
166 xlators/nfs/server/src/Makefile
167 xlators/mgmt/Makefile
168 xlators/mgmt/glusterd/Makefile
169 xlators/mgmt/glusterd/src/Makefile
175 extras/init.d/Makefile
176 extras/init.d/glusterd.plist
177 extras/init.d/glusterd-Debian
178 extras/init.d/glusterd-Redhat
179 extras/init.d/glusterd-FreeBSD
180 extras/init.d/glusterd-SuSE
181 extras/systemd/Makefile
182 extras/systemd/glusterd.service
183 extras/benchmarking/Makefile
184 extras/hook-scripts/Makefile
188 extras/LinuxRPM/Makefile
189 extras/geo-rep/Makefile
190 extras/hook-scripts/add-brick/Makefile
191 extras/hook-scripts/add-brick/pre/Makefile
192 extras/hook-scripts/add-brick/post/Makefile
193 extras/hook-scripts/start/Makefile
194 extras/hook-scripts/start/post/Makefile
195 extras/hook-scripts/set/Makefile
196 extras/hook-scripts/set/post/Makefile
197 extras/hook-scripts/stop/Makefile
198 extras/hook-scripts/stop/pre/Makefile
199 extras/hook-scripts/reset/Makefile
200 extras/hook-scripts/reset/post/Makefile
201 extras/hook-scripts/reset/pre/Makefile
202 contrib/fuse-util/Makefile
203 contrib/uuid/uuid_types.h
208 api/examples/Makefile
209 geo-replication/Makefile
210 geo-replication/src/Makefile
211 geo-replication/syncdaemon/Makefile
220 AC_CHECK_PROG([RPCGEN], [rpcgen], [yes], [no])
222 if test "x$RPCGEN" = "xno"; then
223 AC_MSG_ERROR([`rpcgen` not found, glusterfs needs `rpcgen` exiting..])
226 # Initialize CFLAGS before usage
227 AC_ARG_ENABLE([debug],
228 AC_HELP_STRING([--enable-debug],
229 [Enable debug build options.]))
230 if test "x$enable_debug" = "xyes"; then
232 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
235 CFLAGS="${CFLAGS} -g -O2"
240 if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then
241 AC_MSG_ERROR([You need at least OS X 10.7 (Lion) to build Glusterfs])
243 # OSX version lesser than 9 has llvm/clang optimization issues which leads to various segfaults
244 if test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -lt 9; then
245 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
250 AC_ARG_WITH([previous-options],
251 [AS_HELP_STRING([--with-previous-options],
252 [read config.status for configure options])
254 [ if test -r ./config.status && \
255 args=$(grep 'ac_cs_config=' config.status | \
256 sed -e 's/.*"\(.*\)".*/\1/'| sed -e "s/'//g") ; then
258 echo "### Rerunning as '$0 $args'"
264 AC_ARG_WITH(pkgconfigdir,
265 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
266 [pkgconfigdir=$withval],
267 [pkgconfigdir='${libdir}/pkgconfig'])
268 AC_SUBST(pkgconfigdir)
270 AC_ARG_WITH(mountutildir,
271 [ --with-mountutildir=DIR mount helper utility in DIR @<:@/sbin@:>@],
272 [mountutildir=$withval],
273 [mountutildir='/sbin'])
274 AC_SUBST(mountutildir)
276 AC_ARG_WITH(systemddir,
277 [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
278 [systemddir=$withval],
279 [systemddir='/usr/lib/systemd/system'])
283 [ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
285 [initdir='/etc/init.d'])
288 AC_ARG_WITH(launchddir,
289 [ --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
290 [launchddir=$withval],
291 [launchddir='/Library/LaunchDaemons'])
295 [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
303 if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
304 AC_MSG_ERROR([Flex or lex required to build glusterfs.])
310 AC_CHECK_SIZEOF(short)
312 AC_CHECK_SIZEOF(long)
313 AC_CHECK_SIZEOF(long long)
314 SIZEOF_SHORT=$ac_cv_sizeof_short
315 SIZEOF_INT=$ac_cv_sizeof_int
316 SIZEOF_LONG=$ac_cv_sizeof_long
317 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
318 AC_SUBST(SIZEOF_SHORT)
320 AC_SUBST(SIZEOF_LONG)
321 AC_SUBST(SIZEOF_LONG_LONG)
325 if test "x${YACC}" = "xbyacc" -o "x${YACC}" = "xyacc" -o "x${YACC}" = "x"; then
326 AC_MSG_ERROR([GNU Bison required to build glusterfs.])
329 AC_CHECK_TOOL([LD],[ld])
331 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
333 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
336 PKG_CHECK_MODULES([UNITTEST], [cmockery2], [
337 UNITTEST_CPPFLAGS=`${PKG_CONFIG} --print-errors --cflags-only-I "cmockery2"`
338 UNITTEST_CFLAGS=`${PKG_CONFIG} --print-errors --cflags-only-other "cmockery2"`
339 UNITTEST_LDFLAGS=`${PKG_CONFIG} --print-errors --libs-only-L "cmockery2"`
340 UNITTEST_LIBS=`${PKG_CONFIG} --print-errors --libs-only-l "cmockery2"`
342 AC_CHECK_LIB([cmockery], [mock_assert], [
343 UNITTEST_LDFLAGS="-lcmockery -lgcov"
344 UNITTEST_CFLAGS="-Wall -Werror -DUNIT_TESTING=1"
346 AC_MSG_ERROR([cmockery2 library is required to build glusterfs])
350 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
352 AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
354 AC_CHECK_LIB([intl], [gettext])
356 AC_CHECK_HEADERS([sys/xattr.h])
358 AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
360 AC_CHECK_HEADERS([sys/extattr.h])
362 AC_CHECK_HEADERS([openssl/md5.h])
364 AC_CHECK_HEADERS([linux/falloc.h])
366 dnl Mac OS X does not have spinlocks
367 AC_CHECK_FUNC([pthread_spin_init], [have_spinlock=yes])
368 if test "x${have_spinlock}" = "xyes"; then
369 AC_DEFINE(HAVE_SPINLOCK, 1, [define if found spinlock])
371 AC_SUBST(HAVE_SPINLOCK)
373 dnl some os may not have GNU defined strnlen function
374 AC_CHECK_FUNC([strnlen], [have_strnlen=yes])
375 if test "x${have_strnlen}" = "xyes"; then
376 AC_DEFINE(HAVE_STRNLEN, 1, [define if found strnlen])
378 AC_SUBST(HAVE_STRNLEN)
381 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
382 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
384 if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
385 AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
388 dnl test umount2 function
389 AC_CHECK_FUNC([umount2], [have_umount2=yes])
391 if test "x${have_umount2}" = "xyes"; then
392 AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
396 AC_ARG_ENABLE([fuse-client],
397 AC_HELP_STRING([--disable-fuse-client],
398 [Do not build the fuse client. NOTE: you cannot mount glusterfs without the client]))
401 if test "x$enable_fuse_client" != "xno"; then
402 FUSE_CLIENT_SUBDIR=fuse
403 BUILD_FUSE_CLIENT="yes"
406 AC_ARG_ENABLE([bd-xlator],
407 AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
409 if test "x$enable_bd_xlator" != "xno"; then
410 AC_CHECK_LIB([lvm2app],
411 [lvm_init,lvm_lv_from_name],
415 if test "x$HAVE_BD_LIB" = "xyes"; then
416 # lvm_lv_from_name() has been made public with lvm2-2.02.79
419 [NEED_LVM_LV_FROM_NAME_DECL="no"],
420 [NEED_LVM_LV_FROM_NAME_DECL="yes"],
421 [[#include <lvm2app.h>]])
425 if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
426 echo "BD xlator requested but required lvm2 development library not found."
431 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
433 AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
435 if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
436 AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
437 was not found in the lvm2app.h header, but can be linked])
441 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
443 # start encryption/crypt section
445 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
447 AC_ARG_ENABLE([crypt-xlator],
448 AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
450 if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
451 AC_MSG_ERROR([Encryption xlator requires OpenSSL with cmac.h])
454 BUILD_CRYPT_XLATOR=no
455 if test "x$enable_crypt_xlator" != "xno" -a "x$have_cmac_h" = "xyes"; then
456 BUILD_CRYPT_XLATOR=yes
457 AC_DEFINE(HAVE_CRYPT_XLATOR, 1, [enable building crypt encryption xlator])
460 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
462 AC_SUBST(FUSE_CLIENT_SUBDIR)
467 AC_ARG_ENABLE([fusermount],
468 AC_HELP_STRING([--disable-fusermount],
469 [Use system's fusermount]))
471 BUILD_FUSERMOUNT="yes"
472 if test "x$enable_fusermount" = "xno"; then
473 BUILD_FUSERMOUNT="no"
475 AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
476 FUSERMOUNT_SUBDIR="contrib/fuse-util"
479 AC_SUBST(FUSERMOUNT_SUBDIR)
480 #end FUSERMOUNT section
484 AC_ARG_ENABLE([qemu-block],
485 AC_HELP_STRING([--enable-qemu-block],
486 [Build QEMU Block formats translator]))
488 if test "x$enable_qemu_block" != "xno"; then
489 PKG_CHECK_MODULES([GLIB], [glib-2.0],
494 if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then
495 echo "QEMU Block formats translator requires libglib-2.0, but missing."
500 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
502 AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
503 Block translator enabled])
507 # end QEMU_BLOCK section
510 AC_ARG_ENABLE([epoll],
511 AC_HELP_STRING([--disable-epoll],
512 [Use poll instead of epoll.]))
515 if test "x$enable_epoll" != "xno"; then
516 AC_CHECK_HEADERS([sys/epoll.h],
524 AC_ARG_ENABLE([ibverbs],
525 AC_HELP_STRING([--disable-ibverbs],
526 [Do not build the ibverbs transport]))
528 if test "x$enable_ibverbs" != "xno"; then
529 AC_CHECK_LIB([ibverbs],
530 [ibv_get_device_list],
531 [HAVE_LIBIBVERBS="yes"],
532 [HAVE_LIBIBVERBS="no"])
533 AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"])
536 if test "x$enable_ibverbs" = "xyes"; then
537 if test "x$HAVE_LIBIBVERBS" = "xno"; then
538 echo "ibverbs-transport requested, but libibverbs is not present."
542 if test "x$HAVE_RDMACM" = "xno"; then
543 echo "ibverbs-transport requested, but librdmacm is not present."
550 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
551 IBVERBS_SUBDIR=ib-verbs
557 AC_SUBST(IBVERBS_SUBDIR)
558 AC_SUBST(RDMA_SUBDIR)
559 # end IBVERBS section
563 AC_ARG_ENABLE([georeplication],
564 AC_HELP_STRING([--disable-georeplication],
565 [Do not install georeplication components]))
576 #disabling geo replication for non-linux platforms
577 enable_georeplication=no
581 if test "x$enable_georeplication" != "xno"; then
582 SYNCDAEMON_SUBDIR=geo-replication
585 BUILD_SYNCDAEMON="yes"
586 AM_PATH_PYTHON([2.4])
587 echo -n "checking if python is python 2.x... "
588 if echo $PYTHON_VERSION | grep ^2; then
592 AC_MSG_ERROR([only python 2.x is supported])
594 echo -n "checking if python has ctypes support... "
595 if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
599 AC_MSG_ERROR([python does not have ctypes support])
602 AC_SUBST(SYNCDAEMON_COMPILE)
603 AC_SUBST(SYNCDAEMON_SUBDIR)
604 # end SYNCDAEMON section
606 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
608 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],,
609 [AC_CHECK_LIB([z], [deflate], [LIBZ_LIBS="-lz"],
611 echo -n "features requiring zlib enabled: "
612 if test "x$BUILD_CDC" = "xyes" ; then
614 AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])
618 AC_SUBST(LIBZ_CFLAGS)
620 # end CDC xlator secion
622 # check for systemtap/dtrace
624 AC_MSG_CHECKING([whether to include systemtap tracing support])
625 AC_ARG_ENABLE([systemtap],
626 [AS_HELP_STRING([--enable-systemtap],
627 [Enable inclusion of systemtap trace support])],
628 [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
630 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
631 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
633 if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
634 AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
635 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
639 if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
640 if test "x${DTRACE}" = "xno"; then
641 AC_MSG_ERROR([dtrace not found])
642 elif test "$x{SDT_H_FOUND}" = "xno"; then
643 AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
647 if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
648 AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
649 AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
652 # end of systemtap/dtrace
655 AC_ARG_ENABLE([xml-output],
656 AC_HELP_STRING([--disable-xml-output],
657 [Disable the xml output]))
658 BUILD_XML_OUTPUT="yes"
659 if test "x$enable_xml_output" != "xno"; then
660 #check if libxml is present if so enable HAVE_LIB_XML
661 m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes])
662 if test "x${no_xml}" = "x"; then
663 AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.])
665 if test "x$enable_georeplication" != "xno"; then
666 AC_MSG_ERROR([libxml2 devel libraries not found])
668 AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
669 BUILD_XML_OUTPUT="no"
674 if test "x$enable_georeplication" != "xno"; then
675 AC_MSG_ERROR([geo-replication requires xml output])
677 BUILD_XML_OUTPUT="no"
681 AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes])
682 if test "x${have_backtrace}" = "xyes"; then
683 AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace])
685 AC_SUBST(HAVE_BACKTRACE)
687 if test "x${have_backtrace}" != "xyes"; then
688 AC_TRY_COMPILE([#include <math.h>], [double x=0.0; x=ceil(0.0);],
690 AC_MSG_ERROR([need math library for libexecinfo]))
691 if test "x${have_math_h}" = "xyes"; then
696 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
697 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
698 if test "x${have_malloc_stats}" = "xyes"; then
699 AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
701 AC_SUBST(HAVE_MALLOC_STATS)
703 dnl Linux, Solaris, Cygwin
704 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
706 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
709 CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063 -DCONFIG_MACHINE_BSWAP_H"
712 AC_CHECK_FUNC([linkat], [have_linkat=yes])
713 if test "x${have_linkat}" = "xyes"; then
714 AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
716 AC_SUBST(HAVE_LINKAT)
718 dnl check for Monotonic clock
719 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])))
721 dnl Add cmockery2 for unit tests
724 dnl remove --coverage on FreeBSD due to a known llvm packaging bug
725 UNITTEST_CFLAGS="${UNITTEST_CPPFLAGS} ${UNITTEST_CFLAGS} -g -DDEBUG -O0"
726 UNITTEST_LDFLAGS="${UNITTEST_LIBS} ${UNITTEST_LDFLAGS}"
729 UNITTEST_CFLAGS="${UNITTEST_CPPFLAGS} ${UNITTEST_CFLAGS} -g -DDEBUG -O0 --coverage"
730 UNITTEST_LDFLAGS="${UNITTEST_LIBS} ${UNITTEST_LDFLAGS}"
734 AC_SUBST(UNITTEST_CFLAGS)
735 AC_SUBST(UNITTEST_LDFLAGS)
738 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
739 AC_CONFIG_SUBDIRS(contrib/argp-standalone)
741 BUILD_ARGP_STANDALONE=no
742 if test "x${ac_cv_header_argp_h}" = "xno"; then
743 BUILD_ARGP_STANDALONE=yes
744 ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/contrib/argp-standalone'
745 ARGP_STANDALONE_LDADD='${top_builddir}/contrib/argp-standalone/libargp.a'
746 ARGP_STANDALONE_DIR='${top_builddir}/contrib/argp-standalone'
749 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
750 AC_SUBST(ARGP_STANDALONE_LDADD)
751 AC_SUBST(ARGP_STANDALONE_DIR)
753 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
755 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
756 if test "x${have_llistxattr}" = "xyes"; then
757 AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
760 AC_CHECK_FUNC([fdatasync], [have_fdatasync=no])
761 if test "x${have_fdatasync}" = "xyes"; then
762 AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
765 AC_CHECK_FUNC([fallocate], [have_fallocate=yes])
766 if test "x${have_fallocate}" = "xyes"; then
767 AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists])
770 AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes])
771 if test "x${have_posix_fallocate}" = "xyes"; then
772 AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists])
775 # Check the distribution where you are compiling glusterfs on
778 AC_CHECK_FILE([/etc/debian_version])
779 AC_CHECK_FILE([/etc/SuSE-release])
780 AC_CHECK_FILE([/etc/redhat-release])
782 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
783 GF_DISTRIBUTION=Debian
785 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
788 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
789 GF_DISTRIBUTION=Redhat
792 AC_SUBST(GF_DISTRIBUTION)
795 GF_LDFLAGS="-rdynamic"
797 dnl check for gcc -Werror=format-security
798 saved_GF_CFLAGS="-Wformat -Werror=format-security"
799 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
800 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
801 echo $cc_werror_format_security
802 if test "x$cc_werror_format_security" = "xno"; then
803 GF_CFLAGS="$GF_CFLAGS"
805 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
808 dnl check for gcc -Werror=implicit-function-declaration
809 saved_GF_CFLAGS=$GF_CFLAGS
810 GF_CFLAGS="-Werror=implicit-function-declaration"
811 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
812 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
813 echo $cc_werror_implicit
814 if test "x$cc_werror_implicit" = "xno"; then
815 GF_CFLAGS="$saved_GF_CFLAGS"
817 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
820 dnl clang is mostly GCC-compatible, but its version is much lower,
821 dnl so we have to check for it.
822 AC_MSG_CHECKING([if compiling with clang])
825 [AC_LANG_PROGRAM([], [[
830 [CLANG=yes], [CLANG=no])
832 AC_MSG_RESULT([$CLANG])
834 if test "x$CLANG" = "xyes"; then
835 GF_COMPILER_FLAGS="-Wno-gnu"
838 if test "x$ac_cv_header_execinfo_h" = "xno"; then
839 # The reason is that __builtin_frame_address(n) for n > 0 seems
840 # to just crash on most platforms when -fomit-stack-pointer is
841 # specified, which seems to be the default for many platforms on
842 # -O2. The documentation says that __builtin_frame_address()
843 # should return NULL in case it can't get the frame, but it
844 # seems to crash instead.
846 # execinfo.c in ./contrib/libexecinfo uses __builtin_frame_address(n)
847 # for providing cross platform backtrace*() functions.
848 if test "x$CLANG" = "xno"; then
849 CFLAGS="$CFLAGS -fno-omit-frame-pointer"
853 ### Dirty hacky stuff to make LOCALSTATEDIR work
854 if test "x$prefix" = xNONE; then
855 test $localstatedir = '${prefix}/var' && localstatedir=$ac_default_prefix/var
857 LOCALSTATEDIR=$(eval echo ${localstatedir})
859 LOCALSTATEDIR=$(eval echo ${localstatedir})
864 GF_HOST_OS="GF_LINUX_HOST_OS"
865 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS}"
866 GF_LDADD="${ARGP_STANDALONE_LDADD}"
867 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
868 GLUSTERD_WORKDIR="${LOCALSTATEDIR}/lib/glusterd"
871 GF_HOST_OS="GF_SOLARIS_HOST_OS"
872 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
874 GF_LDADD="${ARGP_STANDALONE_LDADD}"
876 FUSE_CLIENT_SUBDIR=""
877 GLUSTERD_WORKDIR="${LOCALSTATEDIR}/lib/glusterd"
880 GF_HOST_OS="GF_BSD_HOST_OS"
881 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
882 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
883 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
884 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(sbindir)\\\""
885 GF_LDADD="${ARGP_STANDALONE_LDADD}"
886 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
887 GF_LDFLAGS="-lexecinfo"
889 GF_FUSE_LDADD="-lperfuse"
890 BUILD_FUSE_CLIENT=yes
894 GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
897 GF_HOST_OS="GF_BSD_HOST_OS"
898 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} -O0"
899 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
900 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
901 GF_CFLAGS="${GF_CFLAGS} -D_LIBGEN_H_"
902 GF_CFLAGS="${GF_CFLAGS} -DO_DSYNC=0"
903 GF_CFLAGS="${GF_CFLAGS} -Dxdr_quad_t=xdr_longlong_t"
904 GF_CFLAGS="${GF_CFLAGS} -Dxdr_u_quad_t=xdr_u_longlong_t"
905 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(sbindir)\\\""
906 GF_LDADD="${ARGP_STANDALONE_LDADD}"
907 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
908 GF_LDFLAGS="-lexecinfo"
910 BUILD_FUSE_CLIENT=yes
913 GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
916 GF_HOST_OS="GF_DARWIN_HOST_OS"
918 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} "
919 GF_CFLAGS="${GF_CFLAGS} -D_REENTRANT -D_XOPEN_SOURCE "
920 GF_CFLAGS="${GF_CFLAGS} -D_DARWIN_USE_64_BIT_INODE "
921 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
922 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
923 GF_LDADD="${ARGP_STANDALONE_LDADD}"
925 GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
926 BUILD_FUSERMOUNT="no"
927 BUILD_QEMU_BLOCK="no"
929 GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
933 # enable/disable QEMU
934 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
937 # enable debug section
938 AC_ARG_ENABLE([debug],
939 AC_HELP_STRING([--enable-debug],
940 [Enable debug build options.]))
944 AC_ARG_ENABLE([syslog],
945 AC_HELP_STRING([--disable-syslog],
946 [Disable syslog for logging]))
949 if test "x$enable_syslog" != "xno"; then
950 AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
954 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
958 AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
959 AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
960 AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
962 if test "x$RLLIBS" != "x"; then
963 if test "x$RL_UNDO" = "xyes"; then
964 AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
967 BUILD_READLINE="no (present but missing undo)"
973 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
975 if test "x$LIBAIO" != "x"; then
976 AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
986 if echo $PYTHON_VERSION | grep ^2; then
990 # Save flags before testing python
992 saved_CPPFLAGS=$CPPFLAGS
993 saved_LDFLAGS=$LDFLAGS
997 CFLAGS="`${PYTHON}-config --cflags`"
999 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
1002 CFLAGS="`${PYTHON}-config --cflags`"
1004 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
1008 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
1009 AC_ARG_ENABLE([glupy],
1010 AS_HELP_STRING([--enable-glupy],
1012 case x$enable_glupy in
1014 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
1016 PYTHONDEV_CFLAGS="$CFLAGS"
1017 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
1018 PYTHONDEV_LDFLAGS="$LDFLAGS"
1019 AC_SUBST(PYTHONDEV_CFLAGS)
1020 AC_SUBST(PYTHONDEV_CPPFLAGS)
1021 AC_SUBST(PYTHONDEV_LDFLAGS)
1023 AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
1029 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
1031 PYTHONDEV_CFLAGS="$CFLAGS"
1032 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
1033 PYTHONDEV_LDFLAGS="$LDFLAGS"
1034 AC_SUBST(PYTHONDEV_CFLAGS)
1035 AC_SUBST(PYTHONDEV_CPPFLAGS)
1036 AC_SUBST(PYTHONDEV_LDFLAGS)
1039 ---------------------------------------------------------------------------------
1040 cannot build glupy. python 2.x and python-devel/python-dev package are required.
1041 ---------------------------------------------------------------------------------])
1046 CFLAGS=$saved_CFLAGS
1047 CPPFLAGS=$saved_CPPFLAGS
1048 LDFLAGS=$saved_LDFLAGS
1056 if test "x$BUILD_GLUPY" = "xyes"; then
1057 BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
1058 BUILD_PYTHON_LIB=python$PYTHON_VERSION
1060 GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
1061 GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
1062 echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
1063 AC_SUBST(BUILD_PYTHON_INC)
1064 AC_SUBST(BUILD_PYTHON_LIB)
1065 AC_SUBST(GLUPY_SUBDIR)
1066 AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
1067 AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
1072 # end enable debug section
1074 dnl Required if cmockery2 headers are not in standar paths
1075 GF_CFLAGS="${GF_CFLAGS} ${UNITTEST_CPPFLAGS}"
1077 AC_SUBST(GF_HOST_OS)
1079 AC_SUBST(GF_LDFLAGS)
1081 AC_SUBST(GF_FUSE_LDADD)
1082 AC_SUBST(GF_FUSE_CFLAGS)
1085 AC_SUBST(AM_MAKEFLAGS)
1086 AC_SUBST(AM_LIBTOOLFLAGS)
1088 CONTRIBDIR='$(top_srcdir)/contrib'
1089 AC_SUBST(CONTRIBDIR)
1091 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
1092 GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
1093 GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
1094 AC_SUBST([GF_CPPFLAGS])
1096 AM_CONDITIONAL([GF_LINUX_HOST_OS], test "${GF_HOST_OS}" = "GF_LINUX_HOST_OS")
1097 AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS")
1098 AM_CONDITIONAL([GF_BSD_HOST_OS], test "${GF_HOST_OS}" = "GF_BSD_HOST_OS")
1100 AC_SUBST(GLUSTERD_WORKDIR)
1101 AM_CONDITIONAL([GF_INSTALL_GLUSTERD_WORKDIR], test ! -d ${GLUSTERD_WORKDIR} && test -d ${sysconfdir}/glusterd )
1103 dnl pkg-config versioning
1104 GFAPI_VERSION="7.0.0"
1105 LIBGFCHANGELOG_VERSION="0.0.1"
1106 AC_SUBST(GFAPI_VERSION)
1107 AC_SUBST(LIBGFCHANGELOG_VERSION)
1109 dnl libtool versioning
1110 LIBGFXDR_LT_VERSION="0:1:0"
1111 LIBGFRPC_LT_VERSION="0:1:0"
1112 LIBGLUSTERFS_LT_VERSION="0:1:0"
1113 LIBGFCHANGELOG_LT_VERSION="0:1:0"
1114 GFAPI_LT_VERSION="7:0:0"
1115 AC_SUBST(LIBGFXDR_LT_VERSION)
1116 AC_SUBST(LIBGFRPC_LT_VERSION)
1117 AC_SUBST(LIBGLUSTERFS_LT_VERSION)
1118 AC_SUBST(LIBGFCHANGELOG_LT_VERSION)
1119 AC_SUBST(GFAPI_LT_VERSION)
1121 dnl this change necessary for run-tests.sh
1122 AC_CONFIG_FILES([tests/env.rc],[ln -s ${ac_abs_builddir}/env.rc ${ac_abs_srcdir}/env.rc 2>/dev/null])
1127 echo "GlusterFS configure summary"
1128 echo "==========================="
1129 echo "FUSE client : $BUILD_FUSE_CLIENT"
1130 echo "Infiniband verbs : $BUILD_IBVERBS"
1131 echo "epoll IO multiplex : $BUILD_EPOLL"
1132 echo "argp-standalone : $BUILD_ARGP_STANDALONE"
1133 echo "fusermount : $BUILD_FUSERMOUNT"
1134 echo "readline : $BUILD_READLINE"
1135 echo "georeplication : $BUILD_SYNCDAEMON"
1136 echo "Linux-AIO : $BUILD_LIBAIO"
1137 echo "Enable Debug : $BUILD_DEBUG"
1138 echo "systemtap : $BUILD_SYSTEMTAP"
1139 echo "Block Device xlator : $BUILD_BD_XLATOR"
1140 echo "glupy : $BUILD_GLUPY"
1141 echo "Use syslog : $USE_SYSLOG"
1142 echo "XML output : $BUILD_XML_OUTPUT"
1143 echo "QEMU Block formats : $BUILD_QEMU_BLOCK"
1144 echo "Encryption xlator : $BUILD_CRYPT_XLATOR"