]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/ntp/sntp/configure.ac
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / ntp / sntp / configure.ac
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
8 # Checks for programs.
9 AC_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.
13 AC_DISABLE_SHARED
14
15 AC_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)
22 case "${enable_local_libopts+set}" in
23  set) ;;
24  *) enable_local_libopts=yes ;;
25 esac
26 case "${enable_libopts_install+set}" in
27  set) ;;
28  *) enable_libopts_install=no ;;
29 esac
30 LIBOPTS_CHECK
31
32 AC_MSG_CHECKING([[if $CC can handle #warning]])
33 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no])
34 AC_MSG_RESULT([$ac_cv_cpp_warning])
35
36 case "$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     ;;
41 esac
42
43 # Checks for libraries.
44
45 # Checks for header files.
46 AC_HEADER_STDC
47 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])
48
49 # Checks for typedefs, structures, and compiler characteristics.
50 AC_C_CONST
51 AC_TYPE_SIZE_T
52 AC_HEADER_TIME
53 AC_STRUCT_TM
54
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
73 AC_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 ])
85 case "$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     ;;
89 esac
90
91 case "$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     ;;
96 esac
97
98 # Checks for library functions.
99 AC_FUNC_MEMCMP
100 AC_FUNC_SETVBUF_REVERSED
101 AC_TYPE_SIGNAL
102 AC_CHECK_FUNCS([alarm])
103 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent, , , -lsocket))
104 AC_CHECK_FUNCS([gettimeofday inet_ntoa memset])
105 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
106 AC_CHECK_FUNCS(sqrt, , AC_CHECK_LIB(m, sqrt))
107 AC_CHECK_FUNCS([strrchr])
108
109 case "$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     ;;
124 esac
125
126 AC_MSG_CHECKING(for bin subdirectory)
127 AC_ARG_WITH(binsubdir,
128         AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
129         use_binsubdir="$withval", use_binsubdir="bin")
130
131 case "$use_binsubdir" in
132  bin)
133     ;;
134  sbin)
135     ;;
136  *)
137     AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
138     ;;
139 esac
140 AC_MSG_RESULT($use_binsubdir)
141 BINSUBDIR=$use_binsubdir
142 AC_SUBST(BINSUBDIR)
143
144 AC_CONFIG_FILES([Makefile])
145 AC_OUTPUT