1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.60) 5AC_INIT([MFS], [3.0.116], [bugs@moosefs.com], [moosefs]) 6release=1 7buildno=$(cat buildno.txt) 8 9dnl AC_CONFIG_SRCDIR([MFSCommunication.h]) 10AC_CONFIG_HEADER([config.h]) 11AC_CANONICAL_TARGET 12AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) 13AM_SILENT_RULES([yes]) 14AC_CONFIG_MACRO_DIRS([m4]) 15 16versmaj=$(echo $PACKAGE_VERSION | cut -d. -f1) 17versmid=$(echo $PACKAGE_VERSION | cut -d. -f2) 18versmin=$(echo $PACKAGE_VERSION | cut -d. -f3) 19AC_DEFINE_UNQUOTED([VERSMAJ], [$versmaj], [Major MFS version]) 20AC_DEFINE_UNQUOTED([VERSMID], [$versmid], [Middle MFS version]) 21AC_DEFINE_UNQUOTED([VERSMIN], [($versmin)*2], [Minor MFS version]) 22AC_DEFINE_UNQUOTED([VERSHEX], [(($versmaj)*0x10000+($versmid)*0x100+($versmin)*2)], [Full MFS version as a hex number]) 23#AC_DEFINE_UNQUOTED([VERSMIN], [$versmin], [Minor MFS version]) 24#AC_DEFINE_UNQUOTED([VERSHEX], [(($versmaj)*0x10000+($versmid)*0x100+($versmin))], [Full MFS version as a hex number]) 25AC_DEFINE_UNQUOTED([RELEASE], [$release], [Release number]) 26AC_DEFINE_UNQUOTED([BUILDNO], [$buildno], [Build number]) 27AC_DEFINE([VERSION2INT(maj,med,min)], [((maj)*0x10000+(med)*0x100+(((maj)>1)?((min)*2):(min)))], [Version converter from human readable format to binary format used in MFS packets]) 28AC_DEFINE_UNQUOTED([VERSSTR], ["${PACKAGE_VERSION}-${release}"], [MFS version - string]) 29 30# Define paths 31test "$prefix" = "NONE" && prefix="$ac_default_prefix" 32test "$exec_prefix" = "NONE" && exec_prefix="$prefix" 33eval DATA_PATH="${localstatedir}/mfs" 34eval ETC_PATH="${sysconfdir}" 35eval BIN_PATH="${bindir}" 36eval SBIN_PATH="${sbindir}" 37# use system /var/run when using system-wide installation prefix 38if test "${prefix#/usr}" != "${prefix}" -o "${prefix#/opt}" != "${prefix}"; then 39 RUN_PATH="/var/run/mfs" 40else 41 RUN_PATH="${prefix}/var/run/mfs" 42fi 43AC_SUBST([DATA_PATH]) 44AC_SUBST([ETC_PATH]) 45AC_SUBST([BIN_PATH]) 46AC_SUBST([SBIN_PATH]) 47AC_SUBST([RUN_PATH]) 48AC_DEFINE_UNQUOTED([PREFIX], ["${prefix}"], [Installation prefix]) 49AC_DEFINE_UNQUOTED([ETC_PATH], ["$ETC_PATH"], [Configuration directory]) 50AC_DEFINE_UNQUOTED([DATA_PATH], ["$DATA_PATH"], [Data directory]) 51AC_DEFINE_UNQUOTED([RUN_PATH], ["$RUN_PATH"], [PID file directory]) 52 53# Checks for programs. 54AM_PROG_AR 55AC_PROG_CC(mycc gcc llvm-gcc clang) 56AM_PROG_CC_C_O 57AC_PROG_LN_S 58AC_PROG_LIBTOOL 59 60AC_ARG_ENABLE([externalcflags], [AS_HELP_STRING([--enable-externalcflags], [Build with default CFLAGS])], [ enable_externalcflags=yes ]) 61AC_ARG_ENABLE([gperftools], [AS_HELP_STRING([--enable-gperftools], [Build with google perftools on (debug only)])], [ enable_gperftools=yes ]) 62AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Build version without optimizations])], [ enable_debug=yes ]) 63 64if test "X$MFS_FORCE_DEBUG" = "XYES"; then 65 enable_debug=yes 66fi 67 68AX_CHECK_COMPILE_FLAG([-std=c11], [ CCSTD="-std=c11" ], [ 69 AX_CHECK_COMPILE_FLAG([-std=gnu99], [ CCSTD="-std=gnu99" ], [ 70 AX_CHECK_COMPILE_FLAG([-std=c99], [ CCSTD="-std=c99" ], [ 71 CCSTD="" 72 ]) 73 ]) 74]) 75 76if test "$CCSTD" = "-std=c11"; then 77 ac_have_atomics=maybe 78 AC_DEFINE([HAVE_C11_COMPILER], [1], [Compiler understands C11 standard]) 79else 80 ac_have_atomics=no 81fi 82 83if test "$GCC" = "yes"; then 84 if test "$enable_externalcflags" != "yes" ; then 85 if test "$enable_gperftools" = "yes" -o "$enable_debug" = "yes" ; then 86 CFLAGS="-O0 -fno-omit-frame-pointer -g -DMFSDEBUG $CCSTD -Wall -Wextra -Wshadow -pedantic -fwrapv" 87 else 88 CFLAGS="-O2 $CFLAGS -g $CCSTD -Wall -Wextra -Wshadow -pedantic -fwrapv" 89 fi 90 fi 91 if test "$enable_gperftools" = "yes"; then 92 CPPFLAGS="$CPPFLAGS -DGPERFTOOLS" 93 LDFLAGS="$LDFLAGS -L/opt/local/lib -lprofiler" 94 fi 95fi 96 97root_sbindir="xxx" 98fuse_lib_name="fuse" 99 100case $target_os in 101 *linux*) 102 fuse=maybe 103 bdev=maybe 104 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DDEFAULT_SUGID_CLEAR_MODE_EXT" 105 # Check whether exec_prefix=/usr: 106 eval root_sbindir="${sbindir}" 107 case $exec_prefix:$prefix in 108 NONE:NONE | NONE:/usr | /usr:*) 109 root_sbindir="/sbin" 110 esac 111 ;; 112 *solaris*) 113 # OpenSolaris has fuse available and is still identified as "solaris" 114 fuse=maybe 115 bdev=no 116 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -DDEFAULT_SUGID_CLEAR_MODE_OSX" 117 ;; 118 *darwin*) 119 fuse=maybe 120 bdev=no 121 fuse_lib_name="osxfuse" 122 # MacFUSE installs to different prefix than pkgconfig 123 if test -f /usr/local/lib/pkgconfig/fuse.pc ; then 124 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 125 export PKG_CONFIG_PATH 126 fi 127 CPPFLAGS="$CPPFLAGS -DDEFAULT_SUGID_CLEAR_MODE_OSX" 128 ;; 129 *bsd*) 130 fuse=maybe 131 bdev=no 132 CPPFLAGS="$CPPFLAGS -DDEFAULT_SUGID_CLEAR_MODE_BSD" 133 ;; 134 *) 135 fuse=no 136 bdev=no 137 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 138 ;; 139esac 140 141AC_SUBST([root_sbindir]) 142 143AX_PTHREAD(, [AC_MSG_ERROR([Posix threads not found])]) 144dnl AC_CHECK_LIB([pthread], [pthread_create]) 145 146# Checks for libraries. 147 148# Solaris: 149AC_SEARCH_LIBS([socket], [socket]) 150AC_SEARCH_LIBS([getaddrinfo], [nsl]) 151# FreeBSD: 152AC_SEARCH_LIBS([kvm_open], [kvm]) 153# Linux: 154AC_SEARCH_LIBS([clock_gettime], [rt]) 155 156# We do not use AC_SEARCH_LIBS to avoid adding '-lm' to every binary 157mathlib=no 158AC_CHECK_LIB([m],[round],[ AC_CHECK_HEADERS([math.h],[mathlib=yes]) ]) 159 160if test "$mathlib" = "no"; then 161 MATH_LIBS= 162else 163 MATH_LIBS=-lm 164fi 165AC_SUBST([MATH_LIBS]) 166 167# Checks for header files. 168AC_HEADER_DIRENT 169AC_HEADER_STDC 170AC_HEADER_SYS_WAIT 171AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h sys/statvfs.h sys/time.h syslog.h unistd.h],, [AC_MSG_ERROR([One of required headers was not found])]) 172 173# Checks for typedefs, structures, and compiler characteristics. 174AC_C_CONST 175AC_C_BIGENDIAN 176AC_C_INLINE 177AC_C_VOLATILE 178AC_C_FLEXIBLE_ARRAY_MEMBER 179AC_HEADER_STDBOOL 180AC_TYPE_INT8_T 181AC_TYPE_UINT8_T 182AC_TYPE_INT16_T 183AC_TYPE_UINT16_T 184AC_TYPE_INT32_T 185AC_TYPE_UINT32_T 186AC_TYPE_INT64_T 187AC_TYPE_UINT64_T 188AC_TYPE_UID_T 189AC_TYPE_MODE_T 190AC_TYPE_OFF_T 191AC_TYPE_PID_T 192AC_TYPE_SIZE_T 193AC_STRUCT_ST_BLOCKS 194AC_CHECK_MEMBERS([struct stat.st_rdev]) 195AC_CHECK_MEMBERS([struct stat.st_birthtime]) 196AC_CHECK_MEMBERS([struct stat.st_blksize]) 197AC_CHECK_MEMBERS([struct stat.st_flags]) 198AC_CHECK_MEMBER([struct sockaddr_in.sin_len], [ AC_DEFINE([HAVE_SOCKADDR_SIN_LEN], [1], [Do we have sockaddr.sin_len?]) ], [], [ 199#include <sys/types.h> 200#include <sys/socket.h> 201#include <netinet/in.h> 202]) 203 204AC_HEADER_TIME 205AC_STRUCT_TM 206AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,, [ 207#ifdef TM_IN_SYS_TIME 208# include <sys/time.h> 209#else 210# include <time.h> 211#endif 212]) 213 214AC_SYS_LARGEFILE 215 216# Checks for library functions. 217AC_FUNC_STRERROR_R 218AC_FUNC_CLOSEDIR_VOID 219AC_FUNC_FORK 220AC_FUNC_LSTAT 221AC_FUNC_MEMCMP 222dnl AC_FUNC_SELECT_ARGTYPES 223AC_FUNC_STAT 224 225dnl AC_FUNC_MALLOC 226dnl AC_FUNC_REALLOC 227# rpl_malloc/rpl_realloc problem AC_FUNC_MALLOC/AC_FUNC_REALLOC !!! 228AC_CHECK_FUNCS([malloc realloc reallocf]) 229 230# required functions 231AC_CHECK_FUNCS([atexit bzero ftruncate getaddrinfo getpass gettimeofday memmove memset mkdir realpath poll socket strchr strdup strtol strtoul ftello fseeko],, [AC_MSG_ERROR([One of required functions was not found])]) 232 233# optional temporary file function 234AC_CHECK_FUNCS([mkstemp mktemp]) 235 236# optional error conversion functions 237AC_CHECK_FUNCS([strerror perror]) 238 239# optional system functions 240AC_CHECK_FUNCS([dup2 mlockall getcwd setproctitle]) 241 242# check for mmap support 243AC_CHECK_HEADERS([sys/mman.h], [AC_CHECK_FUNCS([mmap])]) 244dnl AC_CHECK_HEADERS([sys/mman.h]) 245 246# check for xattr support 247AC_CHECK_HEADERS([attr/xattr.h]) 248AC_CHECK_HEADERS([sys/xattr.h]) 249 250# check for bsd-locks (flock) optional header 251AC_CHECK_HEADERS([sys/file.h]) 252 253# check if poll is in poll.h instead of sys/poll.h 254AC_CHECK_HEADERS([poll.h], [AC_CHECK_FUNCS([poll])]) 255 256# optional I/O functions 257AC_CHECK_FUNCS([pread pwrite readv writev posix_fadvise]) 258 259# optional sleep function 260AC_CHECK_FUNCS([nanosleep]) 261 262# optional resource usage function and headers 263AC_CHECK_FUNCS([getrusage setitimer]) 264AC_CHECK_HEADERS([sys/rusage.h sys/resource.h]) 265AC_CHECK_MEMBERS([struct rusage.ru_maxrss],,, [ 266#include <sys/time.h> 267#ifdef HAVE_GETRUSAGE 268# ifdef HAVE_SYS_RESOURCE_H 269# include <sys/resource.h> 270# endif 271# ifdef HAVE_SYS_RUSAGE_H 272# include <sys/rusage.h> 273# endif 274#endif 275]) 276 277# optional clock related headers and functions 278AC_CHECK_HEADERS([mach/mach.h mach/mach_time.h], [AC_CHECK_FUNCS([mach_absolute_time mach_timebase_info])]) 279AC_CHECK_FUNCS([clock_gettime]) 280 281# optional getgroups headers 282AC_CHECK_HEADERS([sys/sysctl.h]) 283 284# optional out of memory killer header 285AC_CHECK_HEADERS([linux/oom.h]) 286 287# optional uname header 288AC_CHECK_HEADERS([sys/utsname.h]) 289 290# glibc tuning 291AC_CHECK_HEADERS([malloc.h]) 292AC_CHECK_FUNCS([mallopt]) 293 294# core dumps 295AC_CHECK_HEADERS([sys/prctl.h], [AC_CHECK_FUNCS([prctl])]) 296 297# check for asprintf 298AC_CHECK_FUNCS([asprintf]) 299 300dnl optional thread functions 301dnl AC_CHECK_FUNCS([pthread_spin_lock]) 302 303dnl optional interfaces (Linux, FreeBSD) 304dnl AC_CHECK_FUNCS([fopencookie funopen]) 305 306AC_LANG([C]) 307 308AC_MSG_CHECKING([for __builtin_bswap16]) 309AC_RUN_IFELSE( 310 [AC_LANG_PROGRAM([#include <inttypes.h>],[uint16_t x = __builtin_bswap16(0x1234)])], 311 [ 312 AC_MSG_RESULT(yes) 313 AC_DEFINE([BSWAP16(x)], [__builtin_bswap16(x)], [bswap16]) 314 ],[ 315 AC_MSG_RESULT(no) 316 AC_DEFINE([BSWAP16(x)], [((((x)<<8)&0xFF00) | (((x)>>8)&0xFF))], [bswap16]) 317 ]) 318 319AC_MSG_CHECKING([for __builtin_bswap32]) 320AC_RUN_IFELSE( 321 [AC_LANG_PROGRAM([#include <inttypes.h>],[uint32_t x = __builtin_bswap32(0x12345678)])], 322 [ 323 AC_MSG_RESULT(yes) 324 AC_DEFINE([BSWAP32(x)], [__builtin_bswap32(x)], [bswap32]) 325 ],[ 326 AC_MSG_RESULT(no) 327 AC_DEFINE([BSWAP32(x)], [((((x)<<24)&0xFF000000) | (((x)<<8)&0xFF0000) | (((x)>>8)&0xFF00) | (((x)>>24)&0xFF))], [bswap32]) 328 ]) 329 330AC_MSG_CHECKING([for __builtin_bswap64]) 331AC_RUN_IFELSE( 332 [AC_LANG_PROGRAM([#include <inttypes.h>],[uint64_t x = __builtin_bswap64(0x123456789ABCDEF0)])], 333 [ 334 AC_MSG_RESULT(yes) 335 AC_DEFINE([BSWAP64(x)], [__builtin_bswap64(x)], [bswap64]) 336 ],[ 337 AC_MSG_RESULT(no) 338 AC_DEFINE([BSWAP64(x)], [((((x)<<56)&0xFF00000000000000) | (((x)<<40)&0xFF000000000000) | (((x)<<24)&0xFF0000000000) | (((x)<<8)&0xFF00000000) | (((x)>>8)&0xFF000000) | (((x)>>24)&0xFF0000) | (((x)>>40)&0xFF00) | (((x)>>56)&0xFF))], [bswap64]) 339 ]) 340 341 342# Check for Mac OS X's broken poll 343if test "$ac_cv_func_poll" = "yes"; then 344AC_MSG_CHECKING([if poll works on devices]) 345AC_RUN_IFELSE( 346 [AC_LANG_PROGRAM([[ 347#include <stdlib.h> 348#include <fcntl.h> 349#include <poll.h> 350]],[[ 351int main(void) { 352 struct pollfd fds[1]; 353 int fd; 354 fd = open("/dev/null", 1); 355 fds[0].fd = fd; 356 fds[0].events = POLLIN; 357 fds[0].revents = 0; 358 if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) { 359 exit(1); /* Does not work for devices -- fail */ 360 } 361 exit(0); 362 } 363]])],[ac_have_working_poll=yes],[ac_have_working_poll=no]) 364if test "$ac_have_working_poll" = "no" ; then 365 AC_DEFINE([BROKEN_POLL], [1],[poll does not work properly on devices]) 366fi 367AC_MSG_RESULT($ac_have_working_poll) 368fi dnl poll() was found 369 370 371AC_MSG_CHECKING([for __sync_OP_and_fetch]) 372AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], 373 [[unsigned long long int foo, bar; bar = __sync_add_and_fetch(&foo, 1); bar = __sync_sub_and_fetch(&foo, 1); bar = __sync_or_and_fetch(&foo, 1); bar = __sync_and_and_fetch(&foo, 1); bar = __sync_xor_and_fetch(&foo, 1); ]])], 374 [ac_have___sync_op_and_fetch=yes], [ac_have___sync_op_and_fetch=no]) 375if test "$ac_have___sync_op_and_fetch" = "yes" ; then 376 AC_DEFINE([HAVE___SYNC_OP_AND_FETCH], [1], [have __sync_OP_and_fetch intrinsics]) 377fi 378AC_MSG_RESULT($ac_have___sync_op_and_fetch) 379 380 381AC_MSG_CHECKING([for __sync_fetch_and_OP]) 382AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], 383 [[unsigned long long int foo, bar; bar = __sync_fetch_and_add(&foo, 1); bar = __sync_fetch_and_sub(&foo, 1); bar = __sync_fetch_and_or(&foo, 1); bar = __sync_fetch_and_and(&foo, 1); bar = __sync_fetch_and_xor(&foo, 1); ]])], 384 [ac_have___sync_fetch_and_op=yes], [ac_have___sync_fetch_and_op=no]) 385if test "$ac_have___sync_fetch_and_op" = "yes" ; then 386 AC_DEFINE([HAVE___SYNC_FETCH_AND_OP], [1], [have __sync_fetch_and_OP intrinsics]) 387fi 388AC_MSG_RESULT($ac_have___sync_fetch_and_op) 389 390AC_MSG_CHECKING([for __sync_bool_compare_and_swap]) 391AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], 392 [[unsigned long long int foo; int i,j; foo = 54; i = __sync_bool_compare_and_swap(&foo,54,7); j = __sync_bool_compare_and_swap(&foo,23,77); ]])], 393 [ac_have___sync_bool_compare_and_swap=yes], [ac_have___sync_bool_compare_and_swap=no]) 394if test "$ac_have___sync_bool_compare_and_swap" = "yes" ; then 395 AC_DEFINE([HAVE___SYNC_BOOL_COMPARE_AND_SWAP], [1], [have __sync_bool_compare_and_swap intrinsic]) 396fi 397AC_MSG_RESULT($ac_have___sync_bool_compare_and_swap) 398 399if test "$ac_have_atomics" != "no" ; then 400 AC_MSG_CHECKING([for _Atomic support]) 401 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdatomic.h>]], 402 [[_Atomic unsigned long long int foo; atomic_init(&foo,41); atomic_fetch_add(&foo,1); ]])], 403 [ac_have_atomics=yes], [ac_have_atomics=no]) 404 AC_MSG_RESULT($ac_have_atomics) 405fi 406if test "$ac_have_atomics" = "yes" ; then 407 AC_DEFINE([HAVE_ATOMICS], [1], [have support for atomic operations]) 408fi 409 410 411 412saved_cflags="$CFLAGS" 413CFLAGS="-Werror" 414AC_MSG_CHECKING([for __attribute__((fallthrough))]) 415AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[ 416int main(void) { 417 int a=0; 418 switch (a) { 419 case 1: 420 a=2; 421 __attribute__((fallthrough)); 422 case 2: 423 a=1; 424 } 425 return a; 426} 427]])],[ac_have_working_attribute_fallthrough=yes],[ac_have_working_attribute_fallthrough=no]) 428if test "$ac_have_working_attribute_fallthrough" = "yes" ; then 429 AC_DEFINE([nobreak],[__attribute__((fallthrough))],[have __attribute__((fallthrough))]) 430else 431 AC_DEFINE([nobreak],[],[do not have __attribute__((fallthrough))]) 432fi 433AC_MSG_RESULT($ac_have_working_attribute_fallthrough) 434CFLAGS="$saved_cflags" 435 436AC_CHECK_PROGS([KILL], [kill]) 437PKG_PROG_PKG_CONFIG 438PKG_CHECK_MODULES([SYSTEMD], [systemd], [ 439 systemdunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`" 440], [ 441 systemdunitdir=no 442]) 443AC_SUBST([systemdunitdir]) 444 445dnl this is work in progress 446dnl AC_ARG_ENABLE([lightmfs], [AS_HELP_STRING([--enable-lightmfs], [Build special version])]) 447 448AC_ARG_ENABLE([all], 449 [AS_HELP_STRING([--disable-all], [By default do not build anything except for manually enabled modules])]) 450 451dnl AC_ARG_ENABLE([generalmans], 452dnl [AS_HELP_STRING([--disable-general-mans], [Do not install general mans])]) 453 454AC_ARG_ENABLE([mfsmaster], 455 [AS_HELP_STRING([--disable-mfsmaster], [Do not build mfsmaster])], 456 [], 457 [enable_mfsmaster="$enable_all"]) 458AC_ARG_ENABLE([mfsmetalogger], 459 [AS_HELP_STRING([--disable-mfsmetalogger], [Do not build mfsmetalogger])], 460 [], 461 [enable_mfsmetalogger="$enable_all"]) 462AC_ARG_ENABLE([mfssupervisor], 463 [AS_HELP_STRING([--disable-mfssupervisor], [Do not build mfssupervisor])], 464 [], 465 [enable_mfssupervisor="$enable_all"]) 466AC_ARG_ENABLE([mfschunkserver], 467 [AS_HELP_STRING([--disable-mfschunkserver], [Do not build mfschunkserver])], 468 [], 469 [enable_mfschunkserver="$enable_all"]) 470AC_ARG_ENABLE([mfsmount], 471 [AS_HELP_STRING([--disable-mfsmount], [Do not build mfsmount])], 472 [], 473 [enable_mfsmount="$enable_all"]) 474AC_ARG_ENABLE([mfsbdev], 475 [AS_HELP_STRING([--disable-mfsbdev], [Do not build mfsbdev])], 476 [], 477 [enable_mfsbdev="$enable_all"]) 478AC_ARG_ENABLE([mfscgi], 479 [AS_HELP_STRING([--disable-mfscgi], [Do not install CGI scripts])], 480 [], 481 [enable_mfscgi="$enable_all"]) 482AC_ARG_ENABLE([mfscli], 483 [AS_HELP_STRING([--disable-mfscli], [Do not install CLI script])], 484 [], 485 [enable_mfscli="$enable_all"]) 486AC_ARG_ENABLE([mfscgiserv], 487 [AS_HELP_STRING([--disable-mfscgiserv], [Do not install CGI server])], 488 [], 489 [enable_mfscgiserv="$enable_all"]) 490AC_ARG_ENABLE([mfsnetdump], 491 [AS_HELP_STRING([--disable-mfsnetdump], [Do not build mfsnetdump])], 492 [], 493 [enable_mfsnetdump="$enable_all"]) 494AC_ARG_WITH([mfscgi-dir], 495 [AS_HELP_STRING([--with-mfscgi-dir=CGIDIR], [Choose CGI directory (default=DATADIR/mfscgi)])], 496 [CGIDIR="${withval}"], 497 [eval eval CGIDIR="${datadir}/mfscgi"]) 498AC_ARG_WITH([mfscgiserv-dir], 499 [AS_HELP_STRING([--with-mfscgiserv-dir=CGISERVDIR], [Choose CGI directory (default=SBINDIR)])], 500 [CGISERVDIR="${withval}"], 501 [eval CGISERVDIR="${sbindir}"]) 502AC_ARG_WITH([zlib], 503 [AS_HELP_STRING([--without-zlib], [Do not use zlib for PNG compression])], 504 [use_zlib="${withval}"], 505 [use_zlib=yes]) 506AC_ARG_WITH([systemdsystemunitdir], 507 [AS_HELP_STRING([--with-systemdsystemunitdir=PATH], [Path to install systemd units (no=omit)])], 508 [systemdunitdir="${withval}"]) 509 510AM_CONDITIONAL([WITH_SYSTEMD], [test "$systemdunitdir" != "no"]) 511 512if test "$enable_mfscgi" != "no" -o "$enable_mfscli" != "no" -o "$enable_mfscgiserv" != "no"; then 513 AC_CHECK_PROGS(PYTHON, [python3 python2 python python3.7 python3.6 python3.5 python3.4 python2.7], [na]) 514 if test "$PYTHON" = na; then 515 PYTHON="python" 516 AC_MSG_RESULT([Python binary not found !!! - using default in shebangs]) 517 else 518 AC_MSG_RESULT([Python binary for script shebangs: $PYTHON]) 519 fi 520fi 521 522dnl AX_PYTHON 523dnl if test "$enable_mfscgi" = "no"; then 524dnl enable_mfscgiserv=no 525dnl fi 526AM_CONDITIONAL([WITH_PYTHON], [test "$enable_mfscgi" != "no" -o "$enable_mfscli" != "no" -o "$enable_mfscgiserv" != "no"]) 527AM_CONDITIONAL([BUILD_SCRIPTS], [test "$enable_mfscgi" != "no" -o "$enable_mfscli" != "no" -o "$enable_mfscgiserv" != "no"]) 528AM_CONDITIONAL([INSTALL_CGI], [test "$enable_mfscgi" != "no"]) 529AM_CONDITIONAL([INSTALL_CLI], [test "$enable_mfscli" != "no"]) 530AM_CONDITIONAL([INSTALL_CGISERV], [test "$enable_mfscgiserv" != "no"]) 531AM_CONDITIONAL([INSTALL_MOOSEFS_MOUNT], [test "$root_sbindir" != "xxx"]) 532AC_SUBST([CGIDIR]) 533AC_SUBST([CGISERVDIR]) 534AC_SUBST([PYTHON]) 535 536AM_CONDITIONAL([BUILD_MASTER], [test "$enable_mfsmaster" != "no"]) 537AM_CONDITIONAL([BUILD_METALOGGER], [test "$enable_mfsmetalogger" != "no"]) 538AM_CONDITIONAL([BUILD_SUPERVISOR], [test "$enable_mfssupervisor" != "no"]) 539AM_CONDITIONAL([BUILD_CHUNKSERVER], [test "$enable_mfschunkserver" != "no"]) 540 541 542pcap=no 543AC_CHECK_LIB([pcap],[pcap_lib_version],[ AC_CHECK_HEADERS([pcap.h],[pcap=yes]) ]) 544 545if test "$pcap" = "no"; then 546 PCAP_LIBS= 547 if test "enable_mfsnetdump" != "no"; then 548 echo "****** mfsnetdump disabled ******" 549 echo "* mfsnetdump needs pcap library *" 550 echo "*********************************" 551 enable_mfsnetdump=no 552 fi 553else 554 PCAP_LIBS=-lpcap 555 # check for new PCAP pcap_findalldevs 556 AC_CHECK_LIB([pcap], [pcap_findalldevs], [AC_DEFINE([HAVE_PCAP_FINDALLDEVS],[1],[libpcap has function pcap_findalldevs])]) 557 558fi 559AC_SUBST([PCAP_LIBS]) 560 561AM_CONDITIONAL([BUILD_NETDUMP], [test "$enable_mfsnetdump" != "no"]) 562 563if test "$bdev" != "no" -a "enable_mfsbdev" != "no"; then 564 AC_CHECK_HEADERS([linux/nbd.h linux/fs.h],,[bdev=no]) 565fi 566 567AM_CONDITIONAL([WITH_BDEV], [test "$bdev" != "no" -a "$enable_mfsbdev" != "no"]) 568 569if test "$fuse" != "no" -a "enable_mfsmount" != "no"; then 570 if test -n "$PKG_CONFIG"; then 571 PKG_CHECK_MODULES([FUSE], [fuse3 >= 3.2.1], [AC_DEFINE([HAVE_FUSE3],[1],[libfuse3 detected])] , [ PKG_CHECK_MODULES([FUSE], [fuse >= 2.6], , [fuse=no]) ]) 572 else 573 echo "no pkg-config - can't check FUSE version" 574 fuse=no 575 fi 576fi 577if test "$fuse" = "no"; then 578 if test "$enable_mfsmount" = "yes"; then 579 if test -n "$PKG_CONFIG"; then 580 AC_MSG_ERROR([mfsmount build was forced, but fuse library is too old or not installed]) 581 else 582 AC_MSG_ERROR([mfsmount build was forced, but pkg-config not installed]) 583 fi 584 else 585 if test "$enable_mfsmount" != "no"; then 586 if test -n "$PKG_CONFIG"; then 587 echo "******************************** mfsmount disabled ********************************" 588 echo "* fuse library is too old or not installed - mfsmount needs version 2.6 or higher *" 589 echo "***********************************************************************************" 590 else 591 echo "**** mfsmount disabled *****" 592 echo "* pkg-config not installed *" 593 echo "****************************" 594 fi 595 fi 596 fi 597fi 598if test "$fuse" != "no" ; then 599 case $target_os in 600 freebsd6*) 601 echo "*************************************************************************" 602 echo "* Dynamic linker in FreeBSD 6.x doesn't support symbol versioning. *" 603 echo "* It causes calling wrong functions from libfuse and crashing mfsmount. *" 604 echo "* Due to above switching libfuse from dynamic linking to static. *" 605 echo "*************************************************************************" 606 FUSE_LIBS="-pthread /usr/local/lib/libfuse.a /usr/local/lib/libiconv.a" 607 AC_SUBST(FUSE_LIBS) 608 ;; 609 esac 610fi 611 612AC_CHECK_LIB([$fuse_lib_name], [fuse_version], [AC_DEFINE([HAVE_FUSE_VERSION],[1],[libfuse has function fuse_version])]) 613 614AM_CONDITIONAL([WITH_MOUNT], [test "$fuse" != "no" -a "$enable_mfsmount" != "no"]) 615 616AM_CONDITIONAL([BUILD_CLIENT], [test \( "$fuse" != "no" -a "$enable_mfsmount" != "no" \) -o \( "$bdev" != "no" -a "$enable_mfsbdev" != "no" \)]) 617 618AM_CONDITIONAL([CREATE_ETC_MFS], [test "$enable_mfsmaster" != "no" -o "$enable_mfsmetalogger" != "no" -o "$enable_mfschunkserver" != "no" -o "$enable_mfsmount" != "no"]) 619AM_CONDITIONAL([CREATE_DATA_DIR], [test "$enable_mfsmaster" != "no" -o "$enable_mfsmetalogger" != "no" -o "$enable_mfschunkserver" != "no" -o "$enable_mfscgiserv" != "no"]) 620 621if test "$use_zlib" = "yes"; then 622 623 zlib=no 624 AC_CHECK_LIB(z, zlibVersion, [ AC_CHECK_HEADERS(zlib.h,[zlib=yes]) ]) 625 626 if test "$zlib" = "no"; then 627 ZLIB_LIBS= 628 if test "$enable_mfsmaster" != "no" -o "$enable_mfschunkserver" != "no"; then 629 AC_MSG_ERROR([zlib development library not found]) 630 fi 631 else 632 ZLIB_LIBS=-lz 633 fi 634 AC_SUBST([ZLIB_LIBS]) 635fi 636 637DEFAULT_USER=nobody 638DEFAULT_GROUP= 639AC_ARG_WITH([default-user], 640 [AS_HELP_STRING([--with-default-user=USER], [Choose default user to run daemons as])], 641 [DEFAULT_USER="${withval}"]) 642AC_ARG_WITH([default-group], 643 [AS_HELP_STRING([--with-default-group=GROUP], [Choose default group to run daemons as])], 644 [DEFAULT_GROUP="${withval}"]) 645AC_DEFINE_UNQUOTED([DEFAULT_USER], ["$DEFAULT_USER"], [Default working user]) 646AC_DEFINE_UNQUOTED([DEFAULT_GROUP], ["$DEFAULT_GROUP"], [Default working group]) 647AC_SUBST([DEFAULT_USER]) 648AC_SUBST([DEFAULT_GROUP]) 649 650DEFAULT_PORTBASE=9400 651DEFAULT_MASTERNAME=mfsmaster 652AC_ARG_WITH([default-portbase], 653 [AS_HELP_STRING([--with-default-portbase=NUMBER], [Default communiaction port base (default=9400, which means ports 9419,9420,etc.)])], 654 [DEFAULT_PORTBASE="${withval}"]) 655AC_ARG_WITH([default-mastername], 656 [AS_HELP_STRING([--with-default-mastername=MASTER_DNS_NAME], [Defines default DNS name pointing to all masters (default=mfsmaster)])], 657 [DEFAULT_MASTERNAME="${withval}"]) 658DEFAULT_MASTER_CONTROL_PORT=$((DEFAULT_PORTBASE+19)) 659DEFAULT_MASTER_CS_PORT=$((DEFAULT_PORTBASE+20)) 660DEFAULT_MASTER_CLIENT_PORT=$((DEFAULT_PORTBASE+21)) 661DEFAULT_CS_DATA_PORT=$((DEFAULT_PORTBASE+22)) 662DEFAULT_CGISERV_HTTP_PORT=$((DEFAULT_PORTBASE+25)) 663AC_DEFINE_UNQUOTED([DEFAULT_PORTBASE], [$DEFAULT_PORTBASE], [Default port base]) 664AC_DEFINE_UNQUOTED([DEFAULT_MASTER_CONTROL_PORT], ["$DEFAULT_MASTER_CONTROL_PORT"], [Default master command port]) 665AC_DEFINE_UNQUOTED([DEFAULT_MASTER_CS_PORT], ["$DEFAULT_MASTER_CS_PORT"], [Default master chunkserver port]) 666AC_DEFINE_UNQUOTED([DEFAULT_MASTER_CLIENT_PORT], ["$DEFAULT_MASTER_CLIENT_PORT"], [Default master client port]) 667AC_DEFINE_UNQUOTED([DEFAULT_CS_DATA_PORT], ["$DEFAULT_CS_DATA_PORT"], [Default chunkserver data port]) 668AC_DEFINE_UNQUOTED([DEFAULT_CGISERV_HTTP_PORT], ["$DEFAULT_CGISERV_HTTP_PORT"], [Default cgiserver http port]) 669AC_DEFINE_UNQUOTED([DEFAULT_MASTERNAME], ["$DEFAULT_MASTERNAME"], [Default master name]) 670AC_SUBST([DEFAULT_PORTBASE]) 671AC_SUBST([DEFAULT_MASTER_CONTROL_PORT]) 672AC_SUBST([DEFAULT_MASTER_CS_PORT]) 673AC_SUBST([DEFAULT_MASTER_CLIENT_PORT]) 674AC_SUBST([DEFAULT_CS_DATA_PORT]) 675AC_SUBST([DEFAULT_CGISERV_HTTP_PORT]) 676AC_SUBST([DEFAULT_MASTERNAME]) 677 678if test "$enable_lightmfs" = "yes"; then 679 PROTO_BASE=65536 680 LIGHT_MFS=1 681else 682 PROTO_BASE=0 683 LIGHT_MFS=0 684fi 685AC_SUBST([PROTO_BASE]) 686AC_SUBST([LIGHT_MFS]) 687AC_DEFINE_UNQUOTED([PROTO_BASE], [$PROTO_BASE], [Base value for protocol commands]) 688AC_DEFINE_UNQUOTED([LIGHT_MFS], [$LIGHT_MFS], [Build light version]) 689 690AC_SUBST([release]) 691AC_SUBST([buildno]) 692 693AC_CONFIG_FILES([Makefile 694 mfsmanpages/Makefile 695 mfschunkserver/Makefile 696 mfsscripts/Makefile 697 mfsdata/Makefile 698 mfsmaster/Makefile 699 mfsmetatools/Makefile 700 mfsmetalogger/Makefile 701 mfssupervisor/Makefile 702 mfsclient/Makefile 703 mfsnetdump/Makefile 704 mfstests/Makefile 705 systemd/Makefile 706 mfsscripts/mfscli.py 707 mfsscripts/chart.cgi 708 mfsscripts/index.html 709 mfsscripts/mfscgiserv.py 710 mfsdata/mfschunkserver.cfg 711 mfsdata/mfsmaster.cfg 712 mfsdata/mfsmetalogger.cfg 713 mfsdata/mfsmount.cfg 714 systemd/moosefs-cgiserv.service 715 systemd/moosefs-chunkserver.service 716 systemd/moosefs-chunkserver@.service 717 systemd/moosefs-master.service 718 systemd/moosefs-master@.service 719 systemd/moosefs-metalogger.service 720 systemd/moosefs-metalogger@.service 721]) 722AC_OUTPUT 723echo 724echo "Summary:" 725echo 726echo "VERSION / RELEASE / BUILDNO ......... ${PACKAGE_VERSION} / ${release} / ${buildno}" 727echo 728echo "CC .................................. $CC" 729echo "CFLAGS .............................. $CFLAGS" 730echo "CPPFLAGS ............................ $CPPFLAGS" 731echo "PYTHON .............................. $PYTHON" 732echo 733echo "PREFIX .............................. ${prefix}" 734echo "RUN_PATH ............................ $RUN_PATH" 735echo "DATA_PATH ........................... $DATA_PATH" 736echo "ETC_PATH ............................ $ETC_PATH" 737echo "BIN_PATH ............................ $BIN_PATH" 738echo "SBIN_PATH ........................... $SBIN_PATH" 739echo "CGI_PATH ............................ $CGIDIR" 740echo "CGISERV_PATH ........................ $CGISERVDIR" 741echo 742echo "DEFAULT_USER:DEFAULT_GROUP .......... ${DEFAULT_USER}:${DEFAULT_GROUP}" 743echo "MASTER DNS NAME ..................... ${DEFAULT_MASTERNAME}" 744echo "PORTS ............................... ${DEFAULT_MASTER_CONTROL_PORT}:${DEFAULT_MASTER_CS_PORT}:${DEFAULT_MASTER_CLIENT_PORT}:${DEFAULT_CS_DATA_PORT}:${DEFAULT_CGISERV_HTTP_PORT}" 745echo 746if test "$BUILD_MASTER_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 747echo "BUILD_MASTER ........................ $RESULT" 748if test "$BUILD_METALOGGER_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 749echo "BUILD_METALOGGER .................... $RESULT" 750if test "$BUILD_SUPERVISOR_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 751echo "BUILD_SUPERVISOR .................... $RESULT" 752if test "$BUILD_CHUNKSERVER_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 753echo "BUILD_CHUNKSERVER ................... $RESULT" 754if test "$BUILD_NETDUMP_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 755echo "BUILD_NETDUMP ....................... $RESULT" 756if test "$BUILD_SCRIPTS_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 757echo "BUILD_SCRIPTS ....................... $RESULT" 758if test "$INSTALL_CGI_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 759echo " CGI ............................. $RESULT" 760if test "$INSTALL_CLI_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 761echo " CLI ............................. $RESULT" 762if test "$INSTALL_CGISERV_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 763echo " CGISERV ......................... $RESULT" 764if test "$BUILD_CLIENT_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 765echo "BUILD_CLIENT ........................ $RESULT" 766if test "$WITH_MOUNT_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 767echo " MOUNT ........................... $RESULT" 768if test "$WITH_BDEV_TRUE" = ""; then RESULT="yes"; else RESULT="no"; fi 769echo " BDEV ............................ $RESULT" 770echo 771