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"
229 AC_ARG_WITH(pkgconfigdir,
230 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
231 [pkgconfigdir=$withval],
232 [pkgconfigdir='${libdir}/pkgconfig'])
233 AC_SUBST(pkgconfigdir)
235 AC_ARG_WITH(mountutildir,
236 [ --with-mountutildir=DIR mount helper utility in DIR @<:@/sbin@:>@],
237 [mountutildir=$withval],
238 [mountutildir='/sbin'])
239 AC_SUBST(mountutildir)
241 AC_ARG_WITH(systemddir,
242 [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
243 [systemddir=$withval],
244 [systemddir='/usr/lib/systemd/system'])
248 [ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
250 [initdir='/etc/init.d'])
253 AC_ARG_WITH(launchddir,
254 [ --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
255 [launchddir=$withval],
256 [launchddir='/Library/LaunchDaemons'])
260 [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
268 if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
269 AC_MSG_ERROR([Flex or lex required to build glusterfs.])
275 AC_CHECK_SIZEOF(short)
277 AC_CHECK_SIZEOF(long)
278 AC_CHECK_SIZEOF(long long)
279 SIZEOF_SHORT=$ac_cv_sizeof_short
280 SIZEOF_INT=$ac_cv_sizeof_int
281 SIZEOF_LONG=$ac_cv_sizeof_long
282 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
283 AC_SUBST(SIZEOF_SHORT)
285 AC_SUBST(SIZEOF_LONG)
286 AC_SUBST(SIZEOF_LONG_LONG)
290 if test "x${YACC}" = "xbyacc" -o "x${YACC}" = "xyacc" -o "x${YACC}" = "x"; then
291 AC_MSG_ERROR([GNU Bison required to build glusterfs.])
294 AC_CHECK_TOOL([LD],[ld])
296 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
298 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
300 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
302 AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
304 AC_CHECK_HEADERS([sys/xattr.h])
306 AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
308 AC_CHECK_HEADERS([sys/extattr.h])
310 AC_CHECK_HEADERS([openssl/md5.h])
312 AC_CHECK_HEADERS([linux/falloc.h])
314 AC_CHECK_HEADERS([libintl.h])
318 if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then
319 AC_MSG_ERROR([You need at least OS X 10.7 (Lion) to build Glusterfs])
324 dnl Mac OS X does not have spinlocks
325 AC_CHECK_FUNC([pthread_spin_init], [have_spinlock=yes])
326 if test "x${have_spinlock}" = "xyes"; then
327 AC_DEFINE(HAVE_SPINLOCK, 1, [define if found spinlock])
329 AC_SUBST(HAVE_SPINLOCK)
331 dnl some os may not have GNU defined strnlen function
332 AC_CHECK_FUNC([strnlen], [have_strnlen=yes])
333 if test "x${have_strnlen}" = "xyes"; then
334 AC_DEFINE(HAVE_STRNLEN, 1, [define if found strnlen])
336 AC_SUBST(HAVE_STRNLEN)
339 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
340 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
342 if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
343 AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
346 dnl test umount2 function
347 AC_CHECK_FUNC([umount2], [have_umount2=yes])
349 if test "x${have_umount2}" = "xyes"; then
350 AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
354 AC_ARG_ENABLE([fuse-client],
355 AC_HELP_STRING([--disable-fuse-client],
356 [Do not build the fuse client. NOTE: you cannot mount glusterfs without the client]))
359 if test "x$enable_fuse_client" != "xno"; then
360 FUSE_CLIENT_SUBDIR=fuse
361 BUILD_FUSE_CLIENT="yes"
364 AC_ARG_ENABLE([bd-xlator],
365 AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
367 if test "x$enable_bd_xlator" != "xno"; then
368 AC_CHECK_LIB([lvm2app],
369 [lvm_init,lvm_lv_from_name],
373 if test "x$HAVE_BD_LIB" = "xyes"; then
374 # lvm_lv_from_name() has been made public with lvm2-2.02.79
377 [NEED_LVM_LV_FROM_NAME_DECL="no"],
378 [NEED_LVM_LV_FROM_NAME_DECL="yes"],
379 [[#include <lvm2app.h>]])
383 if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
384 echo "BD xlator requested but required lvm2 development library not found."
389 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
391 AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
393 if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
394 AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
395 was not found in the lvm2app.h header, but can be linked])
399 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
401 # start encryption/crypt section
403 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
405 AC_ARG_ENABLE([crypt-xlator],
406 AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
408 if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
409 AC_MSG_ERROR([Encryption xlator requires OpenSSL with cmac.h])
412 BUILD_CRYPT_XLATOR=no
413 if test "x$enable_crypt_xlator" != "xno" -a "x$have_cmac_h" = "xyes"; then
414 BUILD_CRYPT_XLATOR=yes
415 AC_DEFINE(HAVE_CRYPT_XLATOR, 1, [enable building crypt encryption xlator])
418 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
420 AC_SUBST(FUSE_CLIENT_SUBDIR)
425 AC_ARG_ENABLE([fusermount],
426 AC_HELP_STRING([--disable-fusermount],
427 [Use system's fusermount]))
429 BUILD_FUSERMOUNT="yes"
430 if test "x$enable_fusermount" = "xno"; then
431 BUILD_FUSERMOUNT="no"
433 AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
434 FUSERMOUNT_SUBDIR="contrib/fuse-util"
437 AC_SUBST(FUSERMOUNT_SUBDIR)
438 #end FUSERMOUNT section
442 AC_ARG_ENABLE([qemu-block],
443 AC_HELP_STRING([--enable-qemu-block],
444 [Build QEMU Block formats translator]))
446 if test "x$enable_qemu_block" != "xno"; then
447 PKG_CHECK_MODULES([GLIB], [glib-2.0],
452 if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then
453 echo "QEMU Block formats translator requires libglib-2.0, but missing."
458 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
460 AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
461 Block translator enabled])
465 # end QEMU_BLOCK section
468 AC_ARG_ENABLE([epoll],
469 AC_HELP_STRING([--disable-epoll],
470 [Use poll instead of epoll.]))
473 if test "x$enable_epoll" != "xno"; then
474 AC_CHECK_HEADERS([sys/epoll.h],
482 AC_ARG_ENABLE([ibverbs],
483 AC_HELP_STRING([--disable-ibverbs],
484 [Do not build the ibverbs transport]))
486 if test "x$enable_ibverbs" != "xno"; then
487 AC_CHECK_LIB([ibverbs],
488 [ibv_get_device_list],
489 [HAVE_LIBIBVERBS="yes"],
490 [HAVE_LIBIBVERBS="no"])
491 AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"])
494 if test "x$enable_ibverbs" = "xyes"; then
495 if test "x$HAVE_LIBIBVERBS" = "xno"; then
496 echo "ibverbs-transport requested, but libibverbs is not present."
500 if test "x$HAVE_RDMACM" = "xno"; then
501 echo "ibverbs-transport requested, but librdmacm is not present."
508 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
509 IBVERBS_SUBDIR=ib-verbs
515 AC_SUBST(IBVERBS_SUBDIR)
516 AC_SUBST(RDMA_SUBDIR)
517 # end IBVERBS section
521 AC_ARG_ENABLE([georeplication],
522 AC_HELP_STRING([--disable-georeplication],
523 [Do not install georeplication components]))
534 #disabling geo replication for non-linux platforms
535 enable_georeplication=no
539 if test "x$enable_georeplication" != "xno"; then
540 SYNCDAEMON_SUBDIR=geo-replication
543 BUILD_SYNCDAEMON="yes"
544 AM_PATH_PYTHON([2.4])
545 echo -n "checking if python is python 2.x... "
546 if echo $PYTHON_VERSION | grep ^2; then
550 AC_MSG_ERROR([only python 2.x is supported])
552 echo -n "checking if python has ctypes support... "
553 if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
557 AC_MSG_ERROR([python does not have ctypes support])
560 AC_SUBST(SYNCDAEMON_COMPILE)
561 AC_SUBST(SYNCDAEMON_SUBDIR)
562 # end SYNCDAEMON section
564 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
565 echo -n "checking if libz is present... "
567 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],
568 [echo "yes (features requiring zlib enabled)" AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])],
571 AC_SUBST(LIBZ_CFLAGS)
573 # end CDC xlator secion
575 # check for systemtap/dtrace
577 AC_MSG_CHECKING([whether to include systemtap tracing support])
578 AC_ARG_ENABLE([systemtap],
579 [AS_HELP_STRING([--enable-systemtap],
580 [Enable inclusion of systemtap trace support])],
581 [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
583 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
584 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
586 if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
587 AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
588 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
592 if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
593 if test "x${DTRACE}" = "xno"; then
594 AC_MSG_ERROR([dtrace not found])
595 elif test "$x{SDT_H_FOUND}" = "xno"; then
596 AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
600 if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
601 AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
602 AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
605 # end of systemtap/dtrace
608 AC_ARG_ENABLE([xml-output],
609 AC_HELP_STRING([--disable-xml-output],
610 [Disable the xml output]))
611 BUILD_XML_OUTPUT="yes"
612 if test "x$enable_xml_output" != "xno"; then
613 #check if libxml is present if so enable HAVE_LIB_XML
614 m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes])
615 if test "x${no_xml}" = "x"; then
616 AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.])
618 if test "x$enable_georeplication" != "xno"; then
619 AC_MSG_ERROR([libxml2 devel libraries not found])
621 AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
622 BUILD_XML_OUTPUT="no"
627 if test "x$enable_georeplication" != "xno"; then
628 AC_MSG_ERROR([geo-replication requires xml output])
630 BUILD_XML_OUTPUT="no"
634 dnl FreeBSD > 5 has execinfo as a Ported library for giving a workaround
635 dnl solution to GCC backtrace functionality
637 AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes],
638 AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace=yes]))
639 dnl AC_MSG_ERROR([libexecinfo not found libexecinfo required.])))
641 if test "x${have_backtrace}" = "xyes"; then
642 AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace])
644 AC_SUBST(HAVE_BACKTRACE)
646 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
647 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
648 if test "x${have_malloc_stats}" = "xyes"; then
649 AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
651 AC_SUBST(HAVE_MALLOC_STATS)
653 dnl Linux, Solaris, Cygwin
654 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
656 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
659 CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063"
662 AC_CHECK_FUNC([linkat], [have_linkat=yes])
663 if test "x${have_linkat}" = "xyes"; then
664 AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
666 AC_SUBST(HAVE_LINKAT)
668 dnl check for Monotonic clock
669 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])))
672 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
673 AC_CONFIG_SUBDIRS(contrib/argp-standalone)
675 BUILD_ARGP_STANDALONE=no
676 if test "x${ac_cv_header_argp_h}" = "xno"; then
677 BUILD_ARGP_STANDALONE=yes
678 ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/contrib/argp-standalone'
679 ARGP_STANDALONE_LDADD='${top_builddir}/contrib/argp-standalone/libargp.a'
680 ARGP_STANDALONE_DIR='${top_builddir}/contrib/argp-standalone'
683 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
684 AC_SUBST(ARGP_STANDALONE_LDADD)
685 AC_SUBST(ARGP_STANDALONE_DIR)
687 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
689 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
690 if test "x${have_llistxattr}" = "xyes"; then
691 AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
694 AC_CHECK_FUNC([fdatasync], [have_fdatasync=no])
695 if test "x${have_fdatasync}" = "xyes"; then
696 AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
699 AC_CHECK_FUNC([fallocate], [have_fallocate=yes])
700 if test "x${have_fallocate}" = "xyes"; then
701 AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists])
704 AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes])
705 if test "x${have_posix_fallocate}" = "xyes"; then
706 AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists])
709 # Check the distribution where you are compiling glusterfs on
712 AC_CHECK_FILE([/etc/debian_version])
713 AC_CHECK_FILE([/etc/SuSE-release])
714 AC_CHECK_FILE([/etc/redhat-release])
716 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
717 GF_DISTRIBUTION=Debian
719 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
722 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
723 GF_DISTRIBUTION=Redhat
726 AC_SUBST(GF_DISTRIBUTION)
729 GF_LDFLAGS="-rdynamic"
731 dnl check for gcc -Werror=format-security
732 saved_GF_CFLAGS="-Wformat -Werror=format-security"
733 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
735 echo $cc_werror_format_security
736 if test "x$cc_werror_format_security" = "xno"; then
737 GF_CFLAGS="$GF_CFLAGS"
739 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
742 dnl check for gcc -Werror=implicit-function-declaration
743 saved_GF_CFLAGS=$GF_CFLAGS
744 GF_CFLAGS="-Werror=implicit-function-declaration"
745 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
747 echo $cc_werror_implicit
748 if test "x$cc_werror_implicit" = "xno"; then
749 GF_CFLAGS="$saved_GF_CFLAGS"
751 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
754 dnl clang is mostly GCC-compatible, but its version is much lower,
755 dnl so we have to check for it.
756 AC_MSG_CHECKING([if compiling with clang])
759 [AC_LANG_PROGRAM([], [[
764 [CLANG=yes], [CLANG=no])
766 AC_MSG_RESULT([$CLANG])
768 if test "x$CLANG" = "xyes"; then
769 GF_COMPILER_FLAGS="-Wno-gnu -Wno-unknown-pragmas -Wno-deprecated-declarations -Wno-enum-conversion"
775 GF_HOST_OS="GF_LINUX_HOST_OS"
776 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
777 GF_LDADD="${ARGP_STANDALONE_LDADD}"
778 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
781 GF_HOST_OS="GF_SOLARIS_HOST_OS"
782 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
784 GF_LDADD="${ARGP_STANDALONE_LDADD}"
785 GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
787 FUSE_CLIENT_SUBDIR=""
790 GF_HOST_OS="GF_BSD_HOST_OS"
791 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
792 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
793 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
794 GF_LDADD="${ARGP_STANDALONE_LDADD}"
795 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
796 GF_GLUSTERFS_LIBS="-lexecinfo"
798 GF_FUSE_LDADD="-lperfuse"
799 BUILD_FUSE_CLIENT=yes
803 GF_HOST_OS="GF_BSD_HOST_OS"
804 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
805 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
806 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
807 GF_LDADD="${ARGP_STANDALONE_LDADD}"
808 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
809 GF_GLUSTERFS_LIBS="-lexecinfo"
814 GF_HOST_OS="GF_DARWIN_HOST_OS"
816 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -D_XOPEN_SOURCE "
817 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
818 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
819 GF_LDADD="${ARGP_STANDALONE_LDADD}"
821 GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
822 BUILD_FUSERMOUNT="no"
823 BUILD_QEMU_BLOCK="no"
828 # enable/disable QEMU
829 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
832 # enable debug section
833 AC_ARG_ENABLE([debug],
834 AC_HELP_STRING([--enable-debug],
835 [Enable debug build options.]))
839 AC_ARG_ENABLE([syslog],
840 AC_HELP_STRING([--disable-syslog],
841 [Disable syslog for logging]))
844 if test "x$enable_syslog" != "xno"; then
845 AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
849 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
853 AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
854 AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
855 AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
857 if test "x$RLLIBS" != "x"; then
858 if test "x$RL_UNDO" == "xyes"; then
859 AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
862 BUILD_READLINE="no (present but missing undo)"
868 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
870 if test "x$LIBAIO" != "x"; then
871 AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
881 if echo $PYTHON_VERSION | grep ^2; then
885 # Save flags before testing python
887 saved_CPPFLAGS=$CPPFLAGS
888 saved_LDFLAGS=$LDFLAGS
892 CFLAGS="`${PYTHON}-config --cflags`"
894 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
897 CFLAGS="`${PYTHON}-config --cflags`"
899 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
903 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
904 AC_ARG_ENABLE([glupy],
905 AS_HELP_STRING([--enable-glupy],
907 case x$enable_glupy in
909 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
911 PYTHONDEV_CFLAGS="$CFLAGS"
912 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
913 PYTHONDEV_LDFLAGS="$LDFLAGS"
914 AC_SUBST(PYTHONDEV_CFLAGS)
915 AC_SUBST(PYTHONDEV_CPPFLAGS)
916 AC_SUBST(PYTHONDEV_LDFLAGS)
918 AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
924 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
926 PYTHONDEV_CFLAGS="$CFLAGS"
927 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
928 PYTHONDEV_LDFLAGS="$LDFLAGS"
929 AC_SUBST(PYTHONDEV_CFLAGS)
930 AC_SUBST(PYTHONDEV_CPPFLAGS)
931 AC_SUBST(PYTHONDEV_LDFLAGS)
934 ---------------------------------------------------------------------------------
935 cannot build glupy. python 2.x and python-devel/python-dev package are required.
936 ---------------------------------------------------------------------------------])
942 CPPFLAGS=$saved_CPPFLAGS
943 LDFLAGS=$saved_LDFLAGS
951 if test "x$BUILD_GLUPY" = "xyes"; then
952 BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
953 BUILD_PYTHON_LIB=python$PYTHON_VERSION
955 GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
956 GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
957 echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
958 AC_SUBST(BUILD_PYTHON_INC)
959 AC_SUBST(BUILD_PYTHON_LIB)
960 AC_SUBST(GLUPY_SUBDIR)
961 AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
962 AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
967 # end enable debug section
970 AC_SUBST([GF_GLUSTERFS_LIBS])
974 AC_SUBST(GF_FUSE_LDADD)
975 AC_SUBST(GF_FUSE_CFLAGS)
978 AC_SUBST(AM_MAKEFLAGS)
979 AC_SUBST(AM_LIBTOOLFLAGS)
981 CONTRIBDIR='$(top_srcdir)/contrib'
984 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
985 GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
986 GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
987 AC_SUBST([GF_CPPFLAGS])
989 AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS")
991 AM_CONDITIONAL([GF_INSTALL_VAR_LIB_GLUSTERD], test ! -d ${localstatedir}/lib/glusterd && test -d ${sysconfdir}/glusterd )
993 dnl pkg-config versioning
994 GFAPI_VERSION="6.0.0"
995 LIBGFCHANGELOG_VERSION="0.0.1"
996 AC_SUBST(GFAPI_VERSION)
997 AC_SUBST(LIBGFCHANGELOG_VERSION)
999 dnl libtool versioning
1000 LIBGFXDR_LT_VERSION="0:1:0"
1001 LIBGFRPC_LT_VERSION="0:1:0"
1002 LIBGLUSTERFS_LT_VERSION="0:1:0"
1003 LIBGFCHANGELOG_LT_VERSION="0:1:0"
1004 GFAPI_LT_VERSION="6:0:0"
1005 AC_SUBST(LIBGFXDR_LT_VERSION)
1006 AC_SUBST(LIBGFRPC_LT_VERSION)
1007 AC_SUBST(LIBGLUSTERFS_LT_VERSION)
1008 AC_SUBST(LIBGFCHANGELOG_LT_VERSION)
1009 AC_SUBST(GFAPI_LT_VERSION)
1014 echo "GlusterFS configure summary"
1015 echo "==========================="
1016 echo "FUSE client : $BUILD_FUSE_CLIENT"
1017 echo "Infiniband verbs : $BUILD_IBVERBS"
1018 echo "epoll IO multiplex : $BUILD_EPOLL"
1019 echo "argp-standalone : $BUILD_ARGP_STANDALONE"
1020 echo "fusermount : $BUILD_FUSERMOUNT"
1021 echo "readline : $BUILD_READLINE"
1022 echo "georeplication : $BUILD_SYNCDAEMON"
1023 echo "Linux-AIO : $BUILD_LIBAIO"
1024 echo "Enable Debug : $BUILD_DEBUG"
1025 echo "systemtap : $BUILD_SYSTEMTAP"
1026 echo "Block Device xlator : $BUILD_BD_XLATOR"
1027 echo "glupy : $BUILD_GLUPY"
1028 echo "Use syslog : $USE_SYSLOG"
1029 echo "XML output : $BUILD_XML_OUTPUT"
1030 echo "QEMU Block formats : $BUILD_QEMU_BLOCK"
1031 echo "Encryption xlator : $BUILD_CRYPT_XLATOR"