configure.in 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. AC_INIT(src/isync.h)
  2. AM_CONFIG_HEADER(config.h)
  3. AM_INIT_AUTOMAKE(isync, 1.0.1)
  4. AM_MAINTAINER_MODE
  5. AM_PROG_CC_STDC
  6. if test "$GCC" = yes; then
  7. CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wstrict-prototypes"
  8. fi
  9. AC_CHECK_FUNCS(vasprintf)
  10. AC_CHECK_LIB(socket, socket, [SOCK_LIBS="-lsocket"])
  11. AC_CHECK_LIB(nsl, inet_ntoa, [SOCK_LIBS="$SOCK_LIBS -lnsl"])
  12. AC_SUBST(SOCK_LIBS)
  13. m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
  14. have_ssl_paths=
  15. AC_ARG_WITH(ssl,
  16. AS_HELP_STRING([--with-ssl[=PATH]], [where to look for SSL [detect]]),
  17. [ob_cv_with_ssl=$withval])
  18. if test "x$ob_cv_with_ssl" != xno; then
  19. case $ob_cv_with_ssl in
  20. ""|yes)
  21. dnl Detect the pkg-config tool, as it may have extra info about the openssl
  22. dnl installation we can use. I *believe* this is what we are expected to do
  23. dnl on really recent Redhat Linux hosts.
  24. AC_PATH_PROG(PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
  25. if test "$PKGCONFIG" != "no" ; then
  26. AC_MSG_CHECKING([OpenSSL presence with pkg-config])
  27. if $PKGCONFIG --exists openssl; then
  28. SSL_LIBS=`$PKGCONFIG --libs-only-l openssl`
  29. SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl`
  30. SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl`
  31. have_ssl_paths=yes
  32. AC_MSG_RESULT([found])
  33. else
  34. AC_MSG_RESULT([not found])
  35. fi
  36. fi
  37. ;;
  38. *)
  39. SSL_LDFLAGS=-L$ob_cv_with_ssl/lib$libsuff
  40. SSL_CPPFLAGS=-I$ob_cv_with_ssl/include
  41. ;;
  42. esac
  43. if test -z "$have_ssl_paths"; then
  44. sav_LDFLAGS=$LDFLAGS
  45. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  46. AC_CHECK_LIB(dl, dlopen, [LIBDL=-ldl])
  47. AC_CHECK_LIB(crypto, CRYPTO_lock, [LIBCRYPTO=-lcrypto])
  48. AC_CHECK_LIB(ssl, SSL_connect,
  49. [SSL_LIBS="-lssl $LIBCRYPTO $LIBDL" have_ssl_paths=yes])
  50. LDFLAGS=$sav_LDFLAGS
  51. fi
  52. sav_CPPFLAGS=$CPPFLAGS
  53. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  54. AC_CHECK_HEADER(openssl/ssl.h, , [have_ssl_paths=])
  55. CPPFLAGS=$sav_CPPFLAGS
  56. if test -z "$have_ssl_paths"; then
  57. if test -n "$ob_cv_with_ssl"; then
  58. AC_MSG_ERROR([OpenSSL libs and/or includes were not found where specified])
  59. fi
  60. else
  61. AC_DEFINE(HAVE_LIBSSL, 1, [if you have the OpenSSL libraries])
  62. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  63. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  64. fi
  65. fi
  66. AC_SUBST(SSL_LIBS)
  67. AC_CACHE_CHECK([for Berkley DB 4.2], ac_cv_berkdb4,
  68. [ac_cv_berkdb4=no
  69. AC_TRY_LINK([#include <db.h>],
  70. [DB *db;
  71. db->truncate(db, 0, 0, 0);
  72. db->open(db, 0, "foo", "foo", DB_HASH, DB_CREATE, 0)],
  73. [ac_cv_berkdb4=yes])])
  74. if test "x$ac_cv_berkdb4" = xno; then
  75. AC_MSG_ERROR([Berkley DB 4.2 not found.
  76. You must install libdb4.2 including the respective development files/headers.])
  77. fi
  78. AC_ARG_ENABLE(compat,
  79. AS_HELP_STRING([--disable-compat], [don't include isync compatibility wrapper [no]]),
  80. [ob_cv_enable_compat=$enableval])
  81. if test "x$ob_cv_enable_compat" != xno; then
  82. AC_CHECK_FUNCS(getopt_long)
  83. fi
  84. AM_CONDITIONAL(with_compat, test "x$ob_cv_enable_compat" != xno)
  85. AC_OUTPUT(Makefile src/Makefile src/compat/Makefile isync.spec)
  86. if test -n "$have_ssl_paths"; then
  87. AC_MSG_RESULT([
  88. Using SSL
  89. ])
  90. else
  91. AC_MSG_RESULT([
  92. Not using SSL
  93. ])
  94. fi