Always build EC xlator
[obnox/glusterfs.git] / configure.ac
1 dnl  Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
2 dnl  This file is part of GlusterFS.
3 dnl
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.
8
9 AC_INIT([glusterfs],
10         [m4_esyscmd([build-aux/pkg-version --version])],
11         [gluster-users@gluster.org],,[https://github.com/gluster/glusterfs.git])
12
13 AC_SUBST([PACKAGE_RELEASE],
14          [m4_esyscmd([build-aux/pkg-version --release])])
15
16 AM_INIT_AUTOMAKE
17
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])
21
22 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
23
24 if make --help 2>&1 | grep -q no-print-directory; then
25    AM_MAKEFLAGS="$AM_MAKEFLAGS --no-print-directory";
26 fi
27
28 if make --help 2>&1 | grep -q quiet; then
29    AM_MAKEFLAGS="$AM_MAKEFLAGS --quiet"
30 fi
31
32 if libtool --help 2>&1 | grep -q quiet; then
33    AM_LIBTOOLFLAGS="--quiet";
34 fi
35
36 AC_CONFIG_HEADERS([config.h])
37
38 AC_CONFIG_FILES([Makefile
39                 libglusterfs/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
44                 glusterfsd/Makefile
45                 glusterfsd/src/Makefile
46                 rpc/Makefile
47                 rpc/rpc-lib/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
54                 rpc/xdr/Makefile
55                 rpc/xdr/src/Makefile
56                 xlators/Makefile
57                 xlators/meta/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
164                 xlators/nfs/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
170                 cli/Makefile
171                 cli/src/Makefile
172                 doc/Makefile
173                 extras/Makefile
174                 extras/glusterd.vol
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
185                 extras/ocf/Makefile
186                 extras/ocf/glusterd
187                 extras/ocf/volume
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
204                 glusterfs-api.pc
205                 libgfchangelog.pc
206                 api/Makefile
207                 api/src/Makefile
208                 api/examples/Makefile
209                 geo-replication/Makefile
210                 geo-replication/src/Makefile
211                 geo-replication/syncdaemon/Makefile
212                 glusterfs.spec])
213
214 AC_CANONICAL_HOST
215
216 AC_PROG_CC
217 AC_DISABLE_STATIC
218 AC_PROG_LIBTOOL
219
220 AC_CHECK_PROG([RPCGEN], [rpcgen], [yes], [no])
221
222 if test "x$RPCGEN" = "xno"; then
223    AC_MSG_ERROR([`rpcgen` not found, glusterfs needs `rpcgen` exiting..])
224 fi
225
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
231         BUILD_DEBUG=yes
232         CFLAGS="${CFLAGS} -g -O0 -DDEBUG"
233 else
234         BUILD_DEBUG=no
235         CFLAGS="${CFLAGS} -g -O2"
236 fi
237
238 case $host_os in
239   darwin*)
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])
242     fi
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"
246     fi
247     ;;
248 esac
249
250 AC_ARG_WITH([previous-options],
251         [AS_HELP_STRING([--with-previous-options],
252                         [read config.status for configure options])
253         ],
254         [ if test -r ./config.status && \
255              args=$(grep 'ac_cs_config=' config.status | \
256                     sed -e 's/.*"\(.*\)".*/\1/'| sed -e "s/'//g") ; then
257             echo "###"
258             echo "### Rerunning as '$0 $args'"
259             echo "###"
260             exec $0 $args
261           fi
262         ])
263
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)
269
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)
275
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'])
280 AC_SUBST(systemddir)
281
282 AC_ARG_WITH(initdir,
283             [  --with-initdir=DIR init.d scripts in DIR @<:@/etc/init.d@:>@],
284             [initdir=$withval],
285             [initdir='/etc/init.d'])
286 AC_SUBST(initdir)
287
288 AC_ARG_WITH(launchddir,
289             [  --with-launchddir=DIR launchd services in DIR @<:@/Library/LaunchDaemons@:>@],
290             [launchddir=$withval],
291             [launchddir='/Library/LaunchDaemons'])
292 AC_SUBST(launchddir)
293
294 AC_ARG_WITH([ocf],
295             [AS_HELP_STRING([--without-ocf], [build OCF-compliant cluster resource agents])],
296             ,
297             [OCF_SUBDIR='ocf'],
298             )
299 AC_SUBST(OCF_SUBDIR)
300
301 # LEX needs a check
302 AC_PROG_LEX
303 if test  "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then
304    AC_MSG_ERROR([Flex or lex required to build glusterfs.])
305 fi
306
307 dnl
308 dnl Word sizes...
309 dnl
310 AC_CHECK_SIZEOF(short)
311 AC_CHECK_SIZEOF(int)
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)
319 AC_SUBST(SIZEOF_INT)
320 AC_SUBST(SIZEOF_LONG)
321 AC_SUBST(SIZEOF_LONG_LONG)
322
323 # YACC needs a check
324 AC_PROG_YACC
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.])
327 fi
328
329 AC_CHECK_TOOL([LD],[ld])
330
331 AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs]))
332
333 AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs]))
334
335
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"`
341 ],[
342   AC_CHECK_LIB([cmockery], [mock_assert], [
343     UNITTEST_LDFLAGS="-lcmockery -lgcov"
344     UNITTEST_CFLAGS="-Wall -Werror -DUNIT_TESTING=1"
345   ], [
346     AC_MSG_ERROR([cmockery2 library is required to build glusterfs])
347   ])
348 ])
349
350 AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs])))
351
352 AC_CHECK_LIB([readline], [rl_do_undo], [RL_UNDO="yes"], [RL_UNDO="no"])
353
354 AC_CHECK_LIB([intl], [gettext])
355
356 AC_CHECK_HEADERS([sys/xattr.h])
357
358 AC_CHECK_HEADERS([sys/ioctl.h], AC_DEFINE(HAVE_IOCTL_IN_SYS_IOCTL_H, 1, [have sys/ioctl.h]))
359
360 AC_CHECK_HEADERS([sys/extattr.h])
361
362 AC_CHECK_HEADERS([openssl/md5.h])
363
364 AC_CHECK_HEADERS([linux/falloc.h])
365
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])
370 fi
371 AC_SUBST(HAVE_SPINLOCK)
372
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])
377 fi
378 AC_SUBST(HAVE_STRNLEN)
379
380
381 AC_CHECK_FUNC([setfsuid], [have_setfsuid=yes])
382 AC_CHECK_FUNC([setfsgid], [have_setfsgid=yes])
383
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])
386 fi
387
388 dnl test umount2 function
389 AC_CHECK_FUNC([umount2], [have_umount2=yes])
390
391 if test "x${have_umount2}" = "xyes"; then
392    AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
393 fi
394
395 # FUSE section
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]))
399
400 BUILD_FUSE_CLIENT=no
401 if test "x$enable_fuse_client" != "xno"; then
402    FUSE_CLIENT_SUBDIR=fuse
403    BUILD_FUSE_CLIENT="yes"
404 fi
405
406 AC_ARG_ENABLE([bd-xlator],
407               AC_HELP_STRING([--enable-bd-xlator], [Build BD xlator]))
408
409 if test "x$enable_bd_xlator" != "xno"; then
410   AC_CHECK_LIB([lvm2app],
411                [lvm_init,lvm_lv_from_name],
412                [HAVE_BD_LIB="yes"],
413                [HAVE_BD_LIB="no"])
414
415 if test "x$HAVE_BD_LIB" = "xyes"; then
416     # lvm_lv_from_name() has been made public with lvm2-2.02.79
417     AC_CHECK_DECLS(
418                   [lvm_lv_from_name],
419                   [NEED_LVM_LV_FROM_NAME_DECL="no"],
420                   [NEED_LVM_LV_FROM_NAME_DECL="yes"],
421                   [[#include <lvm2app.h>]])
422   fi
423 fi
424
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."
427    exit 1
428 fi
429
430 BUILD_BD_XLATOR=no
431 if test "x${enable-bd-xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
432   BUILD_BD_XLATOR=yes
433   AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd xlator
434                             enabled])
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])
438   fi
439 fi
440
441 AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
442
443 # start encryption/crypt section
444
445 AC_CHECK_HEADERS([openssl/cmac.h], [have_cmac_h=yes], [have_cmac_h=no])
446
447 AC_ARG_ENABLE([crypt-xlator],
448         AC_HELP_STRING([--enable-crypt-xlator], [Build crypt encryption xlator]))
449
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])
452 fi
453
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])
458 fi
459
460 AM_CONDITIONAL([ENABLE_CRYPT_XLATOR], [test x$BUILD_CRYPT_XLATOR = xyes])
461
462 AC_SUBST(FUSE_CLIENT_SUBDIR)
463 # end FUSE section
464
465
466 # FUSERMOUNT section
467 AC_ARG_ENABLE([fusermount],
468               AC_HELP_STRING([--disable-fusermount],
469                              [Use system's fusermount]))
470
471 BUILD_FUSERMOUNT="yes"
472 if test "x$enable_fusermount" = "xno"; then
473    BUILD_FUSERMOUNT="no"
474 else
475    AC_DEFINE(GF_FUSERMOUNT, 1, [Use our own fusermount])
476    FUSERMOUNT_SUBDIR="contrib/fuse-util"
477 fi
478
479 AC_SUBST(FUSERMOUNT_SUBDIR)
480 #end FUSERMOUNT section
481
482 # QEMU_BLOCK section
483
484 AC_ARG_ENABLE([qemu-block],
485                 AC_HELP_STRING([--enable-qemu-block],
486                         [Build QEMU Block formats translator]))
487
488 if test "x$enable_qemu_block" != "xno"; then
489   PKG_CHECK_MODULES([GLIB], [glib-2.0],
490                     [HAVE_GLIB_2="yes"],
491                     [HAVE_GLIB_2="no"])
492 fi
493
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."
496    exit 1
497 fi
498
499 BUILD_QEMU_BLOCK=no
500 if test "x${enable_qemu_block}" != "xno" -a "x${HAVE_GLIB_2}" = "xyes"; then
501   BUILD_QEMU_BLOCK=yes
502   AC_DEFINE(HAVE_QEMU_BLOCK, 1, [define if libglib-2.0 library found and QEMU
503                              Block translator enabled])
504 fi
505
506
507 # end QEMU_BLOCK section
508
509 # EPOLL section
510 AC_ARG_ENABLE([epoll],
511               AC_HELP_STRING([--disable-epoll],
512                              [Use poll instead of epoll.]))
513
514 BUILD_EPOLL=no
515 if test "x$enable_epoll" != "xno"; then
516    AC_CHECK_HEADERS([sys/epoll.h],
517                     [BUILD_EPOLL=yes],
518                     [BUILD_EPOLL=no])
519 fi
520 # end EPOLL section
521
522
523 # IBVERBS section
524 AC_ARG_ENABLE([ibverbs],
525               AC_HELP_STRING([--disable-ibverbs],
526                              [Do not build the ibverbs transport]))
527
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"])
534 fi
535
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."
539       exit 1
540    fi
541
542    if test "x$HAVE_RDMACM" = "xno"; then
543       echo "ibverbs-transport requested, but librdmacm is not present."
544       exit 1
545    fi
546 fi
547
548 BUILD_RDMA=no
549 BUILD_IBVERBS=no
550 if test "x$enable_ibverbs" != "xno" -a "x$HAVE_LIBIBVERBS" = "xyes" -a "x$HAVE_RDMACM" = "xyes"; then
551   IBVERBS_SUBDIR=ib-verbs
552   BUILD_IBVERBS=yes
553   RDMA_SUBDIR=rdma
554   BUILD_RDMA=yes
555 fi
556
557 AC_SUBST(IBVERBS_SUBDIR)
558 AC_SUBST(RDMA_SUBDIR)
559 # end IBVERBS section
560
561
562 # SYNCDAEMON section
563 AC_ARG_ENABLE([georeplication],
564               AC_HELP_STRING([--disable-georeplication],
565                              [Do not install georeplication components]))
566
567 BUILD_SYNCDAEMON=no
568 case $host_os in
569      linux*)
570 #do nothing
571        ;;
572      netbsd*)
573 #do nothing
574        ;;
575      *)
576 #disabling geo replication for non-linux platforms
577         enable_georeplication=no
578         ;;
579 esac
580 SYNCDAEMON_COMPILE=0
581 if test "x$enable_georeplication" != "xno"; then
582   SYNCDAEMON_SUBDIR=geo-replication
583   SYNCDAEMON_COMPILE=1
584
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
589     :
590   else
591     echo no
592     AC_MSG_ERROR([only python 2.x is supported])
593   fi
594   echo -n "checking if python has ctypes support... "
595   if "$PYTHON" -c 'import ctypes' 2>/dev/null; then
596     echo yes
597   else
598     echo no
599     AC_MSG_ERROR([python does not have ctypes support])
600   fi
601 fi
602 AC_SUBST(SYNCDAEMON_COMPILE)
603 AC_SUBST(SYNCDAEMON_SUBDIR)
604 # end SYNCDAEMON section
605
606 # CDC xlator - check if libz is present if so enable HAVE_LIB_Z 
607 BUILD_CDC=yes
608 PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0],,
609                   [AC_CHECK_LIB([z], [deflate], [LIBZ_LIBS="-lz"],
610                                 [BUILD_CDC=no])])
611 echo -n "features requiring zlib enabled: "
612 if test "x$BUILD_CDC" = "xyes" ; then
613   echo "yes"
614   AC_DEFINE(HAVE_LIB_Z, 1, [define if zlib is present])
615 else
616   echo "no"
617 fi
618 AC_SUBST(LIBZ_CFLAGS)
619 AC_SUBST(LIBZ_LIBS)
620 # end CDC xlator secion
621
622 # check for systemtap/dtrace
623 BUILD_SYSTEMTAP=no
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"])
629
630 AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x${ENABLE_SYSTEMTAP}" = "xyes"])
631 AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
632
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"],
636                     [SDT_H_FOUND="no"])
637 fi
638
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])
644     fi
645 fi
646
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.])
650     BUILD_SYSTEMTAP=yes
651 fi
652 # end of systemtap/dtrace
653
654 # xml-output
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.])
664     else
665         if test "x$enable_georeplication" != "xno"; then
666            AC_MSG_ERROR([libxml2 devel libraries not found])
667         else
668            AC_MSG_WARN([libxml2 devel libraries not found disabling XML support])
669            BUILD_XML_OUTPUT="no"
670         fi
671
672     fi
673 else
674     if test "x$enable_georeplication" != "xno"; then
675        AC_MSG_ERROR([geo-replication requires xml output])
676     fi
677     BUILD_XML_OUTPUT="no"
678 fi
679 # end of xml-output
680
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])
684 fi
685 AC_SUBST(HAVE_BACKTRACE)
686
687 if test "x${have_backtrace}" != "xyes"; then
688 AC_TRY_COMPILE([#include <math.h>], [double x=0.0; x=ceil(0.0);],
689    [have_math_h=yes],
690    AC_MSG_ERROR([need math library for libexecinfo]))
691 if test "x${have_math_h}" = "xyes"; then
692    LIBS="$LIBS -lm"
693 fi
694 fi
695
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])
700 fi
701 AC_SUBST(HAVE_MALLOC_STATS)
702
703 dnl Linux, Solaris, Cygwin
704 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
705 dnl FreeBSD, NetBSD
706 AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec])
707 case $host_os in
708         *netbsd*)
709         CFLAGS="${CFLAGS} -D_INCOMPLETE_XOPEN_C063 -DCONFIG_MACHINE_BSWAP_H"
710         ;;
711 esac
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])
715 fi
716 AC_SUBST(HAVE_LINKAT)
717
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])))
720
721 dnl Add cmockery2 for unit tests
722 case $host_os in
723   freebsd*)
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}"
727     ;;
728   *)
729     UNITTEST_CFLAGS="${UNITTEST_CPPFLAGS} ${UNITTEST_CFLAGS} -g -DDEBUG -O0 --coverage"
730     UNITTEST_LDFLAGS="${UNITTEST_LIBS} ${UNITTEST_LDFLAGS}"
731     ;;
732 esac
733
734 AC_SUBST(UNITTEST_CFLAGS)
735 AC_SUBST(UNITTEST_LDFLAGS)
736
737 dnl Check for argp
738 AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp]))
739 AC_CONFIG_SUBDIRS(contrib/argp-standalone)
740
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'
747 fi
748
749 AC_SUBST(ARGP_STANDALONE_CPPFLAGS)
750 AC_SUBST(ARGP_STANDALONE_LDADD)
751 AC_SUBST(ARGP_STANDALONE_DIR)
752
753 AC_CHECK_HEADER([malloc.h], AC_DEFINE(HAVE_MALLOC_H, 1, [have malloc.h]))
754
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])
758 fi
759
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])
763 fi
764
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])
768 fi
769
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])
773 fi
774
775 # Check the distribution where you are compiling glusterfs on
776
777 GF_DISTRIBUTION=
778 AC_CHECK_FILE([/etc/debian_version])
779 AC_CHECK_FILE([/etc/SuSE-release])
780 AC_CHECK_FILE([/etc/redhat-release])
781
782 if test "x$ac_cv_file__etc_debian_version" = "xyes"; then
783    GF_DISTRIBUTION=Debian
784 fi
785 if test "x$ac_cv_file__etc_SuSE_release" = "xyes"; then
786    GF_DISTRIBUTION=SuSE
787 fi
788 if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
789    GF_DISTRIBUTION=Redhat
790 fi
791
792 AC_SUBST(GF_DISTRIBUTION)
793
794 GF_HOST_OS=""
795 GF_LDFLAGS="-rdynamic"
796
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"
804 else
805     GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
806 fi
807
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"
816 else
817     GF_CFLAGS="$saved_GF_CFLAGS $GF_CFLAGS"
818 fi
819
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])
823
824 AC_COMPILE_IFELSE(
825 [AC_LANG_PROGRAM([], [[
826 #ifndef __clang__
827        not clang
828 #endif
829 ]])],
830 [CLANG=yes], [CLANG=no])
831
832 AC_MSG_RESULT([$CLANG])
833
834 if test "x$CLANG" = "xyes"; then
835    GF_COMPILER_FLAGS="-Wno-gnu"
836 fi
837
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.
845
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"
850    fi
851 fi
852
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
856    localstatedir=/var
857    LOCALSTATEDIR=$(eval echo ${localstatedir})
858 else
859    LOCALSTATEDIR=$(eval echo ${localstatedir})
860 fi
861
862 case $host_os in
863      linux*)
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"
869         ;;
870      solaris*)
871         GF_HOST_OS="GF_SOLARIS_HOST_OS"
872         GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64"
873         GF_LDFLAGS=""
874         GF_LDADD="${ARGP_STANDALONE_LDADD}"
875         BUILD_FUSE_CLIENT=no
876         FUSE_CLIENT_SUBDIR=""
877         GLUSTERD_WORKDIR="${LOCALSTATEDIR}/lib/glusterd"
878         ;;
879      *netbsd*)
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"
888         fi
889         GF_FUSE_LDADD="-lperfuse"
890         BUILD_FUSE_CLIENT=yes
891         LEXLIB=""
892         BUILD_FUSERMOUNT=no
893         FUSERMOUNT_SUBDIR=""
894         GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
895         ;;
896      *freebsd*)
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"
909         fi
910         BUILD_FUSE_CLIENT=yes
911         BUILD_FUSERMOUNT=no
912         FUSERMOUNT_SUBDIR=""
913         GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
914         ;;
915      darwin*)
916         GF_HOST_OS="GF_DARWIN_HOST_OS"
917         LIBTOOL=glibtool
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}"
924         GF_LDFLAGS=""
925         GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
926         BUILD_FUSERMOUNT="no"
927         BUILD_QEMU_BLOCK="no"
928         FUSERMOUNT_SUBDIR=""
929         GLUSTERD_WORKDIR="${LOCALSTATEDIR}/db/glusterd"
930         ;;
931 esac
932
933 # enable/disable QEMU
934 AM_CONDITIONAL([ENABLE_QEMU_BLOCK], [test x$BUILD_QEMU_BLOCK = xyes])
935
936
937 # enable debug section
938 AC_ARG_ENABLE([debug],
939               AC_HELP_STRING([--enable-debug],
940                              [Enable debug build options.]))
941
942
943 # syslog section
944 AC_ARG_ENABLE([syslog],
945               AC_HELP_STRING([--disable-syslog],
946                              [Disable syslog for logging]))
947
948 USE_SYSLOG="yes"
949 if test "x$enable_syslog" != "xno"; then
950   AC_DEFINE(GF_USE_SYSLOG, 1, [Use syslog for logging])
951 else
952   USE_SYSLOG="no"
953 fi
954 AM_CONDITIONAL([ENABLE_SYSLOG], [test x$USE_SYSLOG = xyes])
955 #end syslog section
956
957 BUILD_READLINE=no
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"])
961
962 if test "x$RLLIBS" != "x"; then
963    if test "x$RL_UNDO" = "xyes"; then
964       AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
965       BUILD_READLINE=yes
966    else
967       BUILD_READLINE="no (present but missing undo)"
968    fi
969
970 fi
971
972 BUILD_LIBAIO=no
973 AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
974
975 if test "x$LIBAIO" != "x"; then
976    AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
977    BUILD_LIBAIO=yes
978 fi
979
980 # glupy section
981 BUILD_GLUPY=no
982 have_python2=no
983 have_Python_h=no
984
985 AM_PATH_PYTHON()
986 if echo $PYTHON_VERSION | grep ^2; then
987   have_python2=yes
988 fi
989
990 # Save flags before testing python
991 saved_CFLAGS=$CFLAGS
992 saved_CPPFLAGS=$CPPFLAGS
993 saved_LDFLAGS=$LDFLAGS
994
995 case $host_os in
996      linux*)
997        CFLAGS="`${PYTHON}-config --cflags`"
998        CPPFLAGS=$CFLAGS
999        LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
1000        ;;
1001      darwin*)
1002        CFLAGS="`${PYTHON}-config --cflags`"
1003        CPPFLAGS=$CFLAGS
1004        LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`"
1005        ;;
1006 esac
1007
1008 AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[])
1009 AC_ARG_ENABLE([glupy],
1010               AS_HELP_STRING([--enable-glupy],
1011                              [build glupy]))
1012 case x$enable_glupy in
1013    xyes)
1014       if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
1015         BUILD_GLUPY=yes
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)
1022       else
1023         AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x])
1024       fi
1025       ;;
1026    xno)
1027       ;;
1028    *)
1029       if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
1030         BUILD_GLUPY=yes
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)
1037       else
1038         AC_MSG_WARN([
1039         ---------------------------------------------------------------------------------
1040          cannot build glupy. python 2.x and python-devel/python-dev package are required.
1041         ---------------------------------------------------------------------------------])
1042       fi
1043       ;;
1044 esac
1045 # Restore flags
1046 CFLAGS=$saved_CFLAGS
1047 CPPFLAGS=$saved_CPPFLAGS
1048 LDFLAGS=$saved_LDFLAGS
1049
1050 case $host_os in
1051      darwin*)
1052         BUILD_GLUPY=no
1053         ;;
1054 esac
1055
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
1059    GLUPY_SUBDIR=glupy
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)
1068 fi
1069 # end glupy section
1070
1071 AC_SUBST(CFLAGS)
1072 # end enable debug section
1073
1074 dnl Required if cmockery2 headers are not in standar paths
1075 GF_CFLAGS="${GF_CFLAGS} ${UNITTEST_CPPFLAGS}"
1076
1077 AC_SUBST(GF_HOST_OS)
1078 AC_SUBST(GF_CFLAGS)
1079 AC_SUBST(GF_LDFLAGS)
1080 AC_SUBST(GF_LDADD)
1081 AC_SUBST(GF_FUSE_LDADD)
1082 AC_SUBST(GF_FUSE_CFLAGS)
1083 AC_SUBST(RLLIBS)
1084 AC_SUBST(LIBAIO)
1085 AC_SUBST(AM_MAKEFLAGS)
1086 AC_SUBST(AM_LIBTOOLFLAGS)
1087
1088 CONTRIBDIR='$(top_srcdir)/contrib'
1089 AC_SUBST(CONTRIBDIR)
1090
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])
1095
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")
1099
1100 AC_SUBST(GLUSTERD_WORKDIR)
1101 AM_CONDITIONAL([GF_INSTALL_GLUSTERD_WORKDIR], test ! -d ${GLUSTERD_WORKDIR} && test -d ${sysconfdir}/glusterd )
1102
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)
1108
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)
1120
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])
1123
1124 AC_OUTPUT
1125
1126 echo
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"
1145 echo