configure.ac 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. AC_PREREQ([2.53])
  2. AC_INIT([libdsm], [m4_esyscmd([./package_version.sh])],
  3. [], [libdsm], [])
  4. AC_CONFIG_HEADER(config.h)
  5. AC_CONFIG_SRCDIR([include/bdsm.h])
  6. AC_CONFIG_LIBOBJ_DIR([compat])
  7. AM_INIT_AUTOMAKE([1.6 foreign subdir-objects tar-ustar dist-zip])
  8. m4_ifdef([AM_SILENT_RULES], [
  9. AM_SILENT_RULES([yes])
  10. ])
  11. AC_CANONICAL_HOST
  12. BDSM_ABI_VERSION=m4_esyscmd([./abi_version.sh])
  13. BDSM_PACKAGE_VERSION=m4_esyscmd([./package_version.sh])
  14. BDSM_LIBTOOL_VERSION=m4_esyscmd([./abi_version.sh -libtool])
  15. AC_SUBST(BDSM_ABI_VERSION)
  16. AC_SUBST(BDSM_PACKAGE_VERSION)
  17. AC_SUBST(BDSM_LIBTOOL_VERSION)
  18. AC_MSG_NOTICE([dsm package version: $BDSM_PACKAGE_VERSION])
  19. AC_MSG_NOTICE([dsm ABI version: $BDSM_ABI_VERSION])
  20. AC_PROG_CC_C99
  21. AM_PROG_CC_C_O
  22. dnl Where is iconv? In libc or separate lib?
  23. AM_ICONV
  24. AC_ARG_ENABLE([programs],
  25. AS_HELP_STRING([--enable-programs], [Build additional programs [default=yes]])
  26. )
  27. AC_ARG_ENABLE([debug],
  28. AS_HELP_STRING([--enable-debug], [Additional debugging features [default=yes]])
  29. )
  30. AS_IF([test x"$enable_debug" != x"no"], [
  31. AC_DEFINE([BDSM_DEBUG], [1], [Enable debug message and compile flags])
  32. ])
  33. AM_CONDITIONAL([DEBUG], [test x"$enable_debug" != x"no"])
  34. AM_CONDITIONAL([PROGRAMS], [test x"$enable_programs" != x"no"])
  35. LT_INIT
  36. DOLT
  37. AC_CONFIG_MACRO_DIR([m4])
  38. dnl Check for pthreads
  39. AX_PTHREAD
  40. ##############################
  41. ## Checks for the ASN.1 parser
  42. PKG_CHECK_MODULES([TASN1], [libtasn1])
  43. ## Check if it supports new types
  44. AC_MSG_CHECKING([whether libtasn1 version >= 3.0])
  45. CFLAGS="$CFLAGS $TASN1_CFLAGS"
  46. AC_COMPILE_IFELSE([
  47. AC_LANG_PROGRAM([#include <libtasn1.h>], [ asn1_node test; ])
  48. ], [
  49. AC_MSG_RESULT([yes])
  50. HAVE_TASN1_3PLUS=yes
  51. ], [
  52. AC_MSG_RESULT([no])
  53. HAVE_TASN1_3PLUS=no
  54. ])
  55. AM_CONDITIONAL([HAVE_TASN1_3PLUS],[test x$HAVE_TASN1_3PLUS = xyes])
  56. AS_IF([test x"$HAVE_TASN1_3PLUS" = x"yes"], [
  57. AC_DEFINE([HAVE_TASN1_3PLUS], [1], [libtasn1 has v 3.0 downcase types])
  58. dnl Ugly compatibility with old 2.x types
  59. AC_DEFINE([ASN1_ARRAY_TYPE], [asn1_static_node], [...])
  60. ], [
  61. dnl Ugly compatibility with new 3.x types
  62. AC_DEFINE([asn1_static_node], [ASN1_ARRAY_TYPE], [...])
  63. ])
  64. AC_SEARCH_LIBS([strlcpy], [bsd], [
  65. AC_DEFINE([HAVE_LIBBSD], [1], [Does this system have libbsd strl*** functions implementation])
  66. ])
  67. AC_REPLACE_FUNCS([strlcpy])
  68. AC_CHECK_HEADERS([bsd/string.h])
  69. AC_CHECK_HEADERS([langinfo.h])
  70. ## Configure random device path
  71. AC_ARG_WITH([urandom],
  72. [AS_HELP_STRING([--with-urandom=PATH],
  73. [Configure the path of the random generation device used @<:@default=/dev/urandom@:>@ ])],
  74. [], [with_urandom=/dev/urandom])
  75. AC_DEFINE_UNQUOTED([URANDOM], ["$with_urandom"], [Path of the random number generation device])
  76. ## Check for doxygen presence
  77. AC_CHECK_PROGS([DOXYGEN], [doxygen])
  78. AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
  79. if test -z "$DOXYGEN";
  80. then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
  81. else
  82. AC_CONFIG_FILES([doc/Doxyfile])
  83. fi
  84. case "${host_os}" in
  85. *android*)
  86. BDSM_LIB_LOG="-llog"
  87. LDFLAGS="${LDFLAGS} ${BDSM_LIB_LOG}"
  88. ;;
  89. esac
  90. AC_SUBST(BDSM_LIB_LOG)
  91. AC_OUTPUT([
  92. Makefile
  93. libdsm.pc
  94. ])