/contrib/ntp/sntp/configure.ac

https://bitbucket.org/freebsd/freebsd-head/ · m4 · 159 lines · 120 code · 21 blank · 18 comment · 0 complexity · 5ed28d8ca9785022353d8a3b765bb15a MD5 · raw file

  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT(main.c)
  3. AM_INIT_AUTOMAKE([msntp],[1.6])
  4. AC_CONFIG_SRCDIR([header.h])
  5. AC_CANONICAL_HOST
  6. AM_CONFIG_HEADER(config.h)
  7. # Checks for programs.
  8. AC_PROG_CC
  9. # So far, the only shared library we might use is libopts.
  10. # It's a small library - we might as well use a static version of it.
  11. AC_DISABLE_SHARED
  12. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  13. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  14. AC_PROG_LIBTOOL
  15. # NTP has (so far) been relying on leading-edge autogen.
  16. # Therefore, by default:
  17. # - use the version we ship with
  18. # - do not install it
  19. # - build a static copy (AC_DISABLE_SHARED - done earlier)
  20. case "${enable_local_libopts+set}" in
  21. set) ;;
  22. *) enable_local_libopts=yes ;;
  23. esac
  24. case "${enable_libopts_install+set}" in
  25. set) ;;
  26. *) enable_libopts_install=no ;;
  27. esac
  28. LIBOPTS_CHECK
  29. AC_MSG_CHECKING([[if $CC can handle #warning]])
  30. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no])
  31. AC_MSG_RESULT([$ac_cv_cpp_warning])
  32. case "$ac_cv_cpp_warning" in
  33. no)
  34. AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid #warning on option name collisions?])
  35. AC_MSG_RESULT([[Enabling NO_OPTION_NAME_WARNINGS as #warning does not work]])
  36. ;;
  37. esac
  38. AC_C_INLINE
  39. case "$ac_cv_c_inline" in
  40. '')
  41. ;;
  42. *)
  43. AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
  44. AC_SUBST(HAVE_INLINE)
  45. esac
  46. # Checks for libraries.
  47. # Checks for header files.
  48. AC_HEADER_STDC
  49. AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h])
  50. # Checks for typedefs, structures, and compiler characteristics.
  51. AC_C_CONST
  52. AC_TYPE_SIZE_T
  53. AC_HEADER_TIME
  54. AC_STRUCT_TM
  55. AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
  56. ac_cv_have_ss_family_in_struct_ss, [
  57. AC_TRY_COMPILE(
  58. [
  59. #include <sys/types.h>
  60. #include <sys/socket.h>
  61. ],
  62. [ struct sockaddr_storage s; s.ss_family = 1; ],
  63. [ ac_cv_have_ss_family_in_struct_ss="yes" ],
  64. [ ac_cv_have_ss_family_in_struct_ss="no" ],
  65. )
  66. ])
  67. case "$ac_cv_have_ss_family_in_struct_ss" in
  68. yes)
  69. AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
  70. ;;
  71. esac
  72. AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
  73. ac_cv_have___ss_family_in_struct_ss, [
  74. AC_TRY_COMPILE(
  75. [
  76. #include <sys/types.h>
  77. #include <sys/socket.h>
  78. ],
  79. [ struct sockaddr_storage s; s.__ss_family = 1; ],
  80. [ ac_cv_have___ss_family_in_struct_ss="yes" ],
  81. [ ac_cv_have___ss_family_in_struct_ss="no" ]
  82. )
  83. ])
  84. case "$ac_cv_have___ss_family_in_struct_ss" in
  85. yes)
  86. AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
  87. ;;
  88. esac
  89. case "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in
  90. noyes)
  91. AC_DEFINE_UNQUOTED([ss_family], [__ss_family], [normalize ss_family access])
  92. AC_DEFINE_UNQUOTED([ss_len], [__ss_len], [normalize ss_len access])
  93. ;;
  94. esac
  95. # Checks for library functions.
  96. #AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother?
  97. AC_FUNC_SETVBUF_REVERSED
  98. AC_TYPE_SIGNAL
  99. AC_CHECK_FUNCS([alarm])
  100. AC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket]))
  101. AC_CHECK_FUNCS([gettimeofday inet_ntoa memset])
  102. AC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket]))
  103. AC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m]))
  104. AC_CHECK_FUNCS([strrchr])
  105. case "$host" in
  106. *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20
  107. case "$GCC" in
  108. yes)
  109. ;;
  110. *) CFLAGS="$CFLAGS -Wp,-H18816"
  111. ;;
  112. esac
  113. ;;
  114. *-*-linux*)
  115. CFLAGS="$CFLAGS -DADJTIME_MISSING"
  116. ;;
  117. *-*-sunos*)
  118. CFLAGS="$CFLAGS -DNONBLOCK_BROKEN"
  119. ;;
  120. esac
  121. AC_MSG_CHECKING(for bin subdirectory)
  122. AC_ARG_WITH(binsubdir,
  123. AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
  124. use_binsubdir="$withval", use_binsubdir="bin")
  125. case "$use_binsubdir" in
  126. bin)
  127. ;;
  128. sbin)
  129. ;;
  130. *)
  131. AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
  132. ;;
  133. esac
  134. AC_MSG_RESULT($use_binsubdir)
  135. BINSUBDIR=$use_binsubdir
  136. AC_SUBST(BINSUBDIR)
  137. AC_CONFIG_FILES([Makefile])
  138. AC_OUTPUT