summaryrefslogtreecommitdiffstats
path: root/patches/libnet-1.1.3-RC-01/01-libnet-1.1.3-RC01-endianess.diff
blob: 02a501c8887f044c90c8c0a5fb941215bec756bb (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
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
--- libnet-1.1.3-RC-01-orig/acinclude.m4	2004-11-09 18:25:31.000000000 +0100
+++ libnet-1.1.3-RC-01/acinclude.m4	2005-12-31 00:06:08.000000000 +0100
@@ -98,7 +98,9 @@
     else
         ac_libnet_have_packet_socket=`./pf_packet-test`;
     fi
-    if test $ac_libnet_have_packet_socket = choked; then
+    if test x$ac_libnet_have_packet_socket = x; then
+	AC_MSG_RESULT([test program run choked... if cross-compiling, set ac_libnet_have_packet_socket to yes or no])
+    elif test $ac_libnet_have_packet_socket = choked; then
         AC_MSG_RESULT(test program compile choked... assuming no)
     elif test $ac_libnet_have_packet_socket = yes; then
         AC_MSG_RESULT(yes)
@@ -268,89 +270,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, 1,
-                [We are running on a big-endian machine.])
-            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, 1, 
-                [We are running on a little-endian machine.])
-            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)
--- libnet-1.1.3-RC-01-orig/autogen.sh	2004-11-09 17:21:58.000000000 +0100
+++ libnet-1.1.3-RC-01/autogen.sh	2005-12-31 00:09:49.000000000 +0100
@@ -12,7 +12,7 @@
 rm -fr autom4te.cache
 libtoolize --copy --force
 aclocal -I .
-autoheader
+#autoheader
 automake -a -c --foreign
 autoconf
 rm -fr autom4te.cache
--- libnet-1.1.3-RC-01-orig/configure.in	2005-12-30 23:58:58.000000000 +0100
+++ libnet-1.1.3-RC-01/configure.in	2005-12-31 00:10:37.000000000 +0100
@@ -6,6 +6,7 @@
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
+AC_PREREQ(2.52)
 AC_INIT(Packet construction library, 1.1.3-RC-01)
 AC_MSG_RESULT(beginning autoconfiguration process for libnet-${PACKAGE_VERSION} ...)
 AC_CANONICAL_SYSTEM
@@ -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
 
@@ -261,7 +271,9 @@
 
 esac
 
-AC_OUTPUT(Makefile src/Makefile include/Makefile \
-    include/libnet/Makefile sample/Makefile version.h include/libnet.h \
-    libnet-config, chmod +x libnet-config)
+AC_CONFIG_FILES(Makefile src/Makefile include/Makefile \
+    include/libnet/Makefile sample/Makefile version.h include/libnet.h)
+AC_CONFIG_FILES(libnet-config, [chmod +x libnet-config])
+AC_OUTPUT
+
 dnl EOF