Annotation of embedaddon/mtr/configure.ac, revision 1.1.1.2
1.1.1.2 ! misho 1: AC_INIT([mtr], [0.86])
1.1 misho 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([ipinfo],
46: [ --without-ipinfo Do not try to use ipinfo lookup at all],
1.1.1.2 ! misho 47: [ipinfo="${withval}"], [ipinfo=yes])
! 48: AM_CONDITIONAL([IPINFO], [test x$ipinfo = xyes])
1.1 misho 49:
50: AC_ARG_ENABLE(ipv6,
51: [ --disable-ipv6 Do not enable IPv6],
52: WANTS_IPV6=$enableval, WANTS_IPV6=yes)
1.1.1.2 ! misho 53:
! 54: m4_ifndef([AM_PATH_GTK_2_0], [m4_defun([AM_PATH_GTK_2_0], [AC_MSG_ERROR([
! 55: Could not locate the gtk2 automake macros, these are usually located in
! 56: .../share/aclocal/gtk-2.0.m4
! 57: Before running bootstrap try setting the environment variable
! 58: ACLOCAL_PATH="/own/dir"
! 59: or configure --without-gtk.
! 60: ])])])
1.1 misho 61:
62: if test "x$WANTS_GTK" = "xyes"; then
63: AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS"
64: LIBS="$LIBS $GTK_LIBS -lm",
65: AC_MSG_WARN(Building without GTK2 display support)
66: AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.])
67: GTK_OBJ="")
68: else
69: AC_DEFINE(NO_GTK)
70: GTK_OBJ=""
1.1.1.2 ! misho 71: fi
! 72:
! 73: if test "x$ipinfo" = "xno"; then
! 74: AC_DEFINE([NO_IPINFO], [1], [Define to disable ipinfo lookup])
1.1 misho 75: fi
76:
77: AC_CHECK_FUNC(socket, ,
78: AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found)))
79:
80: AC_CHECK_FUNC(gethostbyname, ,
81: AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found)))
82:
83: #AC_CHECK_FUNC(res_init, ,
84: # AC_CHECK_LIB(bind, res_init, ,
85: # AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found))))
86:
87: AC_CHECK_FUNCS(seteuid)
88: # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
89:
90: #AC_CHECK_FUNC(res_mkquery, ,
91: # AC_CHECK_LIB(bind, res_mkquery, ,
92: # AC_CHECK_LIB(resolv, res_mkquery, ,
93: # AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
94:
95: # See if a library is needed for res_mkquery and if so put it in RESOLV_LIBS
96: RESOLV_LIBS=
97: AC_SUBST(RESOLV_LIBS)
98: AC_DEFUN([LIBRESOLVTEST_SRC], [
99: AC_LANG_PROGRAM([[
100: #include <netinet/in.h>
101: #include <resolv.h>
102: ]], [[
103: int (*res_mkquery_func)(int,...) = (int (*)(int,...))res_mkquery;
104: (void)(*res_mkquery_func)(0);
105: ]])])
106: AC_MSG_CHECKING([whether library required for res_mkquery])
107: RESOLV_LIB_NONE=
108: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
109: [AC_MSG_RESULT([no])
110: RESOLV_LIB_NONE=yes],
111: [AC_MSG_RESULT([yes])])
112: if test "x$RESOLV_LIB_NONE" = "x"; then
113: AC_MSG_CHECKING([for res_mkquery in -lbind])
114: STASH_LIBS="$LIBS"
115: LIBS="$STASH_LIBS -lbind"
116: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
117: [AC_MSG_RESULT([yes])
118: RESOLV_LIBS=-lbind],
119: [AC_MSG_RESULT([no])])
120: if test "x$RESOLV_LIBS" = "x"; then
121: AC_MSG_CHECKING([for res_mkquery in -lresolv])
122: LIBS="$STASH_LIBS -lresolv"
123: AC_LINK_IFELSE([LIBRESOLVTEST_SRC],
124: [AC_MSG_RESULT([yes])
125: RESOLV_LIBS=-lresolv],
126: [AC_MSG_RESULT([no])
127: AC_MSG_ERROR(No resolver library found)])
128: fi
129: LIBS="$STASH_LIBS"
130: fi
131:
132: AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR, 1, [Define if you don't have the herror() function available.]))
133: AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR, 1, [Define if you don't have the strerror() function available.]))
134:
135: USES_IPV6=
136: AC_CHECK_FUNC(getaddrinfo,
137: [if test "$WANTS_IPV6" = "yes"; then
138: AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6])
139: USES_IPV6=yes
140: fi])
141:
142: AC_DEFUN([NEED_RES_STATE_EXT_TEST_SRC], [
143: AC_LANG_PROGRAM([[
144: #include <netinet/in.h>
145: #include <resolv.h>
146: #ifdef __GLIBC__
147: #define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i]))
148: #else
149: #define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6)
150: #endif
151: ]], [[
152: struct __res_state res;
153: return RESEXTIN6(res,0).sin6_addr.s6_addr[0];
154: ]])])
155: AC_DEFUN([DEFINE_RES_STATE_EXT_TEST_SRC], [
156: AC_LANG_PROGRAM([[
157: #include <netinet/in.h>
158: #include <resolv.h>
159: #ifdef __GLIBC__
160: #define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i]))
161: #else
162: #define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6)
163: struct __res_state_ext {
164: union res_sockaddr_union nsaddrs[MAXNS];
165: struct sort_list {
166: int af;
167: union {
168: struct in_addr ina;
169: struct in6_addr in6a;
170: } addr, mask;
171: } sort_list[MAXRESOLVSORT];
172: char nsuffix[64];
173: char nsuffix2[64];
174: };
175: #endif
176: ]], [[
177: struct __res_state res;
178: return RESEXTIN6(res,0).sin6_addr.s6_addr[0];
179: ]])])
180: if test "x$USES_IPV6" = "xyes"; then
181: AC_MSG_CHECKING([whether __res_state_ext needs to be defined])
182: AC_COMPILE_IFELSE([NEED_RES_STATE_EXT_TEST_SRC],
183: [AC_MSG_RESULT([no])],
184: [AC_MSG_RESULT([yes])
185: AC_MSG_CHECKING([whether provided __res_state_ext definition can be compiled])
186: AC_COMPILE_IFELSE([DEFINE_RES_STATE_EXT_TEST_SRC],
187: [AC_MSG_RESULT([yes])
188: AC_DEFINE(NEED_RES_STATE_EXT, 1, [Define if struct __res_state_ext needs to be defined.])],
189: [AC_MSG_RESULT([no])
190: AC_MSG_ERROR(Need definition for struct __res_state_ext but unable to define it.)])])
191: fi
192:
193: AC_CHECK_DECLS(errno, , , [[
194: #include <errno.h>
195: #include <sys/errno.h>
196: ]] )
197:
198: AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[
199: #include <netinet/in.h>
200: #ifdef HAVE_SOCKET_H
201: #include <socket.h>
202: #endif
203: #ifdef HAVE_SYS_SOCKET_H
204: #include <sys/socket.h>
205: #endif
206: ]])
207:
208: AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[
209: #include <netinet/in.h>
210: ]])
211:
212: dnl Add C flags to display more warnings
213: AC_MSG_CHECKING(for C flags to get more warnings)
214: ac_save_CFLAGS="$CFLAGS"
215: if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
216: dnl gcc is the easiest C compiler
217: warning_CFLAGS="-Wall"
218: # Check if compiler supports -Wno-pointer-sign and add it if supports
219: CFLAGS_saved="$CFLAGS"
220: CFLAGS="$CFLAGS -Wno-pointer-sign"
221: AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ int foo; ]])],
222: [ warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" ],)
223: CFLAGS="$CFLAGS_saved"
224: else
225: dnl Vendor supplied C compilers are a bit tricky
226: case "$host_os" in
227: dnl SGI IRIX with the MipsPRO C compiler
228: irix*)
229: CFLAGS="$CFLAGS -fullwarn"
230: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-fullwarn"],[])
231: ;;
232:
233: dnl SunOS 4.x with the SparcWorks(?) acc compiler
234: sunos*)
235: if "$CC" = "acc" ; then
236: CFLAGS="$CFLAGS -vc"
237: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-vc"],[])
238: fi
239: ;;
240:
241: dnl Unknown, do nothing
242: *)
243: warning_CFLAGS="none"
244: ;;
245: esac
246: fi
247: CFLAGS="$ac_save_CFLAGS"
248: if test "$warning_CFLAGS" = "none" ; then
249: AC_MSG_RESULT(none)
250: else
251: CFLAGS="$CFLAGS $warning_CFLAGS"
252: AC_MSG_RESULT($warning_CFLAGS)
253: fi
254:
255:
256:
257:
258: AC_CONFIG_HEADERS([config.h])
259: AC_CONFIG_FILES([Makefile img/Makefile])
260: AC_OUTPUT
261:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>