You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.3 KiB

  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.61)
  4. AC_INIT([spawn-fcgi],[1.6.5])
  5. AC_CONFIG_SRCDIR([src/spawn-fcgi.c])
  6. AC_CONFIG_HEADER([config.h])
  7. AM_INIT_AUTOMAKE([-Wall -Werror foreign])
  8. # Checks for programs.
  9. AC_PROG_CC
  10. AC_PROG_MAKE_SET
  11. dnl @synopsis TRY_CFLAGS [compiler flags]
  12. dnl @summary check whether C compiler supports given flags and adds them to CFLAGS
  13. AC_DEFUN([TRY_CFLAGS],
  14. [dnl
  15. AC_MSG_CHECKING([if $CC supports $1])
  16. AC_LANG_PUSH([C])
  17. ac_try_cflags_saved_cflags="${CFLAGS}"
  18. CFLAGS="${CFLAGS} $1"
  19. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
  20. [AC_MSG_RESULT([yes])],
  21. [
  22. AC_MSG_ERROR([no])
  23. # options not supported, remove them:
  24. CFLAGS="${ac_try_cflags_saved_cflags}"
  25. ]
  26. )
  27. AC_LANG_POP([C])
  28. ])
  29. # Checks for libraries.
  30. # Checks for header files.
  31. AC_HEADER_STDC
  32. AC_HEADER_SYS_WAIT
  33. AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h getopt.h grp.h netdb.h \
  34. netinet/in.h netinet/tcp.h pwd.h stdio.h stdlib.h \
  35. string.h sys/ioctl.h sys/socket.h sys/stat.h sys/time.h \
  36. sys/types.h sys/un.h sys/wait.h unistd.h])
  37. # Checks for typedefs, structures, and compiler characteristics.
  38. AC_C_CONST
  39. AC_TYPE_UID_T
  40. AC_TYPE_PID_T
  41. AC_HEADER_TIME
  42. AC_CHECK_TYPES(socklen_t,,,[#include <sys/types.h>
  43. #include <sys/socket.h>])
  44. ## solaris needs -lsocket -lnsl
  45. AC_SEARCH_LIBS([socket],[socket])
  46. AC_SEARCH_LIBS([inet_addr],[nsl socket])
  47. # Checks for library functions.
  48. AC_FUNC_CHOWN
  49. AC_FUNC_FORK
  50. AC_FUNC_MALLOC
  51. AC_FUNC_SELECT_ARGTYPES
  52. AC_FUNC_STAT
  53. AC_CHECK_FUNCS([dup2 memset putenv select socket strerror strtol issetugid inet_pton])
  54. # Check for IPv6 support
  55. AC_ARG_ENABLE(ipv6,
  56. AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
  57. [case "${enableval}" in
  58. yes) ipv6=true ;;
  59. no) ipv6=false ;;
  60. *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
  61. esac],[ipv6=true])
  62. if test x$ipv6 = xtrue; then
  63. AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
  64. [AC_TRY_LINK([[
  65. #include <sys/types.h>
  66. #include <sys/socket.h>
  67. #include <netinet/in.h>
  68. ]], [[
  69. struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
  70. ]], [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
  71. if test "$ac_cv_ipv6_support" = yes; then
  72. AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
  73. fi
  74. fi
  75. # check for extra compiler options (warning options)
  76. if test "${GCC}" = "yes"; then
  77. TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
  78. TRY_CFLAGS([-std=gnu99])
  79. fi
  80. AC_ARG_ENABLE([extra-warnings],
  81. [AS_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)])],
  82. [case "${enableval}" in
  83. yes) extrawarnings=true ;;
  84. no) extrawarnings=false ;;
  85. *) AC_MSG_ERROR([bad value ${enableval} for --enable-extra-warnings]) ;;
  86. esac],[extrawarnings=false])
  87. if test x$extrawarnings = xtrue; then
  88. TRY_CFLAGS([-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -Wmissing-prototypes -Wshadow -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wl,--as-needed -Wl,--no-undefined])
  89. fi
  90. AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
  91. AC_OUTPUT