home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / configure.in < prev    next >
Text File  |  2011-03-23  |  40KB  |  1,300 lines

  1. dnl **************************************************************
  2. dnl PVFS2 AUTOCONF SCRIPT
  3. dnl
  4. dnl Process this file with autoconf to produce a configure script.
  5. dnl You may need to use autoheader as well if changing any DEFINEs
  6.  
  7. dnl sanity checks, output header, location of scripts used here
  8. AC_INIT(include/pvfs2-types.h)
  9. AC_PREREQ(2.59)
  10. AC_CONFIG_AUX_DIR(maint/config)
  11.  
  12. dnl
  13. dnl for test builds, insert the build date and time information into
  14. dnl into the version; for official releases, clear the PVFS2_PRE line
  15. dnl
  16. dnl PVFS2 versioning information.  
  17. dnl An @ in the date string can confuse e.g. scp and 'make kmod'
  18. CONFIGURE_TIME=`date -u +"%Y-%m-%d-%H%M%S"`
  19. PVFS2_VERSION_MAJOR=2
  20. PVFS2_VERSION_MINOR=8
  21. PVFS2_VERSION_SUB=3
  22. PVFS2_VERSION_RELEASE="orangefs-20110323"
  23. #PVFS2_PRE=""
  24. #PVFS2_VERSION_PRE="orangefs-$CONFIGURE_TIME"
  25.  
  26. PVFS2_VERSION=$PVFS2_VERSION_MAJOR.$PVFS2_VERSION_MINOR.$PVFS2_VERSION_SUB-$PVFS2_VERSION_RELEASE
  27. AC_SUBST(PVFS2_VERSION)
  28. AC_DEFINE_UNQUOTED(PVFS2_VERSION_MAJOR, $PVFS2_VERSION_MAJOR, major version number)
  29. AC_DEFINE_UNQUOTED(PVFS2_VERSION_MINOR, $PVFS2_VERSION_MINOR, minor version number)
  30. AC_DEFINE_UNQUOTED(PVFS2_VERSION_SUB, $PVFS2_VERSION_SUB, sub version number)
  31. #AC_DEFINE_UNQUOTED(PVFS2_VERSION_RELEASE, $PVFS2_VERSION_RELEASE, release version number)
  32. AC_SUBST(PVFS2_VERSION_MAJOR)
  33. AC_SUBST(PVFS2_VERSION_MINOR)
  34. AC_SUBST(PVFS2_VERSION_SUB)
  35. #AC_SUBST(PVFS2_VERSION_RELEASE)
  36.  
  37. dnl BMI_ONLY_TAG
  38.  
  39. dnl Checks for host type
  40. dnl Ensures we can compile on this OS
  41. AC_CANONICAL_HOST
  42.  
  43. USR_CFLAGS=$CFLAGS
  44. if test "x$USR_CFLAGS" = "x"; then
  45.     USR_CFLAGS_SET=no
  46. fi
  47.  
  48. AC_CONFIG_HEADER(pvfs2-config.h)
  49.  
  50. AC_CHECK_HEADER([pwd.h],
  51.     [AC_DEFINE(HAVE_GETPWUID, 1, Define if pwd.h exists)])
  52. AC_CHECK_HEADER([sys/vfs.h],
  53.         [AC_DEFINE(HAVE_SYS_VFS_H, 1, Define if sys/vfs.h exists)])
  54. AC_CHECK_HEADER([sys/mount.h],
  55.         [AC_DEFINE(HAVE_SYS_MOUNT_H, 1, Define if sys/mount.h exists)])
  56.  
  57. AC_CHECK_HEADERS([mntent.h, fstab.h])
  58.  
  59. AC_CHECK_HEADERS(stdarg.h)
  60.  
  61. AC_CHECK_HEADERS(attr/xattr.h)
  62. AC_CHECK_HEADERS(sys/xattr.h)
  63.  
  64. AC_CHECK_SIZEOF([long int])
  65.  
  66. dnl Check for utilities that we need during the build process
  67. AC_PROG_INSTALL
  68. AC_PROG_CC
  69.  
  70. AC_MSG_CHECKING([for required gcc])
  71. if test "x$GCC" = "x"; then
  72.     AC_MSG_ERROR(no)
  73. fi
  74.  
  75. CFLAGS=$USR_CFLAGS
  76.  
  77. AC_PROG_CPP
  78. AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
  79. AC_CHECK_PROG(HAVE_FIND, find, yes, no)
  80. AC_CHECK_PROG(HAVE_BISON, bison, yes, no)
  81. AC_CHECK_PROG(HAVE_FLEX, flex, yes, no)
  82.  
  83.  
  84. AC_MSG_CHECKING([for required Math::BigInt perl module])
  85. perl -e "use Math::BigInt" 2>&1 > /dev/null
  86. if test $? != 0; then
  87.     AC_MSG_ERROR(no)
  88. else
  89.     AC_MSG_RESULT(yes)
  90. fi
  91.  
  92. if test $host != $build; then
  93.     AC_CHECK_PROGS(BUILD_CC, gcc cc)
  94. else
  95.     BUILD_CC=$CC
  96.     BUILD_CFLAGS=$BUILD_CFLAGS
  97.     BUILD_LDFLAGS=$BUILD_LDFLAGS
  98. fi
  99.  
  100. AC_SUBST(BUILD_CC)
  101. AC_SUBST(BUILD_CFLAGS)
  102. AC_SUBST(BUILD_LDFLAGS)
  103.  
  104. #
  105. # Threading options.
  106. #
  107. # Client - thread-safe or not
  108. #   --disable-thread-safety : chooses null or posix locking mechanism
  109. #   For applications that know they are not multi-threaded, or choose
  110. #   to handle locking themselves, this configure option can be used to
  111. #   slightly decrease library-induced latency by removing the locking.
  112. #
  113. # Client - job threading
  114. #   libpvfs2-threaded.{so,a} with __PVFS2_JOB_THREADED__
  115. #   This option causes the client library to spawn an extra thread
  116. #   to handle network communications.  In this way, it is possible
  117. #   that the library can handle new and completed requests from
  118. #   the application while also interacting with the network.
  119. #
  120. #   These separate libraries can not be built using the existing
  121. #   configure mechanism.  They are only built if required by the
  122. #   kernel module helper.
  123. #
  124. # Server - three options:
  125. #   trove
  126. #     (hack Makefile.in)
  127. #   job
  128. #     (hack Makefile.in)
  129. #   aio
  130. #     --disable-aio-threaded-callbacks
  131. #
  132. #   Trove (storage) and job threading in the server are implemented
  133. #   using #defines, but not exported through the configure mechanism.
  134. #   AIO threaded callbacks are a separate thread used in conjunction
  135. #   with trove, and can be disabled through a configure option as
  136. #   AIO has been found to be buggy on many systems.
  137. #
  138. #
  139. # Kernel module helper - job threading
  140. #   --enable-threaded-kmod-helper
  141. #
  142. #   This is a special client that "helps" applications that access PVFS
  143. #   through the kernel using normal VFS calls (e.g. "ls").  This
  144. #   configure options builds it using __PVFS2_JOB_THREADED__ as described
  145. #   above.  That enables a thread for the network layer and a thread
  146. #   for the kernel interface.  This has the potential to increase the
  147. #   rate at which concurrent operations are processed, but has the potential
  148. #   drawback of somewhat higher overhead for a single operation and lack
  149. #   of testing.
  150. #
  151. #   Enabling this options causes one of libpvfs2-threaded.{so,a} to be
  152. #   built, depending on --enable-shared and --enable-static.  If both are
  153. #   enabled, the shared library takes precedence.
  154. #
  155.  
  156. dnl a mechanism to turn off threads in the client library
  157. AC_MSG_CHECKING([for client library thread safety support])
  158. AC_ARG_ENABLE(thread-safety,
  159. [  --disable-thread-safety Disables thread safety in the client library],
  160. [if test "x$enableval" = "xno" ; then
  161.     LIBCFLAGS="$LIBCFLAGS -D__GEN_NULL_LOCKING__"
  162.     THREAD_LIB=""
  163.     AC_MSG_RESULT(no)
  164. fi],
  165. [   LIBCFLAGS="$LIBCFLAGS -D__GEN_POSIX_LOCKING__"
  166.     THREAD_LIB="-lpthread"
  167.     AC_MSG_RESULT(yes) ])
  168.  
  169. AC_SUBST(LIBCFLAGS)
  170. AC_SUBST(THREAD_LIB)
  171.  
  172. dnl a mechanism to disable building the PVFS2 server
  173. AC_ARG_ENABLE(server,
  174. [  --disable-server        Disables building of PVFS2 server],
  175. [if test "x$enableval" = "xyes" ; then
  176.     BUILD_SERVER=1
  177.     NEED_BERKELEY_DB=yes
  178. else
  179.     BUILD_SERVER=""
  180. fi],
  181.     BUILD_SERVER=1
  182.     NEED_BERKELEY_DB=yes)
  183. AC_SUBST(BUILD_SERVER)
  184.  
  185. AC_ARG_WITH(openssl,
  186.     [  --with-openssl=<dir>    Build with openssl (default=/usr)
  187.   --without-openssl       Don't build with openssl.],
  188.     [AX_OPENSSL(${withval})],
  189.     [AX_OPENSSL_OPTIONAL])
  190.  
  191. dnl a mechanism to turn off memory usage statistics in karma (may be
  192. dnl confusing for some classes of users)
  193. AC_ARG_ENABLE(karma-mem-usage-stats,
  194. [  --disable-karma-mem-usage-stats
  195.                           Disables memory usage stats in karma],
  196. [if test "x$enableval" = "xno" ; then
  197.     CFLAGS="$CFLAGS -D__KARMA_DISABLE_MEM_USAGE__"
  198. fi]
  199. ,)
  200.  
  201. dnl build only the bmi library
  202. AC_ARG_ENABLE(bmi-only,
  203. [  --enable-bmi-only       Build only the BMI library],
  204. [if test "x$enableval" = "xyes" ; then
  205.     BUILD_BMI_ONLY=1
  206. fi]
  207. ,)
  208. AC_SUBST(BUILD_BMI_ONLY)
  209.  
  210. dnl if we're only building the BMI lib, disable checks for server and DB.
  211. if test "x$BUILD_BMI_ONLY" = "x1"; then
  212.     BUILD_SERVER=""
  213.     NEED_BERKELEY_DB=no
  214.     AC_SUBST(BUILD_SERVER)
  215.     AC_SUBST(NEED_BERKELEY_DB)
  216. fi
  217.  
  218. dnl a mechanism to turn off perf counters
  219. AC_ARG_ENABLE(perf-counters,
  220. [  --disable-perf-counters Disables pvfs2-server performance counters],
  221. [if test "x$enableval" = "xno" ; then
  222.     CFLAGS="$CFLAGS -D__PVFS2_DISABLE_PERF_COUNTERS__"
  223. fi]
  224. ,)
  225.  
  226. dnl a mechanism to turn on mmap-readahead caching (for kernel interface)
  227. MMAP_RA_CACHE=""
  228. AC_ARG_ENABLE(mmap-racache,
  229. [  --enable-mmap-racache   **EXPERIMENTAL** Enables mmap-readahead in kernel 
  230.                           interface],
  231. [if test "x$enableval" = "xyes" ; then
  232. MMAP_RA_CACHE="-DUSE_MMAP_RA_CACHE"
  233. fi]
  234. ,)
  235. AC_SUBST(MMAP_RA_CACHE)
  236.  
  237. dnl See if the --enable-trusted-connections  option was given to configure
  238. AC_ARG_ENABLE(trusted-connections,
  239. [  --enable-trusted-connections
  240.                           **EXPERIMENTAL** Enable connects only 
  241.                           from trusted hosts/ports ],
  242. [if test "x$enableval" = "xyes"; then
  243. TRUSTED_CONNECTIONS="-DUSE_TRUSTED"
  244. fi],
  245. )
  246. AC_SUBST(TRUSTED_CONNECTIONS)
  247.  
  248.  
  249. dnl a function to check if we have the required gtk stuff for the
  250. dnl karma gui
  251. test_for_karma()
  252. {
  253.   AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
  254.   if test "x$HAVE_PKGCONFIG" = "xyes" ; then
  255.      AC_MSG_CHECKING([for gtk2.0 (for karma gui)])
  256.      if `pkg-config --exists gtk+-2.0` ; then
  257.         AC_MSG_RESULT(yes)
  258.         GTKLIBS=`pkg-config --libs gtk+-2.0`
  259.         GTKCFLAGS=`pkg-config --cflags gtk+-2.0`
  260.  
  261.         AC_SUBST(GTKLIBS)
  262.         AC_SUBST(GTKCFLAGS)
  263.         BUILD_KARMA="1"
  264.         AC_SUBST(BUILD_KARMA)
  265.      else
  266.         AC_MSG_RESULT(no)
  267.      fi
  268.   fi
  269. }
  270.  
  271. dnl optionally disable building the karma gui
  272. AC_ARG_ENABLE(karma,
  273. [  --disable-karma         Disables optional gui.  (Enabled by default)],
  274. [ if test "x$enableval" = "xyes" ; then
  275.       test_for_karma
  276.    fi
  277. ],
  278. [test_for_karma]
  279. )
  280.  
  281. dnl shared or static client library (see --enable-shared below)
  282. AC_ARG_ENABLE(static,
  283. [  --disable-static        Do not build static client library],
  284. [build_static=$enableval], [build_static=yes])
  285. AC_SUBST(build_static)
  286.  
  287. dnl NOTE: removing the linux-gnu host check for now; we may want to put it back
  288. dnl before releaseing any code, though...  -Phil
  289. dnl 
  290. dnl AC_MSG_CHECKING(whether we know how to compile for this OS)
  291. dnl if test x$host_os != xlinux-gnu; then AC_MSG_ERROR($host_os not supported.)
  292. dnl else AC_MSG_RESULT(yes)
  293. dnl fi
  294.  
  295. dnl some redhat 2.4 kernels have a lot of 2.6 features, so we need to take
  296. dnl special measures to accomodate those hacked kernels.  However, we do not
  297. dnl need to take these workarounds if someone is building a stock kernel.org
  298. dnl kernel.  
  299.  
  300. dnl was the configure option passed in?
  301. set_redhat24=0
  302. dnl what was the configure option set to?
  303. use_redhat24=0
  304.  
  305. AC_ARG_ENABLE([redhat24],
  306. [  --enable-redhat24       Enable workaround for RedHat 2.4 kernel], 
  307.     set_redhat24=1
  308.     if test "$enableval" = no ; then 
  309.         use_redhat24=0
  310.     else
  311.         use_redhat24=1 
  312.     fi
  313. )
  314.  
  315. dnl some systems (ie, RedHat EL 3 prior to Update 2) have buggy NPTL/Pthread
  316. dnl implementations.  We accomodate this with a server stub script hack that
  317. dnl attempts to disable NPTL and fall back to old fashioned Linux Threads.
  318.  
  319. dnl was the configure option passed in?
  320. set_nptl_workaround=0
  321. dnl what was the configure option set to?
  322. use_nptl_workaround=0
  323.  
  324. AC_ARG_ENABLE([nptl-workaround],
  325. [  --enable-nptl-workaround
  326.                           Enable workaround for buggy NPTL/Pthread libraries], 
  327.     set_nptl_workaround=1
  328.     if test "$enableval" = no ; then 
  329.         use_nptl_workaround=0
  330.     else
  331.         use_nptl_workaround=1 
  332.     fi
  333. )
  334.  
  335. dnl We check for the following redhat tags, as they all have similarly
  336. dnl modified 2.4.x kernels
  337. dnl
  338. RHTAG1="Red Hat Linux release 9"
  339. RHTAG2="Red Hat Enterprise Linux WS release 3"
  340. RHTAG3="Red Hat Enterprise Linux AS release 3"
  341. RHTAG4="Red Hat Enterprise Linux ES release 3"
  342. RHTAG5="Red Hat Linux Advanced Server release 2.1AS"
  343. RHTAG6="Fedora Core release 1 (Yarrow)"
  344.  
  345.  
  346. dnl we won't be able to catch all cases, but see if we can
  347. dnl get the majority of platforms where we might need to work around
  348. dnl backported features.  Basically we give up if running on these redhat
  349. dnl versions 
  350.  
  351. REDHAT_RELEASE=""
  352. if test -f /etc/redhat-release; then
  353.     AC_MSG_CHECKING(for tagged Redhat releases (must patch))
  354.     REDHAT_REL=`cat /etc/redhat-release`
  355.     if test "x`echo $REDHAT_REL | cut -b 1-23`" = "x$RHTAG1" ||
  356.        test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG2" ||
  357.        test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG3" ||
  358.        test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG4" ||
  359.        test "x`echo $REDHAT_REL | cut -b 1-43`" = "x$RHTAG5" ||
  360.        test "x`echo $REDHAT_REL | cut -b 1-30`" = "x$RHTAG6" ; then
  361.        AC_MSG_RESULT(yes)
  362.        
  363.        if test "$set_redhat24" = 0 || test "$set_nptl_workaround" = 0 ; then
  364.            AC_MSG_ERROR([
  365.     You appear to be configuring PVFS2 on a RedHat distribution that
  366.     likely ships with a heavily modified kernel and c library.  You must
  367.     specify two configure arguments to provide necessary information before
  368.     proceeding.  First pick one of these two options:
  369.     =============================
  370.     --enable-redhat24         (if you are using a redhat provided 2.4 kernel)
  371.     --disable-redhat24        (if you are using a stock kernel.org kernel)
  372.     =============================
  373.     Also pick one of the next two options.  You should probably enable the
  374.     workaround if you are using RedHat EL 3 prior to update 2.  Otherwise it
  375.     is probably safer (and higher performance) to disable it:
  376.     =============================
  377.     --enable-nptl-workaround  (to work around buggy glibc pthread library)
  378.     --disable-nptl-workaround (if you trust your glibc pthread library)
  379.     ============================= ])
  380.        fi
  381.     else
  382.        AC_MSG_RESULT(no)
  383.     fi
  384. fi
  385.  
  386. dnl some non-redhat kernels (like whitebox linux and centos) rebuild
  387. dnl rhel and give the distribution a different name, so if the user sets
  388. dnl "enable-redhat24", then use it no matter what /etc/redhat-release might say
  389.  
  390. if test "$use_redhat24" = 1 ; then
  391.    REDHAT_RELEASE="-DREDHAT_RELEASE_9"
  392. fi
  393. AC_SUBST(REDHAT_RELEASE)
  394.  
  395. if test "$use_nptl_workaround" = 1 ; then
  396.    NPTL_WORKAROUND="1"
  397. fi
  398. AC_SUBST(NPTL_WORKAROUND)
  399.  
  400. use_aio_thcb=1
  401. AC_ARG_ENABLE([aio-threaded-callbacks],
  402. [  --disable-aio-threaded-callbacks
  403.                           **EXPERIMENTAL** Disable use of AIO 
  404.                           threaded callbacks],
  405.     if test "$enableval" = no ; then use_aio_thcb=0 ; fi)
  406.  
  407. dnl there used to be a big hairy test in here, back when glibc-2.3.0 and
  408. dnl glibc-2.3.1 had buggy aio callbacks.  That test was broken because it
  409. dnl assumed just linux, and could not handle glibc-2.4.x (or newer).  Rely on
  410. dnl aio-threaded-callbacks, perhaps with a blacklist of distros that have the
  411. dnl broken glibc.
  412.  
  413. MISC_TROVE_FLAGS=""
  414. if test $use_aio_thcb = 1 ; then
  415.     MISC_TROVE_FLAGS="-D__PVFS2_TROVE_AIO_THREADED__"
  416. fi
  417. AC_SUBST(MISC_TROVE_FLAGS)
  418.  
  419. dnl Check for AIO's aiocb->__error_code field (linux has it, OS X doesn't)
  420. AC_MSG_CHECKING([for __error_code field in aiocb struct])
  421. AC_TRY_COMPILE(
  422.     [
  423.          #include <aio.h>
  424.     ], 
  425.     [
  426.         struct aiocb aiocb;
  427.     aiocb.__error_code = 0;
  428.     ],
  429.     AC_MSG_RESULT(yes)
  430.     AC_DEFINE(HAVE_AIOCB_ERROR_CODE, 1, Define if aiocb->__error_code exists)
  431.     ,
  432.     AC_MSG_RESULT(no)
  433. )
  434.  
  435. dnl Check for AIO's aiocb->__return_value field (linux has it, OS X doesn't)
  436. AC_MSG_CHECKING([for __return_value field in aiocb struct])
  437. AC_TRY_COMPILE(
  438.     [
  439.         #include <aio.h>
  440.     ],
  441.     [
  442.         struct aiocb aiocb;
  443.     aiocb.__return_value = 0;
  444.     ],
  445.     AC_MSG_RESULT(yes)
  446.     AC_DEFINE(HAVE_AIOCB_RETURN_VALUE, 1, Define if aiocb->__return_value exists)
  447.     ,
  448.     AC_MSG_RESULT(no)
  449. )
  450. dnl Check byte ordering
  451. AC_C_BIGENDIAN
  452.  
  453. dnl Check size of pointer type; needed by id-generator
  454. AC_CHECK_SIZEOF(void *)
  455.  
  456. dnl Options for debugging
  457. dnl This particular one enables tracing of memory allocation and
  458. dnl    freeing with the mtrace tool
  459. AC_ARG_WITH(mtrace,
  460. [  --with-mtrace           Use mtrace (must set MALLOC_TRACE to output file)],
  461. CFLAGS="$CFLAGS -include mcheck.h"
  462. AC_DEFINE(WITH_MTRACE, 1, Define if mtrace memory leak detection was enabled)
  463. )
  464.  
  465. dnl This particular one enables berkeley db to emit detected errors
  466. AC_ARG_WITH(berkdb-debug,
  467. [  --with-berkdb-debug     Use berkeley db error reporting (if detected).],
  468. AC_DEFINE(BERKDB_ERROR_REPORTING, 1, Define if berkeley db error reporting was enabled)
  469. )
  470.  
  471. TAU_INCS=
  472. BUILD_TAU=
  473.  
  474. dnl use the tau trace library
  475. AC_ARG_WITH(tau,
  476. [  --with-tau=path         Use TAU trace library installed in "path"],
  477.     if test "x$withval" = "xyes" ; then
  478.            AC_MSG_ERROR(--with-tau must be given a pathname)
  479.     else
  480.        TAU_INCS="-I$withval/include"
  481.        CFLAGS="$CFLAGS $TAU_INCS -D__PVFS2_ENABLE_EVENT__"
  482.        LDFLAGS="$LDFLAGS -L$withval/$(uname -m)/lib"
  483.        tau_mkfile=$withval/$(uname -m)/lib/Makefile.*-profile-trace
  484.        if test ! -f $tau_mkfile; then
  485.            AC_MSG_ERROR(TAU not compiled with profiling and tracing support)
  486.        fi
  487.        tau_config=$(echo $tau_mkfile | sed -e "s|.*Makefile.tau-||")
  488.        LIBS="$LIBS -lTAU_tf -lTAU_traceinput-$tau_config -ltau-$tau_config -lpthread -lstdc++"
  489.        AC_DEFINE(HAVE_TAU, 1, [Define if TAU library is used])
  490.        BUILD_TAU=1
  491.     fi
  492. )
  493.  
  494. AC_SUBST(TAU_INCS)
  495. AC_SUBST(BUILD_TAU)
  496.  
  497. BUILD_KERNEL=
  498.  
  499. dnl
  500. dnl Enables the kernel module to build if the appropriate
  501. dnl linux-2.6.x path is specified
  502. dnl Make sure this is a usable kernel source tree too.
  503. dnl
  504. AC_ARG_WITH(kernel,
  505. [  --with-kernel=srcpath   Build pvfs2 kernel module against 2.6.x src],
  506.     if test "x$withval" = "xyes" -o "x$withval" = "x" ; then
  507.            AC_MSG_ERROR(--with-kernel must be given the path to your kernel source.)
  508.     fi
  509.     if ! test -d $withval ; then
  510.            AC_MSG_ERROR(The --with-kernel path $withval is not a directory.)
  511.     fi
  512.     if ! test -r $withval/include/linux/version.h ; then
  513.        AC_MSG_ERROR(The kernel source tree must have been configured.)
  514.     fi
  515.  
  516.     if test -r $withval/include/linux/version.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/linux/version.h ; then
  517.         vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/version.h`
  518.     elif test -r $withval/include/linux/utsrelease.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/linux/utsrelease.h; then
  519.         vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/utsrelease.h`
  520.     elif test -r  $withval/include/generated/utsrelease.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/generated/utsrelease.h; then
  521.         vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/generated/utsrelease.h`
  522.     else
  523.         AC_MSG_ERROR(The kernel source tree does not appear to be 2.6)
  524.     fi
  525.  
  526.     # At least up through 2.6.3 needed to write .__modpost.cmd; this changed
  527.     # sometime between then and 2.6.10.   Now anybody can compile out-of-tree
  528.     # modules against a configured kernel tree
  529.     LINUX_KERNEL_SRC="$withval"
  530.     BUILD_KERNEL=1
  531.     , LINUX_KERNEL_SRC=""
  532. )
  533.  
  534. dnl
  535. dnl Enables the kernel module to build if the appropriate
  536. dnl linux-2.4.x path is specified
  537. dnl Make sure this is a usable kernel source tree too.
  538. dnl
  539. AC_ARG_WITH(kernel24,
  540. [  --with-kernel24=srcpath Build pvfs2 kernel module against 2.4.x src],
  541.     if test "x$withval" = "xyes" -o "x$withval" = "x" ; then
  542.            AC_MSG_ERROR(--with-kernel24 must be given the path to your kernel 2.4.x source.)
  543.     fi
  544.     if ! test -d $withval ; then
  545.            AC_MSG_ERROR(The --with-kernel path $withval is not a directory.)
  546.     fi
  547.     if ! test -r $withval/include/linux/version.h ; then
  548.        AC_MSG_ERROR(The kernel source tree must have been configured.)
  549.     fi
  550.     vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/version.h`
  551.     if ! grep -q UTS_RELEASE..2\\.4\\. $withval/include/linux/version.h ; then
  552.        AC_MSG_ERROR(The kernel source tree does not appear to be 2.4)
  553.     fi
  554.     k24_minor_ver=`echo $vers | cut -b 26- | sed -n 's/\"//p' | head -n 1`
  555.     tmp_k24_minor_ver=`echo $k24_minor_ver | grep \-`
  556.     if ! test "x$tmp_k24_minor_ver" = "x"; then
  557.        tmp_k24_minor_ver=`echo $k24_minor_ver | cut -d- -f1`
  558.        k24_minor_ver=$tmp_k24_minor_ver
  559.     fi
  560.     LINUX24_KERNEL_SRC="$withval" LINUX24_KERNEL_MINOR_VER="`echo $k24_minor_ver| cut -d'.' -f 1`"
  561.     BUILD_KERNEL=1
  562.     , LINUX24_KERNEL_SRC="" LINUX24_KERNEL_MINOR_VER="")
  563.  
  564. AC_SUBST(BUILD_KERNEL)
  565.  
  566. dnl now that we have the path to kernel source we can feature-test kernels. 
  567.  
  568. oldcflags=$CFLAGS
  569. if test -z "${LINUX_KERNEL_SRC}"  ; then
  570.     lk_src=${LINUX24_KERNEL_SRC}
  571. elif test -z "${LINUX24_KERNEL_SRC}"  ; then
  572.     lk_src=${LINUX_KERNEL_SRC}
  573. fi
  574.  
  575. dnl some kernels (SLES9 2.6.5-7.191, for one) will pass the test for ki_dtor
  576. dnl but the resulting pvfs2.ko module will be built with internal
  577. dnl symbols (mmgrab and flush_icache_range).  
  578. dnl 
  579. dnl if option not given, carry out the test.  Only certain kernels (like SLES
  580. dnl 9) will need --disable-kernel-aio
  581.  
  582. AC_ARG_ENABLE(kernel-aio,
  583.   [  --disable-kernel-aio    Forcibly disable kernel aio],
  584.   [ enable_kernel_aio=$enableval ],
  585.   [ enable_kernel_aio=yes ]
  586.   )
  587.  
  588. AC_ARG_ENABLE(kernel-sendfile,
  589.   [  --enable-kernel-sendfile
  590.                           **EXPERIMENTAL** Forcibly enable kernel sendfile],
  591.   [ enable_kernel_sendfile=$enableval ],
  592.   [ enable_kernel_sendfile=no ]
  593.   )
  594.  
  595. if test -n "$lk_src" ; then
  596.     AX_KERNEL_FEATURES
  597.     AC_DEFINE(WITH_LINUX_KMOD, 1, [Define to build for linux kernel module userspace helper.])
  598. fi
  599.  
  600. dnl
  601. dnl Enabling this option links pvfs2-client-core against libpvfs2-threaded.so.
  602. dnl Note that even without this option, pvfs2-client-core always requires
  603. dnl pthreads to run its remount thread.
  604. dnl
  605. AC_ARG_ENABLE([threaded-kmod-helper],
  606. [  --enable-threaded-kmod-helper
  607.                           **EXPERIMENTAL** Use threads in the kernel 
  608.                           helper application],
  609. [ if test "x$enableval" = "xyes" ; then
  610.     THREADED_KMOD_HELPER=yes
  611.   fi
  612. ])
  613. AC_SUBST(THREADED_KMOD_HELPER)
  614.  
  615. dnl PAV configuration needs absolute location of source and build.
  616. dnl Linux-2.6 module needs absolute location of source, and uses the
  617. dnl relative location for soft links for out-of-tree builds.
  618. BUILD_ABSOLUTE_TOP=`pwd`
  619. SRC_RELATIVE_TOP=`echo $0 | sed -e "s|configure$||"`
  620. SRC_ABSOLUTE_TOP=`cd $SRC_RELATIVE_TOP ; pwd`
  621.  
  622. AC_SUBST(LINUX_KERNEL_SRC)
  623. AC_SUBST(LINUX24_KERNEL_SRC)
  624. AC_SUBST(LINUX24_KERNEL_MINOR_VER)
  625. AC_SUBST(BUILD_ABSOLUTE_TOP)
  626. AC_SUBST(SRC_RELATIVE_TOP)
  627. AC_SUBST(SRC_ABSOLUTE_TOP)
  628.  
  629. dnl Optimized code, but never override CFLAGS from command line or environment.
  630. AC_ARG_ENABLE(fast,
  631. [  --enable-fast           Disable optional debugging, enable optimizations.],
  632. [
  633. if test "x$USR_CFLAGS_SET" = "xno"; then
  634.     CFLAGS="$CFLAGS -DNDEBUG -O3 -DGOSSIP_DISABLE_DEBUG"
  635. fi
  636. ])
  637.  
  638. dnl
  639. dnl a function to check for FUSE
  640. dnl
  641. test_for_fuse()
  642. {
  643.   AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
  644.   if test "x$HAVE_PKGCONFIG" = "xyes" ; then
  645.     AC_MSG_CHECKING([for FUSE library])
  646.     if `pkg-config --exists fuse` ; then
  647.        AC_MSG_RESULT(yes)
  648.        FUSE_LDFLAGS=`pkg-config --libs fuse`
  649.        FUSE_CFLAGS=`pkg-config --cflags fuse`
  650.  
  651.        AC_SUBST(FUSE_LDFLAGS)
  652.        AC_SUBST(FUSE_CFLAGS)
  653.        BUILD_FUSE="1"
  654.        AC_SUBST(BUILD_FUSE)
  655.     else
  656.             AC_MSG_ERROR([FUSE: FUSE library not found. Check LD_LIBRARY_PATH.])
  657.     fi
  658.   else
  659.           AC_MSG_ERROR(FUSE: pkg-config not available. Please install pkg-config.)
  660.   fi
  661. }
  662.  
  663. dnl FUSE component
  664. AC_ARG_ENABLE(fuse,
  665. [  --enable-fuse           **EXPERIMENTAL** Enable FUSE component],
  666. [
  667. if test "x$enableval" = "xyes" ; then
  668.    test_for_fuse
  669.    CFLAGS="$CFLAGS -D__PVFS2_ENABLE_FUSE__"
  670. fi
  671. ],
  672. )
  673.  
  674. # default CFLAGS is -g -O2, unless user set CFLAGS or asked for --enable-fast
  675. if test "x$USR_CFLAGS_SET" = "xno" && test "x$enable_fast" != "xyes"; then
  676.     CFLAGS="$CFLAGS -g -O2"
  677. fi
  678.  
  679. dnl Options that are not yet working
  680. dnl --------------------------------
  681. dnl AC_ARG_ENABLE(profiling,
  682. dnl [  --enable-profiling      Enable profiling (using gprof).                     *** not yet working ***],
  683. dnl CFLAGS="$CFLAGS -pg -fprofile-arcs",
  684. dnl )
  685. dnl 
  686. dnl AC_ARG_ENABLE(coverage,
  687. dnl [  --enable-coverage       Enable coverage analysis (disables optimizations).  *** not yet working ***],
  688. dnl [ CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0"
  689. dnl ENABLE_COVERAGE=1 ],
  690. dnl )
  691.  
  692. AC_SUBST(ENABLE_COVERAGE)
  693.  
  694. STRICT_CFLAGS=
  695. AC_ARG_ENABLE(strict,
  696. [  --enable-strict         Turn on strict compiler warnings],
  697.     STRICT_CFLAGS=1)
  698. AC_SUBST(STRICT_CFLAGS)
  699.  
  700. dnl Check if user actually wants to see all our build output (compiles, links, etc.).
  701. AC_ARG_ENABLE(verbose-build,
  702. [  --enable-verbose-build  Enables full output during build process],
  703. QUIET_COMPILE=0,
  704. QUIET_COMPILE=1)
  705.  
  706. AC_SUBST(QUIET_COMPILE)
  707.  
  708. dnl
  709. dnl a function to check for epoll capabilities
  710. dnl
  711. test_for_epoll()
  712. {
  713.   AC_CHECK_HEADERS(sys/epoll.h)
  714.   AC_MSG_CHECKING(for epoll functions)
  715.   AC_TRY_LINK([#include <sys/epoll.h>], [
  716.     int fd;
  717.     fd = epoll_create(1);
  718.     close(fd);
  719.   ],
  720.      AC_MSG_RESULT(yes)
  721.      BUILD_EPOLL=1
  722.      AC_SUBST(BUILD_EPOLL),
  723.      AC_MSG_RESULT(no)
  724.   )
  725. }
  726.  
  727. dnl optionally enable use of epoll() on Linux instead of poll()
  728. dnl optionally disable use of epoll() on Linux instead of poll()
  729. AC_ARG_ENABLE(epoll,
  730. [  --enable-epoll          Enable use of epoll for TCP/IP polling 
  731.                           (epoll is enabled by default, this option
  732.               ensures no checking is done for x-compiling)
  733.   --disable-epoll         Disable epoll, use poll instead],
  734. [
  735.    if test "x$enableval" = "xyes"; then
  736.         BUILD_EPOLL=1
  737.         AC_SUBST(BUILD_EPOLL)
  738.    fi
  739. ],
  740. [
  741.   test_for_epoll
  742. ])
  743.  
  744. dnl enables a hack to print back traces out of segfault signal handler
  745. AC_ARG_ENABLE(segv-backtrace,
  746. [  --disable-segv-backtrace
  747.                           Disables back traces in segfault signal handler],,
  748.     AC_MSG_CHECKING(if segv backtrace capable)
  749.     AC_TRY_COMPILE([
  750. #include <execinfo.h>
  751. #define __USE_GNU
  752. #include <ucontext.h>
  753. #if !defined(REG_EIP) && !defined(REG_RIP)
  754.            choke me
  755. #endif
  756.            ], [],
  757.            AC_MSG_RESULT(yes)
  758.                PVFS2_SEGV_BACKTRACE=1,
  759.            AC_MSG_RESULT(no)
  760.     )
  761. )
  762. AC_SUBST(PVFS2_SEGV_BACKTRACE)
  763.  
  764. dnl shared or static client library
  765. AC_ARG_ENABLE(shared,
  766. [  --enable-shared         Build shared client library],
  767. [build_shared=$enableval], [build_shared=no])
  768. AC_SUBST(build_shared)
  769.  
  770. dnl Bad things happen in the makefile if you happen to --disable-static
  771. dnl but do not --enable-shared.
  772. if test "x$build_shared" = "xno" -a "x$build_static" = "xno" ; then
  773.     AC_MSG_ERROR([Must do --enable-shared or --enable-static or both.])
  774. fi
  775.  
  776. dnl See if CC is a GNU compiler.  This may require a real test in future
  777. dnl versions of autoconf.  In 2.13 it is a side-effect of AC_PROG_CC.  First
  778. dnl check if it is an Intel compiler; those lie and claim to be gcc but are
  779. dnl not argument compatible
  780. INTELC=
  781. GNUC=
  782. AC_MSG_CHECKING(whether cc is an Intel compiler)
  783. AC_TRY_COMPILE([
  784. #ifndef __ICC
  785.        choke me
  786. #endif
  787. ], [],
  788.     AC_MSG_RESULT(yes)
  789.     INTELC=1
  790.     ,
  791.     AC_MSG_RESULT(no)
  792. )
  793. if test "x$INTELC" = "x" ; then
  794.     if test "x$GCC" = "xyes" ; then
  795.        GNUC=1
  796.     fi
  797. fi
  798. AC_SUBST(INTELC)
  799. AC_SUBST(GNUC)
  800.  
  801. AC_ARG_WITH(efence,
  802. [  --with-efence=<path>    Use electric fence for malloc debugging.],
  803.        if test "x$withval" != "xyes" ; then
  804.               LDFLAGS="${LDFLAGS} -L$withval"
  805.        fi
  806.        AC_CHECK_LIB(efence,malloc)
  807. )
  808.  
  809. dnl Use compiled-in valgrind annotations?  Give the header path if
  810. dnl is not in the usual location.  It is common to install the header
  811. dnl in a subdirectory, so look for that too.  Leave the include path
  812. dnl in CPPFLAGS if it is not a standard header.
  813. AC_ARG_WITH(valgrind,
  814. [  --with-valgrind[=<path>]  Use valgrind annotations for debugging.], [
  815.     found=no
  816.     save_cppflags="$CPPFLAGS"
  817.     AC_MSG_CHECKING(for valgrind.h usability)
  818.     if test "x$withval" = xyes ; then
  819.     AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes)
  820.     if test x$found = xno ; then
  821.         CPPFLAGS="$CPPFLAGS -I/usr/include/valgrind"
  822.         AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
  823.         CPPFLAGS="$save_cppflags")
  824.     fi
  825.     else
  826.     for d in $withval $withval/include \
  827.              $withval/valgrind $withval/include/valgrind
  828.     do
  829.         CPPFLAGS="$CPPFLAGS -I$d"
  830.         AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
  831.         CPPFLAGS="$save_cppflags")
  832.         if test x$found = xyes ; then
  833.         break
  834.         fi
  835.     done
  836.     fi
  837.     AC_MSG_RESULT($found)
  838.     if test x$found = xyes ; then
  839.     AC_DEFINE(HAVE_VALGRIND_H, 1, Define if include file valgrind.h exists)
  840.     fi
  841. ])
  842.  
  843. if test "x$NEED_BERKELEY_DB" = "xyes" ; then
  844.     dnl
  845.     dnl make sure that required db development package is installed
  846.     dnl and valid; path can be specified at configure time
  847.     dnl
  848.     AC_ARG_WITH(db,
  849.            [  --with-db=<dir>         Location of installed DB package (default=/usr)],
  850.            [AX_BERKELEY_DB(${withval})],
  851.        [AX_BERKELEY_DB("")])
  852. fi
  853. dnl end of NEED_BERKELEY_DB section
  854.  
  855. if test "x$BUILD_SERVER" = "x1"; then
  856.     dnl check if -lrt is required
  857.     AX_CHECK_NEEDS_LIBRT
  858. fi
  859.  
  860. case "$host_os" in
  861.  
  862.     *darwin*)
  863.     AC_DEFINE([TARGET_OS_DARWIN], 1, Define if on darwin)
  864.         TARGET_OS_DARWIN=1
  865.     AC_SUBST(TARGET_OS_DARWIN)
  866.     ;;
  867.     *linux*)
  868.     AC_DEFINE([TARGET_OS_LINUX], 1, Define if on linux)
  869.         TARGET_OS_LINUX=1
  870.     AC_SUBST(TARGET_OS_LINUX)
  871.     ;;
  872. esac
  873.  
  874. AC_CHECK_HEADERS(netdb.h)
  875. AC_CHECK_HEADERS(arpa/inet.h)
  876. AC_CHECK_HEADERS(sys/socket.h)
  877. dnl check for gethostbyname function
  878. AC_MSG_CHECKING(for gethostbyname)
  879. oldcflags="$CFLAGS"
  880. CFLAGS="$USR_CFLAGS"
  881. AC_TRY_COMPILE([
  882. #include <netdb.h>
  883. ], [
  884. gethostbyname("localhost");
  885. ],
  886. AC_MSG_RESULT(yes)
  887. AC_DEFINE(HAVE_GETHOSTBYNAME, 1, Define if gethostbyname function exists),
  888. AC_MSG_RESULT(no)
  889. WARN_ABOUT_HOSTNAMES="yes")
  890.  
  891. AC_MSG_CHECKING(for gethostbyaddr)
  892. AC_TRY_COMPILE([
  893. #include <netdb.h>
  894. ], [
  895. struct sockaddr_in peer;
  896. gethostbyaddr((void *)&peer.sin_addr.s_addr, sizeof(struct in_addr), AF_INET);
  897. ],
  898. AC_MSG_RESULT(yes)
  899. AC_DEFINE(HAVE_GETHOSTBYADDR, 1, Define if gethostbyaddr function exists),
  900. AC_MSG_RESULT(no)  )
  901.  
  902. CFLAGS="$oldcflags"
  903.  
  904. dnl allow disabling TCP BMI method
  905. BUILD_BMI_TCP=1
  906. AC_ARG_WITH(bmi-tcp,
  907. [  --without-bmi-tcp       Disable BMI TCP method],
  908.     if test -z "$withval" -o "$withval" = yes ; then
  909.     :
  910.     elif test "$withval" = no ; then
  911.     BUILD_BMI_TCP=
  912.     else
  913.     AC_MSG_ERROR([Option --with-tcp requires yes/no argument.])
  914.     fi
  915. )
  916. AC_SUBST(BUILD_BMI_TCP)
  917.  
  918. dnl
  919. dnl Configure bmi_gm, if --with-gm or a variant given.
  920. dnl
  921. AX_GM
  922.  
  923. dnl
  924. dnl Configure bmi_mx, if --with-mx or a variant given.
  925. dnl
  926. AX_MX
  927.  
  928. dnl
  929. dnl Configure bmi_ib, if --with-ib or a variant given.
  930. dnl
  931. AX_IB
  932.  
  933. dnl
  934. dnl Configure bmi_portals, if --with-portals or a variant given.
  935. dnl
  936. AX_PORTALS
  937.  
  938. dnl
  939. dnl Configure bmi_zoid, if --with-zoid or a variant given.
  940. dnl
  941. AX_ZOID
  942.  
  943. dnl
  944. dnl check if fgetxattr takes extra arguments
  945. AC_MSG_CHECKING([for fgetxattr extra arguments])
  946. AC_TRY_COMPILE([
  947.     #include <sys/types.h>
  948.     #ifdef HAVE_ATTR_XATTR_H
  949.     #include <attr/xattr.h>
  950.     #endif
  951.     #ifdef HAVE_SYS_XATTR_H
  952.     #include <sys/xattr.h>
  953.     #endif
  954.     ],
  955.     [
  956.     fgetxattr(0, 0, 0, 0, 0, 0);
  957.     ],
  958.     AC_MSG_RESULT(yes)
  959.     AC_DEFINE(HAVE_FGETXATTR_EXTRA_ARGS, 1, Define if fgetxattr takes position and option arguments),
  960.     AC_MSG_RESULT(no)
  961. )
  962.  
  963. dnl
  964. dnl look for sysinfo header
  965. AC_CHECK_HEADER(sys/sysinfo.h,
  966.        AC_DEFINE(HAVE_SYSINFO, 1, Define if sysinfo.h is present)
  967.        )
  968.  
  969. dnl for regular functions, add another AC_CHECK_FUNCS line
  970. AC_CHECK_FUNCS(strnlen)
  971. AC_CHECK_FUNCS(strtoull)
  972. AC_CHECK_FUNCS(strstr)
  973. AC_CHECK_FUNCS(fgetxattr)
  974. AC_CHECK_FUNCS(fsetxattr)
  975.  
  976. dnl fgetxattr doesn't have a prototype on some systems
  977. AC_MSG_CHECKING([for fgetxattr prototype])
  978. AC_TRY_COMPILE([
  979.     #include <sys/types.h>
  980.     #ifdef HAVE_ATTR_XATTR_H
  981.     #include <attr/xattr.h>
  982.     #endif
  983.     #ifdef HAVE_SYS_XATTR_H
  984.     #include <sys/xattr.h>
  985.     #endif
  986.     char * fgetxattr(char *foo);
  987.     ], [], 
  988.     AC_MSG_RESULT(no),
  989.     AC_MSG_RESULT(yes)
  990.     AC_DEFINE(HAVE_FGETXATTR_PROTOTYPE, 1, Define if system provides fgtxattr prototype)
  991. )
  992.  
  993. dnl
  994. dnl check if fgetxattr takes extra arguments:  old systems that do not have any
  995. dnl sort of fgetxattr should fall back to our faked version.
  996.  
  997. AC_MSG_CHECKING([for fgetxattr extra arguments])
  998. AC_TRY_COMPILE([
  999.     #include <sys/types.h>
  1000.     #ifdef HAVE_ATTR_XATTR_H
  1001.     #include <attr/xattr.h>
  1002.     #endif
  1003.     #ifdef HAVE_SYS_XATTR_H
  1004.     #include <sys/xattr.h>
  1005.     #endif
  1006.     ],
  1007.     [
  1008.     #ifdef HAVE_FGETXATTR_PROTOTYPE
  1009.     fgetxattr(0, 0, 0, 0, 0, 0);
  1010.     #else
  1011.     #  error
  1012.     #endif
  1013.     ],
  1014.     AC_MSG_RESULT(yes)
  1015.     AC_DEFINE(HAVE_FGETXATTR_EXTRA_ARGS, 1, Define if fgetxattr takes position and option arguments),
  1016.     AC_MSG_RESULT(no)
  1017. )
  1018.  
  1019. AC_MSG_CHECKING([for fsetxattr extra arguments])
  1020. AC_TRY_COMPILE([
  1021.     #include <sys/types.h>
  1022.     #ifdef HAVE_ATTR_XATTR_H
  1023.     #include <attr/xattr.h>
  1024.     #endif
  1025.     #ifdef HAVE_SYS_XATTR_H
  1026.     #include <sys/xattr.h>
  1027.     #endif
  1028.     ],
  1029.     [
  1030.     fsetxattr(0, 0, 0, 0, 0, 0);
  1031.     ],
  1032.     AC_MSG_RESULT(yes)
  1033.     AC_DEFINE(HAVE_FSETXATTR_EXTRA_ARGS, 1, Define if fsetxattr takes position and option arguments),
  1034.     AC_MSG_RESULT(no)
  1035. )
  1036.  
  1037.  
  1038. dnl check for getmntent(), special test
  1039. AC_FUNC_GETMNTENT
  1040.  
  1041. dnl if we use headers that might not be on every platform, add them here
  1042. AC_CHECK_HEADERS(malloc.h)
  1043. AC_CHECK_HEADERS(mntent.h)
  1044.  
  1045. AC_ARG_ENABLE(static-server,
  1046. [  --enable-static-server  Builds the server static],
  1047. [ staticserver=$enableval ],
  1048. [ staticserver="no" ] )
  1049.  
  1050. if test "$staticserver" = "yes"; then
  1051.     SERVER_LDFLAGS="$LDFLAGS -static"
  1052. else
  1053.     SERVER_LDFLAGS="$LDFLAGS -rdynamic"
  1054. fi
  1055.  
  1056. AC_SUBST(SERVER_LDFLAGS)
  1057.  
  1058. dnl this is a special case, used to key off options controlling gossip
  1059. dnl   backtrace capability
  1060. AC_CHECK_HEADERS(execinfo.h,
  1061.     LDFLAGS="$LDFLAGS -rdynamic"
  1062.     GOSSIP_ENABLE_BACKTRACE=1
  1063. )
  1064. AC_SUBST(GOSSIP_ENABLE_BACKTRACE)
  1065.  
  1066. dnl --
  1067. dnl Check for SDL
  1068. AC_MSG_CHECKING([for SDL])
  1069. SDL_CONFIG=`which sdl-config 2> /dev/null`
  1070. if ! test -z "$SDL_CONFIG" && test -x "$SDL_CONFIG"; then
  1071.    AC_MSG_RESULT(yes)
  1072.    SDL_VERSION=`sdl-config --version`
  1073.    VISCFLAGS=`sdl-config --cflags`
  1074.    VISCLIBS=`sdl-config --libs`
  1075.  
  1076.    dnl We also need SDL ttf support
  1077.    dnl only define BUILD_VIS if we have all required parts
  1078.    AC_CHECK_HEADERS(SDL_ttf.h,
  1079.        [BUILD_VIS="1"
  1080.         CPPFLAGS="$CPPFLAGS $VISCFLAGS"],
  1081.         [AC_CHECK_HEADERS(SDL/SDL_ttf.h,
  1082.             [BUILD_VIS="1"
  1083.             CPPFLAGS="$CPPFLAGS $VISCFLAGS"],)],
  1084. )
  1085.  
  1086.    AC_SUBST(BUILD_VIS)
  1087.    AC_SUBST(VISCFLAGS)
  1088.    AC_SUBST(VISLIBS)
  1089. else
  1090.    AC_MSG_RESULT(no)
  1091. fi
  1092.  
  1093. dnl Which form of strerror?
  1094. AC_MSG_CHECKING([for GNU-style strerror_r])
  1095. AC_TRY_COMPILE(
  1096.     [
  1097.     #include <string.h>
  1098.     extern char *strerror_r();
  1099.     ], [],
  1100.     AC_MSG_RESULT(yes)
  1101.     AC_DEFINE(HAVE_GNU_STRERROR_R, 1, Define if strerror_r is GNU-specific)
  1102.     ,
  1103.     AC_MSG_RESULT(no)
  1104. )
  1105.  
  1106. dnl create any missing subdirectories that wouldn't be created
  1107. dnl by AC_OUTPUT below (which won't create intermediate dirs).
  1108. for d in src/apps src/io src/common src/client src/kernel \
  1109.        doc src/apps/kernel test; do
  1110.        install -d $d;
  1111. done
  1112.  
  1113. dnl output final version of top level makefile and subdirectory
  1114. dnl    makefile includes
  1115. AC_OUTPUT(include/pvfs2.h
  1116. Makefile
  1117. module.mk
  1118. src/apps/admin/module.mk
  1119. src/apps/admin/pvfs2-config
  1120. src/apps/devel/module.mk
  1121. src/apps/karma/module.mk
  1122. src/apps/vis/module.mk
  1123. src/apps/fuse/module.mk
  1124. src/apps/kernel/linux/module.mk
  1125. src/apps/user/module.mk
  1126. src/io/trove/module.mk
  1127. src/io/trove/trove-handle-mgmt/module.mk
  1128. src/io/trove/trove-dbpf/module.mk
  1129. src/common/misc/module.mk
  1130. src/common/quickhash/module.mk
  1131. src/common/quicklist/module.mk
  1132. src/common/dotconf/module.mk
  1133. src/common/id-generator/module.mk
  1134. src/common/gossip/module.mk
  1135. src/common/gen-locks/module.mk
  1136. src/common/llist/module.mk
  1137. src/common/statecomp/module.mk
  1138. src/common/events/module.mk
  1139. src/common/mgmt/module.mk
  1140. src/io/bmi/module.mk
  1141. src/io/bmi/bmi_tcp/module.mk
  1142. src/io/bmi/bmi_gm/module.mk
  1143. src/io/bmi/bmi_mx/module.mk
  1144. src/io/bmi/bmi_ib/module.mk
  1145. src/io/bmi/bmi_portals/module.mk
  1146. src/io/bmi/bmi_zoid/module.mk
  1147. src/io/description/module.mk
  1148. src/io/flow/module.mk
  1149. src/io/flow/flowproto-bmi-trove/module.mk
  1150. src/io/flow/flowproto-template/module.mk
  1151. src/io/flow/flowproto-dump-offsets/module.mk
  1152. src/io/flow/flowproto-bmi-cache/module.mk
  1153. src/io/buffer/module.mk
  1154. src/io/job/module.mk
  1155. src/io/dev/module.mk
  1156. src/proto/module.mk
  1157. src/server/module.mk
  1158. src/server/request-scheduler/module.mk
  1159. src/client/sysint/module.mk
  1160. src/kernel/linux-2.6/Makefile
  1161. src/kernel/linux-2.4/Makefile
  1162. doc/module.mk
  1163. doc/coding/module.mk
  1164. doc/design/module.mk
  1165. doc/random/module.mk
  1166. examples/pvfs2-server.rc
  1167. doc/doxygen/pvfs2-doxygen.conf
  1168. )
  1169.  
  1170. chmod +x $BUILD_ABSOLUTE_TOP/src/apps/admin/pvfs2-config
  1171.  
  1172. # print a summary of the configuration information
  1173. if test "x$BUILD_BMI_ONLY" = "x1" ; then
  1174.     AC_MSG_RESULT()
  1175.     AC_MSG_RESULT([***** Displaying BMI configuration information *****])
  1176.     AC_MSG_RESULT([----------------------------------------------------])
  1177.     PKGSTR="BMI"
  1178. else
  1179.     AC_MSG_RESULT()
  1180.     AC_MSG_RESULT([***** Displaying PVFS Configuration Information *****])
  1181.     AC_MSG_RESULT([------------------------------------------------------])
  1182.     PKGSTR="PVFS2"
  1183. fi
  1184.  
  1185. # print PVFS configs (not used by BMI)
  1186. if test "x$BUILD_BMI_ONLY" != "x1" ; then
  1187.  
  1188. if test "x$BUILD_KARMA" = "x1" ; then
  1189.    AC_MSG_RESULT([PVFS2 configured to build karma gui               : yes])
  1190. else
  1191.    AC_MSG_RESULT([PVFS2 configured to build karma gui               :  no])
  1192. fi
  1193.  
  1194. if test "x$ENABLE_COVERAGE" = "x1" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1195.    AC_MSG_RESULT([PVFS2 configured to perform coverage analysis     : yes])
  1196. else
  1197.    AC_MSG_RESULT([PVFS2 configured to perform coverage analysis     :  no])
  1198. fi
  1199.  
  1200. if test "x$MISC_TROVE_FLAGS" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1201.    AC_MSG_RESULT([PVFS2 configured for aio threaded callbacks       :  no])
  1202. else
  1203.    AC_MSG_RESULT([PVFS2 configured for aio threaded callbacks       : yes])
  1204. fi
  1205.  
  1206. if test "x$BUILD_FUSE" = "x1" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1207.    AC_MSG_RESULT([PVFS2 configured to use FUSE                      : yes])
  1208. else
  1209.    AC_MSG_RESULT([PVFS2 configured to use FUSE                      :  no])
  1210. fi
  1211.  
  1212. if test "x$LINUX_KERNEL_SRC" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1213.    AC_MSG_RESULT([PVFS2 configured for the 2.6.x kernel module      :  no])
  1214. else
  1215.    AC_MSG_RESULT([PVFS2 configured for the 2.6.x kernel module      : yes])
  1216. fi
  1217.  
  1218. if test "x$LINUX24_KERNEL_SRC" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1219.    AC_MSG_RESULT([PVFS2 configured for the 2.4.x kernel module      :  no])
  1220. else
  1221.    AC_MSG_RESULT([PVFS2 configured for the 2.4.x kernel module      : yes])
  1222. fi
  1223.  
  1224. if test "x$MMAP_RA_CACHE" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1225.    AC_MSG_RESULT([PVFS2 configured for using the mmap-ra-cache      :  no])
  1226. else
  1227.    AC_MSG_RESULT([PVFS2 configured for using the mmap-ra-cache      : yes])
  1228. fi
  1229.  
  1230. if test "x$REDHAT_RELEASE" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1231.    AC_MSG_RESULT([PVFS2 will use workaround for redhat 2.4 kernels  :  no])
  1232. else
  1233.    AC_MSG_RESULT([PVFS2 will use workaround for redhat 2.4 kernels  : yes])
  1234. fi
  1235.  
  1236. if test "x$NPTL_WORKAROUND" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1237.    AC_MSG_RESULT([PVFS2 will use workaround for buggy NPTL          :  no])
  1238. else
  1239.    AC_MSG_RESULT([PVFS2 will use workaround for buggy NPTL          : yes])
  1240. fi
  1241.  
  1242. if test "x$BUILD_SERVER" = "x1" -a "x$BUILD_BMI_ONLY" != "x1"; then
  1243.    AC_MSG_RESULT([PVFS2 server will be built                        : yes])
  1244. else
  1245.    AC_MSG_RESULT([PVFS2 server will be built                        :  no])
  1246.  
  1247. fi
  1248.  
  1249. else
  1250.  
  1251. # print BMI and PVFS configs
  1252. if test "x$THREAD_LIB" = "x"; then
  1253.    AC_MSG_RESULT([$PKGSTR configured for a thread-safe client library :  no])
  1254. else
  1255.    AC_MSG_RESULT([$PKGSTR configured for a thread-safe client library : yes])
  1256. fi
  1257.  
  1258. if test "x$BUILD_EPOLL" = "x1" ; then
  1259.    AC_MSG_RESULT([$PKGSTR configured to use epoll                     : yes])
  1260. else
  1261.    AC_MSG_RESULT([$PKGSTR configured to use epoll                     :  no])
  1262. fi
  1263.  
  1264. if test "x$TRUSTED_CONNECTIONS" = "x" ; then
  1265.     AC_MSG_RESULT([$PKGSTR configured for using trusted connections    :  no])
  1266. else
  1267.     AC_MSG_RESULT([$PKGSTR configured for using trusted connections    : yes])
  1268. fi
  1269.  
  1270. fi # end of BMI/PVFS config display
  1271.  
  1272. if test "x$WARN_ABOUT_HOSTNAMES" = "xyes" ; then
  1273.    AC_MSG_RESULT(WARNING: gethostbyname is not supported on this machine: ALL ADDRESSES MUST BE IN DOT NOTATION.)
  1274. fi
  1275.  
  1276.  
  1277. dnl
  1278. dnl Warn about potential slowness if using a "fast" network along with
  1279. dnl TCP.  Polling with timeout in BMI is implemented by sequentially asking
  1280. dnl each device to poll for half of the timeout.  This leads to a fixed 5 ms
  1281. dnl delay in the TCP device before the IB device can be queried, for instance.
  1282. dnl When traffic will only appear on one device, suggest that TCP be disabled.
  1283. dnl But leave TCP as default on, certainly, as that is what most people want.
  1284. dnl
  1285. if test x$BUILD_GM = x1 -o x$BUILD_MX = x1 -o x$BUILD_IB = x1 -o \
  1286.     x$BUILD_OPENIB = x1 -o x$BUILD_PORTALS = x1 -o x$BUILD_ZOID = x1 ; then
  1287.     if test x$BUILD_BMI_TCP = x1 ; then
  1288.     AC_MSG_WARN([You have selected to build $PKGSTR to use a "fast" network
  1289.             interface, but have not disabled TCP.  The way this is
  1290.             currently implemented will lead to rather slow response
  1291.             times on the fast interface.  Suggest you configure with
  1292.             "--without-bmi-tcp" for the best performance.])
  1293.     fi
  1294. fi
  1295.  
  1296. AC_MSG_RESULT()
  1297. AC_MSG_RESULT([$PKGSTR version string: $PVFS2_VERSION])
  1298.  
  1299. AC_MSG_RESULT()
  1300.