forked from jwt27/djgpp-cvs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
174 lines (162 loc) · 4.64 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT([dj64dev], [0.2])
AC_CONFIG_FILES([Makefile.conf src/gcc.opt
dj64.pc
dj64_s.pc
dj64static.pc
djdev64.pc
djstub64.pc
])
VERSION="$PACKAGE_VERSION"
AC_SUBST(VERSION)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AX_PROG_CC_FOR_BUILD
CFLAGS="$CFLAGS \
-fno-common \
-fpic \
-ffreestanding \
-flto=auto \
-nostdinc \
-ggdb3 \
-Og \
-Wall \
-Wcast-qual \
-Werror \
-Wno-parentheses \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wpointer-arith \
-Wshadow \
-Wwrite-strings \
-Wundef \
-Wno-array-bounds \
-Wno-unneeded-internal-declaration \
-Wno-unknown-warning-option \
-Wsign-compare"
machine=`$CC -dumpmachine | cut -d- -f1 | sed 's/i.86/i386/'`
AC_MSG_CHECKING([for $CC actually being clang])
if $CC -v 2>&1 | grep 'clang' >/dev/null; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for clang >= 3.7])
clang_ver=`$CC -v 2>&1 | grep version | sed 's/.*version //' | cut -d " " -f 1`
clang_maj=`echo $clang_ver | cut -d "." -f 1`
clang_mid=`echo $clang_ver | cut -d "." -f 2`
if test $clang_maj -ge 3 -a $clang_mid -ge 7 -o $clang_maj -ge 4 ; then
AC_MSG_RESULT([yes, $clang_ver])
else
AC_MSG_RESULT([no, $clang_ver])
AC_MSG_ERROR([Need clang-3.7 or newer, or use gcc instead])
fi
CC_IS_CLANG=1
else
AC_MSG_RESULT([no])
CC_IS_CLANG=0
fi
AC_SUBST(CC_IS_CLANG)
if test -n "$CROSS_PREFIX"; then
AC_PATH_PROG([CROSS_AS], [${CROSS_PREFIX}as])
if test -z "$CROSS_AS"; then
AC_MSG_ERROR([${CROSS_PREFIX}as not found, CROSS_PREFIX is wrong])
fi
else
AC_PATH_PROGS([CROSS_AS], [i686-linux-gnu-as i386-elf-as])
fi
if test -z "$CROSS_AS"; then
if test "$CONFIG_HOST" = "Darwin"; then
AC_MSG_ERROR([Please install i386-elf-binutils from https://github.com/nativeos/homebrew-i386-elf-toolchain])
fi
AC_PATH_PROG([CROSS_AS], [x86_64-linux-gnu-as])
if test -z "$CROSS_AS"; then
if test "$machine" = "i386" -o "$machine" = "x86_64"; then
AC_PATH_PROG([CROSS_AS], [as])
if test -z "$CROSS_AS"; then
AC_PATH_PROG([CROSS_AS], [clang])
if test -z "$CROSS_AS"; then
AC_MSG_ERROR([gnu assembler not found, please install clang or binutils])
else
CROSS_ASFLAGS="-m32 -x assembler -c"
fi
else
CROSS_ASFLAGS="--32"
fi
else
AC_PATH_PROG([CROSS_AS], [clang])
if test -n "$CROSS_AS"; then
CROSS_ASFLAGS="-x assembler -target i686-unknown-linux-gnu -c"
else
AC_MSG_ERROR([386 assembler not found, please install clang or binutils-i686-linux-gnu])
fi
fi
else
CROSS_ASFLAGS="--32"
fi
fi
AC_SUBST(CROSS_ASFLAGS)
if test -n "$CROSS_PREFIX"; then
AC_PATH_PROG([CROSS_LD], [${CROSS_PREFIX}ld])
if test -z "$CROSS_LD"; then
AC_MSG_ERROR([${CROSS_PREFIX}ld not found, CROSS_PREFIX is wrong])
fi
else
AC_PATH_PROGS([CROSS_LD], [i686-linux-gnu-ld i386-elf-ld x86_64-linux-gnu-ld ld.lld])
fi
if test -z "$CROSS_LD"; then
if test "$machine" = "i386" -o "$machine" = "x86_64"; then
AC_PATH_PROGS([CROSS_LD], [ld])
fi
fi
if test -z "$CROSS_LD"; then
AC_MSG_ERROR([cross-ld not found])
fi
AC_MSG_CHECKING([ld supports --image-base])
if ! $CROSS_LD --image-base=0x0 -v >/dev/null 2>&1; then
AC_MSG_RESULT([no, using -Ttext-segment])
XLD_IMB_OPT=-Ttext-segment
else
AC_MSG_RESULT([yes])
XLD_IMB_OPT=--image-base
fi
AC_SUBST(XLD_IMB_OPT)
if test -n "$CROSS_PREFIX"; then
AC_PATH_PROG([CROSS_AR], [${CROSS_PREFIX}ar])
if test -z "$CROSS_AR"; then
AC_MSG_ERROR([${CROSS_PREFIX}ar not found, CROSS_PREFIX is wrong])
fi
else
AC_PATH_PROGS([CROSS_AR], [i686-linux-gnu-ar i386-elf-ar x86_64-linux-gnu-ar llvm-ar])
fi
if test -z "$CROSS_AR"; then
if test "$machine" = "i386" -o "$machine" = "x86_64"; then
AC_PATH_PROGS([CROSS_AR], [ar])
fi
fi
if test -z "$CROSS_AR"; then
AC_MSG_ERROR([cross-ar not found])
fi
if test -n "$CROSS_PREFIX"; then
AC_PATH_PROG([CROSS_STRIP], [${CROSS_PREFIX}strip])
if test -z "$CROSS_STRIP"; then
AC_MSG_ERROR([${CROSS_PREFIX}strip not found, CROSS_PREFIX is wrong])
fi
else
AC_PATH_PROGS([CROSS_STRIP], [i686-linux-gnu-strip i386-elf-strip x86_64-linux-gnu-strip llvm-strip])
fi
if test -z "$CROSS_STRIP"; then
if test "$machine" = "i386" -o "$machine" = "x86_64"; then
AC_PATH_PROGS([CROSS_STRIP], [strip])
fi
fi
if test -z "$CROSS_STRIP"; then
AC_MSG_ERROR([cross-strip not found])
fi
AC_CHECK_PROGS([UCTAGS], [uctags ctags])
AC_CHECK_PROGS([URTAGS], [ureadtags readtags])
if test -z "$UCTAGS" -o -z "$URTAGS"; then
AC_MSG_ERROR([universal-ctags not installed])
fi
if ! $UCTAGS --version | grep "Universal Ctags" >/dev/null; then
AC_MSG_ERROR([bsd ctags do not suit, install universal-ctags])
fi
AC_OUTPUT