aboutsummaryrefslogtreecommitdiff
path: root/package/infozip/0001-configure-fix-cross-build.patch
blob: 0b939b35bcf9e5ae03b224e305dc149bb6cbe0aa (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
From 941c322e4378e0ef09f21bfd7b2a337b8f812629 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@openwide.fr>
Date: Mon, 27 Jan 2014 22:42:53 +0100
Subject: [PATCH 1/1] configure: fix cross-compilation issues

- Use CFLAGS from command line

- Remove "Check C compiler type (optimization options)"
  This test force optimization to -O3
  while it is already set in CFLAGS

- Don't use host CPP

- Remove "Check for Large File Support"
  LFS support is already set in CFLAGS

Note: configure script still use host nm

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
 unix/Makefile  |   4 +-
 unix/configure | 161 +--------------------------------------------------------
 2 files changed, 3 insertions(+), 162 deletions(-)

diff --git a/unix/Makefile b/unix/Makefile
index abd0c44..8388c74 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -58,7 +58,7 @@ IZ_OUR_BZIP2_DIR = bzip2
 #   LFLAGS1   flags after output file spec, before obj file list
 #   LFLAGS2   flags after obj file list (libraries, etc)
 CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
-CFLAGS = -O2 $(CFLAGS_NOOPT)
+CFLAGS ?= -O2 $(CFLAGS_NOOPT)
 LFLAGS1 =
 LFLAGS2 = -s
 
@@ -177,7 +177,7 @@ uninstall:
 
 
 flags:  unix/configure
-	sh unix/configure "${CC}" "${CFLAGS_NOOPT}" "${IZ_BZIP2}"
+	sh unix/configure "${CC}" "${CFLAGS}" "${IZ_BZIP2}"
 
 # These symbols, when #defined using -D have these effects on compilation:
 # ZMEM                  - includes C language versions of memset(), memcpy(),
diff --git a/unix/configure b/unix/configure
index 73ba803..57272db 100644
--- a/unix/configure
+++ b/unix/configure
@@ -22,109 +22,9 @@ LFLAGS1=''
 LFLAGS2=''
 LN="ln -s"
 
-CFLAGS_OPT=''
-
 # bzip2
 IZ_BZIP2=${3-}
-CFLAGS_BZ=''
-
-
-echo 'Check C compiler type (optimization options)'
-# Sun C?
-cat > conftest.c << _EOF_
-int main()
-{
-#ifndef __SUNPRO_C
-   bad code
-#endif
-   return 0;
-}
-_EOF_
-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-if test $? -eq 0; then
-  CFLAGS_OPT='-xO3'
-  echo "  Sun C ($CFLAGS_OPT)"
-else
-  # Tru64 DEC/Compaq/HP C?
-  cat > conftest.c << _EOF_
-int main()
-{
-#ifndef __DECC
-   bad code
-#endif
-   return 0;
-}
-_EOF_
-  $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-  if test $? -eq 0; then
-    CFLAGS_OPT='-O3'
-    echo "  DEC C ($CFLAGS_OPT)"
-  else
-    # HP-UX HP C?
-    cat > conftest.c << _EOF_
-int main()
-{
-#ifdef __GNUC__
-   bad code
-#endif
-#ifndef __hpux
-   bad code
-#endif
-   return 0;
-}
-_EOF_
-    $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-    if test $? -eq 0; then
-      # HP-UX, not GCC.  Lame bundled or real ANSI compiler?
-      CFLAGS_OPT_TRY="+O3 +Onolimit"
-      $CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
-       grep '(Bundled)' > /dev/null
-      if test $? -ne 0; then
-        CFLAGS_OPT="$CFLAGS_OPT_TRY"
-        echo "  HP-UX ANSI C ($CFLAGS_OPT)"
-      else
-        echo '  HP-UX Bundled C (no opt)'
-      fi
-    else
-      # GNU C?
-      cat > conftest.c << _EOF_
-int main()
-{
-#ifndef __GNUC__
-   bad code
-#endif
-   return 0;
-}
-_EOF_
-      $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-      if test $? -eq 0; then
-        CFLAGS_OPT='-O3'
-        echo "  GNU C ($CFLAGS_OPT)"
-        # Special Mac OS X shared library "ld" option?
-        if test ` uname -s 2> /dev/null ` = 'Darwin'; then
-          lf='-Wl,-search_paths_first'
-          $CC $CFLAGS $lf conftest.c > /dev/null 2>/dev/null
-          if test $? -eq 0; then
-            LFLAGS2="${LFLAGS2} ${lf}"
-          fi
-          rm -f conftest
-        fi
-      else
-        CFLAGS_OPT='-O'
-        echo "  Other-unknown C ($CFLAGS_OPT)"
-      fi
-    fi
-  fi
-fi
-
-# optimization flags
-if test -n "${CFLAGS_OPT}"; then
-  CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
-  CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
-fi
-
-
-# bzip2
+CFLAGS_BZ="${CFLAGS}"
 
 echo "Check bzip2 support"
 CC_BZ="${CC}"
@@ -220,13 +120,6 @@ fi
 echo Check for the C preprocessor
 # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
 CPP="${CC} -E"
-# solaris as(1) needs -P, maybe others as well ?
-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
-[ -f /lib/cpp ] && CPP=/lib/cpp
-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
-[ -f /xenix ] && CPP="${CC} -E"
-[ -f /lynx.os ] && CPP="${CC} -E"
 
 echo "#include <stdio.h>" > conftest.c
 $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
@@ -398,58 +291,6 @@ else
   fi
 fi
 
-
-# Now we set the 64-bit file environment and check the size of off_t
-# Added 11/4/2003 EG
-# Revised 8/12/2004 EG
-
-echo Check for Large File Support
-cat > conftest.c << _EOF_
-# define _LARGEFILE_SOURCE       /* some OSes need this for fseeko */
-# define _LARGEFILE64_SOURCE
-# define _FILE_OFFSET_BITS 64       /* select default interface as 64 bit */
-# define _LARGE_FILES        /* some OSes need this for 64-bit off_t */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-int main()
-{
-  off_t offset;
-  struct stat s;
-  /* see if have 64-bit off_t */
-  if (sizeof(offset) < 8)
-    return 1;
-  printf("  off_t is %d bytes\n", sizeof(off_t));
-  /* see if have 64-bit stat */
-  if (sizeof(s.st_size) < 8) {
-    printf("  s.st_size is %d bytes\n", sizeof(s.st_size));
-    return 2;
-  }
-  return 3;
-}
-_EOF_
-# compile it
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
-  echo -- no Large File Support
-else
-# run it
-  ./conftest
-  r=$?
-  if [ $r -eq 1 ]; then
-    echo -- no Large File Support - no 64-bit off_t
-  elif [ $r -eq 2 ]; then
-    echo -- no Large File Support - no 64-bit stat
-  elif [ $r -eq 3 ]; then
-    echo -- yes we have Large File Support!
-    CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
-  else
-    echo -- no Large File Support - conftest returned $r
-  fi
-fi
-
-
 # Check for wide char for Unicode support
 # Added 11/24/2005 EG
 
-- 
1.8.5.3