1: AC_PREREQ([2.59])
2: AC_INIT([mtr],
3: [m4_esyscmd([build-aux/git-version-gen .tarball-version])],
4: [R.E.Wolff@BitWizard.nl], [],
5: [http://www.BitWizard.nl/mtr/])
6: AC_CONFIG_SRCDIR([ui/mtr.c])
7: AC_CONFIG_AUX_DIR([build-aux])
8: AC_USE_SYSTEM_EXTENSIONS
9: AM_INIT_AUTOMAKE([
10: 1.7.9
11: foreign
12: subdir-objects
13: ])
14:
15: # --enable-silent-rules
16: m4_ifdef([AM_SILENT_RULES],
17: [AM_SILENT_RULES([yes])],
18: [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
19:
20: AC_CANONICAL_HOST
21: AC_PROG_CC
22:
23: # Check pkg-config availability.
24: m4_ifndef([PKG_PROG_PKG_CONFIG],
25: [m4_fatal(
26: [Could not locate the pkg-config autoconf macros. These are usually located
27: in /usr/share/aclocal/pkg.m4. If your macros are in a different location,
28: try setting the environment variable ACLOCAL_OPTS="-I/other/macro/dir"
29: before running ./bootstrap.sh again.])
30: ])
31: PKG_PROG_PKG_CONFIG
32:
33: AM_CONDITIONAL([CYGWIN], [test "$host_os" = cygwin])
34:
35: # Check bytes in types.
36: AC_CHECK_SIZEOF([unsigned char], [1])
37: AC_CHECK_SIZEOF([unsigned short], [2])
38: AC_CHECK_SIZEOF([unsigned int], [4])
39: AC_CHECK_SIZEOF([unsigned long], [4])
40:
41: # Check headers.
42: AC_CHECK_HEADERS([ \
43: arpa/nameser_compat.h \
44: curses.h \
45: cursesX.h \
46: error.h \
47: fcntl.h \
48: linux/icmp.h \
49: ncurses.h \
50: ncurses/curses.h \
51: netinet/in.h \
52: socket.h \
53: sys/cdefs.h \
54: sys/limits.h \
55: sys/socket.h \
56: stdio_ext.h \
57: sys/types.h \
58: sys/xti.h \
59: values.h \
60: ])
61:
62: # Check functions.
63: AC_CHECK_FUNCS([ \
64: __fpending \
65: fcntl \
66: ])
67:
68: AC_CHECK_FUNC([error], [with_error=no],
69: [AC_CHECK_FUNCS([verr verrx vwarn vwarnx], [with_error=yes],
70: [AC_MSG_ERROR([cannot find working error printing function])
71: ])
72: ])
73: AM_CONDITIONAL([WITH_ERROR], [test "x$with_error" = "xyes"])
74:
75: AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes])
76: AS_IF([test "x$with_getopt" = "xno"], [
77: AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long])
78: ])
79: AM_CONDITIONAL([WITH_GETOPT], [test "x$with_getopt" = "xyes"])
80:
81: AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([No math library found])])
82:
83: # Find GTK
84: AC_ARG_WITH([gtk],
85: [AS_HELP_STRING([--without-gtk], [Build without the GTK+2.0 interface])],
86: [], [with_gtk=yes])
87: AS_IF([test "x$with_gtk" = "xyes"],
88: [PKG_CHECK_MODULES([GTK], [gtk+-2.0],
89: [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+-2.0 library available])],
90: [with_gtk=no])
91: ])
92: AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes])
93:
94: # Find ncurses
95: AC_ARG_WITH([ncurses],
96: [AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])],
97: [], [with_ncurses=yes])
98: AS_IF([test "x$with_ncurses" = "xyes"],
99:
100: # Prefer ncurses over curses, if both are available.
101: # (On Solaris 11.3, ncurses builds and links for us, but curses does not.)
102: [AC_SEARCH_LIBS(
103: [initscr], [ncurses curses],
104: [AC_DEFINE([HAVE_CURSES], [1], [Define if a curses library available])],
105: [with_ncurses=no])
106: ])
107: AM_CONDITIONAL([WITH_CURSES], [test "x$with_ncurses" = xyes])
108:
109: AC_CHECK_LIB([cap], [cap_set_proc], [],
110: AS_IF([test "$host_os" = linux-gnu],
111: AC_MSG_WARN([Capabilities support is strongly recommended for increased security. See SECURITY for more information.])))
112:
113: # Enable ipinfo
114: AC_ARG_WITH([ipinfo],
115: [AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])],
116: [], [with_ipinfo=yes])
117: AM_CONDITIONAL([WITH_IPINFO], [test "x$with_ipinfo" = "xyes"])
118: AS_IF([test "x$with_ipinfo" = "xyes"], [
119: AC_DEFINE([HAVE_IPINFO], [1], [Define when ipinfo lookups are in use])
120: ])
121:
122: AC_ARG_ENABLE([ipv6],
123: [AS_HELP_STRING([--disable-ipv6], [Do not enable IPv6])],
124: [WANTS_IPV6=$enableval], [WANTS_IPV6=yes])
125:
126: AS_IF([test "x$WANTS_IPV6" = "xyes"], [
127: AC_DEFINE([ENABLE_IPV6], [1], [Define to enable IPv6])
128: USES_IPV6=yes
129: ])
130:
131: AC_CHECK_FUNC([socket], [],
132: [AC_CHECK_LIB([socket], [socket], [], [AC_MSG_ERROR([No socket library found])])])
133:
134: AC_CHECK_FUNC([gethostbyname], [],
135: [AC_CHECK_LIB([nsl], [gethostbyname], [], [AC_MSG_ERROR([No nameservice library found])])])
136:
137: # Find resolver library.
138: AC_CHECK_FUNC([res_query], [RESOLV_LIBS=""], [
139: AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"], [
140: AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"], [
141: AC_CHECK_LIB([bind], [res_query], [RESOLV_LIBS="-lbind"], [
142: AC_MSG_ERROR([No resolver library found])
143: ])
144: ])
145: ])
146: ])
147: dnl MacOS has res_query in libc, but needs libresolv for dn_expand().
148: AS_IF([test "x" = "x$RESOLV_LIBS"], [
149: AC_CHECK_LIB([resolv], [dn_expand], [RESOLV_LIBS="-lresolv"])
150: ])
151: AC_SUBST([RESOLV_LIBS])
152:
153: # Check errno and socket data types.
154: AC_CHECK_DECLS([errno], [], [], [[
155: #include <errno.h>
156: #include <sys/errno.h>
157: ]])
158:
159: AC_CHECK_TYPE([socklen_t],
160: [AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [],
161: [[#include <netinet/in.h>
162: #ifdef HAVE_SOCKET_H
163: #include <socket.h>
164: #endif
165: #ifdef HAVE_SYS_SOCKET_H
166: #include <sys/socket.h>
167: #endif]])
168:
169: AC_CHECK_TYPES([time_t], [], [], [[
170: #include <time.h>
171: ]])
172:
173: # Add C flags to display more warnings
174: AC_MSG_CHECKING([for C flags to get more warnings])
175: ac_save_CFLAGS="$CFLAGS"
176:
177: AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
178: dnl gcc is the easiest C compiler
179: warning_CFLAGS="-Wall"
180: # Check if compiler supports -Wno-pointer-sign and add it if supports
181: CFLAGS_saved="$CFLAGS"
182: CFLAGS="$CFLAGS -Wno-pointer-sign"
183: AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo;]])],
184: [warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign"], [])
185: CFLAGS="$CFLAGS_saved"
186: ], [
187: dnl Vendor supplied C compilers are a bit tricky
188: AS_CASE([$host_os],
189: dnl SGI IRIX with the MipsPRO C compiler
190: [irix*], [
191: CFLAGS="$CFLAGS -fullwarn"
192: AC_COMPILE_IFELSE([
193: AC_LANG_PROGRAM(
194: [[#include <stdio.h>]],
195: [[printf("test");]])],
196: [warning_CFLAGS="-fullwarn"], []
197: )
198: ],
199: dnl SunOS 4.x with the SparcWorks(?) acc compiler
200: [sunos*], [
201: AS_IF([test "$CC" = "acc"], [
202: CFLAGS="$CFLAGS -vc"
203: AC_COMPILE_IFELSE([
204: AC_LANG_PROGRAM(
205: [[#include <stdio.h>]],
206: [[printf("test");]])],
207: [warning_CFLAGS="-vc"], []
208: )
209: ])
210: ]
211: dnl Unknown, do nothing
212: [*], [
213: warning_CFLAGS="none"
214: ]
215: )
216: ])
217: CFLAGS="$ac_save_CFLAGS"
218:
219: AS_IF([test "$warning_CFLAGS" = "none"], [
220: AC_MSG_RESULT([none])
221: ], [
222: CFLAGS="$CFLAGS $warning_CFLAGS"
223: AC_MSG_RESULT([$warning_CFLAGS])
224: ])
225:
226: # bash-completion
227: AC_ARG_WITH([bashcompletiondir],
228: AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
229: [],
230: [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
231: with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
232: ], [
233: with_bashcompletiondir=${datadir}/bash-completion/completions
234: ])
235: ])
236: AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
237: AC_ARG_ENABLE([bash-completion],
238: AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
239: [], [enable_bash_completion=yes]
240: )
241: AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
242:
243: # Prepare config.h, Makefile, and output them.
244: AC_CONFIG_HEADERS([config.h])
245: AC_CONFIG_FILES([Makefile])
246: AC_OUTPUT
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>