configure.ac 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. dnl Process this file with autoconf to produce a configure script.
  2. # Copyright (C) 1999-2005, 2015, 2016 Free Software Foundation, Inc.
  3. #
  4. # This file is part of GNU JWhois.
  5. #
  6. # GNU JWhois is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # GNU JWhois is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with GNU JWhois. If not, see <http://www.gnu.org/licenses/>.
  18. AC_INIT([GNU JWhois],
  19. m4_esyscmd([build-aux/git-version-gen .tarball-version]),
  20. [bug-jwhois@gnu.org])
  21. AC_CONFIG_SRCDIR([src/jconfig.c])
  22. AC_CONFIG_HEADER([src/config.h])
  23. AC_CONFIG_AUX_DIR([build-aux])
  24. AM_INIT_AUTOMAKE([gnu subdir-objects])
  25. AM_SILENT_RULES([yes]) # Enable silent rules by default.
  26. AH_TEMPLATE([CACHEFILE], [Default filename for the cache functionality])
  27. AH_TEMPLATE([NOCACHE], [Define if you want to disable cache functionality])
  28. AH_TEMPLATE([HAVE_DBM_OPEN], [Define if you have the dbm_open function. ])
  29. AH_TEMPLATE([HAVE_GDBM_OPEN], [Define if you have the gdbm_open function. ])
  30. AC_ARG_ENABLE([default-host],
  31. [AS_HELP_STRING([--enable-default-host=HOST],
  32. [default whois host (default whois.internic.net)])],
  33. [enable_default_host="$enableval"],
  34. [enable_default_host="whois.internic.net"])
  35. AC_DEFINE_UNQUOTED([DEFAULT_HOST], ["$enable_default_host"],
  36. [Default Whois server.])
  37. AC_ARG_ENABLE([whois-servers],
  38. [AS_HELP_STRING([--enable-whois-servers=DOMAIN],
  39. [default whois-servers.net domain (default whois-servers.net)])],
  40. [enable_whois_servers="$enableval"],
  41. [enable_whois_servers="whois-servers.net"])
  42. AC_DEFINE_UNQUOTED([WHOIS_SERVERS], ["$enable_whois_servers"],
  43. [Default whois-servers.net domain for the whois-servers support])
  44. AC_ARG_ENABLE([cache-expire],
  45. [AS_HELP_STRING([--enable-cache-expire=HOURS],
  46. [default expire time in hours for cached objects (default 168 hours)])],
  47. [enable_cache_expire="$enableval"],
  48. [enable_cache_expire="168"])
  49. AC_DEFINE_UNQUOTED([CACHE_EXPIRE], ["$enable_cache_expire"],
  50. [Default expire time for the cache functionality])
  51. AC_ARG_WITH([cache],
  52. [AS_HELP_STRING([--without-cache],
  53. [disable cache manager (see README for more info)])],
  54. [AS_IF([test x$withval = xno],
  55. [AC_DEFINE([NOCACHE], [1])
  56. cache=no],
  57. [cache=yes])],
  58. [cache=yes])
  59. AC_SUBST([cache])
  60. AC_PROG_INSTALL
  61. AC_PROG_CC
  62. gl_EARLY
  63. AM_GNU_GETTEXT([external])
  64. AM_GNU_GETTEXT_VERSION([0.19.2])
  65. AM_ICONV
  66. AC_C_BIGENDIAN
  67. # For gnulib
  68. gl_INIT
  69. AC_ARG_ENABLE([gcc-warnings],
  70. [AS_HELP_STRING([--enable-gcc-warnings],
  71. [turn on many GCC warnings (for developers; best with GNU make)])],
  72. [AS_CASE([$enableval],
  73. [yes|no], [],
  74. [AC_MSG_ERROR([bad value $enableval for gcc-warnings option])])
  75. gl_gcc_warnings=$enableval],
  76. [gl_gcc_warnings=no])
  77. if test "$enable_gcc_warnings" = yes; then
  78. warn_common='-Wall -Wno-sign-compare -Wcast-align -Wdocumentation
  79. -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wshadow
  80. -Wstrict-prototypes'
  81. for i in $warn_common;
  82. do
  83. gl_WARN_ADD([$i], [WARN_CFLAGS])
  84. done
  85. gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
  86. fi
  87. AC_CHECK_FUNC(connect,,
  88. AC_CHECK_LIB(socket, connect))
  89. AC_CHECK_FUNC(socket,,
  90. AC_CHECK_LIB(socket, socket)
  91. AC_CHECK_LIB(inet, socket))
  92. AC_CHECK_FUNCS(getipnodebyname)
  93. AC_CHECK_LIB(inet6, main,
  94. AC_CHECK_LIB(resolv, main))
  95. AC_CHECK_FUNCS(memcpy strtol)
  96. AC_CHECK_FUNCS(strcasecmp strncasecmp getopt_long)
  97. AC_HEADER_STDC([])
  98. AC_CHECK_HEADERS([sys/fcntl.h malloc.h stdint.h inttypes.h idna.h])
  99. AC_HEADER_TIME
  100. dnl check for inet_pton
  101. AC_CHECK_FUNCS(inet_pton)
  102. dnl Some systems have it, but not IPv6
  103. if test "$ac_cv_func_inet_pton" = "yes" ; then
  104. AC_MSG_CHECKING(if inet_pton supports IPv6)
  105. AC_TRY_RUN(
  106. [
  107. #include <stdlib.h>
  108. #include <sys/types.h>
  109. #include <sys/socket.h>
  110. #include <netinet/in.h>
  111. int main()
  112. {
  113. struct in6_addr addr6;
  114. if (inet_pton(AF_INET6, "::1", &addr6) < 1)
  115. exit (EXIT_FAILURE);
  116. else
  117. exit (EXIT_SUCCESS);
  118. }
  119. ], [
  120. AC_MSG_RESULT(yes)
  121. AC_DEFINE([HAVE_INET_PTON_IPV6], [1],
  122. [Define to 1 if inet_pton supports IPv6.])
  123. ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
  124. fi
  125. AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
  126. [Support IDN (needs GNU Libidn)]),
  127. libidn=$withval, libidn=yes)
  128. if test "$libidn" != "no"; then
  129. if test "$libidn" != "yes"; then
  130. LDFLAGS="${LDFLAGS} -L$libidn/lib"
  131. CPPFLAGS="${CPPFLAGS} -I$libidn/include"
  132. fi
  133. AC_CHECK_HEADER(idna.h,
  134. AC_CHECK_LIB(idn, stringprep_check_version,
  135. [libidn=yes LIBS="${LIBS} -lidn"], libidn=no),
  136. libidn=no)
  137. fi
  138. if test "$libidn" != "no" ; then
  139. AC_DEFINE([LIBIDN], [1],
  140. [Define to 1 if you want IDN support.])
  141. else
  142. AC_MSG_WARN([Libidn not found])
  143. fi
  144. AC_MSG_CHECKING([if Libidn should be used])
  145. AC_MSG_RESULT($libidn)
  146. found=no
  147. if test x$cache = xyes; then
  148. AC_CHECK_FUNC(dbm_open,
  149. [AC_DEFINE([HAVE_DBM_OPEN])
  150. found=yes])
  151. if test x$found = xno; then
  152. AC_CHECK_LIB(gdbm, gdbm_open,
  153. [AC_DEFINE([HAVE_GDBM_OPEN])
  154. LIBS="-lgdbm $LIBS"
  155. found=yes])
  156. fi
  157. if test x$found = xno; then
  158. AC_CHECK_LIB(ndbm, dbm_open,
  159. [AC_DEFINE([HAVE_DBM_OPEN])
  160. LIBS="-lndbm $LIBS"
  161. found=yes])
  162. fi
  163. if test x$found = xno; then
  164. AC_MSG_WARN("You don\'t have any dbm libraries installed -- disabling cache functions")
  165. AC_DEFINE([NOCACHE],1)
  166. cache=no
  167. else
  168. AC_CHECK_HEADERS(gdbm.h ndbm.h dbm.h db1/ndbm.h)
  169. fi
  170. fi
  171. if test "$ac_cv_lib_intl_bindtextdomain" = "yes" \
  172. || test "$ac_cv_lib_intl_gettext" = "yes"; then
  173. LIBS="-lintl $LIBS"
  174. AC_CHECK_HEADERS(libintl.h)
  175. fi
  176. ## Are we building from git checked-out sources, or a tarball ? This allows
  177. ## specifying some rules used only when bootstrapping.
  178. AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])
  179. ## GNU help2man creates man pages from --help output.
  180. AM_MISSING_PROG([HELP2MAN], [help2man])
  181. AX_CODE_COVERAGE
  182. AC_CONFIG_FILES([Makefile
  183. lib/Makefile
  184. po/Makefile.in])
  185. AC_OUTPUT