File: configure.in

package info (click to toggle)
netdiag 1.2-1
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 3,268 kB
  • sloc: ansic: 23,895; sh: 5,544; makefile: 328; awk: 130
file content (170 lines) | stat: -rw-r--r-- 4,324 bytes parent folder | download | duplicates (3)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
dnl
dnl	Copyright (c) 2003 Rinet Corp., Novosibirsk, Russia
dnl
dnl Redistribution and use in source forms, with and without modification,
dnl are permitted provided that this entire comment appears intact.
dnl Redistribution in binary form may occur without any restrictions.
dnl
dnl THIS SOFTWARE IS PROVIDED ``AS IS'' WITHOUT ANY WARRANTIES OF ANY KIND.
dnl

dnl
dnl configure.in -- template for ./configure
dnl Process this file with `autoconf' to produce a configure script
dnl	remember to edit configure.in, not ./configure
dnl

AC_INIT(trafshow.c)
AC_CONFIG_HEADER(config.h)

AC_CANONICAL_SYSTEM

dnl Checks for misc required programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_LEX
AC_REQUIRE_CPP
AC_AIX
ACX_PTHREAD(, AC_MSG_ERROR(cannot find pthread; see the INSTALL notes))

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/termios.h net/if_dl.h paths.h resolv.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(u_int64_t, unsigned long long)

dnl AC_CHECK_TYPE(in_addr_t, unsigned int)
dnl Some OS keeps in_addr_t in netinet/in.h not in sys/types.h
AC_CACHE_CHECK(for in_addr_t, ac_cv_type_in_addr_t,
	AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
		],[in_addr_t ipaddr],
		ac_cv_type_in_addr_t="yes",
		ac_cv_type_in_addr_t="unsigned int"
	)
)
if test "$ac_cv_type_in_addr_t" != yes; then
	AC_DEFINE_UNQUOTED(in_addr_t, $ac_cv_type_in_addr_t)
fi

AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t,
	AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
	],[socklen_t slen],
		ac_cv_type_socklen_t="yes",
		ac_cv_type_socklen_t="int"
	)
)
if test "$ac_cv_type_socklen_t" != yes; then
	AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_type_socklen_t)
fi

AC_CACHE_CHECK(for struct sockaddr_storage, ac_cv_sockaddr_storage,
	AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
	],[struct sockaddr_storage ss],
		ac_cv_sockaddr_storage="yes",
		ac_cv_sockaddr_storage="no"
	)
)
if test "$ac_cv_sockaddr_storage" != no; then
	AC_DEFINE(HAVE_SOCKADDR_STORAGE)
fi

AC_CACHE_CHECK(for struct ether_addr, ac_cv_ether_addr,
	AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/if_ether.h>
	],[struct ether_addr ea],
		ac_cv_ether_addr="yes",
		ac_cv_ether_addr="no"
	)
)
if test "$ac_cv_ether_addr" != no; then
	AC_DEFINE(HAVE_ETHER_ADDR)
fi

dnl Check for network system libraries.
AC_CHECK_LIB(resolv, main)
AC_CHECK_LIB(inet, main)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, connect)

dnl Checks for library functions.
AC_CHECK_FUNCS(siginterrupt)
AC_REPLACE_FUNCS(snprintf strftime strcasecmp)

dnl Check for pcap libraries.
AC_CHECK_LIB(pcap, pcap_findalldevs,,
	     AC_MSG_ERROR(at least libpcap 0.7 is required; see the INSTALL notes))
AC_CHECK_FUNCS(pcap_dump_flush)
AC_CHECK_FUNCS(pcap_get_selectable_fd)

dnl termcap library may be required.
AC_CHECK_LIB(termcap, tgetent)

AC_MSG_CHECKING(for curses library)
AC_CACHE_VAL(ac_cv_have_curses,
	ac_cv_save_CFLAGS="$CFLAGS"
	ac_cv_save_LIBS="$LIBS"
	LIBS="-lslang $ac_cv_save_LIBS"
	AC_TRY_LINK([#include <slcurses.h>],[initscr();],
	ac_cv_have_curses="slang",
		LIBS="-lncurses $ac_cv_save_LIBS"
		AC_TRY_LINK([#include <ncurses.h>], [initscr();],
		ac_cv_have_curses="ncurses",
			CFLAGS="-I/usr/include/ncurses $ac_cv_save_CFLAGS"
			AC_TRY_LINK([#include <ncurses.h>], [initscr();],
			ac_cv_have_curses="n_curses",
				LIBS="-lcurses $ac_cv_save_LIBS"
				AC_TRY_LINK([#include <curses.h>], [initscr();],
				ac_cv_have_curses="curses",
					ac_cv_have_curses="none"
				)
			)
		)
	)
	CFLAGS="$ac_cv_save_CFLAGS"
)
AC_MSG_RESULT($ac_cv_have_curses)

case "$ac_cv_have_curses" in

slang)
	AC_DEFINE(HAVE_SLCURSES)
	AC_DEFINE(HAVE_HAS_COLORS)
	;;
ncurses)
	AC_DEFINE(HAVE_NCURSES)
	AC_CHECK_FUNCS(has_colors)
	;;
n_curses)
	CFLAGS="-I/usr/include/ncurses $CFLAGS"
	AC_DEFINE(HAVE_NCURSES)
	AC_CHECK_FUNCS(has_colors)
	;;
curses)
	AC_DEFINE(HAVE_CURSES)
	AC_CHECK_FUNCS(has_colors)
	;;
*)
	AC_MSG_ERROR(cannot find curses; see the INSTALL notes)
	;;
esac

AC_CHECK_FUNCS(bkgd wbkgd wredrawln resizeterm use_default_colors)

AC_OUTPUT(Makefile)