configure.ac 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. AC_INIT([zookeeper C client],3.4.0,[zookeeper-user@hadoop.apache.org],[c-client-src])
  5. AC_CONFIG_SRCDIR([src/zookeeper.c])
  6. # initialize Doxygen support
  7. DX_HTML_FEATURE(ON)
  8. DX_CHM_FEATURE(OFF)
  9. DX_CHI_FEATURE(OFF)
  10. DX_MAN_FEATURE(OFF)
  11. DX_RTF_FEATURE(OFF)
  12. DX_XML_FEATURE(OFF)
  13. DX_PDF_FEATURE(OFF)
  14. DX_PS_FEATURE(OFF)
  15. DX_INIT_DOXYGEN([zookeeper],[c-doc.Doxyfile],[docs])
  16. # initialize automake
  17. AM_INIT_AUTOMAKE([-Wall foreign])
  18. AC_CONFIG_HEADER([config.h])
  19. # Checks for programs.
  20. AC_ARG_WITH(cppunit,
  21. [ --without-cppunit do not use CPPUNIT])
  22. if test "$with_cppunit" = "no" ; then
  23. CPPUNIT_PATH="No_CPPUNIT"
  24. CPPUNIT_INCLUDE=
  25. CPPUNIT_LIBS=
  26. else
  27. AM_PATH_CPPUNIT(1.10.2)
  28. fi
  29. if test "$CALLER" = "ANT" ; then
  30. CPPUNIT_CFLAGS="$CPPUNIT_CFLAGS -DZKSERVER_CMD=\"\\\"${base_dir}/src/c/tests/zkServer.sh\\\"\""
  31. else
  32. CPPUNIT_CFLAGS="$CPPUNIT_CFLAGS -DZKSERVER_CMD=\"\\\"./tests/zkServer.sh\\\"\""
  33. AC_CHECK_FILES([generated/zookeeper.jute.c generated/zookeeper.jute.h],[],
  34. [AC_MSG_ERROR([jute files are missing! Please run "ant compile_jute" while in the zookeeper top level directory.])
  35. ])
  36. fi
  37. AC_SUBST(CPPUNIT_CFLAGS)
  38. AC_PROG_CC
  39. AM_PROG_CC_C_O
  40. AC_PROG_CXX
  41. AC_PROG_INSTALL
  42. AC_PROG_LN_S
  43. # AC_DISABLE_SHARED
  44. AC_PROG_LIBTOOL
  45. #enable -D_GNU_SOURCE since the return code value of getaddrinfo
  46. #ifdefed with __USE_GNU
  47. #features.h header undef's __USE_GNU and defines it only if _GNU_SOURCE is defined
  48. #hence this define for gcc
  49. AC_ARG_ENABLE([debug],
  50. [AS_HELP_STRING([--enable-debug],[enable debug build [default=no]])],
  51. [CFLAGS="-g -O0 -D_GNU_SOURCE";CXXFLAGS="-g -O0"],[CFLAGS="-g -O2 -D_GNU_SOURCE";CXXFLAGS="-g -O2"])
  52. AC_ARG_WITH([syncapi],
  53. [AS_HELP_STRING([--with-syncapi],[build with support for SyncAPI [default=yes]])],
  54. [],[with_syncapi=yes])
  55. # Checks for libraries.
  56. AC_CHECK_LIB([pthread], [pthread_mutex_lock],[have_pthread=yes],[have_pthread=no])
  57. if test "x$with_syncapi" != xno && test "x$have_pthread" = xno; then
  58. AC_MSG_WARN([cannot build SyncAPI -- pthread not found])
  59. with_syncapi=no
  60. fi
  61. if test "x$with_syncapi" != xno; then
  62. AC_MSG_NOTICE([building with SyncAPI support])
  63. else
  64. AC_MSG_NOTICE([building without SyncAPI support])
  65. fi
  66. AM_CONDITIONAL([WANT_SYNCAPI],[test "x$with_syncapi" != xno])
  67. # Checks for header files.
  68. AC_HEADER_STDC
  69. AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h sys/utsname.h])
  70. # Checks for typedefs, structures, and compiler characteristics.
  71. AC_C_CONST
  72. AC_C_INLINE
  73. AC_HEADER_TIME
  74. AC_CHECK_TYPE([nfds_t],
  75. [AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[poll() second argument type])],
  76. [AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[poll() second argument type])],
  77. [#include <poll.h>])
  78. # Checks for library functions.
  79. AC_CHECK_FUNCS([getcwd gethostbyname gethostname getlogin getpwuid_r gettimeofday getuid memmove memset poll socket strchr strdup strerror strtol])
  80. AC_CONFIG_FILES([Makefile])
  81. AC_OUTPUT