configure.ac 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(iksemel,1.3)
  3. AC_PREREQ(2.50)
  4. AC_CONFIG_AUX_DIR(build)
  5. AC_CONFIG_SRCDIR([configure.ac])
  6. AM_INIT_AUTOMAKE
  7. AC_CONFIG_HEADERS(include/config.h)
  8. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  9. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  10. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  11. AC_CANONICAL_HOST
  12. dnl Checks for programs
  13. AC_PROG_CC
  14. AC_PROG_INSTALL
  15. AC_CHECK_TOOL(OBJDUMP, objdump, :)
  16. AM_PROG_LIBTOOL
  17. AC_LANG_C
  18. dnl Checks for header files
  19. AC_HEADER_STDC
  20. AC_CHECK_HEADERS(unistd.h strings.h errno.h)
  21. dnl Checks for typedefs and structures
  22. AC_C_CONST
  23. AC_C_INLINE
  24. AC_TYPE_SIZE_T
  25. AC_CHECK_MEMBERS([struct stat.st_blksize])
  26. dnl Special check for windows
  27. case "$host_os" in
  28. *mingw*)
  29. AC_CHECK_LIB(wsock32, main, , AC_MSG_ERROR(Winsock is needed for a Win32 build.))
  30. ;;
  31. esac
  32. dnl Check for posix io
  33. AC_ARG_ENABLE(default-io,
  34. [ --disable-default-io disable builtin socket transport code ],
  35. defio=$enableval, defio=yes)
  36. if test "$defio" = yes; then
  37. AC_DEFINE(USE_DEFAULT_IO,1,[Define this is you want default transport])
  38. fi
  39. AM_CONDITIONAL(DO_POSIX, test "x$defio" = "xyes")
  40. dnl Checks for library functions
  41. AC_SEARCH_LIBS(recv,socket)
  42. AC_CHECK_FUNCS(getopt_long)
  43. AC_CHECK_FUNCS(getaddrinfo)
  44. #AX_PATH_LIBGNUTLS(,AC_DEFINE(HAVE_GNUTLS,,"Use libgnutls"))
  45. m4_include([openssl.m4])
  46. SAC_OPENSSL
  47. dnl Check -Wall flag of GCC
  48. if test "x$GCC" = "xyes"; then
  49. if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
  50. CFLAGS="$CFLAGS -Wall"
  51. fi
  52. fi
  53. AC_DEFUN([AX_COMPILER_VENDOR],
  54. [
  55. AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
  56. [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
  57. # note: don't check for gcc first since some other compilers define __GNUC__
  58. for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
  59. vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
  60. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
  61. #if !($vencpp)
  62. thisisanerror;
  63. #endif
  64. ])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
  65. done
  66. ])
  67. ])
  68. AX_COMPILER_VENDOR
  69. # Enable 64 bit build
  70. AC_ARG_ENABLE(64,
  71. [AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
  72. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  73. if test "${enable_64}" = "yes"; then
  74. CFLAGS="$CFLAGS -mt -m64 -lgpg-error"
  75. CXXFLAGS="$CXXFLAGS -mt -m64 -lgpg-error"
  76. SUNFLAGS="-xc99=all -mt -m64 -lgpg-error"
  77. else
  78. CFLAGS="$CFLAGS -mt -lgpg-error"
  79. CXXFLAGS="$CXXFLAGS -mt -lgpg-error"
  80. SUNFLAGS="-xc99=all -mt -lgpg-error"
  81. fi
  82. fi
  83. AC_SUBST(SUNCFLAGS)
  84. dnl Generating makefiles
  85. AC_CONFIG_FILES([
  86. Makefile
  87. iksemel.pc
  88. src/Makefile
  89. include/Makefile
  90. tools/Makefile
  91. test/Makefile
  92. doc/Makefile
  93. ])
  94. AC_OUTPUT