2
2
dnl configure.in
3
3
dnl
4
4
dnl Copyright (c) 2000 Dug Song <[email protected] >
5
+ dnl Modified by Ali Abdulkadir <[email protected] >
5
6
dnl
6
- dnl $Id: configure.in 638 2007-01-20 11:39:21Z dugsong $
7
+ dnl Process this file with autoconf to produce a configure script.
7
8
8
- AC_INIT ( [ libdnet] , [ 1.12] )
9
+ AC_INIT ( [ libdnet] ,
[ 1.12] , [ [email protected] ] , [ libdnet ] , [ https://github.com/sgeto/libdnet ] )
9
10
AC_CONFIG_SRCDIR ( [ include/dnet.h] )
10
- AC_CONFIG_AUX_DIR ( config )
11
+ AC_CONFIG_AUX_DIR ( [ build-aux ] )
11
12
AC_SUBST ( ac_aux_dir )
12
-
13
+ AC_PREREQ ( [ 2.69] )
14
+ LT_PREREQ([ 2.4.2] )
15
+ AC_MSG_RESULT ( Beginning autoconfiguration process for libdnet-${PACKAGE_VERSION} ... )
13
16
AC_CONFIG_HEADERS ( [ include/config.h] )
14
17
AM_INIT_AUTOMAKE
15
18
@@ -19,27 +22,41 @@ AC_CONFIG_MACRO_DIR([m4])
19
22
dnl XXX - stop the insanity!@#$
20
23
AM_MAINTAINER_MODE
21
24
25
+ dnl the default compiler flags are "-O2 -g" if the user does not set anything.
26
+ dnl IMO O2 optimizations are fine, but debugging should be completely up to the
27
+ dnl user. The following test does just that. (Do not move these lines
28
+ dnl below "AC_PROG_CC"!!)
29
+ if test -z $CFLAGS; then
30
+ CFLAGS="-O2"
31
+ fi
32
+
22
33
dnl Check for system type.
23
34
dnl XXX - we do this to qualify our later feature checks, since some
24
35
dnl systems claim to support multiple features, but are quite b0rked.
25
36
AC_CANONICAL_HOST
26
- dnl XXX - spoof AC_CYGWIN
37
+
27
38
case "$host_os" in
28
39
*cygwin*) CYGWIN=yes;MINGW=no;;
29
40
*mingw*) CYGWIN=yes;MINGW=yes;;
30
41
*) CYGWIN=no;MINGW=no;;
31
42
esac
32
43
33
- dnl Initialize prefix.
34
- if test "$prefix" = "NONE"; then
35
- prefix="/usr/local"
44
+ dnl Initialize and Handle the --prefix=... option
45
+
46
+ if test "${prefix}" = "NONE"; then
47
+ prefix=/usr/local
48
+ fi
49
+ if test "${exec_prefix}" = "NONE"; then
50
+ exec_prefix=$prefix
36
51
fi
52
+ dnl libdir must be a fully qualified path (not ${exec_prefix}/lib)
53
+ eval libdir="$libdir"
37
54
38
55
dnl Checks for programs.
39
56
AC_PROG_CC
40
57
AC_PROG_INSTALL
41
- AC_LIBTOOL_DLOPEN
42
- AM_PROG_LIBTOOL
58
+ LT_INIT( [ dlopen win32-dll ] )
59
+ LT_LANG( [ Windows Resource ] )
43
60
44
61
dnl Checks for Python.
45
62
dnl XXX - use AM_PATH_PYTHON after automake upgrade
@@ -65,7 +82,7 @@ AC_ARG_WITH(python,
65
82
fi
66
83
done
67
84
if test "x$PYTHON" = "x"; then
68
- AC_ERROR (python not found in $withval)
85
+ AC_MSG_ERROR ( python not found in $withval )
69
86
fi
70
87
;;
71
88
esac
@@ -82,6 +99,11 @@ if test -r /usr/include/sgidefs.h ; then
82
99
fi
83
100
dnl XXX - we need MingW32 under Cygwin for win32
84
101
if test "$CYGWIN" = yes ; then
102
+ WIN32="yes"
103
+ AC_SUBST ( WIN32 )
104
+ AM_CONDITIONAL([ WIN32] , [ test "${WIN32}" = "yes"] )
105
+ AC_CHECK_TOOL ( [ WINDRES] , [ windres] , AC_MSG_ERROR ( [ windres not found] ) )
106
+ AC_SUBST ( WINDRES )
85
107
if test -d /usr/include/mingw || test -d /usr/i686-w64-mingw32; then
86
108
if test "$MINGW" = no ; then
87
109
CPPFLAGS="$CPPFLAGS -mno-cygwin"
@@ -91,35 +113,72 @@ if test "$CYGWIN" = yes ; then
91
113
[ Define for faster code generation.] )
92
114
AC_CHECK_LIB ( ws2_32 , main )
93
115
AC_CHECK_LIB ( iphlpapi , main )
116
+ AC_CHECK_LIB ( packet , PacketSetMode , ,AC_MSG_ERROR ( libpacket.a not found. ) )
117
+ AC_CHECK_LIB ( wpcap , pcap_setmode , ,AC_MSG_ERROR ( libwpcap.a not found. ) )
94
118
AC_DEFINE ( snprintf , _snprintf ,
95
119
[ Use MingW32's internal snprintf] )
120
+ elif test "$MINGW" = yes ; then
121
+ WIN32="yes"
122
+ AC_SUBST ( WIN32 )
123
+ AM_CONDITIONAL([ WIN32] , [ test "${WIN32}" = "yes"] )
124
+ AC_CHECK_TOOL ( [ WINDRES] , [ windres] , AC_MSG_ERROR ( [ windres not found] ) )
125
+ AC_SUBST ( WINDRES )
126
+ AC_DEFINE ( WIN32_LEAN_AND_MEAN , 1 ,
127
+ [ Define for faster code generation.] )
128
+ if test "${cross_compiling}" = "yes" ; then
129
+ if test "$host" = "i686-w64-mingw32" ; then
130
+ AC_CHECK_LIB ( packet , PacketSetMode , ,AC_MSG_ERROR ( libpacket.a not found. ) )
131
+ AC_CHECK_LIB ( wpcap , pcap_setmode , ,AC_MSG_ERROR ( libwpcap.a not found. ) )
132
+ LIBS="$LIBS -lws2_32 -liphlpapi"
133
+ CFLAGS="$CFLAGS -static-libgcc -march=i686 -mwin32"
134
+ else
135
+ AC_CHECK_LIB ( packet , PacketSetMode , ,AC_MSG_ERROR ( libpacket.a not found. ) )
136
+ AC_CHECK_LIB ( wpcap , pcap_setmode , ,AC_MSG_ERROR ( libwpcap.a not found. ) )
137
+ LIBS="$LIBS -lws2_32 -liphlpapi"
138
+ CFLAGS="$CFLAGS -static-libgcc -mwin32"
139
+ LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
140
+ fi
141
+ else
142
+ if test "$host" = "i686-w64-mingw32" ; then
143
+ AC_CHECK_LIB ( packet , PacketSetMode , ,AC_MSG_ERROR ( libpacket.a not found. ) )
144
+ AC_CHECK_LIB ( wpcap , pcap_setmode , ,AC_MSG_ERROR ( libwpcap.a not found. ) )
145
+ LIBS="$LIBS -lws2_32 -liphlpapi"
146
+ CFLAGS="$CFLAGS -march=i686 -mwin32"
147
+ else
148
+ AC_CHECK_LIB ( packet , PacketSetMode , ,AC_MSG_ERROR ( libpacket.a not found. ) )
149
+ AC_CHECK_LIB ( wpcap , pcap_setmode , ,AC_MSG_ERROR ( libwpcap.a not found. ) )
150
+ LIBS="$LIBS -lws2_32 -liphlpapi"
151
+ CFLAGS="$CFLAGS -mwin32"
152
+ LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
153
+ fi
154
+ fi
96
155
else
97
156
AC_MSG_ERROR ( [ need MingW32 package to build under Cygwin] )
98
157
fi
99
- AC_MSG_CHECKING ( for WinPcap developer's pack )
100
- AC_ARG_WITH ( wpdpack ,
101
- [ --with-wpdpack=DIR use WinPcap developer's pack in DIR] ,
102
- [ AC_MSG_RESULT ( $withval )
103
- if test -f $withval/Include/Packet32.h -a -f $withval/Lib/Packet.lib; then
104
- owd=`pwd`
105
- if cd $withval; then withval=`pwd`; cd $owd; fi
106
- CFLAGS="$CFLAGS -I$withval/include"
107
- LIBS="$LIBS -L$withval/lib -lPacket -lwpcap"
108
- else
109
- AC_MSG_ERROR ( packet32.h or packet.lib not found in $withval )
110
- fi ] ,
111
- [ for dir in ${prefix} ${HOME}/WPdpack ; do
112
- if test -f ${dir}/include/packet32.h -a -f ${dir}/lib/packet.lib; then
113
- CFLAGS="$CFLAGS -I${dir}/include"
114
- LIBS="$LIBS -L${dir}/lib -lpacket -lpcap"
115
- have_pcap=yes
116
- break;
117
- fi
118
- done
119
- if test "$have_pcap" != yes; then
120
- AC_MSG_ERROR ( WinPcap developer's pack not found )
121
- fi
122
- AC_MSG_RESULT ( yes ) ] )
158
+ # AC_MSG_CHECKING(for WinPcap developer's pack)
159
+ # AC_ARG_WITH(wpdpack,
160
+ # [ --with-wpdpack=DIR use WinPcap developer's pack in DIR],
161
+ # [ AC_MSG_RESULT($withval)
162
+ # if test -f $withval/Include/Packet32.h -a -f $withval/Lib/Packet.lib; then
163
+ # owd=`pwd`
164
+ # if cd $withval; then withval=`pwd`; cd $owd; fi
165
+ # CFLAGS="$CFLAGS -I$withval/include"
166
+ # LIBS="$LIBS -L$withval/lib -lPacket -lwpcap"
167
+ # else
168
+ # AC_MSG_ERROR(packet32.h or packet.lib not found in $withval)
169
+ # fi ],
170
+ # [ for dir in ${prefix} ${HOME}/WPdpack ; do
171
+ # if test -f ${dir}/include/packet32.h -a -f ${dir}/lib/packet.lib; then
172
+ # CFLAGS="$CFLAGS -I${dir}/include"
173
+ # LIBS="$LIBS -L${dir}/lib -lpacket -lpcap"
174
+ # have_pcap=yes
175
+ # break;
176
+ # fi
177
+ # done
178
+ # if test "$have_pcap" != yes; then
179
+ # AC_MSG_ERROR(WinPcap developer's pack not found)
180
+ # fi
181
+ # AC_MSG_RESULT(yes) ]
123
182
fi
124
183
125
184
dnl Checks for libraries.
@@ -149,7 +208,7 @@ AC_ARG_WITH(check,
149
208
CHECKINC="-I$withval/src"
150
209
CHECKLIB="-L$withval/src -lcheck"
151
210
else
152
- AC_ERROR (check.h or libcheck.a not found in $withval)
211
+ AC_MSG_ERROR ( check.h or libcheck.a not found in $withval )
153
212
fi
154
213
;;
155
214
esac ] ,
325
384
AC_LIBOBJ ( [ tun-none] )
326
385
fi
327
386
328
- AC_OUTPUT ([ Makefile dnet-config include/Makefile include/dnet/Makefile
387
+ AC_CONFIG_FILES ( [ Makefile dnet-config include/Makefile include/dnet/Makefile
329
388
man/Makefile src/Makefile python/Makefile python/setup.py
330
- test/Makefile test/check/Makefile test/dnet/Makefile] ,
331
- [ chmod 755 dnet-config] )
389
+ test/Makefile test/check/Makefile test/dnet/Makefile] )
390
+ AC_CONFIG_COMMANDS ( [ default] ,[ chmod 755 dnet-config] ,[ ] )
391
+ AC_OUTPUT
0 commit comments