~ubuntu-branches/ubuntu/precise/ettercap/precise

« back to all changes in this revision

Viewing changes to aclocal.m4

  • Committer: Bazaar Package Importer
  • Author(s): Murat Demirten
  • Date: 2003-06-21 19:57:18 UTC
  • Revision ID: james.westby@ubuntu.com-20030621195718-qqbbfk18e1djchd9
Tags: upstream-0.6.b
ImportĀ upstreamĀ versionĀ 0.6.b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
 
2
 
 
3
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
 
4
# Free Software Foundation, Inc.
 
5
# This file is free software; the Free Software Foundation
 
6
# gives unlimited permission to copy and/or distribute it,
 
7
# with or without modifications, as long as this notice is preserved.
 
8
 
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 
11
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
12
# PARTICULAR PURPOSE.
 
13
 
 
14
 
 
15
dnl
 
16
dnl EC_MESSAGE(MESSAGE)
 
17
dnl
 
18
 
 
19
AC_DEFUN(EC_MESSAGE,[
 
20
   AC_MSG_RESULT()
 
21
   AC_MSG_RESULT(${SB}$1...${EB})
 
22
   AC_MSG_RESULT()
 
23
])
 
24
 
 
25
dnl
 
26
dnl EC_CHECK_OPTION(STRING, VAR)
 
27
dnl
 
28
 
 
29
AC_DEFUN(EC_CHECK_OPTION,[
 
30
   echo "$1 ${SB}$2${EB}"
 
31
])
 
32
 
 
33
 
 
34
dnl
 
35
dnl EC_LINUX_KERNEL()
 
36
dnl
 
37
 
 
38
AC_DEFUN(EC_LINUX_KERNEL,[
 
39
 
 
40
   AC_MSG_CHECKING(Linux kernel version)
 
41
   major=`uname -r  | cut -f1 -d"."`
 
42
   minor=`uname -r  | cut -f2 -d"."`
 
43
   uname=`uname -r`
 
44
   AC_MSG_RESULT($uname)
 
45
   if test "$major$minor" -lt 20; then
 
46
      AC_MSG_WARN(*******************************);
 
47
      AC_MSG_WARN(* Kernel >= 2.0.x REQUIRED !! *);
 
48
      AC_MSG_WARN(*******************************);
 
49
      exit;
 
50
   fi
 
51
])
 
52
 
 
53
 
 
54
dnl
 
55
dnl EC_FREEBSD_VERSION()
 
56
dnl
 
57
 
 
58
AC_DEFUN(EC_FREEBSD_VERSION,[
 
59
 
 
60
   AC_MSG_CHECKING(FreeBSD version)
 
61
   major=`uname -r  | cut -f1 -d"."`
 
62
   minor=`uname -r  | cut -f2 -d"." | cut -f1 -d"-"`
 
63
   uname=`uname -r`
 
64
   AC_MSG_RESULT($uname)
 
65
   if test "$major$minor" -lt 40; then
 
66
      AC_MSG_WARN(***************************************************);
 
67
      AC_MSG_WARN(* Tested only on FreeBSD 4.x !!                   *);
 
68
      AC_MSG_WARN(* Please send me comments, patches or bug-reports *);
 
69
      AC_MSG_WARN(* on how ettercap works within your system...     *);
 
70
      AC_MSG_WARN(***************************************************);
 
71
   fi
 
72
 
 
73
])
 
74
 
 
75
 
 
76
dnl
 
77
dnl EC_DARWIN_KERNEL()
 
78
dnl
 
79
 
 
80
AC_DEFUN(EC_DARWIN_KERNEL,[
 
81
 
 
82
   AC_MSG_CHECKING(Darwin version)
 
83
   major=`uname -r  | cut -f1 -d"."`
 
84
   minor=`uname -r  | cut -f2 -d"."`
 
85
   uname=`uname -r`
 
86
   AC_MSG_RESULT($uname)
 
87
   if test "$major$minor" -lt 14; then
 
88
      ac_cv_ec_undefined="suppress"
 
89
   elif test "$major$minor" -gt 13; then
 
90
      ac_cv_ec_undefined="error"
 
91
   fi
 
92
])
 
93
 
 
94
 
 
95
dnl
 
96
dnl EC_WINDOWS_KERNEL()
 
97
dnl
 
98
 
 
99
AC_DEFUN(EC_WINDOWS_KERNEL,[
 
100
 
 
101
   AC_MSG_CHECKING(Windows kernel version)
 
102
   tech=`uname | cut -f2 -d"_" | cut -f1 -d"-"`
 
103
   major=`uname | cut -f2 -d"-" | cut -f1 -d"."`
 
104
   minor=`uname | cut -f2 -d"-" | cut -f2 -d"."`
 
105
   AC_MSG_RESULT($tech $major.$minor)
 
106
   if test "$tech" != "NT"; then
 
107
      ac_cv_ec_windows_version="-DWIN9X"
 
108
   elif test "$major$minor" -lt 50; then
 
109
      ac_cv_ec_windows_version="-DWINNT"
 
110
   else
 
111
      ac_cv_ec_windows_version="-DWIN2K_XP"
 
112
   fi
 
113
 
 
114
   AC_MSG_CHECKING(Cygwin dll version)
 
115
   uname=`uname -r | cut -f1 -d"("`
 
116
   major=`uname -r | cut -f1 -d"(" | cut -f1 -d"."`
 
117
   minor=`uname -r | cut -f1 -d"(" | cut -f2 -d"."`
 
118
   AC_MSG_RESULT($uname)
 
119
   if test "$major$minor" -lt 13; then
 
120
      AC_MSG_WARN(****************************);
 
121
      AC_MSG_WARN(* Cygwin 1.3.x REQUIRED !! *);
 
122
      AC_MSG_WARN(****************************);
 
123
      exit;
 
124
   fi
 
125
])
 
126
 
 
127
 
 
128
dnl
 
129
dnl EC_PF_PACKET()
 
130
dnl
 
131
dnl   returns  HAVE_PF_PACKET
 
132
dnl            ac_cv_ec_nopf=1  (if fails)
 
133
dnl
 
134
 
 
135
AC_DEFUN(EC_PF_PACKET,[
 
136
 
 
137
   AC_MSG_CHECKING(if you can create PF_PACKET socket)
 
138
   AC_TRY_COMPILE([
 
139
   #include <arpa/inet.h>
 
140
   #include <sys/socket.h>
 
141
   #include <features.h>         /* for the glibc version number */
 
142
   #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
 
143
   #include <netpacket/packet.h>
 
144
   #include <net/ethernet.h>     /* the L2 protocols */
 
145
   #else
 
146
   #include <asm/types.h>
 
147
   #include <linux/if_ether.h>   /* The L2 protocols */
 
148
   #endif],
 
149
   [ int sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); ],
 
150
   [  AC_MSG_RESULT(yes)
 
151
      AC_DEFINE(HAVE_PF_PACKET,1) ],
 
152
   [  AC_MSG_RESULT(no);
 
153
      ac_cv_ec_nopf=1 ]
 
154
   )
 
155
 
 
156
])
 
157
 
 
158
 
 
159
dnl
 
160
dnl EC_SOCK_PACKET()
 
161
dnl
 
162
dnl   returns  HAVE_SCOK_PACKET
 
163
dnl            ac_cv_ec_nosock=1 (if fails)
 
164
dnl
 
165
 
 
166
AC_DEFUN(EC_SOCK_PACKET,[
 
167
 
 
168
   AC_MSG_CHECKING(if you can create SOCK_PACKET socket)
 
169
   AC_TRY_COMPILE([
 
170
   #include <arpa/inet.h>
 
171
   #include <sys/socket.h>
 
172
   #include <features.h>         /* for the glibc version number */
 
173
   #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
 
174
   #include <net/ethernet.h>     /* the L2 protocols */
 
175
   #else
 
176
   #include <asm/types.h>
 
177
   #include <linux/if_ether.h>   /* The L2 protocols */
 
178
   #endif],
 
179
   [ int sock = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL)); ],
 
180
   [  AC_MSG_RESULT(yes)
 
181
      AC_DEFINE(HAVE_SOCK_PACKET,1) ],
 
182
   [  AC_MSG_RESULT(no);
 
183
      ac_cv_ec_nosock=1 ]
 
184
   )
 
185
 
 
186
])
 
187
 
 
188
 
 
189
 
 
190
dnl
 
191
dnl     EC_SOCKLEN_CHECK
 
192
dnl
 
193
dnl results:
 
194
dnl
 
195
dnl     HAVE_SOCKLEN_T
 
196
dnl
 
197
 
 
198
AC_DEFUN(EC_SOCKLEN_CHECK,
 
199
   [AC_MSG_CHECKING(for socklen_t in sys/socket.h)
 
200
 
 
201
   AC_TRY_RUN([
 
202
      #include <sys/types.h>
 
203
      #include <sys/socket.h>
 
204
 
 
205
      int main()
 
206
      {
 
207
         socklen_t from;
 
208
         from = sizeof(socklen_t);
 
209
 
 
210
         return 0;
 
211
      }
 
212
   ],
 
213
   [  AC_MSG_RESULT(yes)
 
214
      AC_DEFINE(HAVE_SOCKLEN_T)
 
215
      ],
 
216
      AC_MSG_RESULT(no);
 
217
      ,
 
218
      AC_MSG_RESULT(unkown when cross-compiling)
 
219
   )
 
220
 
 
221
])
 
222
 
 
223
 
 
224
dnl
 
225
dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
 
226
dnl
 
227
dnl usage:
 
228
dnl
 
229
dnl     AC_LBL_SOCKADDR_SA_LEN
 
230
dnl
 
231
dnl results:
 
232
dnl
 
233
dnl     HAVE_SOCKADDR_SA_LEN (defined)
 
234
dnl
 
235
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
 
236
    [AC_MSG_CHECKING(if sockaddr struct has sa_len member)
 
237
    AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
 
238
        AC_TRY_COMPILE([
 
239
#       include <sys/types.h>
 
240
#       include <sys/socket.h>],
 
241
        [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
 
242
        ac_cv_lbl_sockaddr_has_sa_len=yes,
 
243
        ac_cv_lbl_sockaddr_has_sa_len=no))
 
244
    AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
 
245
    if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
 
246
            AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[if struct sockaddr has sa_len])
 
247
    fi])
 
248
 
 
249
 
 
250
 
 
251
dnl
 
252
dnl Checks to see if unaligned memory accesses fail         (from libpcap aclocal.m4)
 
253
dnl
 
254
dnl usage:
 
255
dnl
 
256
dnl   AC_LBL_UNALIGNED_ACCESS
 
257
dnl
 
258
dnl results:
 
259
dnl
 
260
dnl   LBL_ALIGN (DEFINED)
 
261
dnl
 
262
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
 
263
    [AC_MSG_CHECKING(if unaligned accesses fail)
 
264
    AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
 
265
   [case "$target_cpu" in
 
266
 
 
267
   # XXX: should also check that they don't do weird things (like on arm)
 
268
   alpha*|arm*|hp*|mips|sparc)
 
269
      ac_cv_lbl_unaligned_fail=yes
 
270
      ;;
 
271
 
 
272
   *)
 
273
      cat >conftest.c <<EOF
 
274
#     include <sys/types.h>
 
275
#     include <sys/wait.h>
 
276
#     include <stdio.h>
 
277
      unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
 
278
      main() {
 
279
      unsigned int i;
 
280
      pid_t pid;
 
281
      int status;
 
282
      /* avoid "core dumped" message */
 
283
      pid = fork();
 
284
      if (pid <  0)
 
285
         exit(2);
 
286
      if (pid > 0) {
 
287
         /* parent */
 
288
         pid = waitpid(pid, &status, 0);
 
289
         if (pid < 0)
 
290
            exit(3);
 
291
         exit(!WIFEXITED(status));
 
292
      }
 
293
      /* child */
 
294
      i = *(unsigned int *)&a[[1]];
 
295
      printf("%d\n", i);
 
296
      exit(0);
 
297
      }
 
298
EOF
 
299
      ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
 
300
          conftest.c $LIBS >/dev/null 2>&1
 
301
      if test ! -x conftest ; then
 
302
         dnl failed to compile for some reason
 
303
         ac_cv_lbl_unaligned_fail=yes
 
304
      else
 
305
         ./conftest >conftest.out
 
306
         if test ! -s conftest.out ; then
 
307
            ac_cv_lbl_unaligned_fail=yes
 
308
         else
 
309
            ac_cv_lbl_unaligned_fail=no
 
310
         fi
 
311
      fi
 
312
      rm -f conftest* core core.conftest
 
313
      ;;
 
314
   esac])
 
315
   AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
 
316
   if test $ac_cv_lbl_unaligned_fail = yes ; then
 
317
      AC_DEFINE(LBL_ALIGN,1,[if unaligned access fails])
 
318
   fi])
 
319
 
 
320
 
 
321
 
 
322
AC_DEFUN(EC_CHECK_DATE,[
 
323
   today=`date +%m%d`
 
324
   if test "$today" -eq "0930" -o "$today" -eq "1114" -o "$today" -eq "0125"; then
 
325
 
 
326
      if test "$today" -eq "1114"; then
 
327
         who="ALoR"
 
328
      elif test "$today" -eq "0930"; then
 
329
         who="NaGA"
 
330
      elif test "$today" -eq "0125"; then
 
331
         who="Ettercap"
 
332
      fi
 
333
 
 
334
      echo
 
335
      echo
 
336
      echo "********************************"
 
337
      echo "*                              *"
 
338
      echo "* Today is the $who's birthday *"
 
339
      echo "*                              *"
 
340
      echo "********************************"
 
341
      echo
 
342
      echo "  Only for today ettercap is a"
 
343
      echo " cardware or emailware software."
 
344
      echo
 
345
      echo " a mail will be appreciated... ;)"
 
346
      echo
 
347
      exit
 
348
   fi
 
349
])
 
350
 
 
351
 
 
352
 
 
353
dnl
 
354
dnl EC_PTHREAD_CHECK()
 
355
dnl            ac_cv_ec_nopthread=1 (if fails)
 
356
dnl
 
357
 
 
358
AC_DEFUN(EC_PTHREAD_CHECK,[
 
359
 
 
360
   AC_SEARCH_LIBS(pthread_create, pthread,,
 
361
      [
 
362
         AC_MSG_CHECKING(whether $CC accepts -pthread)
 
363
         CFLAGS_store="$CFLAGS"
 
364
         CFLAGS="$CFLAGS -pthread"
 
365
         AC_TRY_COMPILE([#include <pthread.h>],[pthread_create(NULL, NULL, NULL, NULL);],
 
366
            [AC_MSG_RESULT(yes)
 
367
             LIBS="$LIBS -pthread"],
 
368
            [AC_MSG_RESULT(no)
 
369
               CFLAGS="$CFLAGS_store"
 
370
               AC_MSG_WARN(***************************);
 
371
               AC_MSG_WARN(* PTHREAD ARE REQUIRED !! *);
 
372
               AC_MSG_WARN(***************************);
 
373
               exit
 
374
            ])
 
375
         unset CFLAGS_store
 
376
      ]
 
377
   )
 
378
 
 
379
   if test "$OS" = "SOLARIS"; then
 
380
      AC_SEARCH_LIBS(_getfp, pthread,,)
 
381
   fi
 
382
 
 
383
])
 
384
 
 
385
dnl
 
386
dnl EC_NS_GET()
 
387
dnl
 
388
dnl   returns  HAVE_NS_GET
 
389
dnl
 
390
 
 
391
AC_DEFUN(EC_NS_GET,[
 
392
 
 
393
   AC_MSG_CHECKING(for NS_GET32)
 
394
   AC_TRY_RUN([
 
395
      #include <arpa/nameser.h>
 
396
 
 
397
      int main()
 
398
      {
 
399
         int i;
 
400
         char *p = "\x01\x02\x03\x04";
 
401
         NS_GET32(i, p);
 
402
 
 
403
         return 0;
 
404
      }
 
405
   ],
 
406
   [  AC_MSG_RESULT(yes)
 
407
      AC_DEFINE(HAVE_NS_GET,1) ],
 
408
   [  AC_MSG_RESULT(no); ]
 
409
   )
 
410
 
 
411
])
 
412
 
 
413
dnl vim:ts=3:expandtab
 
414
 
 
415
 
 
416
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
 
417
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
 
418
dnl also defines GSTUFF_PKG_ERRORS on error
 
419
AC_DEFUN(PKG_CHECK_MODULES, [
 
420
  succeeded=no
 
421
 
 
422
  if test -z "$PKG_CONFIG"; then
 
423
    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
424
  fi
 
425
 
 
426
  if test "$PKG_CONFIG" = "no" ; then
 
427
     echo "*** The pkg-config script could not be found. Make sure it is"
 
428
     echo "*** in your path, or set the PKG_CONFIG environment variable"
 
429
     echo "*** to the full path to pkg-config."
 
430
     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
 
431
  else
 
432
     PKG_CONFIG_MIN_VERSION=0.9.0
 
433
     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
 
434
        AC_MSG_CHECKING(for $2)
 
435
 
 
436
        if $PKG_CONFIG --exists "$2" ; then
 
437
            AC_MSG_RESULT(yes)
 
438
            succeeded=yes
 
439
 
 
440
            AC_MSG_CHECKING($1_CFLAGS)
 
441
            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
 
442
            AC_MSG_RESULT($$1_CFLAGS)
 
443
 
 
444
            AC_MSG_CHECKING($1_LIBS)
 
445
            $1_LIBS=`$PKG_CONFIG --libs "$2"`
 
446
            AC_MSG_RESULT($$1_LIBS)
 
447
        else
 
448
            $1_CFLAGS=""
 
449
            $1_LIBS=""
 
450
            ## If we have a custom action on failure, don't print errors, but 
 
451
            ## do set a variable so people can do so.
 
452
            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
 
453
            ifelse([$4], ,echo $$1_PKG_ERRORS,)
 
454
        fi
 
455
 
 
456
        AC_SUBST($1_CFLAGS)
 
457
        AC_SUBST($1_LIBS)
 
458
     else
 
459
        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
 
460
        echo "*** See http://www.freedesktop.org/software/pkgconfig"
 
461
     fi
 
462
  fi
 
463
 
 
464
  if test $succeeded = yes; then
 
465
     ifelse([$3], , :, [$3])
 
466
  else
 
467
     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
 
468
  fi
 
469
])
 
470
 
 
471
 
 
472