configure.ac 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 2)
  4. m4_define([MINOR_VERSION], 1)
  5. m4_define([MICRO_VERSION], 0)
  6. AC_PREREQ(2.59)
  7. AC_INIT([faux],
  8. [MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION],
  9. [serj.kalichev at gmail dot com])
  10. AC_CONFIG_AUX_DIR(aux_scripts)
  11. AC_CONFIG_MACRO_DIR([m4])
  12. # Values for SONAME. See -version-info for details.
  13. AC_SUBST(SONAME_CURRENT, 2)
  14. AC_SUBST(SONAME_REVISION, 0)
  15. AC_SUBST(SONAME_AGE, 0)
  16. # Check for system extensions (_POSIX_THREAD_SEMANTICS for Solaris)
  17. AC_USE_SYSTEM_EXTENSIONS
  18. # Checks for programs.
  19. AC_PROG_CC
  20. AC_LIBTOOL_WIN32_DLL
  21. AC_PROG_LIBTOOL
  22. AC_CONFIG_HEADERS([config.h])
  23. AM_INIT_AUTOMAKE(subdir-objects)
  24. AM_PROG_CC_C_O
  25. # Dir for libc replacements
  26. AC_CONFIG_LIBOBJ_DIR([libc])
  27. # needed to handle 64-bit architecture
  28. AC_CHECK_SIZEOF(int)
  29. AC_CHECK_SIZEOF(long)
  30. AC_CHECK_SIZEOF(size_t)
  31. #########################################
  32. # See if linker supports version scripts
  33. #########################################
  34. # Check if LD supports linker scripts,
  35. # and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
  36. AC_ARG_ENABLE([ld-version-script],
  37. AS_HELP_STRING([--enable-ld-version-script],
  38. [enable linker version script (default is enabled when possible)]),
  39. [have_ld_version_script=$enableval], [])
  40. if test -z "$have_ld_version_script"; then
  41. AC_MSG_CHECKING([if LD -Wl,--version-script works])
  42. save_LDFLAGS="$LDFLAGS"
  43. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  44. cat > conftest.map <<EOF
  45. VERS_1 {
  46. global: sym;
  47. };
  48. VERS_2 {
  49. global: sym;
  50. } VERS_1;
  51. EOF
  52. AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
  53. [have_ld_version_script=yes], [have_ld_version_script=no])
  54. rm -f conftest.map
  55. LDFLAGS="$save_LDFLAGS"
  56. AC_MSG_RESULT($have_ld_version_script)
  57. fi
  58. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  59. ################################
  60. # Deal with debugging options
  61. ################################
  62. AC_ARG_ENABLE(debug,
  63. [AS_HELP_STRING([--enable-debug],
  64. [Turn on debugging including asserts [default=no]])],
  65. [],
  66. [enable_debug=no])
  67. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  68. ################################
  69. # Compile in testc tests
  70. ################################
  71. AC_ARG_ENABLE(testc,
  72. [AS_HELP_STRING([--enable-testc],
  73. [Enable testc tests compiling [default=no]])],
  74. [],
  75. [enable_testc=no])
  76. AM_CONDITIONAL(TESTC,test x$enable_testc = xyes)
  77. ################################
  78. # Internal getopt()
  79. ################################
  80. AC_ARG_WITH(internal-getopt,
  81. [AS_HELP_STRING([--with-internal-getopt],
  82. [Use internal implementation of getopt [default=no]])],
  83. [],
  84. [with_internal_getopt=no])
  85. if test x$with_internal_getopt != xno; then
  86. AC_DEFINE([WITH_INTERNAL_GETOPT], [1], [Use internal getopt() implementation])
  87. AC_LIBOBJ([getopt])
  88. AC_MSG_WARN([Use internal implementation of getopt() and getopt_long()])
  89. else
  90. AC_CHECK_HEADERS(getopt.h, [found_getopt_h=yes],
  91. AC_MSG_WARN([getopt.h not found: only short parameters can be used on command line]))
  92. fi
  93. AC_MSG_CHECKING([for getopt_long()])
  94. if test x$with_internal_getopt = xyes -o x$found_getopt_h = xyes; then
  95. AC_DEFINE([HAVE_GETOPT_LONG], [1], [getopt_long() function])
  96. AC_MSG_RESULT([yes])
  97. else
  98. AC_MSG_RESULT([no])
  99. fi
  100. ################################
  101. # Check for locale.h
  102. ################################
  103. AC_CHECK_HEADERS(locale.h, [],
  104. AC_MSG_WARN([locale.h not found: the locales is not supported]))
  105. ################################
  106. # Check for CODESET within nl_langinfo
  107. ################################
  108. AC_DEFUN([AM_LANGINFO_CODESET],
  109. [
  110. AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
  111. [AC_TRY_LINK([#include <langinfo.h>],
  112. [char* cs = nl_langinfo(CODESET); return !cs;],
  113. [am_cv_langinfo_codeset=yes],
  114. [am_cv_langinfo_codeset=no])
  115. ])
  116. if test $am_cv_langinfo_codeset = yes; then
  117. AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
  118. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  119. fi
  120. ])
  121. AM_LANGINFO_CODESET
  122. ################################
  123. # Check for pwd.h and grp.h
  124. ################################
  125. AC_CHECK_HEADERS(pwd.h, [],
  126. AC_MSG_WARN([pwd.h not found: the pwd operations is not supported]))
  127. AC_CHECK_HEADERS(grp.h, [],
  128. AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
  129. ################################
  130. # Check for dlopen()
  131. ################################
  132. AC_CHECK_HEADERS(dlfcn.h, [
  133. AC_SEARCH_LIBS([dlopen], [dl dld], [], [
  134. AC_MSG_ERROR([unable to find the dlopen() function])
  135. ])
  136. ],[
  137. AC_MSG_ERROR([dlfcn.h not found: the dl operations is not supported])
  138. ])
  139. ################################
  140. # Check for pthread
  141. ################################
  142. # library's net_io.c needs pthread_sigmask()
  143. AX_PTHREAD
  144. ################################
  145. # Check for signalfd()
  146. ################################
  147. AC_CHECK_FUNCS(signalfd, [],
  148. AC_MSG_WARN([signalfd() not found: more complex mechanism will be used]))
  149. ################################
  150. # Check for ppoll()
  151. ################################
  152. AC_CHECK_FUNCS(ppoll, [],
  153. AC_MSG_WARN([ppoll() not found: more complex mechanism will be used]))
  154. AC_CONFIG_FILES([Makefile])
  155. AC_OUTPUT