configure.ac 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. AC_INIT([zktreeutil], [1.0.0])
  5. AM_INIT_AUTOMAKE(foreign)
  6. AC_CONFIG_SRCDIR([src])
  7. AM_CONFIG_HEADER([config.h])
  8. PACKAGE=zktreeutil
  9. VERSION=1.0.0
  10. AC_SUBST(PACKAGE)
  11. AC_SUBST(VERSION)
  12. BUILD_PATH="`pwd`"
  13. # Checks for programs.
  14. AC_LANG_CPLUSPLUS
  15. AC_PROG_CXX
  16. # Checks for libxm2.
  17. AM_PATH_XML2(2.7.3)
  18. XML2_INCLUDE="/usr/include/libxml2"
  19. AC_SUBST(XML2_INCLUDE)
  20. # Zookeeper C client
  21. ZOOKEEPER_PATH=${BUILD_PATH}/../../zookeeper-client/zookeeper-client-c
  22. AC_CHECK_LIB(zookeeper_mt, main, [ZOOKEEPER="-L${ZOOKEEPER_PATH}/target/c/.libs -lzookeeper_mt"],,["-L${ZOOKEEPER_PATH}/target/c/.libs"])
  23. if test -z "${ZOOKEEPER}"; then
  24. AC_ERROR("... zookeeper C client not found!")
  25. fi
  26. AC_SUBST(ZOOKEEPER)
  27. AC_SUBST(ZOOKEEPER_PATH)
  28. ### log4cxx ###
  29. LOG4CXX_VERSION="0.10.0"
  30. LOG4CXX_INCLUDE="/usr/local/include"
  31. LOG4CXX_LIB_PATH="/usr/local/lib"
  32. AC_CHECK_LIB(log4cxx, main, [LOG4CXX="-L${LOG4CXX_LIB_PATH} -llog4cxx"],,["-L${LOG4CXX_LIB_PATH}"])
  33. if test -z "${LOG4CXX}"; then
  34. AC_ERROR("... log4cxx not found!")
  35. fi
  36. dnl OpenSSL
  37. AC_ARG_WITH(openssl,
  38. [AC_HELP_STRING([--with-openssl[=DIR]], [build with openssl (autodetect openssl library by default) )])],
  39. [], [with_openssl=yes])
  40. AC_MSG_NOTICE([configuring SSL using --with-openssl=$with_openssl])
  41. saved_CPPFLAGS="$CPPFLAGS"
  42. saved_LDFLAGS="$LDFLAGS"
  43. if test "x$with_openssl" != "xno" && test "x$with_openssl" != "xyes" ; then
  44. CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
  45. LDFLAGS="$LDFLAGS -L$with_openssl/lib"
  46. fi
  47. have_openssl=no
  48. AC_CHECK_HEADER(openssl/ssl.h, [ AC_CHECK_LIB(ssl, SSL_CTX_new, [have_openssl=yes]) ])
  49. if test "x$with_openssl" != "xno" && test "x$with_openssl" != "xyes" && test "x$have_openssl" != "xyes"; then
  50. CPPFLAGS="$saved_CPPFLAGS"
  51. LDFLAGS="$saved_LDFLAGS"
  52. fi
  53. if test "x$with_openssl" != xno && test "x$have_openssl" = xno; then
  54. AC_MSG_WARN([cannot build SSL support -- openssl not found])
  55. with_openssl=no
  56. fi
  57. if test "x$with_openssl" != xno; then
  58. AC_MSG_NOTICE([building with SSL support])
  59. else
  60. AC_MSG_NOTICE([building without SSL support])
  61. fi
  62. AM_CONDITIONAL([WANT_OPENSSL],[test "x$with_openssl" != xno])
  63. AC_SUBST(LOG4CXX)
  64. AC_SUBST(LOG4CXX_VERSION)
  65. AC_SUBST(LOG4CXX_INCLUDE)
  66. # Checks for header files.
  67. AC_HEADER_DIRENT
  68. AC_HEADER_STDC
  69. AC_CHECK_HEADERS([stdlib.h string.h stdio.h unistd.h boost/shared_ptr.hpp boost/algorithm/string.hpp boost/algorithm/string/split.hpp])
  70. # Checks for typedefs, structures, and compiler characteristics.
  71. AC_HEADER_STDBOOL
  72. AC_C_CONST
  73. AC_C_INLINE
  74. AC_TYPE_SIZE_T
  75. AC_C_VOLATILE
  76. AC_CONFIG_FILES([Makefile])
  77. AC_CONFIG_FILES([src/Makefile])
  78. AC_OUTPUT