configure.ac 5.4 KB

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