xref: /freebsd/contrib/ntp/sntp/configure.ac (revision aa0a1e58)
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
15m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
16m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
17
18AC_PROG_LIBTOOL
19
20# NTP has (so far) been relying on leading-edge autogen.
21# Therefore, by default:
22# - use the version we ship with
23# - do not install it
24# - build a static copy (AC_DISABLE_SHARED - done earlier)
25case "${enable_local_libopts+set}" in
26 set) ;;
27 *) enable_local_libopts=yes ;;
28esac
29case "${enable_libopts_install+set}" in
30 set) ;;
31 *) enable_libopts_install=no ;;
32esac
33LIBOPTS_CHECK
34
35AC_MSG_CHECKING([[if $CC can handle #warning]])
36AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no])
37AC_MSG_RESULT([$ac_cv_cpp_warning])
38
39case "$ac_cv_cpp_warning" in
40 no)
41    AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1], [Should we avoid #warning on option name collisions?])
42    AC_MSG_RESULT([[Enabling NO_OPTION_NAME_WARNINGS as #warning does not work]])
43    ;;
44esac
45
46AC_C_INLINE
47
48case "$ac_cv_c_inline" in
49 '')
50    ;;
51 *)
52    AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
53    AC_SUBST(HAVE_INLINE)
54esac
55
56
57# Checks for libraries.
58
59# Checks for header files.
60AC_HEADER_STDC
61AC_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])
62
63# Checks for typedefs, structures, and compiler characteristics.
64AC_C_CONST
65AC_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