configure.ac 5.5 KB

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