summaryrefslogtreecommitdiffstats
path: root/patches/zip30/zip-2.32-use-cross-cpp.diff
blob: f56476a2c9275e04bd13d6035ef092c749ffc1ae (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
From: Robert Schwebel <r.schwebel@pengutronix.de>
Subject: zip: use $(CPP) instead of hand crafted cpp paths if specified

The configurescript tries to be intelligent and wants to guess where the
preprocessor lives. However, this badly fails in cross scenarios. We
want to use $(CPP) if the user has specified it.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>

---
 unix/Makefile  |    8 ++++----
 unix/configure |   20 +++++++++++---------
 2 files changed, 15 insertions(+), 13 deletions(-)

Index: zip30/unix/Makefile
===================================================================
--- zip30.orig/unix/Makefile
+++ zip30/unix/Makefile
@@ -25,7 +25,7 @@ LN = ln -s
 CC = cc
 BIND = $(CC)
 AS = $(CC) -c
-CPP = /lib/cpp
+CPP = $(CPP)
 E =
 
 # probably can change this to 'install' if you have it
@@ -202,7 +202,7 @@ generic: flags
 	eval $(MAKE) $(MAKEF) zips `cat flags`
 
 generic_gcc:
-	$(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E"
+	$(MAKE) $(MAKEF) generic CC=gcc CPP=$(CPP)
 
 # AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
 att6300nodir:
@@ -227,11 +227,11 @@ cray_v3:
 
 # Cygwin
 cygwin:
-	$(MAKE) $(MAKEF) generic CC="gcc" CPP="gcc -E" EXE=".exe"
+	$(MAKE) $(MAKEF) generic CC="gcc" CPP=$(CPP) EXE=".exe"
 
 # LynxOS
 lynx:
-	$(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E" CFLAGS="$(CFLAGS) \
+	$(MAKE) $(MAKEF) generic CC=gcc CPP=$(CPP) CFLAGS="$(CFLAGS) \
 	 -DNO_UNDERLINE -DLynx -DLYNX LFLAGS2="$LFLAGS2 -lc_p"
 
 # MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
Index: zip30/unix/configure
===================================================================
--- zip30.orig/unix/configure
+++ zip30/unix/configure
@@ -218,15 +218,17 @@ 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"
+if test -z "$CPP"; then
+  # 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"
+fi
 
 echo "#include <stdio.h>" > conftest.c
 $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"