configure.ac revision 200576
11849Swollman# Process this file with autoconf to produce a configure script. 21849SwollmanAC_INIT(main.c) 31849SwollmanAM_INIT_AUTOMAKE([msntp],[1.6]) 41849SwollmanAC_CONFIG_SRCDIR([header.h]) 51849SwollmanAC_CANONICAL_HOST 61849SwollmanAM_CONFIG_HEADER(config.h) 71849Swollman 81849Swollman# Checks for programs. 91849SwollmanAC_PROG_CC 101849Swollman 111849Swollman# So far, the only shared library we might use is libopts. 121849Swollman# It's a small library - we might as well use a static version of it. 131849SwollmanAC_DISABLE_SHARED 141849Swollman 151849Swollmanm4_defun([_LT_AC_LANG_CXX_CONFIG], [:]) 161849Swollmanm4_defun([_LT_AC_LANG_F77_CONFIG], [:]) 171849Swollman 181849SwollmanAC_PROG_LIBTOOL 191849Swollman 201849Swollman# NTP has (so far) been relying on leading-edge autogen. 211849Swollman# Therefore, by default: 221849Swollman# - use the version we ship with 231849Swollman# - do not install it 241849Swollman# - build a static copy (AC_DISABLE_SHARED - done earlier) 251849Swollmancase "${enable_local_libopts+set}" in 261849Swollman set) ;; 271849Swollman *) enable_local_libopts=yes ;; 281849Swollmanesac 291849Swollmancase "${enable_libopts_install+set}" in 301849Swollman set) ;; 3185437Speter *) enable_libopts_install=no ;; 3293000Sobrienesac 331849SwollmanLIBOPTS_CHECK 341849Swollman 351849SwollmanAC_MSG_CHECKING([[if $CC can handle #warning]]) 361849SwollmanAC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no]) 371849SwollmanAC_MSG_RESULT([$ac_cv_cpp_warning]) 381849Swollman 391849Swollmancase "$ac_cv_cpp_warning" in 401849Swollman no) 411849Swollman AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid #warning on option name collisions?]) 421849Swollman AC_MSG_RESULT([[Enabling NO_OPTION_NAME_WARNINGS as #warning does not work]]) 431849Swollman ;; 441849Swollmanesac 451849Swollman 461849SwollmanAC_C_INLINE 471849Swollman 481849Swollmancase "$ac_cv_c_inline" in 491849Swollman '') 501849Swollman ;; 511849Swollman *) 525243Sbde AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available]) 535243Sbde AC_SUBST(HAVE_INLINE) 541849Swollmanesac 551849Swollman 561849Swollman 571849Swollman# Checks for libraries. 581849Swollman 591849Swollman# Checks for header files. 601849SwollmanAC_HEADER_STDC 611849SwollmanAC_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]) 621849Swollman 631849Swollman# Checks for typedefs, structures, and compiler characteristics. 641849SwollmanAC_C_CONST 651849SwollmanAC_TYPE_SIZE_T 661849SwollmanAC_HEADER_TIME 671849SwollmanAC_STRUCT_TM 681849Swollman 691849SwollmanAC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], 701849Swollman ac_cv_have_ss_family_in_struct_ss, [ 711849Swollman AC_TRY_COMPILE( 721849Swollman [ 731849Swollman#include <sys/types.h> 741849Swollman#include <sys/socket.h> 755243Sbde ], 765243Sbde [ struct sockaddr_storage s; s.ss_family = 1; ], 775243Sbde [ ac_cv_have_ss_family_in_struct_ss="yes" ], 785243Sbde [ ac_cv_have_ss_family_in_struct_ss="no" ], 795243Sbde ) 805243Sbde]) 815243Sbdecase "$ac_cv_have_ss_family_in_struct_ss" in 825243Sbde yes) 835243Sbde AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?]) 845243Sbde ;; 855243Sbdeesac 865243Sbde 871849SwollmanAC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], 881849Swollman ac_cv_have___ss_family_in_struct_ss, [ 891849Swollman AC_TRY_COMPILE( 901849Swollman [ 911849Swollman#include <sys/types.h> 921849Swollman#include <sys/socket.h> 931849Swollman ], 941849Swollman [ struct sockaddr_storage s; s.__ss_family = 1; ], 951849Swollman [ ac_cv_have___ss_family_in_struct_ss="yes" ], 961849Swollman [ ac_cv_have___ss_family_in_struct_ss="no" ] 971849Swollman ) 981849Swollman]) 991849Swollmancase "$ac_cv_have___ss_family_in_struct_ss" in 1001849Swollman yes) 1011849Swollman AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?]) 1021849Swollman ;; 1031849Swollmanesac 1041849Swollman 1051849Swollmancase "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in 1061849Swollman noyes) 1071849Swollman AC_DEFINE_UNQUOTED([ss_family], [__ss_family], [normalize ss_family access]) 1081849Swollman AC_DEFINE_UNQUOTED([ss_len], [__ss_len], [normalize ss_len access]) 1091849Swollman ;; 1101849Swollmanesac 1111849Swollman 1121849Swollman# Checks for library functions. 1131849Swollman#AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother? 1141849SwollmanAC_FUNC_SETVBUF_REVERSED 1151849SwollmanAC_TYPE_SIGNAL 1161849SwollmanAC_CHECK_FUNCS([alarm]) 1171849SwollmanAC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket])) 1181849SwollmanAC_CHECK_FUNCS([gettimeofday inet_ntoa memset]) 1191849SwollmanAC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket])) 1201849SwollmanAC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m])) 1211849SwollmanAC_CHECK_FUNCS([strrchr]) 1221849Swollman 1231849Swollmancase "$host" in 1241849Swollman *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20 1251849Swollman case "$GCC" in 1261849Swollman yes) 1271849Swollman ;; 1281849Swollman *) CFLAGS="$CFLAGS -Wp,-H18816" 1291849Swollman ;; 1301849Swollman esac 1311849Swollman ;; 1321849Swollman *-*-linux*) 1331849Swollman CFLAGS="$CFLAGS -DADJTIME_MISSING" 1341849Swollman ;; 1351849Swollman *-*-sunos*) 1361849Swollman CFLAGS="$CFLAGS -DNONBLOCK_BROKEN" 1371849Swollman ;; 1381849Swollmanesac 1391849Swollman 1401849SwollmanAC_MSG_CHECKING(for bin subdirectory) 1411849SwollmanAC_ARG_WITH(binsubdir, 1421849Swollman AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]), 1431849Swollman use_binsubdir="$withval", use_binsubdir="bin") 1441849Swollman 1451849Swollmancase "$use_binsubdir" in 1461849Swollman bin) 1471849Swollman ;; 1481849Swollman sbin) 1491849Swollman ;; 1501849Swollman *) 1511849Swollman AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"]) 1521849Swollman ;; 1531849Swollmanesac 1541849SwollmanAC_MSG_RESULT($use_binsubdir) 1551849SwollmanBINSUBDIR=$use_binsubdir 1561849SwollmanAC_SUBST(BINSUBDIR) 1571849Swollman 1585243SbdeAC_CONFIG_FILES([Makefile]) 1591849SwollmanAC_OUTPUT 1601849Swollman