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])])
17 # Removes warnings when using automake 1.14 around (...but option 'subdir-objects' is disabled )
18 #but libglusterfs fails to build with contrib (Then are not set up that way?)
19 #AM_INIT_AUTOMAKE([subdir-objects])
21 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
23 if make --help 2>&1 | grep -q no-print-directory; then
24 AM_MAKEFLAGS="$AM_MAKEFLAGS --no-print-directory";
27 if make --help 2>&1 | grep -q quiet; then
28 AM_MAKEFLAGS="$AM_MAKEFLAGS --quiet"
31 if libtool --help 2>&1 | grep -q quiet; then
32 AM_LIBTOOLFLAGS="--quiet";
35 AC_CONFIG_HEADERS([config.h])
37 AC_CONFIG_FILES([Makefile
39 libglusterfs/src/Makefile
40 geo-replication/src/peer_gsec_create
41 geo-replication/src/peer_add_secret_pub
43 glusterfsd/src/Makefile
46 rpc/rpc-lib/src/Makefile
47 rpc/rpc-transport/Makefile
48 rpc/rpc-transport/socket/Makefile
49 rpc/rpc-transport/socket/src/Makefile
50 rpc/rpc-transport/rdma/Makefile
51 rpc/rpc-transport/rdma/src/Makefile
56 xlators/meta/src/Makefile
57 xlators/mount/Makefile
58 xlators/mount/fuse/Makefile
59 xlators/mount/fuse/src/Makefile
60 xlators/mount/fuse/utils/mount.glusterfs
61 xlators/mount/fuse/utils/mount_glusterfs
62 xlators/mount/fuse/utils/Makefile
63 xlators/storage/Makefile
64 xlators/storage/posix/Makefile
65 xlators/storage/posix/src/Makefile
66 xlators/storage/bd/Makefile
67 xlators/storage/bd/src/Makefile
68 xlators/cluster/Makefile
69 xlators/cluster/afr/Makefile
70 xlators/cluster/afr/src/Makefile
71 xlators/cluster/stripe/Makefile
72 xlators/cluster/stripe/src/Makefile
73 xlators/cluster/dht/Makefile
74 xlators/cluster/dht/src/Makefile
75 xlators/performance/Makefile
76 xlators/performance/write-behind/Makefile
77 xlators/performance/write-behind/src/Makefile
78 xlators/performance/read-ahead/Makefile
79 xlators/performance/read-ahead/src/Makefile
80 xlators/performance/readdir-ahead/Makefile
81 xlators/performance/readdir-ahead/src/Makefile
82 xlators/performance/io-threads/Makefile
83 xlators/performance/io-threads/src/Makefile
84 xlators/performance/io-cache/Makefile
85 xlators/performance/io-cache/src/Makefile
86 xlators/performance/symlink-cache/Makefile
87 xlators/performance/symlink-cache/src/Makefile
88 xlators/performance/quick-read/Makefile
89 xlators/performance/quick-read/src/Makefile
90 xlators/performance/open-behind/Makefile
91 xlators/performance/open-behind/src/Makefile
92 xlators/performance/md-cache/Makefile
93 xlators/performance/md-cache/src/Makefile
94 xlators/debug/Makefile
95 xlators/debug/trace/Makefile
96 xlators/debug/trace/src/Makefile
97 xlators/debug/error-gen/Makefile
98 xlators/debug/error-gen/src/Makefile
99 xlators/debug/io-stats/Makefile
100 xlators/debug/io-stats/src/Makefile
101 xlators/protocol/Makefile
102 xlators/protocol/auth/Makefile
103 xlators/protocol/auth/addr/Makefile
104 xlators/protocol/auth/addr/src/Makefile
105 xlators/protocol/auth/login/Makefile
106 xlators/protocol/auth/login/src/Makefile
107 xlators/protocol/client/Makefile
108 xlators/protocol/client/src/Makefile
109 xlators/protocol/server/Makefile
110 xlators/protocol/server/src/Makefile
111 xlators/features/Makefile
112 xlators/features/changelog/Makefile
113 xlators/features/changelog/src/Makefile
114 xlators/features/changelog/lib/Makefile
115 xlators/features/changelog/lib/src/Makefile
116 xlators/features/glupy/Makefile
117 xlators/features/glupy/examples/Makefile
118 xlators/features/glupy/src/Makefile
119 xlators/features/glupy/src/setup.py
120 xlators/features/locks/Makefile
121 xlators/features/locks/src/Makefile
122 xlators/features/quota/Makefile
123 xlators/features/quota/src/Makefile
124 xlators/features/marker/Makefile
125 xlators/features/marker/src/Makefile
126 xlators/features/read-only/Makefile
127 xlators/features/read-only/src/Makefile
128 xlators/features/compress/Makefile
129 xlators/features/compress/src/Makefile
130 xlators/features/mac-compat/Makefile
131 xlators/features/mac-compat/src/Makefile
132 xlators/features/quiesce/Makefile
133 xlators/features/quiesce/src/Makefile
134 xlators/features/barrier/Makefile
135 xlators/features/barrier/src/Makefile
136 xlators/features/index/Makefile
137 xlators/features/index/src/Makefile
138 xlators/features/protect/Makefile
139 xlators/features/protect/src/Makefile
140 xlators/features/gfid-access/Makefile
141 xlators/features/gfid-access/src/Makefile
142 xlators/playground/Makefile
143 xlators/playground/template/Makefile
144 xlators/playground/template/src/Makefile
145 xlators/encryption/Makefile
146 xlators/encryption/rot-13/Makefile
147 xlators/encryption/rot-13/src/Makefile
148 xlators/encryption/crypt/Makefile
149 xlators/encryption/crypt/src/Makefile
150 xlators/features/qemu-block/Makefile
151 xlators/features/qemu-block/src/Makefile
152 xlators/system/Makefile
153 xlators/system/posix-acl/Makefile
154 xlators/system/posix-acl/src/Makefile
156 xlators/nfs/server/Makefile
157 xlators/nfs/server/src/Makefile
158 xlators/mgmt/Makefile
159 xlators/mgmt/glusterd/Makefile
160 xlators/mgmt/glusterd/src/Makefile
165 extras/init.d/Makefile
166 extras/init.d/glusterd.plist
167 extras/init.d/glusterd-Debian
168 extras/init.d/glusterd-Redhat
169 extras/init.d/glusterd-SuSE
170 extras/systemd/Makefile
171 extras/systemd/glusterd.service
172 extras/benchmarking/Makefile
173 extras/hook-scripts/Makefile
177 extras/LinuxRPM/Makefile
178 extras/geo-rep/Makefile
179 extras/hook-scripts/add-brick/Makefile
180 extras/hook-scripts/add-brick/pre/Makefile
181 extras/hook-scripts/add-brick/post/Makefile
182 extras/hook-scripts/start/Makefile
183 extras/hook-scripts/start/post/Makefile
184 extras/hook-scripts/set/Makefile
185 extras/hook-scripts/set/post/Makefile
186 extras/hook-scripts/stop/Makefile
187 extras/hook-scripts/stop/pre/Makefile
188 extras/hook-scripts/reset/Makefile
189 extras/hook-scripts/reset/post/Makefile
190 extras/hook-scripts/reset/pre/Makefile
191 contrib/fuse-util/Makefile
192 contrib/uuid/uuid_types.h
197 api/examples/Makefile
198 api/examples/__init__.py
199 api/examples/setup.py
200 geo-replication/Makefile
201 geo-replication/src/Makefile
202 geo-replication/syncdaemon/Makefile
211 AC_CHECK_PROG([RPCGEN], [rpcgen], [yes], [no])
213 if test "x$RPCGEN" = "xno"; then
214 AC_MSG_ERROR([`rpcgen` not found, glusterfs needs `rpcgen` exiting..])
217 # Initialize CFLAGS before usage
218 AC_ARG_ENABLE([debug],
219 AC_HELP_STRING([--enable-debug],
220 [Enable debug build options.]))
221 if test "x$enable_debug" = "xyes"; then
223 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
226 CFLAGS="${CFLAGS} -g -O2"
231 if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then
232 AC_MSG_ERROR([You need at least OS X 10.7 (Lion) to build Glusterfs])
234 # OSX version lesser than 9 has llvm/clang optimization issues which leads to various segfaults
235 if test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -lt 9; then
236 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
241 AC_ARG_WITH(pkgconfigdir,
242 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
243 [pkgconfigdir=$withval],
244 [pkgconfigdir='${libdir}/pkgconfig'])
245 AC_SUBST(pkgconfigdir)
247 AC_ARG_WITH(mountutildir,
248 [ --with-mountutildir=DIR mount helper utility in DIR @<:@/sbin@:>@],
249 [mountutildir=$withval],
250 [mountutildir='/sbin'])
251 AC_SUBST(mountutildir)
253 AC_ARG_WITH(systemddir,
254 [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
255 [systemddir=$withval],
256 [systemddir='/usr/lib/systemd/system'])
260 [ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
262 [initdir='/etc/init.d'])
265 AC_ARG_WITH(launchddir,
266 [ --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
267 [launchddir=$withval],
268 [launchddir='/Library/LaunchDaemons'])
272 [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
280 if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
281 AC_MSG_ERROR([Flex or lex required to build glusterfs.])
287 AC_CHECK_SIZEOF(short)
289 AC_CHECK_SIZEOF(long)
290 AC_CHECK_SIZEOF(long long)
291 SIZEOF_SHORT=$ac_cv_sizeof_short
292 SIZEOF_INT=$ac_cv_sizeof_int
293 SIZEOF_LONG=$ac_cv_sizeof_long
294 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
295 AC_SUBST(SIZEOF_SHORT)
297 AC_SUBST(SIZEOF_LONG)
298 AC_SUBST(SIZEOF_LONG_LONG)
302 if test "x${YACC}" = "xbyacc" -o "x${YACC}" = "xyacc" -o "x${YACC}" = "x"; then
303 AC_MSG_ERROR([GNU Bison required to build glusterfs.])
306 AC_CHECK_TOOL([LD],[ld])
308 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
310 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
312 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
314 AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
316 AC_CHECK_HEADERS([sys/xattr.h])
318 AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
320 AC_CHECK_HEADERS([sys/extattr.h])
322 AC_CHECK_HEADERS([openssl/md5.h])
324 AC_CHECK_HEADERS([linux/falloc.h])
326 AC_CHECK_HEADERS([libintl.h])
328 dnl Mac OS X does not have spinlocks
329 AC_CHECK_FUNC([pthread_spin_init], [have_spinlock=yes])
330 if test "x${have_spinlock}" = "xyes"; then
331 AC_DEFINE(HAVE_SPINLOCK, 1, [define if found spinlock])
333 AC_SUBST(HAVE_SPINLOCK)
335 dnl some os may not have GNU defined strnlen function
336 AC_CHECK_FUNC([strnlen], [have_strnlen=yes])
337 if test "x${have_strnlen}" = "xyes"; then
338 AC_DEFINE(HAVE_STRNLEN, 1, [define if found strnlen])
340 AC_SUBST(HAVE_STRNLEN)
343 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
344 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
346 if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
347 AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
350 dnl test umount2 function
351 AC_CHECK_FUNC([umount2], [have_umount2=yes])
353 if test "x${have_umount2}" = "xyes"; then
354 AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
358 AC_ARG_ENABLE([fuse-client],
359 AC_HELP_STRING([--disable-fuse-client],
360 [Do not build the fuse client. NOTE: you cannot mount glusterfs without the client]))
363 if test "x$enable_fuse_client" != "xno"; then
364 FUSE_CLIENT_SUBDIR=fuse
365 BUILD_FUSE_CLIENT="yes"
368 AC_ARG_ENABLE([bd-xlator],
369 AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
371 if test "x$enable_bd_xlator" != "xno"; then
372 AC_CHECK_LIB([lvm2app],
373 [lvm_init,lvm_lv_from_name],
377 if test "x$HAVE_BD_LIB" = "xyes"; then
378 # lvm_lv_from_name() has been made public with lvm2-2.02.79
381 [NEED_LVM_LV_FROM_NAME_DECL="no"],
382 [NEED_LVM_LV_FROM_NAME_DECL="yes"],
383 [[#include <lvm2app.h>]])
387 if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
388 echo "BD xlator requested but required lvm2 development library not found."
393 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
395 AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
397 if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
398 AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
399 was not found in the lvm2app.h header, but can be linked])
403 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
405 # start encryption/crypt section
407 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
409 AC_ARG_ENABLE([crypt-xlator],
410 AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
412 if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
413 AC_MSG_ERROR([Encryption xlator requires OpenSSL with cmac.h])
416 BUILD_CRYPT_XLATOR=no
417 if test "x$enable_crypt_xlator" != "xno" -a "x$have_cmac_h" = "xyes"; then
418 BUILD_CRYPT_XLATOR=yes
419 AC_DEFINE(HAVE_CRYPT_XLATOR, 1, [enable building crypt encryption xlator])
422 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
424 AC_SUBST(FUSE_CLIENT_SUBDIR)
429 AC_ARG_ENABLE([fusermount],
430 AC_HELP_STRING([--disable-fusermount],
431 [Use system's fusermount]))
433 BUILD_FUSERMOUNT="yes"
434 if test "x$enable_fusermount" = "xno"; then
435 BUILD_FUSERMOUNT="no"
437 AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
438 FUSERMOUNT_SUBDIR="contrib/fuse-util"
441 AC_SUBST(FUSERMOUNT_SUBDIR)
442 #end FUSERMOUNT section
446 AC_ARG_ENABLE([qemu-block],
447 AC_HELP_STRING([--enable-qemu-block],
448 [Build QEMU Block formats translator]))
450 if test "x$enable_qemu_block" != "xno"; then
451 PKG_CHECK_MODULES([GLIB], [glib-2.0],
456 if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then
457 echo "QEMU Block formats translator requires libglib-2.0, but missing."
462 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
464 AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
465 Block translator enabled])
469 # end QEMU_BLOCK section
472 AC_ARG_ENABLE([epoll],
473 AC_HELP_STRING([--disable-epoll],
474 [Use poll instead of epoll.]))
477 if test "x$enable_epoll" != "xno"; then
478 AC_CHECK_HEADERS([sys/epoll.h],
486 AC_ARG_ENABLE([ibverbs],
487 AC_HELP_STRING([--disable-ibverbs],
488 [Do not build the ibverbs transport]))
490 if test "x$enable_ibverbs" != "xno"; then
491 AC_CHECK_LIB([ibverbs],
492 [ibv_get_device_list],
493 [HAVE_LIBIBVERBS="yes"],
494 [HAVE_LIBIBVERBS="no"])
495 AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"])
498 if test "x$enable_ibverbs" = "xyes"; then
499 if test "x$HAVE_LIBIBVERBS" = "xno"; then
500 echo "ibverbs-transport requested, but libibverbs is not present."
504 if test "x$HAVE_RDMACM" = "xno"; then
505 echo "ibverbs-transport requested, but librdmacm is not present."
512 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
513 IBVERBS_SUBDIR=ib-verbs
519 AC_SUBST(IBVERBS_SUBDIR)
520 AC_SUBST(RDMA_SUBDIR)
521 # end IBVERBS section
525 AC_ARG_ENABLE([georeplication],
526 AC_HELP_STRING([--disable-georeplication],
527 [Do not install georeplication components]))
538 #disabling geo replication for non-linux platforms
539 enable_georeplication=no
543 if test "x$enable_georeplication" != "xno"; then
544 SYNCDAEMON_SUBDIR=geo-replication
547 BUILD_SYNCDAEMON="yes"
548 AM_PATH_PYTHON([2.4])
549 echo -n "checking if python is python 2.x... "
550 if echo $PYTHON_VERSION | grep ^2; then
554 AC_MSG_ERROR([only python 2.x is supported])
556 echo -n "checking if python has ctypes support... "
557 if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
561 AC_MSG_ERROR([python does not have ctypes support])
564 AC_SUBST(SYNCDAEMON_COMPILE)
565 AC_SUBST(SYNCDAEMON_SUBDIR)
566 # end SYNCDAEMON section
568 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
569 echo -n "checking if libz is present... "
571 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],
572 [echo "yes (features requiring zlib enabled)" AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])],
575 AC_SUBST(LIBZ_CFLAGS)
577 # end CDC xlator secion
579 # check for systemtap/dtrace
581 AC_MSG_CHECKING([whether to include systemtap tracing support])
582 AC_ARG_ENABLE([systemtap],
583 [AS_HELP_STRING([--enable-systemtap],
584 [Enable inclusion of systemtap trace support])],
585 [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
587 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
588 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
590 if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
591 AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
592 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
596 if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
597 if test "x${DTRACE}" = "xno"; then
598 AC_MSG_ERROR([dtrace not found])
599 elif test "$x{SDT_H_FOUND}" = "xno"; then
600 AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
604 if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
605 AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
606 AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
609 # end of systemtap/dtrace
612 AC_ARG_ENABLE([xml-output],
613 AC_HELP_STRING([--disable-xml-output],
614 [Disable the xml output]))
615 BUILD_XML_OUTPUT="yes"
616 if test "x$enable_xml_output" != "xno"; then
617 #check if libxml is present if so enable HAVE_LIB_XML
618 m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes])
619 if test "x${no_xml}" = "x"; then
620 AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.])
622 if test "x$enable_georeplication" != "xno"; then
623 AC_MSG_ERROR([libxml2 devel libraries not found])
625 AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
626 BUILD_XML_OUTPUT="no"
631 if test "x$enable_georeplication" != "xno"; then
632 AC_MSG_ERROR([geo-replication requires xml output])
634 BUILD_XML_OUTPUT="no"
638 dnl FreeBSD > 5 has execinfo as a Ported library for giving a workaround
639 dnl solution to GCC backtrace functionality
641 AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes],
642 AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace=yes]))
643 dnl AC_MSG_ERROR([libexecinfo not found libexecinfo required.])))
645 if test "x${have_backtrace}" = "xyes"; then
646 AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace])
648 AC_SUBST(HAVE_BACKTRACE)
650 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
651 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
652 if test "x${have_malloc_stats}" = "xyes"; then
653 AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
655 AC_SUBST(HAVE_MALLOC_STATS)
657 dnl Linux, Solaris, Cygwin
658 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
660 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
663 CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063"
666 AC_CHECK_FUNC([linkat], [have_linkat=yes])
667 if test "x${have_linkat}" = "xyes"; then
668 AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
670 AC_SUBST(HAVE_LINKAT)
672 dnl check for Monotonic clock
673 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])))
676 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
677 AC_CONFIG_SUBDIRS(contrib/argp-standalone)
679 BUILD_ARGP_STANDALONE=no
680 if test "x${ac_cv_header_argp_h}" = "xno"; then
681 BUILD_ARGP_STANDALONE=yes
682 ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/contrib/argp-standalone'
683 ARGP_STANDALONE_LDADD='${top_builddir}/contrib/argp-standalone/libargp.a'
684 ARGP_STANDALONE_DIR='${top_builddir}/contrib/argp-standalone'
687 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
688 AC_SUBST(ARGP_STANDALONE_LDADD)
689 AC_SUBST(ARGP_STANDALONE_DIR)
691 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
693 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
694 if test "x${have_llistxattr}" = "xyes"; then
695 AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
698 AC_CHECK_FUNC([fdatasync], [have_fdatasync=no])
699 if test "x${have_fdatasync}" = "xyes"; then
700 AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
703 AC_CHECK_FUNC([fallocate], [have_fallocate=yes])
704 if test "x${have_fallocate}" = "xyes"; then
705 AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists])
708 AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes])
709 if test "x${have_posix_fallocate}" = "xyes"; then
710 AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists])
713 # Check the distribution where you are compiling glusterfs on
716 AC_CHECK_FILE([/etc/debian_version])
717 AC_CHECK_FILE([/etc/SuSE-release])
718 AC_CHECK_FILE([/etc/redhat-release])
720 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
721 GF_DISTRIBUTION=Debian
723 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
726 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
727 GF_DISTRIBUTION=Redhat
730 AC_SUBST(GF_DISTRIBUTION)
733 GF_LDFLAGS="-rdynamic"
735 dnl check for gcc -Werror=format-security
736 saved_GF_CFLAGS="-Wformat -Werror=format-security"
737 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
738 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
739 echo $cc_werror_format_security
740 if test "x$cc_werror_format_security" = "xno"; then
741 GF_CFLAGS="$GF_CFLAGS"
743 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
746 dnl check for gcc -Werror=implicit-function-declaration
747 saved_GF_CFLAGS=$GF_CFLAGS
748 GF_CFLAGS="-Werror=implicit-function-declaration"
749 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
750 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
751 echo $cc_werror_implicit
752 if test "x$cc_werror_implicit" = "xno"; then
753 GF_CFLAGS="$saved_GF_CFLAGS"
755 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
758 dnl clang is mostly GCC-compatible, but its version is much lower,
759 dnl so we have to check for it.
760 AC_MSG_CHECKING([if compiling with clang])
763 [AC_LANG_PROGRAM([], [[
768 [CLANG=yes], [CLANG=no])
770 AC_MSG_RESULT([$CLANG])
772 if test "x$CLANG" = "xyes"; then
773 GF_COMPILER_FLAGS="-Wno-gnu -Wno-unknown-pragmas -Wno-deprecated-declarations -Wno-enum-conversion"
779 GF_HOST_OS="GF_LINUX_HOST_OS"
780 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
781 GF_LDADD="${ARGP_STANDALONE_LDADD}"
782 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
785 GF_HOST_OS="GF_SOLARIS_HOST_OS"
786 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
788 GF_LDADD="${ARGP_STANDALONE_LDADD}"
789 GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
791 FUSE_CLIENT_SUBDIR=""
794 GF_HOST_OS="GF_BSD_HOST_OS"
795 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
796 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
797 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
798 GF_LDADD="${ARGP_STANDALONE_LDADD}"
799 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
800 GF_GLUSTERFS_LIBS="-lexecinfo"
802 GF_FUSE_LDADD="-lperfuse"
803 BUILD_FUSE_CLIENT=yes
807 GF_HOST_OS="GF_BSD_HOST_OS"
808 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
809 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
810 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
811 GF_LDADD="${ARGP_STANDALONE_LDADD}"
812 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
813 GF_GLUSTERFS_LIBS="-lexecinfo"
818 GF_HOST_OS="GF_DARWIN_HOST_OS"
820 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -D_XOPEN_SOURCE "
821 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
822 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
823 GF_LDADD="${ARGP_STANDALONE_LDADD}"
825 GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
826 BUILD_FUSERMOUNT="no"
827 BUILD_QEMU_BLOCK="no"
832 # enable/disable QEMU
833 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
836 # enable debug section
837 AC_ARG_ENABLE([debug],
838 AC_HELP_STRING([--enable-debug],
839 [Enable debug build options.]))
843 AC_ARG_ENABLE([syslog],
844 AC_HELP_STRING([--disable-syslog],
845 [Disable syslog for logging]))
848 if test "x$enable_syslog" != "xno"; then
849 AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
853 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
857 AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
858 AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
859 AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
861 if test "x$RLLIBS" != "x"; then
862 if test "x$RL_UNDO" == "xyes"; then
863 AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
866 BUILD_READLINE="no (present but missing undo)"
872 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
874 if test "x$LIBAIO" != "x"; then
875 AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
885 if echo $PYTHON_VERSION | grep ^2; then
889 # Save flags before testing python
891 saved_CPPFLAGS=$CPPFLAGS
892 saved_LDFLAGS=$LDFLAGS
896 CFLAGS="`${PYTHON}-config --cflags`"
898 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
901 CFLAGS="`${PYTHON}-config --cflags`"
903 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
907 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
908 AC_ARG_ENABLE([glupy],
909 AS_HELP_STRING([--enable-glupy],
911 case x$enable_glupy in
913 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
915 PYTHONDEV_CFLAGS="$CFLAGS"
916 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
917 PYTHONDEV_LDFLAGS="$LDFLAGS"
918 AC_SUBST(PYTHONDEV_CFLAGS)
919 AC_SUBST(PYTHONDEV_CPPFLAGS)
920 AC_SUBST(PYTHONDEV_LDFLAGS)
922 AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
928 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
930 PYTHONDEV_CFLAGS="$CFLAGS"
931 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
932 PYTHONDEV_LDFLAGS="$LDFLAGS"
933 AC_SUBST(PYTHONDEV_CFLAGS)
934 AC_SUBST(PYTHONDEV_CPPFLAGS)
935 AC_SUBST(PYTHONDEV_LDFLAGS)
938 ---------------------------------------------------------------------------------
939 cannot build glupy. python 2.x and python-devel/python-dev package are required.
940 ---------------------------------------------------------------------------------])
946 CPPFLAGS=$saved_CPPFLAGS
947 LDFLAGS=$saved_LDFLAGS
955 if test "x$BUILD_GLUPY" = "xyes"; then
956 BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
957 BUILD_PYTHON_LIB=python$PYTHON_VERSION
959 GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
960 GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
961 echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
962 AC_SUBST(BUILD_PYTHON_INC)
963 AC_SUBST(BUILD_PYTHON_LIB)
964 AC_SUBST(GLUPY_SUBDIR)
965 AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
966 AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
971 # end enable debug section
974 AC_SUBST([GF_GLUSTERFS_LIBS])
978 AC_SUBST(GF_FUSE_LDADD)
979 AC_SUBST(GF_FUSE_CFLAGS)
982 AC_SUBST(AM_MAKEFLAGS)
983 AC_SUBST(AM_LIBTOOLFLAGS)
985 CONTRIBDIR='$(top_srcdir)/contrib'
988 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
989 GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
990 GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
991 AC_SUBST([GF_CPPFLAGS])
993 AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS")
995 AM_CONDITIONAL([GF_INSTALL_VAR_LIB_GLUSTERD], test ! -d ${localstatedir}/lib/glusterd && test -d ${sysconfdir}/glusterd )
997 dnl pkg-config versioning
998 GFAPI_VERSION="6.0.0"
999 LIBGFCHANGELOG_VERSION="0.0.1"
1000 AC_SUBST(GFAPI_VERSION)
1001 AC_SUBST(LIBGFCHANGELOG_VERSION)
1003 dnl libtool versioning
1004 LIBGFXDR_LT_VERSION="0:1:0"
1005 LIBGFRPC_LT_VERSION="0:1:0"
1006 LIBGLUSTERFS_LT_VERSION="0:1:0"
1007 LIBGFCHANGELOG_LT_VERSION="0:1:0"
1008 GFAPI_LT_VERSION="6:0:0"
1009 AC_SUBST(LIBGFXDR_LT_VERSION)
1010 AC_SUBST(LIBGFRPC_LT_VERSION)
1011 AC_SUBST(LIBGLUSTERFS_LT_VERSION)
1012 AC_SUBST(LIBGFCHANGELOG_LT_VERSION)
1013 AC_SUBST(GFAPI_LT_VERSION)
1018 echo "GlusterFS configure summary"
1019 echo "==========================="
1020 echo "FUSE client : $BUILD_FUSE_CLIENT"
1021 echo "Infiniband verbs : $BUILD_IBVERBS"
1022 echo "epoll IO multiplex : $BUILD_EPOLL"
1023 echo "argp-standalone : $BUILD_ARGP_STANDALONE"
1024 echo "fusermount : $BUILD_FUSERMOUNT"
1025 echo "readline : $BUILD_READLINE"
1026 echo "georeplication : $BUILD_SYNCDAEMON"
1027 echo "Linux-AIO : $BUILD_LIBAIO"
1028 echo "Enable Debug : $BUILD_DEBUG"
1029 echo "systemtap : $BUILD_SYSTEMTAP"
1030 echo "Block Device xlator : $BUILD_BD_XLATOR"
1031 echo "glupy : $BUILD_GLUPY"
1032 echo "Use syslog : $USE_SYSLOG"
1033 echo "XML output : $BUILD_XML_OUTPUT"
1034 echo "QEMU Block formats : $BUILD_QEMU_BLOCK"
1035 echo "Encryption xlator : $BUILD_CRYPT_XLATOR"