summaryrefslogtreecommitdiff
path: root/packages/libnet/libnet-1.1.2.1/fix-endianess-test.patch
blob: e75ce6737adf3500342172b05f4215ae68c2f3d3 (plain)
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
Use autoconf's endian check instead of the locally defined check
so that we can determine the endianess without having to compile
a program.

Idea from http://www.security-lists.org/lists/libnet/2003/03/00001.html

Also remove the old test from aclocal.m4.

--- libnet/configure.in	2005/11/15 03:49:30	1.1
+++ libnet/configure.in	2005/11/15 03:50:29
@@ -7,6 +7,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 
+AC_PREREQ(2.52)
 AC_INIT(src/libnet_build_ip.c)
 LIBNET_VERSION=`cat VERSION`
 AC_MSG_RESULT(beginning autoconfiguration process for libnet-$LIBNET_VERSION...)
@@ -29,7 +30,16 @@
 dnl And some custom things
 dnl
 
-AC_LIBNET_ENDIAN_CHECK
+AC_C_BIGENDIAN([
+ AC_DEFINE(LIBNET_BIG_ENDIAN)
+ ENDIANESS="LIBNET_BIG_ENDIAN"
+ LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN"
+],[
+ AC_DEFINE(LIBNET_LIL_ENDIAN)
+ ENDIANESS="LIBNET_LIL_ENDIAN"
+ LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN"
+], AC_MSG_WARN(cannot detect endianess. try setting ac_cv_c_bigendian to yes or no)) 
+
 AC_LBL_UNALIGNED_ACCESS
 dnl AC_LBL_LIBRARY_NET
 
--- libnet/aclocal.m4	2005/11/15 04:02:01	1.1
+++ libnet/aclocal.m4	2005/11/15 04:03:43
@@ -279,87 +279,6 @@
 
 
 dnl
-dnl Checks endianess
-dnl
-dnl usage:
-dnl
-dnl     AC_LIBNET_ENDIAN_CHECK
-dnl
-dnl results:
-dnl
-dnl     LIBNET_BIG_ENDIAN = 1   or
-dnl     LIBNET_LIL_ENDIAN = 1
-dnl
-
-AC_DEFUN(AC_LIBNET_ENDIAN_CHECK,
-    [AC_MSG_CHECKING(machine endianess)
-
-    cat > conftest.c << EOF
-#       include <stdio.h>
-#       include <stdlib.h>
-
-        int main()
-        {
-            union
-            {
-                short s;
-                char c[[sizeof(short)]];
-            } un;
-
-            un.s = 0x0102;
-            if (sizeof (short) == 2)
-            {
-                if (un.c [[0]] == 1 && un.c [[1]] == 2)
-                {
-                    printf("B\n");
-                }
-                else
-                {
-                    if (un.c [[0]] == 2 && un.c [[1]] == 1)
-                    {
-                        printf("L\n");
-                    }
-                }
-            }
-            else
-            {
-                printf("?\n");
-            }
-            return (EXIT_SUCCESS);
-        }
-EOF
-        ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS > /dev/null 2>&1
-        # Oopz 4.3 BSD doesn't have this.  Sorry.
-        if test ! -x conftest ; then
-dnl failed to compile for some reason
-            ac_cv_libnet_endianess=unknown
-        else
-            ./conftest > conftest.out
-            result=`cat conftest.out`
-            if test $result = "B"; then
-                ac_cv_libnet_endianess=big
-            elif test $result = "L"; then
-                ac_cv_libnet_endianess=lil
-            else
-                ac_cv_libnet_endianess=unknown
-            fi                                
-        fi
-        rm -f conftest* core core.conftest
-
-        AC_MSG_RESULT($ac_cv_libnet_endianess)
-
-        if test $ac_cv_libnet_endianess = big ; then
-            AC_DEFINE(LIBNET_BIG_ENDIAN)
-            ENDIANESS="LIBNET_BIG_ENDIAN"
-            LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN"
-        elif test $ac_cv_libnet_endianess = lil ; then
-            AC_DEFINE(LIBNET_LIL_ENDIAN)
-            ENDIANESS="LIBNET_LIL_ENDIAN"
-            LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN"
-        fi
-    ])
-
-dnl
 dnl Improved version of AC_CHECK_LIB
 dnl
 dnl Thanks to John Hawkinson (jhawk@mit.edu)