-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·271 lines (249 loc) · 8.42 KB
/
configure
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#!/bin/sh
# -----------------
# einit module-configure script
# -----------------
# tiny configure script... i might consider adding more on this some other time...
# (i'm just trying to make sure I don't violate any licenses by specifically not using any non-LGPL GPL tools)
# -----------------
# Copyright (c) 2006, Magnus Deininger
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
# the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
# following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
# the following disclaimer in the documentation and/or other materials provided with the distribution.
# * Neither the name of the project nor the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------
INCLUDEPATH="/usr/local/include"
BUILDNUMBER=`cat buildnumber`
if test -d .svn; then
ISSVN=1
echo "configuring eINIT-svn-${BUILDNUMBER}..."
else
ISSVN=0
echo "configuring eINIT-${BUILDNUMBER}..."
fi
PMODULES=""
echo -n "checking options [";
for param in $@; do
short=${param%%=*};
if test "$short" = "--prefix"; then
echo -n " PREFIX";
PREFIX=${param#*=};
elif test "$short" = "--tree-type"; then
echo -n " TREETYPE";
TREETYPE=${param#*=};
elif test "$short" = "--set-type"; then
echo -n " SETTYPE";
SETTYPE=${param#*=};
elif test "$short" = "--with-include"; then
echo -n " INCLUDE";
INCLUDEPATH="${INCLUDEPATH} ${param#*=}";
elif test "$short" = "--host"; then
echo -n " HOST";
RCHOST="${param#*=}";
elif test "$short" = "--target"; then
echo -n " TARGET";
RCTARGET="${param#*=}";
elif test "$short" = "--version"; then
echo -n " VERSION";
RCVERSION="${param#*=}";
elif test "$param" = "--debug"; then
echo -n " DEBUG";
XCFLAGS="$XCFLAGS -DDEBUG -g";
elif test "$param" = "--enable-linux"; then
echo -n " LINUX";
PMODULES="$PMODULES linux";
elif test "$param" = "--enable-bsd"; then
echo -n " BSD";
PMODULES="$PMODULES bsd";
elif test "$param" = "--enable-efl"; then
echo -n " EFL";
PMODULES="$PMODULES efl";
elif test "$param" = "--help"; then
echo -n " HELP";
HELP="1";
elif test "$param" = "--bitch-a-lot"; then
echo -n " BITCHY";
XCFLAGS="$XCFLAGS -Wall -DBITCHY";
elif test "$param" = "--use-posix-regex"; then
echo -n " REGEX";
XCFLAGS="$XCFLAGS -DPOSIXREGEX";
elif test "$param" = "--pthread-wait-bug"; then
echo -n " PTHREAD-WAIT-BUG";
XCFLAGS="$XCFLAGS -DBUGGY_PTHREAD_CHILD_WAIT_HANDLING";
elif test "$param" = "--no-nix-environ"; then
echo -n " NO-NIX-ENVIRON";
XCFLAGS="$XCFLAGS -DNONIXENVIRON";
elif test "$param" = "--svn"; then
echo -n " SVN";
ISSVN=1;
elif test "$param" = "--static"; then
echo -n " STATIC";
STATIC=1;
elif test "$param" = "--ebuild"; then
echo -n " EBUILD";
EBUILD="1";
fi;
done;
echo " ]";
if test "$HELP" = "1"; then
echo "Usage:
./configure [--prefix=path] [--enable-*] [--debug] [--help]
Options:
--prefix=path use this to set a path to install to (absolute!)
--with-include=path use this to set a path to install to (absolute!)
--enable-linux enable compilation of linux-specific modules
--enable-bsd enable compilation of bsd-specific modules
--enable-efl enable compilation of modules that utilise the efl
--bitch-a-lot tell all programs used to compile and link to be more
verbose
--use-posix-regex use posix.2 regular expressions
--pthread-wait-bug some pthreads implementations don't allow all threads
in one process to wait on other processes' children
--tree-type= define the type of tree-structures einit should use.
--debug will #define DEBUG.
--static build with static libs
--help display this text and exit.
--svn indicate that this is a build off SVN.
--ebuild indicate that this script was called from portage/e.a.";
exit;
fi;
echo -n "/etc/make.conf ["
if test "$EBUILD" = "1"; then
echo -n " skipping (ebuild)";
elif test -n ""${CFLAGS}; then
echo -n " skipping (CFLAGS set)";
elif test -f /etc/make.conf; then
echo -n " sourcing";
source /etc/make.conf;
else
echo -n " not found";
fi
echo " ]"
if test -n "$RCHOST"; then CHOST=$RCHOST; fi;
if test -n "$RCTARGET"; then CTARGET=$RCTARGET; fi;
#GCCVERSION=`gcc --version`;
echo -n "checking system type... "
if test -n "$CHOST"; then
CHOST=$CHOST;
else
# CHOST=${GCCVERSION%%gcc-* *};
# CHOST="${CHOST}libc";
CHOST="gcc";
fi
echo " $CHOST";
echo -n "checking target system type... "
if test -n "$CTARGET"; then
CTARGET=$CTARGET;
else
CTARGET=$CHOST;
fi
echo " $CTARGET";
echo -n "checking for a compiler... "
if test -n "$CC"; then
echo "got one! ($CC)";
else
if test -x "$(which ${CTARGET}-gcc-${RCVERSION} 2>/dev/null)"; then CC="${CTARGET}-gcc-${RCVERSION}";
elif test -x "$(which ${CTARGET}-gcc 2>/dev/null)"; then CC="${CTARGET}-gcc";
elif test -x "$(which ${CTARGET}-cc 2>/dev/null)"; then CC="${CTARGET}-cc";
elif test -x "$(which ${CHOST}-gcc-${RCVERSION} 2>/dev/null)"; then CC="${CHOST}-gcc-${RCVERSION}";
elif test -x "$(which ${CHOST}-gcc 2>/dev/null)"; then CC="${CHOST}-gcc";
elif test -x "$(which ${CHOST}-cc 2>/dev/null)"; then CC="${CHOST}-cc";
elif test -x "$(which gcc 2>/dev/null)"; then CC=cc;
elif test -x "$(which icc 2>/dev/null)"; then CC=cc;
elif test -x "$(which cc 2>/dev/null)"; then CC=cc; fi;
if test -n "$CC"; then
echo "$CC";
else
echo "no compiler found, bailing out!"; exit;
fi;
fi
echo "finding absolute include directory..."
INCLUDE="";
echo -n "checking system type... "
CCL="\${CC} \${INCLUDE} \${CFLAGS} -fPIC"
if test -n "`uname -a|grep -i 'darwin kernel'`"; then
echo "Darwin";
XCFLAGS="$XCFLAGS -DDARWIN -DPOSIX -DBSD";
XDYNAMIC="";
LLD="-bundle -Wl,-bundle_loader,`pwd`/src/einit";
STATIC="";
elif test -n "`uname -a|grep -i 'Linux'`"; then
echo "Linux";
XCFLAGS="$XCFLAGS -DPOSIX -DLINUX";
LLD="-shared";
XDYNAMIC="-Wl,-export-dynamic";
LPA="-lpthread";
if test "$STATIC" == "1"; then
# static linking doesn't work like this, it messes up .so modules :/
# STATIC="-static"
STATIC=""
else
STATIC=""
fi
else
echo "(guess) generic posix-ish unix";
XCFLAGS="$XCFLAGS -DPOSIX";
LLD="-shared";
XDYNAMIC="-Wl,-export-dynamic";
LPA="-lpthread";
STATIC="";
fi
if test "${PREFIX}" = "/"; then UPREFIX="${PREFIX}/usr"; else UPREFIX="${PREFIX}"; fi
if test "${EBUILD}" = "1"; then UPREFIX="${PREFIX}/usr"; fi
echo "creating config.mk..."
echo "PREFIX = $PREFIX
ETCDIR = ${PREFIX}/etc/einit
LIBDIR = ${PREFIX}/lib
MODDIR = ${PREFIX}/lib/einit
BINDIR = ${PREFIX}/bin
SBINDIR = ${PREFIX}/sbin
INCLUDEDIR = ${UPREFIX}/include
INSTALL = install
IPARAM =
SOIPARAM = \${IPARAM}
BINIPARAM = \${IPARAM}
PMODULES = $PMODULES
OPTIONS = $OPTIONS
INCLUDE = $INCLUDE
XDYNAMIC = $XDYNAMIC
BUILDNUMBER = $BUILDNUMBER
ISSVN = $ISSVN
CC = $CC
CFLAGS = $CFLAGS$XCFLAGS
LDFLAGS = $LDFLAGS
CCC = \${CC} \${INCLUDE} \${CFLAGS} -DISSVN=\${ISSVN}
CCL = $CCL -DISSVN=\${ISSVN}
CLD = \${CC} \${LDFLAGS}
LLD = \${CC} \${LDFLAGS} $LLD
XLLD = $LLD
STATIC = $STATIC
LPA = $LPA" > config.mk
if test -e src/einit; then
echo -n "cleaning the environment... "
if make clean >/dev/null 2>&1; then
echo "done";
else
echo "failed!";
fi
fi
echo -n "creating dependency information... "
touch src/depend.mk
if make depend > /dev/null; then
echo "done";
else
echo "failed!";
fi