configure.ac 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 check for -Wall -Wextra support
  23. CC_CHECK_CFLAG_APPEND([-Wall -Wsign-compare -Wextra])
  24. dnl Where is iconv? In libc or separate lib?
  25. AM_ICONV
  26. AC_ARG_ENABLE([programs],
  27. AS_HELP_STRING([--enable-programs], [Build additional programs [default=yes]])
  28. )
  29. AC_ARG_ENABLE([debug],
  30. AS_HELP_STRING([--enable-debug], [Additional debugging features [default=yes]])
  31. )
  32. AS_IF([test x"$enable_debug" != x"no"], [
  33. AC_DEFINE([BDSM_DEBUG], [1], [Enable debug message and compile flags])
  34. ])
  35. AM_CONDITIONAL([DEBUG], [test x"$enable_debug" != x"no"])
  36. AM_CONDITIONAL([PROGRAMS], [test x"$enable_programs" != x"no"])
  37. LT_INIT
  38. DOLT
  39. AC_CONFIG_MACRO_DIR([m4])
  40. dnl Check for pthreads
  41. AX_PTHREAD
  42. ##############################
  43. ## Checks for the ASN.1 parser
  44. PKG_CHECK_MODULES([TASN1], [libtasn1])
  45. ## Check if it supports new types
  46. AC_MSG_CHECKING([whether libtasn1 version >= 3.0])
  47. CFLAGS="$CFLAGS $TASN1_CFLAGS"
  48. AC_COMPILE_IFELSE([
  49. AC_LANG_PROGRAM([#include <libtasn1.h>], [ asn1_node test; ])
  50. ], [
  51. AC_MSG_RESULT([yes])
  52. HAVE_TASN1_3PLUS=yes
  53. ], [
  54. AC_MSG_RESULT([no])
  55. HAVE_TASN1_3PLUS=no
  56. ])
  57. AM_CONDITIONAL([HAVE_TASN1_3PLUS],[test x$HAVE_TASN1_3PLUS = xyes])
  58. AS_IF([test x"$HAVE_TASN1_3PLUS" = x"yes"], [
  59. AC_DEFINE([HAVE_TASN1_3PLUS], [1], [libtasn1 has v 3.0 downcase types])
  60. dnl Ugly compatibility with old 2.x types
  61. AC_DEFINE([ASN1_ARRAY_TYPE], [asn1_static_node], [...])
  62. ], [
  63. dnl Ugly compatibility with new 3.x types
  64. AC_DEFINE([asn1_static_node], [ASN1_ARRAY_TYPE], [...])
  65. ])
  66. AC_SEARCH_LIBS([strlcpy], [bsd], [
  67. AC_DEFINE([HAVE_LIBBSD], [1], [Does this system have libbsd strl*** functions implementation])
  68. ])
  69. AC_REPLACE_FUNCS([strlcpy])
  70. AC_REPLACE_FUNCS([clock_gettime])
  71. AC_CHECK_HEADERS([bsd/string.h])
  72. AC_CHECK_HEADERS([langinfo.h])
  73. ## Configure random device path
  74. AC_ARG_WITH([urandom],
  75. [AS_HELP_STRING([--with-urandom=PATH],
  76. [Configure the path of the random generation device used @<:@default=/dev/urandom@:>@ ])],
  77. [], [with_urandom=/dev/urandom])
  78. AC_DEFINE_UNQUOTED([URANDOM], ["$with_urandom"], [Path of the random number generation device])
  79. ## Check for doxygen presence
  80. AC_CHECK_PROGS([DOXYGEN], [doxygen])
  81. AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
  82. if test -z "$DOXYGEN";
  83. then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
  84. else
  85. AC_CONFIG_FILES([doc/Doxyfile])
  86. fi
  87. case "${host_os}" in
  88. *android*)
  89. BDSM_LIB_LOG="-llog"
  90. LDFLAGS="${LDFLAGS} ${BDSM_LIB_LOG}"
  91. ;;
  92. esac
  93. AC_SUBST(BDSM_LIB_LOG)
  94. AC_OUTPUT([
  95. Makefile
  96. libdsm.pc
  97. ])