@@ -387,35 +387,6 @@ AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
387
387
# Before you is a C compiler.
388
388
#
389
389
AC_CHECK_FUNCS ( ether_ntohost , [
390
- AC_CACHE_CHECK ( for buggy ether_ntohost , ac_cv_buggy_ether_ntohost , [
391
- AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
392
- #include <netdb.h>
393
- #include <netinet/ether.h>
394
- #include <stdlib.h>
395
- #include <sys/types.h>
396
- #include <sys/param.h>
397
- #include <sys/socket.h>
398
-
399
- int
400
- main(int argc, char **argv)
401
- {
402
- u_char ea[ 6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
403
- char name[ MAXHOSTNAMELEN] ;
404
-
405
- ether_ntohost(name, (struct ether_addr *)ea);
406
- exit(0);
407
- }
408
- ] ] )
409
- ] , [ ac_cv_buggy_ether_ntohost=no] ,
410
- [ ac_cv_buggy_ether_ntohost=yes] ,
411
- [ ac_cv_buggy_ether_ntohost="not while cross-compiling"] ) ] )
412
- if test "$ac_cv_buggy_ether_ntohost" = "no"; then
413
- AC_DEFINE ( USE_ETHER_NTOHOST , 1 ,
414
- [ define if you have ether_ntohost() and it works] )
415
- fi
416
- ] )
417
- if test "$ac_cv_func_ether_ntohost" = yes -a \
418
- "$ac_cv_buggy_ether_ntohost" = "no"; then
419
390
#
420
391
# OK, we have ether_ntohost(). Is it declared in <net/ethernet.h>?
421
392
#
@@ -424,7 +395,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
424
395
#
425
396
AC_CHECK_DECL ( ether_ntohost ,
426
397
[
427
- AC_DEFINE ( NET_ETHERNET_H_DECLARES_ETHER_NTOHOST ,,
398
+ AC_DEFINE ( NET_ETHERNET_H_DECLARES_ETHER_NTOHOST ,1 ,
428
399
[ Define to 1 if net/ethernet.h declares `ether_ntohost'] )
429
400
] ,,
430
401
[
@@ -472,7 +443,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
472
443
unset ac_cv_have_decl_ether_ntohost
473
444
AC_CHECK_DECL ( ether_ntohost ,
474
445
[
475
- AC_DEFINE ( SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST ,,
446
+ AC_DEFINE ( SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST ,1 ,
476
447
[ Define to 1 if sys/ethernet.h declares `ether_ntohost'] )
477
448
] ,,
478
449
[
@@ -499,7 +470,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
499
470
unset ac_cv_have_decl_ether_ntohost
500
471
AC_CHECK_DECL ( ether_ntohost ,
501
472
[
502
- AC_DEFINE ( ARPA_INET_H_DECLARES_ETHER_NTOHOST ,,
473
+ AC_DEFINE ( ARPA_INET_H_DECLARES_ETHER_NTOHOST ,1 ,
503
474
[ Define to 1 if arpa/inet.h declares `ether_ntohost'] )
504
475
] ,,
505
476
[
@@ -527,7 +498,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
527
498
unset ac_cv_have_decl_ether_ntohost
528
499
AC_CHECK_DECL ( ether_ntohost ,
529
500
[
530
- AC_DEFINE ( NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST ,,
501
+ AC_DEFINE ( NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST ,1 ,
531
502
[ Define to 1 if netinet/if_ether.h declares `ether_ntohost'] )
532
503
] ,,
533
504
[
@@ -562,7 +533,91 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
562
533
#include <netinet/if_ether.h>
563
534
] )
564
535
fi
565
- fi
536
+ AC_CACHE_CHECK ( for buggy ether_ntohost , ac_cv_buggy_ether_ntohost , [
537
+ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
538
+ #include <netdb.h>
539
+ #if defined(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST)
540
+ /*
541
+ * OK, just include <net/ethernet.h>.
542
+ */
543
+ #include <net/ethernet.h>
544
+ #elif defined(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST)
545
+ /*
546
+ * OK, just include <netinet/ether.h>
547
+ */
548
+ #include <netinet/ether.h>
549
+ #elif defined(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST)
550
+ /*
551
+ * OK, just include <sys/ethernet.h>
552
+ */
553
+ #include <sys/ethernet.h>
554
+ #elif defined(ARPA_INET_H_DECLARES_ETHER_NTOHOST)
555
+ /*
556
+ * OK, just include <arpa/inet.h>
557
+ */
558
+ #include <arpa/inet.h>
559
+ #elif defined(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST)
560
+ /*
561
+ * OK, include <netinet/if_ether.h>, after all the other stuff we
562
+ * need to include or define for its benefit.
563
+ */
564
+ #define NEED_NETINET_IF_ETHER_H
565
+ #else
566
+ /*
567
+ * We'll have to declare it ourselves.
568
+ * If <netinet/if_ether.h> defines struct ether_addr, include
569
+ * it. Otherwise, define it ourselves.
570
+ */
571
+ #ifdef HAVE_STRUCT_ETHER_ADDR
572
+ #define NEED_NETINET_IF_ETHER_H
573
+ #else /* HAVE_STRUCT_ETHER_ADDR */
574
+ struct ether_addr {
575
+ /* Beware FreeBSD calls this "octet". */
576
+ unsigned char ether_addr_octet[ MAC_ADDR_LEN] ;
577
+ };
578
+ #endif /* HAVE_STRUCT_ETHER_ADDR */
579
+ #endif /* what declares ether_ntohost() */
580
+
581
+ #ifdef NEED_NETINET_IF_ETHER_H
582
+ /*
583
+ * Include diag-control.h before <net/if.h>, which too defines a macro
584
+ * named ND_UNREACHABLE.
585
+ */
586
+ #include "diag-control.h"
587
+ #include <net/if.h> /* Needed on some platforms */
588
+ #include <netinet/in.h> /* Needed on some platforms */
589
+ #include <netinet/if_ether.h>
590
+ #endif /* NEED_NETINET_IF_ETHER_H */
591
+
592
+ #ifndef HAVE_DECL_ETHER_NTOHOST
593
+ /*
594
+ * No header declares it, so declare it ourselves.
595
+ */
596
+ extern int ether_ntohost(char *, const struct ether_addr *);
597
+ #endif /* !defined(HAVE_DECL_ETHER_NTOHOST) */
598
+ #include <stdlib.h>
599
+ #include <sys/types.h>
600
+ #include <sys/param.h>
601
+ #include <sys/socket.h>
602
+
603
+ int
604
+ main(int argc, char **argv)
605
+ {
606
+ u_char ea[ 6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
607
+ char name[ MAXHOSTNAMELEN] ;
608
+
609
+ ether_ntohost(name, (struct ether_addr *)ea);
610
+ exit(0);
611
+ }
612
+ ] ] )
613
+ ] , [ ac_cv_buggy_ether_ntohost=no] ,
614
+ [ ac_cv_buggy_ether_ntohost=yes] ,
615
+ [ ac_cv_buggy_ether_ntohost="not while cross-compiling"] ) ] )
616
+ if test "$ac_cv_buggy_ether_ntohost" = "no"; then
617
+ AC_DEFINE ( USE_ETHER_NTOHOST , 1 ,
618
+ [ define if you have ether_ntohost() and it works] )
619
+ fi
620
+ ] )
566
621
567
622
#
568
623
# Do we have the new open API? Check for pcap_create, and assume that,
0 commit comments