configure.ac 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. AC_INIT(libteletone, 0.1, BUG-REPORT-ADDRESS)
  5. AC_CONFIG_AUX_DIR(build)
  6. AM_INIT_AUTOMAKE(libteletone,0.1)
  7. AC_CONFIG_SRCDIR([src])
  8. # disable checks
  9. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  10. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  11. # Checks for programs.
  12. AC_PROG_CC
  13. AC_PROG_MAKE_SET
  14. AC_PROG_LIBTOOL
  15. AC_PROG_INSTALL
  16. # Optimize
  17. AC_ARG_ENABLE(optimization,
  18. [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
  19. if test "${enable_optimizer}" = "yes" ; then
  20. AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
  21. AX_CC_MAXOPT
  22. fi
  23. # Enable debugging
  24. AC_ARG_ENABLE(debug,
  25. [AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
  26. if test "${enable_debug}" = "yes"; then
  27. AC_DEFINE([DEBUG],[],[Enable extra debugging.])
  28. AX_CFLAGS_WARN_ALL_ANSI
  29. fi
  30. AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
  31. dnl check for the compiler used
  32. AX_COMPILER_VENDOR
  33. case "$host" in
  34. *-solaris2*)
  35. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  36. new_AM_CFLAGS="-KPIC -DPIC"
  37. new_AM_LDFLAGS="-R${prefix}/lib"
  38. fi
  39. ;;
  40. *-darwin*)
  41. if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
  42. new_AM_CFLAGS="-DMACOSX"
  43. fi
  44. ;;
  45. x86_64-unknown-linux-gnu)
  46. new_AM_CFLAGS="-fPIC"
  47. new_AM_LDFLAGS=""
  48. ;;
  49. i*6-unknown-linux-gnu)
  50. new_AM_CFLAGS="-fpic"
  51. new_AM_LDFLAGS=""
  52. ;;
  53. x86_64-*-freebsd*|amd64-*-freebsd*)
  54. new_AM_CFLAGS="-fpic"
  55. new_AM_LDFLAGS=""
  56. ;;
  57. i*6-*-freebsd*)
  58. new_AM_CFLAGS="-fpic"
  59. new_AM_LDFLAGS=""
  60. ;;
  61. esac
  62. #
  63. # gcc visibility cflag checks
  64. #
  65. AC_ARG_ENABLE([visibility],
  66. [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
  67. [enable_visibility="${enableval}"],
  68. [enable_visibility="detect"]
  69. )
  70. HAVE_VISIBILITY="no"
  71. if test "x${enable_visibility}" != "xno" ; then
  72. case "${ax_cv_c_compiler_vendor}" in
  73. gnu)
  74. save_CFLAGS="${CFLAGS}"
  75. CFLAGS="${CFLAGS} -fvisibility=hidden"
  76. AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
  77. AC_COMPILE_IFELSE(
  78. [AC_LANG_PROGRAM(
  79. [int foo __attribute__ ((visibility("default")));],
  80. [;]
  81. )],
  82. [AC_MSG_RESULT([yes])
  83. new_AM_CFLAGS="${new_AM_CFLAGS} -fvisibility=hidden"
  84. AC_DEFINE([HAVE_VISIBILITY], [1], [GCC visibility support available])
  85. HAVE_VISIBILITY="yes"],
  86. [AC_MSG_RESULT([no])]
  87. )
  88. CFLAGS="${save_CFLAGS}"
  89. ;;
  90. sun)
  91. save_CFLAGS="${CFLAGS}"
  92. CFLAGS="${CFLAGS} -xldscope=hidden"
  93. AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
  94. AC_COMPILE_IFELSE(
  95. [AC_LANG_PROGRAM(
  96. [int foo __attribute__ ((visibility("default")));],
  97. [;]
  98. )],
  99. [AC_MSG_RESULT([yes])
  100. new_AM_CFLAGS="${new_AM_CFLAGS} -xldscope=hidden"
  101. AC_DEFINE([HAVE_VISIBILITY], [1], [SUNCC visibility support available])
  102. HAVE_VISIBILITY="yes"],
  103. [AC_MSG_RESULT([no])]
  104. )
  105. CFLAGS="${save_CFLAGS}"
  106. ;;
  107. *)
  108. if test "x${enable_visibility}" = "xyes" ; then
  109. AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
  110. else
  111. AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
  112. fi
  113. ;;
  114. esac
  115. #
  116. # visibility explicitly requested but not supported by this compiler => error
  117. #
  118. if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
  119. AC_MSG_ERROR([API visibility not supported by this compiler])
  120. fi
  121. fi
  122. AC_SUBST(new_AM_CFLAGS)
  123. AC_SUBST(new_AM_LDFLAGS)
  124. # Checks for header files.
  125. AC_HEADER_DIRENT
  126. AC_HEADER_STDC
  127. #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])
  128. # Checks for typedefs, structures, and compiler characteristics.
  129. AC_C_CONST
  130. AC_C_INLINE
  131. AC_TYPE_SIZE_T
  132. AC_HEADER_TIME
  133. AC_STRUCT_TM
  134. # Checks for library functions.
  135. AC_PROG_GCC_TRADITIONAL
  136. AC_FUNC_MALLOC
  137. AC_TYPE_SIGNAL
  138. AC_FUNC_STRFTIME
  139. #AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr])
  140. AC_CONFIG_FILES([Makefile])
  141. AC_OUTPUT