configure.in 3.2 KB

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