configure.ac 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_INIT(libdingaling, 0.1)
  4. AC_CONFIG_AUX_DIR(build)
  5. AM_INIT_AUTOMAKE
  6. AC_CONFIG_SRCDIR([src])
  7. AC_CONFIG_HEADERS([src/config.h])
  8. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  9. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  10. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  11. #Set default language
  12. AC_LANG_C
  13. # Checks for programs.
  14. AC_PROG_CC
  15. AC_PROG_MAKE_SET
  16. AC_PROG_LIBTOOL
  17. AC_PROG_INSTALL
  18. #Check for compiler vendor
  19. AX_COMPILER_VENDOR
  20. # Optimize
  21. AC_ARG_ENABLE(optimization,
  22. [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
  23. if test "${enable_optimizer}" = "yes" ; then
  24. AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
  25. AX_CC_MAXOPT
  26. fi
  27. # Enable debugging
  28. AC_ARG_ENABLE(debug,
  29. [AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
  30. if test "${enable_debug}" = "yes"; then
  31. AC_DEFINE([DEBUG],[],[Enable extra debugging.])
  32. AX_CFLAGS_WARN_ALL_ANSI
  33. fi
  34. AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
  35. case "$host" in
  36. *-solaris2*)
  37. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  38. SOLINK="-Bdynamic -dy -G"
  39. new_AM_CFLAGS="-KPIC -DPIC"
  40. new_AM_LDFLAGS="-R${prefix}/lib"
  41. FUNC_DEF=__func__
  42. IN_LINE=""
  43. elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
  44. SOLINK="-Bdynamic -dy -G"
  45. new_AM_CFLAGS="-fPIC"
  46. new_AM_LDFLAGS=""
  47. IN_LINE=inline
  48. fi
  49. ;;
  50. *-darwin*)
  51. if test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
  52. SOLINK="-dynamic -bundle -force-flat-namespace"
  53. new_AM_CFLAGS="-DMACOSX"
  54. new_AM_LDFLAGS=""
  55. fi
  56. IN_LINE=inline
  57. ;;
  58. x86_64-*-linux-gnu)
  59. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  60. SOLINK="-Bdynamic -dy -G"
  61. new_AM_CFLAGS="-KPIC -DPIC"
  62. new_AM_LDFLAGS="-R${prefix}/lib"
  63. FUNC_DEF=__func__
  64. elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
  65. SOLINK="-shared -Xlinker -x"
  66. new_AM_CFLAGS="-fPIC"
  67. new_AM_LDFLAGS=""
  68. fi
  69. IN_LINE=inline
  70. ;;
  71. i*6-*-linux-gnu)
  72. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  73. SOLINK="-Bdynamic -dy -G"
  74. new_AM_CFLAGS="-KPIC -DPIC"
  75. new_AM_LDFLAGS="-R${prefix}/lib"
  76. FUNC_DEF=__func__
  77. elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
  78. SOLINK="-shared -Xlinker -x"
  79. new_AM_CFLAGS="-fpic"
  80. new_AM_LDFLAGS=""
  81. fi
  82. IN_LINE=inline
  83. ;;
  84. *)
  85. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  86. SOLINK="-Bdynamic -dy -G"
  87. new_AM_CFLAGS="-KPIC -DPIC"
  88. new_AM_LDFLAGS="-R${prefix}/lib"
  89. FUNC_DEF=__func__
  90. elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
  91. SOLINK="-shared -Xlinker -x"
  92. new_AM_CFLAGS="-fPIC"
  93. new_AM_LDFLAGS=""
  94. fi
  95. IN_LINE=inline
  96. esac
  97. # Enable 64 bit build
  98. AC_ARG_ENABLE(64,
  99. [AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
  100. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  101. if test "${enable_64}" = "yes"; then
  102. new_AM_CFLAGS="$new_AM_CFLAGS -m64"
  103. fi
  104. fi
  105. AC_SUBST(new_AM_CFLAGS)
  106. AC_SUBST(new_AM_LDFLAGS)
  107. AC_SUBST(SOLINK)
  108. AC_DEFINE_UNQUOTED([__inline__],[$IN_LINE],[sunpro is bad at inline])
  109. # Checks for header files.
  110. AC_HEADER_DIRENT
  111. AC_HEADER_STDC
  112. #AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
  113. # Checks for typedefs, structures, and compiler characteristics.
  114. AC_C_CONST
  115. AC_C_INLINE
  116. AC_TYPE_SIZE_T
  117. AC_HEADER_TIME
  118. AC_STRUCT_TM
  119. # Checks for library functions.
  120. AC_PROG_GCC_TRADITIONAL
  121. AC_TYPE_SIGNAL
  122. AC_FUNC_STRFTIME
  123. #AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr])
  124. AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
  125. AC_DEFINE([__LITTLE_ENDIAN],1234,[for the places where it is not defined])
  126. AC_DEFINE([__BIG_ENDIAN],4321,[for the places where it is not defined])
  127. AC_CONFIG_FILES([Makefile])
  128. AC_OUTPUT