configure.in 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. dnl
  2. dnl Configure for librdf
  3. dnl
  4. dnl (Process this file with autoconf to produce a configure script.)
  5. AC_REVISION($Revision$)dnl
  6. AC_PREREQ(2.13)
  7. AC_INIT(rdf_node.c)
  8. AM_CONFIG_HEADER(config.h)
  9. AM_INIT_AUTOMAKE(librdf, 1.0)
  10. dnl Checks for programs.
  11. AC_CANONICAL_HOST
  12. AC_ARG_PROGRAM
  13. AM_SANITY_CHECK
  14. AC_PROG_CC
  15. AC_PROG_INSTALL
  16. AC_PROG_LN_S
  17. AC_PROG_MAKE_SET
  18. AC_PROG_RANLIB
  19. AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
  20. AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
  21. AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
  22. AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
  23. dnl Checks for libraries.
  24. AC_CHECK_HEADERS(gdbm.h)
  25. if test "$ac_cv_header_gdbm_h" = yes ; then
  26. AC_CHECK_LIB(gdbm,gdbm_firstkey)
  27. fi
  28. dnl Checks for header files.
  29. AC_HEADER_STDC
  30. AC_CHECK_HEADERS(stdlib.h unistd.h)
  31. dnl Checks for typedefs, structures, and compiler characteristics.
  32. AC_C_CONST
  33. AC_C_INLINE
  34. AC_C_BIGENDIAN
  35. AC_CHECK_TYPE(byte, MISSING)
  36. AC_CHECK_TYPE(u16, MISSING)
  37. AC_CHECK_TYPE(u32, MISSING)
  38. AC_CHECK_SIZEOF(unsigned char, 1)
  39. AC_CHECK_SIZEOF(unsigned short, 2)
  40. AC_CHECK_SIZEOF(unsigned int, 4)
  41. AC_CHECK_SIZEOF(unsigned long, 4)
  42. AC_CHECK_SIZEOF(unsigned long long, 8)
  43. if test "$ac_cv_sizeof_unsigned_short" = "0" \
  44. || test "$ac_cv_sizeof_unsigned_int" = "0" \
  45. || test "$ac_cv_sizeof_unsigned_long" = "0"; then
  46. AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
  47. fi
  48. dnl Checks for library functions.
  49. AC_FUNC_MEMCMP
  50. dnl Checks for modules
  51. digest_modules="md5 sha1 ripemd160"
  52. AC_MSG_CHECKING(digests wanted)
  53. AC_ARG_ENABLE(digests, [ --enable-digests=LIST Use digests [md5 sha1 ripemd160]], digest_modules="$enableval")
  54. AC_MSG_RESULT($digest_modules)
  55. DIGEST_OBJS=
  56. DIGEST_SRCS=
  57. AC_ARG_WITH(openssl-digests, [ --with-openssl-digests Use openssl digests [yes]], enable_openssl_digests="$withval", enable_openssl_digests="yes")
  58. AC_MSG_CHECKING(whether to use openssl digests)
  59. if test "$enable_openssl_digests" = yes ; then
  60. AC_MSG_RESULT(yes)
  61. AC_CHECK_HEADERS(openssl/crypto.h)
  62. if test "$ac_cv_header_openssl_crypto_h" = yes ; then
  63. AC_DEFINE(HAVE_OPENSSL_DIGESTS)
  64. new_digest_modules=
  65. oLIBS="$LIBS"
  66. have_libcrypto=
  67. for module in $digest_modules; do
  68. func=`echo $module | tr 'a-z' 'A-Z'`
  69. # This is needed because autoheader can't work out which computed
  70. # symbols must be pulled from acconfig.h into config.h.in
  71. found=
  72. case "$func" in
  73. MD5)
  74. AC_CHECK_LIB(crypto, MD5)
  75. if test "$ac_cv_lib_crypto_MD5"; then
  76. AC_DEFINE(HAVE_OPENSSL_CRYPTO_MD5_DIGEST)
  77. found=yes
  78. fi
  79. ;;
  80. SHA1)
  81. AC_CHECK_LIB(crypto, SHA1)
  82. if test "$ac_cv_lib_crypto_SHA1"; then
  83. AC_DEFINE(HAVE_OPENSSL_CRYPTO_SHA1_DIGEST)
  84. found=yes
  85. fi
  86. ;;
  87. RIPEMD160)
  88. AC_CHECK_LIB(crypto, RIPEMD160)
  89. if test "$ac_cv_lib_crypto_RIPEMD160"; then
  90. AC_DEFINE(HAVE_OPENSSL_CRYPTO_RIPEMD160_DIGEST)
  91. found=yes
  92. fi
  93. ;;
  94. esac
  95. if test "$found" = yes; then
  96. have_libcrypto=yes
  97. else
  98. new_digest_modules="${new_digest_modules} $module"
  99. fi
  100. done
  101. if test "$have_libcrypto" = yes; then
  102. LIBS="-lcrypto $oLIBS"
  103. else
  104. LIBS="$oLIBS"
  105. fi
  106. DIGEST_OBJS="$DIGEST_OBJS rdf_digest_openssl.o"
  107. DIGEST_SRCS="$DIGEST_SRCS rdf_digest_openssl.c"
  108. digest_modules=$new_digest_modules
  109. fi
  110. else
  111. AC_MSG_RESULT(no)
  112. fi
  113. # Maybe add some local digest modules
  114. for module in $digest_modules; do
  115. module_u=`echo $module | tr 'a-z' 'A-Z'`
  116. AC_MSG_CHECKING(for local $module digest module)
  117. if test -r $srcdir/$module.c; then
  118. AC_MSG_RESULT(yes);
  119. # This is needed because autoheader can't work out which computed
  120. # symbols must be pulled from acconfig.h into config.h.in
  121. case "$module_u" in
  122. MD5) AC_DEFINE(HAVE_LOCAL_MD5_DIGEST) ;;
  123. SHA1) AC_DEFINE(HAVE_LOCAL_SHA1_DIGEST) ;;
  124. esac
  125. DIGEST_OBJS="$DIGEST_OBJS $module.o"
  126. DIGEST_SRCS="$DIGEST_SRCS $module.c"
  127. else
  128. AC_MSG_RESULT(no);
  129. fi
  130. done
  131. AC_SUBST(DIGEST_OBJS)
  132. AC_SUBST(DIGEST_SRCS)
  133. HASH_OBJS=
  134. HASH_SRCS=
  135. AC_MSG_CHECKING(for libgdbm support)
  136. if test "$ac_cv_lib_gdbm_gdbm_firstkey" = yes ; then
  137. AC_MSG_RESULT(yes);
  138. AC_DEFINE(HAVE_GDBM_HASH)
  139. HASH_OBJS="$HASH_OBJS rdf_hash_gdbm.o"
  140. HASH_SRCS="$HASH_SRCS rdf_hash_gdbm.o"
  141. else
  142. AC_MSG_RESULT(no);
  143. fi
  144. AC_SUBST(HASH_OBJS)
  145. AC_SUBST(HASH_SRCS)
  146. AC_OUTPUT([Makefile])