Annotation of embedaddon/mtr/configure.ac, revision 1.1.1.1
1.1 misho 1: AC_INIT([mtr], [0.85])
2: AC_CONFIG_SRCDIR([mtr.c])
3: AM_INIT_AUTOMAKE([foreign])
4:
5: AC_CONFIG_FILES([version.h.tmp:version.h.in])
6:
7: AC_SUBST(GTK_OBJ)
8: AC_SUBST(CURSES_OBJ)
9:
10: GTK_OBJ=gtk.o
11: CURSES_OBJ=curses.o
12:
13: AC_PROG_CC
14:
15: AC_CHECK_SIZEOF(unsigned char, 1)
16: AC_CHECK_SIZEOF(unsigned short, 2)
17: AC_CHECK_SIZEOF(unsigned int, 4)
18: AC_CHECK_SIZEOF(unsigned long, 4)
19:
20: AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h fcntl.h)
21: AC_CHECK_HEADERS(socket.h sys/socket.h sys/xti.h arpa/nameser_compat.h)
22:
23: # We don't refer to any symbols in termcap, but -lcurses on SunOS does.
24: # We have to trust the linker not to mess things up... (It should not
25: # pull in anything if we don't refer to anything in the lib).
26: AC_CHECK_LIB(termcap, tgetent)
27: AC_CHECK_LIB(tinfo, tgetent)
28:
29: AC_CHECK_FUNC(initscr, ,
30: AC_CHECK_LIB(ncurses, initscr, ,
31: AC_CHECK_LIB(curses, initscr, ,
32: AC_CHECK_LIB(cursesX, initscr, ,
33: AC_MSG_WARN(Building without curses display support)
34: AC_DEFINE(NO_CURSES, 1, Define if you don't have the curses libraries available.)
35: CURSES_OBJ=))))
36:
37: AC_CHECK_FUNCS(attron fcntl)
38:
39: AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found))
40:
41: AC_ARG_WITH(gtk,
42: [ --without-gtk Do not try to use GTK+ at all],
43: WANTS_GTK=$withval, WANTS_GTK=yes)
44:
45: AC_ARG_WITH(glib,
46: [ --without-glib Do not try to use glib at all],
47: WANTS_GLIB=$withval, WANTS_GLIB=yes)
48:
49: AC_ARG_WITH([ipinfo],
50: [ --without-ipinfo Do not try to use ipinfo lookup at all],
51: [case "${withval}" in
52: yes) ipinfo=true ;;
53: no) ipinfo=false ;;
54: *) AC_MSG_ERROR([bad value ${withval} for --with-ipinfo]) ;;
55: esac],[ipinfo=true])
56: AM_CONDITIONAL([IPINFO], [test x$ipinfo = xtrue])
57: if test "x$ipinfo" = "xfalse"; then
58: AC_DEFINE([NO_IPINFO], [1], [Define to disable ipinfo lookup])
59: fi
60:
61: AC_ARG_ENABLE(ipv6,
62: [ --disable-ipv6 Do not enable IPv6],
63: WANTS_IPV6=$enableval, WANTS_IPV6=yes)
64:
65: if test "x$WANTS_GTK" = "xyes"; then
66: AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS"
67: LIBS="$LIBS $GTK_LIBS -lm",
68: AC_MSG_WARN(Building without GTK2 display support)
69: AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.])
70: GTK_OBJ="")
71: else
72: AC_DEFINE(NO_GTK)
73: GTK_OBJ=""
74: if test "x$WANTS_GLIB" = "xyes"; then
75: PKG_CHECK_MODULES([GLIB], [glib-2.0])
76: else
77: AC_DEFINE(NO_GLIB, 1, [Define if you don't have the glib libraries available.])
78: fi
79: fi
80:
81: AC_CHECK_FUNC(socket, ,
82: AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found)))
83:
84: AC_CHECK_FUNC(gethostbyname, ,
85: AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found)))
86:
87: #AC_CHECK_FUNC(res_init, ,
88: # AC_CHECK_LIB(bind, res_init, ,
89: # AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found))))
90:
91: AC_CHECK_FUNCS(seteuid)
92: # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
93:
94: #AC_CHECK_FUNC(res_mkquery, ,
95: # AC_CHECK_LIB(bind, res_mkquery, ,
96: # AC_CHECK_LIB(resolv, res_mkquery, ,
97: # AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
98:
99: # See if a library is needed for res_mkquery and if so put it in RESOLV_LIBS
100: RESOLV_LIBS=
101: AC_SUBST(RESOLV_LIBS)
102: AC_DEFUN([LIBRESOLVTEST_SRC], [
103: AC_LANG_PROGRAM([[
104: #include <netinet/in.h>
105: #include <resolv.h>
106: ]], [[
107: int (*res_mkquery_func)(int,...) = (int (*)(int,...))res_mkquery;
108: (void)(*res_mkquery_func)(0);
109: ]])])
110: AC_MSG_CHECKING([whether library required for res_mkquery])
111: RESOLV_LIB_NONE=
112: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
113: [AC_MSG_RESULT([no])
114: RESOLV_LIB_NONE=yes],
115: [AC_MSG_RESULT([yes])])
116: if test "x$RESOLV_LIB_NONE" = "x"; then
117: AC_MSG_CHECKING([for res_mkquery in -lbind])
118: STASH_LIBS="$LIBS"
119: LIBS="$STASH_LIBS -lbind"
120: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
121: [AC_MSG_RESULT([yes])
122: RESOLV_LIBS=-lbind],
123: [AC_MSG_RESULT([no])])
124: if test "x$RESOLV_LIBS" = "x"; then
125: AC_MSG_CHECKING([for res_mkquery in -lresolv])
126: LIBS="$STASH_LIBS -lresolv"
127: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
128: [AC_MSG_RESULT([yes])
129: RESOLV_LIBS=-lresolv],
130: [AC_MSG_RESULT([no])
131: AC_MSG_ERROR(No resolver library found)])
132: fi
133: LIBS="$STASH_LIBS"
134: fi
135:
136: AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR, 1, [Define if you don't have the herror() function available.]))
137: AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR, 1, [Define if you don't have the strerror() function available.]))
138:
139: USES_IPV6=
140: AC_CHECK_FUNC(getaddrinfo,
141: [if test "$WANTS_IPV6" = "yes"; then
142: AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6])
143: USES_IPV6=yes
144: fi])
145:
146: AC_DEFUN([NEED_RES_STATE_EXT_TEST_SRC], [
147: AC_LANG_PROGRAM([[
148: #include <netinet/in.h>
149: #include <resolv.h>
150: #ifdef __GLIBC__
151: #define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i]))
152: #else
153: #define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6)
154: #endif
155: ]], [[
156: struct __res_state res;
157: return RESEXTIN6(res,0).sin6_addr.s6_addr[0];
158: ]])])
159: AC_DEFUN([DEFINE_RES_STATE_EXT_TEST_SRC], [
160: AC_LANG_PROGRAM([[
161: #include <netinet/in.h>
162: #include <resolv.h>
163: #ifdef __GLIBC__
164: #define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i]))
165: #else
166: #define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6)
167: struct __res_state_ext {
168: union res_sockaddr_union nsaddrs[MAXNS];
169: struct sort_list {
170: int af;
171: union {
172: struct in_addr ina;
173: struct in6_addr in6a;
174: } addr, mask;
175: } sort_list[MAXRESOLVSORT];
176: char nsuffix[64];
177: char nsuffix2[64];
178: };
179: #endif
180: ]], [[
181: struct __res_state res;
182: return RESEXTIN6(res,0).sin6_addr.s6_addr[0];
183: ]])])
184: if test "x$USES_IPV6" = "xyes"; then
185: AC_MSG_CHECKING([whether __res_state_ext needs to be defined])
186: AC_COMPILE_IFELSE([NEED_RES_STATE_EXT_TEST_SRC],
187: [AC_MSG_RESULT([no])],
188: [AC_MSG_RESULT([yes])
189: AC_MSG_CHECKING([whether provided __res_state_ext definition can be compiled])
190: AC_COMPILE_IFELSE([DEFINE_RES_STATE_EXT_TEST_SRC],
191: [AC_MSG_RESULT([yes])
192: AC_DEFINE(NEED_RES_STATE_EXT, 1, [Define if struct __res_state_ext needs to be defined.])],
193: [AC_MSG_RESULT([no])
194: AC_MSG_ERROR(Need definition for struct __res_state_ext but unable to define it.)])])
195: fi
196:
197: AC_CHECK_DECLS(errno, , , [[
198: #include <errno.h>
199: #include <sys/errno.h>
200: ]] )
201:
202: AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[
203: #include <netinet/in.h>
204: #ifdef HAVE_SOCKET_H
205: #include <socket.h>
206: #endif
207: #ifdef HAVE_SYS_SOCKET_H
208: #include <sys/socket.h>
209: #endif
210: ]])
211:
212: AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[
213: #include <netinet/in.h>
214: ]])
215:
216: dnl Add C flags to display more warnings
217: AC_MSG_CHECKING(for C flags to get more warnings)
218: ac_save_CFLAGS="$CFLAGS"
219: if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
220: dnl gcc is the easiest C compiler
221: warning_CFLAGS="-Wall"
222: # Check if compiler supports -Wno-pointer-sign and add it if supports
223: CFLAGS_saved="$CFLAGS"
224: CFLAGS="$CFLAGS -Wno-pointer-sign"
225: AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ int foo; ]])],
226: [ warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" ],)
227: CFLAGS="$CFLAGS_saved"
228: else
229: dnl Vendor supplied C compilers are a bit tricky
230: case "$host_os" in
231: dnl SGI IRIX with the MipsPRO C compiler
232: irix*)
233: CFLAGS="$CFLAGS -fullwarn"
234: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-fullwarn"],[])
235: ;;
236:
237: dnl SunOS 4.x with the SparcWorks(?) acc compiler
238: sunos*)
239: if "$CC" = "acc" ; then
240: CFLAGS="$CFLAGS -vc"
241: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-vc"],[])
242: fi
243: ;;
244:
245: dnl Unknown, do nothing
246: *)
247: warning_CFLAGS="none"
248: ;;
249: esac
250: fi
251: CFLAGS="$ac_save_CFLAGS"
252: if test "$warning_CFLAGS" = "none" ; then
253: AC_MSG_RESULT(none)
254: else
255: CFLAGS="$CFLAGS $warning_CFLAGS"
256: AC_MSG_RESULT($warning_CFLAGS)
257: fi
258:
259:
260:
261:
262: AC_CONFIG_HEADERS([config.h])
263: AC_CONFIG_FILES([Makefile img/Makefile])
264: AC_OUTPUT
265:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>