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