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/features/snapview-server/Makefile
143 xlators/features/snapview-server/src/Makefile
144 xlators/features/snapview-client/Makefile
145 xlators/features/snapview-client/src/Makefile
146 xlators/playground/Makefile
147 xlators/playground/template/Makefile
148 xlators/playground/template/src/Makefile
149 xlators/encryption/Makefile
150 xlators/encryption/rot-13/Makefile
151 xlators/encryption/rot-13/src/Makefile
152 xlators/encryption/crypt/Makefile
153 xlators/encryption/crypt/src/Makefile
154 xlators/features/qemu-block/Makefile
155 xlators/features/qemu-block/src/Makefile
156 xlators/system/Makefile
157 xlators/system/posix-acl/Makefile
158 xlators/system/posix-acl/src/Makefile
160 xlators/nfs/server/Makefile
161 xlators/nfs/server/src/Makefile
162 xlators/mgmt/Makefile
163 xlators/mgmt/glusterd/Makefile
164 xlators/mgmt/glusterd/src/Makefile
169 extras/init.d/Makefile
170 extras/init.d/glusterd.plist
171 extras/init.d/glusterd-Debian
172 extras/init.d/glusterd-Redhat
173 extras/init.d/glusterd-SuSE
174 extras/systemd/Makefile
175 extras/systemd/glusterd.service
176 extras/benchmarking/Makefile
177 extras/hook-scripts/Makefile
181 extras/LinuxRPM/Makefile
182 extras/geo-rep/Makefile
183 extras/hook-scripts/add-brick/Makefile
184 extras/hook-scripts/add-brick/pre/Makefile
185 extras/hook-scripts/add-brick/post/Makefile
186 extras/hook-scripts/start/Makefile
187 extras/hook-scripts/start/post/Makefile
188 extras/hook-scripts/set/Makefile
189 extras/hook-scripts/set/post/Makefile
190 extras/hook-scripts/stop/Makefile
191 extras/hook-scripts/stop/pre/Makefile
192 extras/hook-scripts/reset/Makefile
193 extras/hook-scripts/reset/post/Makefile
194 extras/hook-scripts/reset/pre/Makefile
195 contrib/fuse-util/Makefile
196 contrib/uuid/uuid_types.h
201 api/examples/Makefile
202 api/examples/__init__.py
203 api/examples/setup.py
204 geo-replication/Makefile
205 geo-replication/src/Makefile
206 geo-replication/syncdaemon/Makefile
215 AC_CHECK_PROG([RPCGEN], [rpcgen], [yes], [no])
217 if test "x$RPCGEN" = "xno"; then
218 AC_MSG_ERROR([`rpcgen` not found, glusterfs needs `rpcgen` exiting..])
221 # Initialize CFLAGS before usage
222 AC_ARG_ENABLE([debug],
223 AC_HELP_STRING([--enable-debug],
224 [Enable debug build options.]))
225 if test "x$enable_debug" = "xyes"; then
227 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
230 CFLAGS="${CFLAGS} -g -O2"
235 if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then
236 AC_MSG_ERROR([You need at least OS X 10.7 (Lion) to build Glusterfs])
238 # OSX version lesser than 9 has llvm/clang optimization issues which leads to various segfaults
239 if test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -lt 9; then
240 CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
245 AC_ARG_WITH(pkgconfigdir,
246 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
247 [pkgconfigdir=$withval],
248 [pkgconfigdir='${libdir}/pkgconfig'])
249 AC_SUBST(pkgconfigdir)
251 AC_ARG_WITH(mountutildir,
252 [ --with-mountutildir=DIR mount helper utility in DIR @<:@/sbin@:>@],
253 [mountutildir=$withval],
254 [mountutildir='/sbin'])
255 AC_SUBST(mountutildir)
257 AC_ARG_WITH(systemddir,
258 [ --with-systemddir=DIR systemd service files in DIR @<:@/usr/lib/systemd/system@:>@],
259 [systemddir=$withval],
260 [systemddir='/usr/lib/systemd/system'])
264 [ --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
266 [initdir='/etc/init.d'])
269 AC_ARG_WITH(launchddir,
270 [ --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
271 [launchddir=$withval],
272 [launchddir='/Library/LaunchDaemons'])
276 [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
284 if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
285 AC_MSG_ERROR([Flex or lex required to build glusterfs.])
291 AC_CHECK_SIZEOF(short)
293 AC_CHECK_SIZEOF(long)
294 AC_CHECK_SIZEOF(long long)
295 SIZEOF_SHORT=$ac_cv_sizeof_short
296 SIZEOF_INT=$ac_cv_sizeof_int
297 SIZEOF_LONG=$ac_cv_sizeof_long
298 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
299 AC_SUBST(SIZEOF_SHORT)
301 AC_SUBST(SIZEOF_LONG)
302 AC_SUBST(SIZEOF_LONG_LONG)
306 if test "x${YACC}" = "xbyacc" -o "x${YACC}" = "xyacc" -o "x${YACC}" = "x"; then
307 AC_MSG_ERROR([GNU Bison required to build glusterfs.])
310 AC_CHECK_TOOL([LD],[ld])
312 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
314 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
316 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
318 AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
320 AC_CHECK_LIB([intl], [gettext])
322 AC_CHECK_HEADERS([sys/xattr.h])
324 AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
326 AC_CHECK_HEADERS([sys/extattr.h])
328 AC_CHECK_HEADERS([openssl/md5.h])
330 AC_CHECK_HEADERS([linux/falloc.h])
332 dnl Mac OS X does not have spinlocks
333 AC_CHECK_FUNC([pthread_spin_init], [have_spinlock=yes])
334 if test "x${have_spinlock}" = "xyes"; then
335 AC_DEFINE(HAVE_SPINLOCK, 1, [define if found spinlock])
337 AC_SUBST(HAVE_SPINLOCK)
339 dnl some os may not have GNU defined strnlen function
340 AC_CHECK_FUNC([strnlen], [have_strnlen=yes])
341 if test "x${have_strnlen}" = "xyes"; then
342 AC_DEFINE(HAVE_STRNLEN, 1, [define if found strnlen])
344 AC_SUBST(HAVE_STRNLEN)
347 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
348 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
350 if test "x${have_setfsuid}" = "xyes" -a "x${have_setfsgid}" = "xyes"; then
351 AC_DEFINE(HAVE_SET_FSID, 1, [define if found setfsuid setfsgid])
354 dnl test umount2 function
355 AC_CHECK_FUNC([umount2], [have_umount2=yes])
357 if test "x${have_umount2}" = "xyes"; then
358 AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
362 AC_ARG_ENABLE([fuse-client],
363 AC_HELP_STRING([--disable-fuse-client],
364 [Do not build the fuse client. NOTE: you cannot mount glusterfs without the client]))
367 if test "x$enable_fuse_client" != "xno"; then
368 FUSE_CLIENT_SUBDIR=fuse
369 BUILD_FUSE_CLIENT="yes"
372 AC_ARG_ENABLE([bd-xlator],
373 AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
375 if test "x$enable_bd_xlator" != "xno"; then
376 AC_CHECK_LIB([lvm2app],
377 [lvm_init,lvm_lv_from_name],
381 if test "x$HAVE_BD_LIB" = "xyes"; then
382 # lvm_lv_from_name() has been made public with lvm2-2.02.79
385 [NEED_LVM_LV_FROM_NAME_DECL="no"],
386 [NEED_LVM_LV_FROM_NAME_DECL="yes"],
387 [[#include <lvm2app.h>]])
391 if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
392 echo "BD xlator requested but required lvm2 development library not found."
397 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
399 AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
401 if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
402 AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
403 was not found in the lvm2app.h header, but can be linked])
407 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
409 # start encryption/crypt section
411 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
413 AC_ARG_ENABLE([crypt-xlator],
414 AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
416 if test "x$enable_crypt_xlator" = "xyes" -a "x$have_cmac_h" = "xno"; then
417 AC_MSG_ERROR([Encryption xlator requires OpenSSL with cmac.h])
420 BUILD_CRYPT_XLATOR=no
421 if test "x$enable_crypt_xlator" != "xno" -a "x$have_cmac_h" = "xyes"; then
422 BUILD_CRYPT_XLATOR=yes
423 AC_DEFINE(HAVE_CRYPT_XLATOR, 1, [enable building crypt encryption xlator])
426 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
428 AC_SUBST(FUSE_CLIENT_SUBDIR)
433 AC_ARG_ENABLE([fusermount],
434 AC_HELP_STRING([--disable-fusermount],
435 [Use system's fusermount]))
437 BUILD_FUSERMOUNT="yes"
438 if test "x$enable_fusermount" = "xno"; then
439 BUILD_FUSERMOUNT="no"
441 AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
442 FUSERMOUNT_SUBDIR="contrib/fuse-util"
445 AC_SUBST(FUSERMOUNT_SUBDIR)
446 #end FUSERMOUNT section
450 AC_ARG_ENABLE([qemu-block],
451 AC_HELP_STRING([--enable-qemu-block],
452 [Build QEMU Block formats translator]))
454 if test "x$enable_qemu_block" != "xno"; then
455 PKG_CHECK_MODULES([GLIB], [glib-2.0],
460 if test "x$enable_qemu_block" = "xyes" -a "x$HAVE_GLIB_2" = "xno"; then
461 echo "QEMU Block formats translator requires libglib-2.0, but missing."
466 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
468 AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
469 Block translator enabled])
473 # end QEMU_BLOCK section
476 AC_ARG_ENABLE([epoll],
477 AC_HELP_STRING([--disable-epoll],
478 [Use poll instead of epoll.]))
481 if test "x$enable_epoll" != "xno"; then
482 AC_CHECK_HEADERS([sys/epoll.h],
490 AC_ARG_ENABLE([ibverbs],
491 AC_HELP_STRING([--disable-ibverbs],
492 [Do not build the ibverbs transport]))
494 if test "x$enable_ibverbs" != "xno"; then
495 AC_CHECK_LIB([ibverbs],
496 [ibv_get_device_list],
497 [HAVE_LIBIBVERBS="yes"],
498 [HAVE_LIBIBVERBS="no"])
499 AC_CHECK_LIB([rdmacm], [rdma_create_id], [HAVE_RDMACM="yes"], [HAVE_RDMACM="no"])
502 if test "x$enable_ibverbs" = "xyes"; then
503 if test "x$HAVE_LIBIBVERBS" = "xno"; then
504 echo "ibverbs-transport requested, but libibverbs is not present."
508 if test "x$HAVE_RDMACM" = "xno"; then
509 echo "ibverbs-transport requested, but librdmacm is not present."
516 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
517 IBVERBS_SUBDIR=ib-verbs
523 AC_SUBST(IBVERBS_SUBDIR)
524 AC_SUBST(RDMA_SUBDIR)
525 # end IBVERBS section
529 AC_ARG_ENABLE([georeplication],
530 AC_HELP_STRING([--disable-georeplication],
531 [Do not install georeplication components]))
542 #disabling geo replication for non-linux platforms
543 enable_georeplication=no
547 if test "x$enable_georeplication" != "xno"; then
548 SYNCDAEMON_SUBDIR=geo-replication
551 BUILD_SYNCDAEMON="yes"
552 AM_PATH_PYTHON([2.4])
553 echo -n "checking if python is python 2.x... "
554 if echo $PYTHON_VERSION | grep ^2; then
558 AC_MSG_ERROR([only python 2.x is supported])
560 echo -n "checking if python has ctypes support... "
561 if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
565 AC_MSG_ERROR([python does not have ctypes support])
568 AC_SUBST(SYNCDAEMON_COMPILE)
569 AC_SUBST(SYNCDAEMON_SUBDIR)
570 # end SYNCDAEMON section
572 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z
573 echo -n "checking if libz is present... "
575 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],
576 [echo "yes (features requiring zlib enabled)" AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])],
579 AC_SUBST(LIBZ_CFLAGS)
581 # end CDC xlator secion
583 # check for systemtap/dtrace
585 AC_MSG_CHECKING([whether to include systemtap tracing support])
586 AC_ARG_ENABLE([systemtap],
587 [AS_HELP_STRING([--enable-systemtap],
588 [Enable inclusion of systemtap trace support])],
589 [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP="def"])
591 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
592 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
594 if test "x${ENABLE_SYSTEMTAP}" != "xno"; then
595 AC_CHECK_PROG(DTRACE, dtrace, "yes", "no")
596 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND="yes"],
600 if test "x${ENABLE_SYSTEMTAP}" = "xyes"; then
601 if test "x${DTRACE}" = "xno"; then
602 AC_MSG_ERROR([dtrace not found])
603 elif test "$x{SDT_H_FOUND}" = "xno"; then
604 AC_MSG_ERROR([systemtap support needs sys/sdt.h header])
608 if test "x${DTRACE}" = "xyes" -a "x${SDT_H_FOUND}" = "xyes"; then
609 AC_MSG_CHECKING([x"${DTRACE}"xy"${SDT_H_FOUND}"y])
610 AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
613 # end of systemtap/dtrace
616 AC_ARG_ENABLE([xml-output],
617 AC_HELP_STRING([--disable-xml-output],
618 [Disable the xml output]))
619 BUILD_XML_OUTPUT="yes"
620 if test "x$enable_xml_output" != "xno"; then
621 #check if libxml is present if so enable HAVE_LIB_XML
622 m4_ifdef([AM_PATH_XML2],[AM_PATH_XML2([2.6.19])], [no_xml=yes])
623 if test "x${no_xml}" = "x"; then
624 AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.])
626 if test "x$enable_georeplication" != "xno"; then
627 AC_MSG_ERROR([libxml2 devel libraries not found])
629 AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
630 BUILD_XML_OUTPUT="no"
635 if test "x$enable_georeplication" != "xno"; then
636 AC_MSG_ERROR([geo-replication requires xml output])
638 BUILD_XML_OUTPUT="no"
642 dnl FreeBSD > 5 has execinfo as a Ported library for giving a workaround
643 dnl solution to GCC backtrace functionality
645 AC_CHECK_HEADERS([execinfo.h], [have_backtrace=yes],
646 AC_CHECK_LIB([execinfo], [backtrace], [have_backtrace=yes]))
647 dnl AC_MSG_ERROR([libexecinfo not found libexecinfo required.])))
649 if test "x${have_backtrace}" = "xyes"; then
650 AC_DEFINE(HAVE_BACKTRACE, 1, [define if found backtrace])
652 AC_SUBST(HAVE_BACKTRACE)
654 dnl glusterfs prints memory usage to stderr by sending it SIGUSR1
655 AC_CHECK_FUNC([malloc_stats], [have_malloc_stats=yes])
656 if test "x${have_malloc_stats}" = "xyes"; then
657 AC_DEFINE(HAVE_MALLOC_STATS, 1, [define if found malloc_stats])
659 AC_SUBST(HAVE_MALLOC_STATS)
661 dnl Linux, Solaris, Cygwin
662 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
664 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
667 CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063 -DCONFIG_MACHINE_BSWAP_H"
670 AC_CHECK_FUNC([linkat], [have_linkat=yes])
671 if test "x${have_linkat}" = "xyes"; then
672 AC_DEFINE(HAVE_LINKAT, 1, [define if found linkat])
674 AC_SUBST(HAVE_LINKAT)
676 dnl check for Monotonic clock
677 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])))
680 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
681 AC_CONFIG_SUBDIRS(contrib/argp-standalone)
683 BUILD_ARGP_STANDALONE=no
684 if test "x${ac_cv_header_argp_h}" = "xno"; then
685 BUILD_ARGP_STANDALONE=yes
686 ARGP_STANDALONE_CPPFLAGS='-I${top_srcdir}/contrib/argp-standalone'
687 ARGP_STANDALONE_LDADD='${top_builddir}/contrib/argp-standalone/libargp.a'
688 ARGP_STANDALONE_DIR='${top_builddir}/contrib/argp-standalone'
691 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
692 AC_SUBST(ARGP_STANDALONE_LDADD)
693 AC_SUBST(ARGP_STANDALONE_DIR)
695 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
697 AC_CHECK_FUNC([llistxattr], [have_llistxattr=yes])
698 if test "x${have_llistxattr}" = "xyes"; then
699 AC_DEFINE(HAVE_LLISTXATTR, 1, [define if llistxattr exists])
702 AC_CHECK_FUNC([fdatasync], [have_fdatasync=no])
703 if test "x${have_fdatasync}" = "xyes"; then
704 AC_DEFINE(HAVE_FDATASYNC, 1, [define if fdatasync exists])
707 AC_CHECK_FUNC([fallocate], [have_fallocate=yes])
708 if test "x${have_fallocate}" = "xyes"; then
709 AC_DEFINE(HAVE_FALLOCATE, 1, [define if fallocate exists])
712 AC_CHECK_FUNC([posix_fallocate], [have_posix_fallocate=yes])
713 if test "x${have_posix_fallocate}" = "xyes"; then
714 AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists])
717 # Check the distribution where you are compiling glusterfs on
720 AC_CHECK_FILE([/etc/debian_version])
721 AC_CHECK_FILE([/etc/SuSE-release])
722 AC_CHECK_FILE([/etc/redhat-release])
724 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
725 GF_DISTRIBUTION=Debian
727 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
730 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
731 GF_DISTRIBUTION=Redhat
734 AC_SUBST(GF_DISTRIBUTION)
737 GF_LDFLAGS="-rdynamic"
739 dnl check for gcc -Werror=format-security
740 saved_GF_CFLAGS="-Wformat -Werror=format-security"
741 AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
742 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
743 echo $cc_werror_format_security
744 if test "x$cc_werror_format_security" = "xno"; then
745 GF_CFLAGS="$GF_CFLAGS"
747 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
750 dnl check for gcc -Werror=implicit-function-declaration
751 saved_GF_CFLAGS=$GF_CFLAGS
752 GF_CFLAGS="-Werror=implicit-function-declaration"
753 AC_MSG_CHECKING([whether $CC accepts -Werror=implicit-function-declaration])
754 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_implicit=yes], [cc_werror_implicit=no])
755 echo $cc_werror_implicit
756 if test "x$cc_werror_implicit" = "xno"; then
757 GF_CFLAGS="$saved_GF_CFLAGS"
759 GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
762 dnl clang is mostly GCC-compatible, but its version is much lower,
763 dnl so we have to check for it.
764 AC_MSG_CHECKING([if compiling with clang])
767 [AC_LANG_PROGRAM([], [[
772 [CLANG=yes], [CLANG=no])
774 AC_MSG_RESULT([$CLANG])
776 if test "x$CLANG" = "xyes"; then
777 GF_COMPILER_FLAGS="-Wno-gnu -Wno-deprecated-declarations -Wno-enum-conversion"
783 GF_HOST_OS="GF_LINUX_HOST_OS"
784 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
785 GF_LDADD="${ARGP_STANDALONE_LDADD}"
786 GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\""
789 GF_HOST_OS="GF_SOLARIS_HOST_OS"
790 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
792 GF_LDADD="${ARGP_STANDALONE_LDADD}"
793 GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
795 FUSE_CLIENT_SUBDIR=""
798 GF_HOST_OS="GF_BSD_HOST_OS"
799 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_INCOMPLETE_XOPEN_C063"
800 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
801 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
802 GF_LDADD="${ARGP_STANDALONE_LDADD}"
803 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
804 GF_GLUSTERFS_LIBS="-lexecinfo"
806 GF_FUSE_LDADD="-lperfuse"
807 BUILD_FUSE_CLIENT=yes
811 GF_HOST_OS="GF_BSD_HOST_OS"
812 GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
813 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
814 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
815 GF_LDADD="${ARGP_STANDALONE_LDADD}"
816 if test "x$ac_cv_header_execinfo_h" = "xyes"; then
817 GF_GLUSTERFS_LIBS="-lexecinfo"
822 GF_HOST_OS="GF_DARWIN_HOST_OS"
824 GF_CFLAGS="${GF_COMPILER_FLAGS} ${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -D_XOPEN_SOURCE "
825 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
826 GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
827 GF_LDADD="${ARGP_STANDALONE_LDADD}"
829 GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
830 BUILD_FUSERMOUNT="no"
831 BUILD_QEMU_BLOCK="no"
836 # enable/disable QEMU
837 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
840 # enable debug section
841 AC_ARG_ENABLE([debug],
842 AC_HELP_STRING([--enable-debug],
843 [Enable debug build options.]))
847 AC_ARG_ENABLE([syslog],
848 AC_HELP_STRING([--disable-syslog],
849 [Disable syslog for logging]))
852 if test "x$enable_syslog" != "xno"; then
853 AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
857 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
861 AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
862 AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
863 AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
865 if test "x$RLLIBS" != "x"; then
866 if test "x$RL_UNDO" = "xyes"; then
867 AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
870 BUILD_READLINE="no (present but missing undo)"
876 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
878 if test "x$LIBAIO" != "x"; then
879 AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
889 if echo $PYTHON_VERSION | grep ^2; then
893 # Save flags before testing python
895 saved_CPPFLAGS=$CPPFLAGS
896 saved_LDFLAGS=$LDFLAGS
900 CFLAGS="`${PYTHON}-config --cflags`"
902 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
905 CFLAGS="`${PYTHON}-config --cflags`"
907 LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
911 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
912 AC_ARG_ENABLE([glupy],
913 AS_HELP_STRING([--enable-glupy],
915 case x$enable_glupy in
917 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
919 PYTHONDEV_CFLAGS="$CFLAGS"
920 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
921 PYTHONDEV_LDFLAGS="$LDFLAGS"
922 AC_SUBST(PYTHONDEV_CFLAGS)
923 AC_SUBST(PYTHONDEV_CPPFLAGS)
924 AC_SUBST(PYTHONDEV_LDFLAGS)
926 AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
932 if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
934 PYTHONDEV_CFLAGS="$CFLAGS"
935 PYTHONDEV_CPPFLAGS="$CPPFLAGS"
936 PYTHONDEV_LDFLAGS="$LDFLAGS"
937 AC_SUBST(PYTHONDEV_CFLAGS)
938 AC_SUBST(PYTHONDEV_CPPFLAGS)
939 AC_SUBST(PYTHONDEV_LDFLAGS)
942 ---------------------------------------------------------------------------------
943 cannot build glupy. python 2.x and python-devel/python-dev package are required.
944 ---------------------------------------------------------------------------------])
950 CPPFLAGS=$saved_CPPFLAGS
951 LDFLAGS=$saved_LDFLAGS
959 if test "x$BUILD_GLUPY" = "xyes"; then
960 BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
961 BUILD_PYTHON_LIB=python$PYTHON_VERSION
963 GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
964 GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
965 echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
966 AC_SUBST(BUILD_PYTHON_INC)
967 AC_SUBST(BUILD_PYTHON_LIB)
968 AC_SUBST(GLUPY_SUBDIR)
969 AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
970 AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
975 # end enable debug section
978 AC_SUBST([GF_GLUSTERFS_LIBS])
982 AC_SUBST(GF_FUSE_LDADD)
983 AC_SUBST(GF_FUSE_CFLAGS)
986 AC_SUBST(AM_MAKEFLAGS)
987 AC_SUBST(AM_LIBTOOLFLAGS)
989 CONTRIBDIR='$(top_srcdir)/contrib'
992 GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)'
993 GF_CPPINCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid'
994 GF_CPPFLAGS="$GF_CPPDEFINES $GF_CPPINCLUDES"
995 AC_SUBST([GF_CPPFLAGS])
997 AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS")
999 AM_CONDITIONAL([GF_INSTALL_VAR_LIB_GLUSTERD], test ! -d ${localstatedir}/lib/glusterd && test -d ${sysconfdir}/glusterd )
1001 dnl pkg-config versioning
1002 GFAPI_VERSION="7.0.0"
1003 LIBGFCHANGELOG_VERSION="0.0.1"
1004 AC_SUBST(GFAPI_VERSION)
1005 AC_SUBST(LIBGFCHANGELOG_VERSION)
1007 dnl libtool versioning
1008 LIBGFXDR_LT_VERSION="0:1:0"
1009 LIBGFRPC_LT_VERSION="0:1:0"
1010 LIBGLUSTERFS_LT_VERSION="0:1:0"
1011 LIBGFCHANGELOG_LT_VERSION="0:1:0"
1012 GFAPI_LT_VERSION="7:0:0"
1013 AC_SUBST(LIBGFXDR_LT_VERSION)
1014 AC_SUBST(LIBGFRPC_LT_VERSION)
1015 AC_SUBST(LIBGLUSTERFS_LT_VERSION)
1016 AC_SUBST(LIBGFCHANGELOG_LT_VERSION)
1017 AC_SUBST(GFAPI_LT_VERSION)
1022 echo "GlusterFS configure summary"
1023 echo "==========================="
1024 echo "FUSE client : $BUILD_FUSE_CLIENT"
1025 echo "Infiniband verbs : $BUILD_IBVERBS"
1026 echo "epoll IO multiplex : $BUILD_EPOLL"
1027 echo "argp-standalone : $BUILD_ARGP_STANDALONE"
1028 echo "fusermount : $BUILD_FUSERMOUNT"
1029 echo "readline : $BUILD_READLINE"
1030 echo "georeplication : $BUILD_SYNCDAEMON"
1031 echo "Linux-AIO : $BUILD_LIBAIO"
1032 echo "Enable Debug : $BUILD_DEBUG"
1033 echo "systemtap : $BUILD_SYSTEMTAP"
1034 echo "Block Device xlator : $BUILD_BD_XLATOR"
1035 echo "glupy : $BUILD_GLUPY"
1036 echo "Use syslog : $USE_SYSLOG"
1037 echo "XML output : $BUILD_XML_OUTPUT"
1038 echo "QEMU Block formats : $BUILD_QEMU_BLOCK"
1039 echo "Encryption xlator : $BUILD_CRYPT_XLATOR"