configure.ac revision 256281
11313Ssundar# Process this file with autoconf to produce a configure script. 21313SsundarAC_INIT(main.c) 31313SsundarAM_INIT_AUTOMAKE([msntp],[1.6]) 41313SsundarAC_CONFIG_SRCDIR([header.h]) 51313SsundarAC_CANONICAL_HOST 61313SsundarAM_CONFIG_HEADER(config.h) 71313Ssundar 81313Ssundar# Checks for programs. 91313SsundarAC_PROG_CC 101313Ssundar 111313Ssundar# So far, the only shared library we might use is libopts. 121313Ssundar# It's a small library - we might as well use a static version of it. 131313SsundarAC_DISABLE_SHARED 141313Ssundar 151313Ssundarm4_defun([_LT_AC_LANG_CXX_CONFIG], [:]) 161313Ssundarm4_defun([_LT_AC_LANG_F77_CONFIG], [:]) 171313Ssundar 181313SsundarAC_PROG_LIBTOOL 191313Ssundar 201313Ssundar# NTP has (so far) been relying on leading-edge autogen. 211313Ssundar# Therefore, by default: 221313Ssundar# - use the version we ship with 231313Ssundar# - do not install it 241313Ssundar# - build a static copy (AC_DISABLE_SHARED - done earlier) 251313Ssundarcase "${enable_local_libopts+set}" in 261313Ssundar set) ;; 271313Ssundar *) enable_local_libopts=yes ;; 281313Ssundaresac 291313Ssundarcase "${enable_libopts_install+set}" in 301313Ssundar set) ;; 311313Ssundar *) enable_libopts_install=no ;; 321313Ssundaresac 331313SsundarLIBOPTS_CHECK 341313Ssundar 351313SsundarAC_MSG_CHECKING([[if $CC can handle #warning]]) 361313SsundarAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no]) 371313SsundarAC_MSG_RESULT([$ac_cv_cpp_warning]) 381313Ssundar 391313Ssundarcase "$ac_cv_cpp_warning" in 401313Ssundar no) 411313Ssundar AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid #warning on option name collisions?]) 421313Ssundar AC_MSG_RESULT([[Enabling NO_OPTION_NAME_WARNINGS as #warning does not work]]) 431313Ssundar ;; 441313Ssundaresac 451313Ssundar 461313SsundarAC_C_INLINE 471313Ssundar 481313Ssundarcase "$ac_cv_c_inline" in 491313Ssundar '') 501313Ssundar ;; 511313Ssundar *) 521313Ssundar AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available]) 531313Ssundar AC_SUBST(HAVE_INLINE) 541313Ssundaresac 551313Ssundar 561313Ssundar 571313Ssundar# Checks for libraries. 581313Ssundar 591313Ssundar# Checks for header files. 601313SsundarAC_HEADER_STDC 611313SsundarAC_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]) 621313Ssundar 631313Ssundar# Checks for typedefs, structures, and compiler characteristics. 641313SsundarAC_C_CONST 651313SsundarAC_TYPE_SIZE_T 66AC_HEADER_TIME 67AC_STRUCT_TM 68 69AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], 70 ac_cv_have_ss_family_in_struct_ss, [ 71 AC_TRY_COMPILE( 72 [ 73#include <sys/types.h> 74#include <sys/socket.h> 75 ], 76 [ struct sockaddr_storage s; s.ss_family = 1; ], 77 [ ac_cv_have_ss_family_in_struct_ss="yes" ], 78 [ ac_cv_have_ss_family_in_struct_ss="no" ], 79 ) 80]) 81case "$ac_cv_have_ss_family_in_struct_ss" in 82 yes) 83 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?]) 84 ;; 85esac 86 87AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], 88 ac_cv_have___ss_family_in_struct_ss, [ 89 AC_TRY_COMPILE( 90 [ 91#include <sys/types.h> 92#include <sys/socket.h> 93 ], 94 [ struct sockaddr_storage s; s.__ss_family = 1; ], 95 [ ac_cv_have___ss_family_in_struct_ss="yes" ], 96 [ ac_cv_have___ss_family_in_struct_ss="no" ] 97 ) 98]) 99case "$ac_cv_have___ss_family_in_struct_ss" in 100 yes) 101 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?]) 102 ;; 103esac 104 105case "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in 106 noyes) 107 AC_DEFINE_UNQUOTED([ss_family], [__ss_family], [normalize ss_family access]) 108 AC_DEFINE_UNQUOTED([ss_len], [__ss_len], [normalize ss_len access]) 109 ;; 110esac 111 112# Checks for library functions. 113#AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother? 114AC_FUNC_SETVBUF_REVERSED 115AC_TYPE_SIGNAL 116AC_CHECK_FUNCS([alarm]) 117AC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket])) 118AC_CHECK_FUNCS([gettimeofday inet_ntoa memset]) 119AC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket])) 120AC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m])) 121AC_CHECK_FUNCS([strrchr]) 122 123case "$host" in 124 *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20 125 case "$GCC" in 126 yes) 127 ;; 128 *) CFLAGS="$CFLAGS -Wp,-H18816" 129 ;; 130 esac 131 ;; 132 *-*-linux*) 133 CFLAGS="$CFLAGS -DADJTIME_MISSING" 134 ;; 135 *-*-sunos*) 136 CFLAGS="$CFLAGS -DNONBLOCK_BROKEN" 137 ;; 138esac 139 140AC_MSG_CHECKING(for bin subdirectory) 141AC_ARG_WITH(binsubdir, 142 AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]), 143 use_binsubdir="$withval", use_binsubdir="bin") 144 145case "$use_binsubdir" in 146 bin) 147 ;; 148 sbin) 149 ;; 150 *) 151 AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"]) 152 ;; 153esac 154AC_MSG_RESULT($use_binsubdir) 155BINSUBDIR=$use_binsubdir 156AC_SUBST(BINSUBDIR) 157 158AC_CONFIG_FILES([Makefile]) 159AC_OUTPUT 160