File: configure.ac

package info (click to toggle)
nast 0.2.0-12
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,804 kB
  • sloc: ansic: 7,516; sh: 2,768; makefile: 63
file content (215 lines) | stat: -rw-r--r-- 4,444 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
##############################################
#                                            #
# Nast - Network Analyzer Sniffer Tool       #
#	                                     #
# configure.ac - written by embyte@madlab.it # 
#                modified by Snifth@box.it   #
#                                            #
##############################################

AC_INIT(nast, 0.2.0, embyte@madlab.it)
AC_CONFIG_SRCDIR(main.c)
AC_CONFIG_HEADER(config.h)

# Print a banner
echo "
Please wait, I'm going to configure Nast 0.2.0
"

#########
# Subst #
#########

AC_SUBST(NCURSES)
AC_SUBST(GETOPT)


#################
# Checks for OS #
#################

AC_CANONICAL_TARGET
case "$target" in
*linux*)
	AC_MSG_NOTICE([Found Linux, happy day!])
        ;;    
*freebsd*)
    	AC_MSG_NOTICE([Found FreeBSD, are you a nerd?])
   	;;
*openbsd*)
	AC_MSG_WARN([
	OpenBSD port: we are working on...
	Nast could not run correctly
	])
  	;;
*netbsd*)
	AC_MSG_WARN([
	NetBSD port: we are working on...
	Nast could not run correctly
	])
	;;
*)
        AC_MSG_WARN([

        Your OS seems to be officially unsupported yet, please send an email authors

        ])
	;;
esac


################
# Setup prefix #
################

AC_PREFIX_DEFAULT(/usr/local)
if test "$prefix" = "NONE"; then
   prefix="/usr/local"
   fi
   

#######################
# Checks for compiler #
#######################

AC_PROG_CC


#########################
# Checks for libraries. #
#########################

#
# -- libnet --
#

AC_CHECK_LIB(net, libnet_name2addr4,, AC_MSG_ERROR([

Libnet-1.1.x Packet Shaping Library not found! It's required.
You can download it from official web site: http://www.packetfactory.net/libnet

]))

#
# -- libpcap --
#

AC_CHECK_LIB(pcap, pcap_dispatch,, AC_MSG_ERROR([

Libpcap-0.7.1 Packet Capture Library not found! It's required. 
You can download it from official web site: http://www.tcpdump.org/#current

]))

#
# -- libncurses support --
#

ENABLE_NCRS="no"
AC_CHECK_LIB(ncurses, initscr, ENABLE_NCRS="yes"; NCURSES=ncurses/n_nast.o; LIBS="-lncurses $LIBS"; AC_DEFINE(HAVE_LIBNCURSES), AC_MSG_RESULT([

Ncurses library (*) not found in your system.
You can download it from official web site: http://www.gnu.org/software/ncurses/ncurses.html
(*): CRT screen handling and optimization package

Building without ncurses menu support (-G flag will doesn't work)

]))
#fi

#
#  --lmenu support--
#

ENABLE_NCRS="no"
AC_CHECK_LIB(menu, menu_opts_off, ENABLE_NCRS="yes"; MENU=ncurses/n_menu.o; LIBS="-lmenu $LIBS"; AC_DEFINE(HAVE_LIBMENU), AC_MSG_RESULT([

Menu library (*) not found in your system.
You can download it from official web site: http://www.gnu.org/software/ncurses/ncurses.html
(*): CRT screen handling and optimization package

Building without ncurses menu support (-G flag will doesn't work)

]))






############################
# Checks for linux pthread #
############################

case "$target" in
*linux*)
	AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([

	Linux threads library not found in your linux-box! Strange..

	]))
	
	CFLAGS="${CFLAGS} -Wall -O2"
	;;
*bsd*)
	CFLAGS="${CFLAGS} -Wall -O2 -pthread"
	;;
*gnu*)
	CFLAGS="${CFLAGS} -Wall -O2 -pthread"
	;;
esac	


##############################################
# Checks for headers and common libs/headers #
##############################################

AC_HEADER_STDC
AC_CHECK_HEADERS(errno.h sys/utsname.h,, AC_MSG_WARN(This headers are required!)) 

AH_TEMPLATE(HAVE_GETOPT, define if the getopt.h header is present, OpenBSD for ex. doesn't have one)
AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT), GETOPT="getopt.o getopt1.o")
#AC_CHECK_HEADER(getopt.h, AC_DEFINE(HAVE_GETOPT), GETOPT="getopt.o getopt1.o")

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF


##################
# Write Makefile #
##################

AC_OUTPUT(Makefile)


#################
# Print results #
#################

echo "
Ok. I have done with all. 

Results are:

PLATFORM ...... : `uname -mp`
O.S. .......... : `uname -rs` (`uname -n`)
COMPILER ...... : ${CC}
CFLAGS ........ : ${CFLAGS}
CPPFLAGS ...... : ${CPPFLAGS}
LDFLAGS ....... : ${LDFLAGS}
LIBS .......... : ${LIBS}
PREFIX ........ : ${prefix}

NCURSES SUPPORT : ${ENABLE_NCRS}

Type 'make' to compile or 'make help' to show accepted options.
"

# ok we have done