aboutsummaryrefslogtreecommitdiff
path: root/contrib/traceroute/configure.in
blob: 5455734b3a4a7d371e1955c0248eed2755427b5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
dnl @(#) $Id: configure.in,v 1.33 2000/12/18 09:38:26 leres Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1999, 2000
dnl	The Regents of the University of California.  All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl

AC_INIT(traceroute.c)

AC_CANONICAL_SYSTEM

umask 002

if test -z "$PWD" ; then
	PWD=`pwd`
fi

AC_LBL_C_INIT(V_CCOPT, V_INCLS)

AC_CHECK_HEADERS(malloc.h sys/select.h sys/sockio.h net/route.h \
    net/if_dl.h inet/mib2.h)

AC_REPLACE_FUNCS(strerror usleep)
AC_CHECK_FUNCS(setlinebuf)
if test $ac_cv_func_usleep = "no" ; then
	AC_CHECK_FUNCS(nanosleep)
fi

AC_LBL_LIBRARY_NET

case "$target_os" in

bsd4*)
	AC_DEFINE(HAVE_RAW_OPTIONS)
	;;

bsdi*)
	AC_DEFINE(HAVE_RAW_OPTIONS)
	;;

freebsd*)
	AC_DEFINE(HAVE_RAW_OPTIONS)
	;;

linux*)
	V_INCLS="$V_INCLS -Ilinux-include"
	AC_DEFINE(BYTESWAP_IP_HDR)
	;;

osf3*)
	dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
	AC_DEFINE(__STDC__,2)
	;;

solaris2.[[012345]]*)
	AC_DEFINE(BYTESWAP_IP_HDR)
	AC_DEFINE(CANT_HACK_IPCKSUM)
	;;

solaris*)
	AC_DEFINE(BYTESWAP_IP_HDR)
	;;
esac

dnl
dnl What kind of routing table lookup do we have?
dnl
AC_MSG_CHECKING(routing table type)
t="generic"
if test $ac_cv_header_inet_mib2_h = yes ; then
	t="mib"
elif test $ac_cv_header_net_route_h = yes -a \
    $ac_cv_header_net_if_dl_h = yes ; then
	t="socket"
elif test -f /proc/net/route ; then
	t="linux"
fi

AC_MSG_RESULT(${t})
V_FINDSADDR="findsaddr-${t}.c"


AC_LBL_CHECK_TYPE(int32_t, int)
AC_LBL_CHECK_TYPE(u_int32_t, u_int)

AC_LBL_DEVEL(V_CCOPT)

AC_LBL_SOCKADDR_SA_LEN

AC_MSG_CHECKING(if struct icmp has icmp_nextmtu)
AC_CACHE_VAL(ac_cv_struct_icmp_has_icmp_nextmtu,
    LBL_SAVE_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $V_INCLS"
    AC_TRY_COMPILE([   
#       include <sys/param.h>
#	include <sys/socket.h>
#	include <netinet/in_systm.h>
#       if __STDC__
        /* osf3 has REALLY good prototyes */
        struct mbuf;
        struct rtentry;
#       endif
#       include <netinet/in.h>
#       include <netinet/ip.h>
#       include <netinet/ip_icmp.h>
#       include <netinet/if_ether.h>],
	[u_int i = sizeof(((struct icmp *)0)->icmp_nextmtu)],
	ac_cv_struct_icmp_has_icmp_nextmtu=yes,
	ac_cv_struct_icmp_has_icmp_nextmtu=no)
    CFLAGS="$LBL_SAVE_CFLAGS")
AC_MSG_RESULT($ac_cv_struct_icmp_has_icmp_nextmtu)
if test $ac_cv_struct_icmp_has_icmp_nextmtu = yes ; then
	AC_DEFINE(HAVE_ICMP_NEXTMTU)
fi

if test "${srcdir}" = "." ; then
	srcdirprefix=""
else
	srcdirprefix="./"
fi

if test -r ${srcdirprefix}lbl/gnuc.h ; then
	rm -f gnuc.h
	ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
fi

AC_SUBST(V_CCOPT)
AC_SUBST(V_INCLS)
AC_SUBST(V_FINDSADDR)

AC_PROG_INSTALL

AC_OUTPUT(Makefile)

if test -f .devel ; then
	make depend
fi

exit 0