]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ntp/sntp/configure.ac
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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 m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
16 m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
17
18 AC_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)
25 case "${enable_local_libopts+set}" in
26  set) ;;
27  *) enable_local_libopts=yes ;;
28 esac
29 case "${enable_libopts_install+set}" in
30  set) ;;
31  *) enable_libopts_install=no ;;
32 esac
33 LIBOPTS_CHECK
34
35 AC_MSG_CHECKING([[if $CC can handle #warning]])
36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#warning foo]])],[ac_cv_cpp_warning=yes],[ac_cv_cpp_warning=no])
37 AC_MSG_RESULT([$ac_cv_cpp_warning])
38
39 case "$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     ;;
44 esac
45
46 AC_C_INLINE
47
48 case "$ac_cv_c_inline" in
49  '')
50     ;;
51  *)
52     AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
53     AC_SUBST(HAVE_INLINE)
54 esac
55
56
57 # Checks for libraries.
58
59 # Checks for header files.
60 AC_HEADER_STDC
61 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])
62
63 # Checks for typedefs, structures, and compiler characteristics.
64 AC_C_CONST
65 AC_TYPE_SIZE_T
66 AC_HEADER_TIME
67 AC_STRUCT_TM
68
69 AC_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 ])
81 case "$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     ;;
85 esac
86
87 AC_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 ])
99 case "$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     ;;
103 esac
104
105 case "$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     ;;
110 esac
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?
114 AC_FUNC_SETVBUF_REVERSED
115 AC_TYPE_SIGNAL
116 AC_CHECK_FUNCS([alarm])
117 AC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket]))
118 AC_CHECK_FUNCS([gettimeofday inet_ntoa memset])
119 AC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket]))
120 AC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m]))
121 AC_CHECK_FUNCS([strrchr])
122
123 case "$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     ;;
138 esac
139
140 AC_MSG_CHECKING(for bin subdirectory)
141 AC_ARG_WITH(binsubdir,
142         AC_HELP_STRING([--with-binsubdir], [bin ={bin,sbin}]),
143         use_binsubdir="$withval", use_binsubdir="bin")
144
145 case "$use_binsubdir" in
146  bin)
147     ;;
148  sbin)
149     ;;
150  *)
151     AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
152     ;;
153 esac
154 AC_MSG_RESULT($use_binsubdir)
155 BINSUBDIR=$use_binsubdir
156 AC_SUBST(BINSUBDIR)
157
158 AC_CONFIG_FILES([Makefile])
159 AC_OUTPUT