1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # tcc configure script (c) 2003 Fabrice Bellard
|
---|
4 |
|
---|
5 | # set temporary file name
|
---|
6 | # if test ! -z "$TMPDIR" ; then
|
---|
7 | # TMPDIR1="${TMPDIR}"
|
---|
8 | # elif test ! -z "$TEMPDIR" ; then
|
---|
9 | # TMPDIR1="${TEMPDIR}"
|
---|
10 | # else
|
---|
11 | # TMPDIR1="/tmp"
|
---|
12 | # fi
|
---|
13 | #
|
---|
14 | # bashism: TMPN="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c"
|
---|
15 |
|
---|
16 | TMPN="./conftest-$$"
|
---|
17 | TMPH=$TMPN.h
|
---|
18 |
|
---|
19 | # default parameters
|
---|
20 | prefix=""
|
---|
21 | execprefix=""
|
---|
22 | bindir=""
|
---|
23 | libdir=""
|
---|
24 | tccdir=""
|
---|
25 | includedir=""
|
---|
26 | mandir=""
|
---|
27 | infodir=""
|
---|
28 | sysroot=""
|
---|
29 | cross_prefix=""
|
---|
30 | cc="gcc"
|
---|
31 | ar="ar"
|
---|
32 | strip="strip"
|
---|
33 | bigendian="no"
|
---|
34 | mingw32="no"
|
---|
35 | LIBSUF=".a"
|
---|
36 | EXESUF=""
|
---|
37 | DLLSUF=".so"
|
---|
38 | tcc_sysincludepaths=""
|
---|
39 | tcc_libpaths=""
|
---|
40 | tcc_crtprefix=""
|
---|
41 | tcc_elfinterp=""
|
---|
42 | triplet=
|
---|
43 | tcc_lddir=
|
---|
44 | confvars=
|
---|
45 | suggest="yes"
|
---|
46 | cpu=
|
---|
47 | cpuver=
|
---|
48 | gcc_major=0
|
---|
49 | gcc_minor=0
|
---|
50 |
|
---|
51 | # OS specific
|
---|
52 | targetos=`uname`
|
---|
53 | case $targetos in
|
---|
54 | Darwin)
|
---|
55 | confvars="$confvars OSX"
|
---|
56 | DLLSUF=".dylib"
|
---|
57 | ;;
|
---|
58 | MINGW*|MSYS*|CYGWIN*)
|
---|
59 | mingw32=yes
|
---|
60 | ;;
|
---|
61 | DragonFly|OpenBSD|FreeBSD|NetBSD)
|
---|
62 | confvars="$confvars ldl=no"
|
---|
63 | ;;
|
---|
64 | *)
|
---|
65 | ;;
|
---|
66 | esac
|
---|
67 |
|
---|
68 | # find source path
|
---|
69 | source_path=${0%configure}
|
---|
70 | source_path=${source_path%/}
|
---|
71 | source_path_used="yes"
|
---|
72 | if test -z "$source_path" -o "$source_path" = "." ; then
|
---|
73 | source_path=`pwd`
|
---|
74 | source_path_used="no"
|
---|
75 | fi
|
---|
76 |
|
---|
77 | for opt do
|
---|
78 | eval opt=\"$opt\"
|
---|
79 | case "$opt" in
|
---|
80 | --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
|
---|
81 | ;;
|
---|
82 | --exec-prefix=*) execprefix=`echo $opt | cut -d '=' -f 2`
|
---|
83 | ;;
|
---|
84 | --tccdir=*) tccdir=`echo $opt | cut -d '=' -f 2`
|
---|
85 | ;;
|
---|
86 | --bindir=*) bindir=`echo $opt | cut -d '=' -f 2`
|
---|
87 | ;;
|
---|
88 | --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`
|
---|
89 | ;;
|
---|
90 | --includedir=*) includedir=`echo $opt | cut -d '=' -f 2`
|
---|
91 | ;;
|
---|
92 | --sharedir=*) sharedir=`echo $opt | cut -d '=' -f 2`
|
---|
93 | ;;
|
---|
94 | --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
|
---|
95 | ;;
|
---|
96 | --infodir=*) infodir=`echo $opt | cut -d '=' -f 2`
|
---|
97 | ;;
|
---|
98 | --docdir=*) docdir=`echo $opt | cut -d '=' -f 2`
|
---|
99 | ;;
|
---|
100 | --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2`
|
---|
101 | ;;
|
---|
102 | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
|
---|
103 | ;;
|
---|
104 | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
|
---|
105 | ;;
|
---|
106 | --cc=*) cc=`echo $opt | cut -d '=' -f 2`
|
---|
107 | ;;
|
---|
108 | --ar=*) ar=`echo $opt | cut -d '=' -f 2`
|
---|
109 | ;;
|
---|
110 | --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
|
---|
111 | ;;
|
---|
112 | --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
|
---|
113 | ;;
|
---|
114 | --extra-libs=*) extralibs="${opt#--extra-libs=}"
|
---|
115 | ;;
|
---|
116 | --sysincludepaths=*) tcc_sysincludepaths=`echo $opt | cut -d '=' -f 2`
|
---|
117 | ;;
|
---|
118 | --libpaths=*) tcc_libpaths=`echo $opt | cut -d '=' -f 2`
|
---|
119 | ;;
|
---|
120 | --crtprefix=*) tcc_crtprefix=`echo $opt | cut -d '=' -f 2`
|
---|
121 | ;;
|
---|
122 | --elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
|
---|
123 | ;;
|
---|
124 | --triplet=*) triplet=`echo $opt | cut -d '=' -f 2`
|
---|
125 | ;;
|
---|
126 | --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
|
---|
127 | ;;
|
---|
128 | --enable-cross) confvars="$confvars cross"
|
---|
129 | ;;
|
---|
130 | --disable-static) confvars="$confvars static=no"
|
---|
131 | ;;
|
---|
132 | --enable-static) confvars="$confvars static"
|
---|
133 | ;;
|
---|
134 | --disable-rpath) confvars="$confvars rpath=no"
|
---|
135 | ;;
|
---|
136 | --strip-binaries) confvars="$confvars strip"
|
---|
137 | ;;
|
---|
138 | --with-libgcc) confvars="$confvars libgcc"
|
---|
139 | ;;
|
---|
140 | --with-selinux) confvars="$confvars selinux"
|
---|
141 | ;;
|
---|
142 | --config-mingw32*) mingw32=$(echo "$opt=yes" | cut -d '=' -f 2)
|
---|
143 | ;;
|
---|
144 | --config-*) confvars="$confvars ${opt#--config-}"; suggest="no"
|
---|
145 | ;;
|
---|
146 | --help|-h) show_help="yes"
|
---|
147 | ;;
|
---|
148 | *) echo "configure: WARNING: unrecognized option $opt"
|
---|
149 | ;;
|
---|
150 | esac
|
---|
151 | done
|
---|
152 |
|
---|
153 | if test -z "$cpu" ; then
|
---|
154 | if test -n "$ARCH" ; then
|
---|
155 | cpu="$ARCH"
|
---|
156 | else
|
---|
157 | cpu=`uname -m`
|
---|
158 | fi
|
---|
159 | fi
|
---|
160 |
|
---|
161 | case "$cpu" in
|
---|
162 | x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
|
---|
163 | cpu="i386"
|
---|
164 | ;;
|
---|
165 | x86_64|amd64|x86-64)
|
---|
166 | cpu="x86_64"
|
---|
167 | ;;
|
---|
168 | arm*)
|
---|
169 | case "$cpu" in
|
---|
170 | arm|armv4l)
|
---|
171 | cpuver=4
|
---|
172 | ;;
|
---|
173 | armv5tel|armv5tejl)
|
---|
174 | cpuver=5
|
---|
175 | ;;
|
---|
176 | armv6j|armv6l)
|
---|
177 | cpuver=6
|
---|
178 | ;;
|
---|
179 | armv7a|armv7l)
|
---|
180 | cpuver=7
|
---|
181 | ;;
|
---|
182 | esac
|
---|
183 | cpu="arm"
|
---|
184 | ;;
|
---|
185 | aarch64)
|
---|
186 | cpu="aarch64"
|
---|
187 | ;;
|
---|
188 | alpha)
|
---|
189 | cpu="alpha"
|
---|
190 | ;;
|
---|
191 | "Power Macintosh"|ppc|ppc64)
|
---|
192 | cpu="ppc"
|
---|
193 | ;;
|
---|
194 | mips)
|
---|
195 | cpu="mips"
|
---|
196 | ;;
|
---|
197 | s390)
|
---|
198 | cpu="s390"
|
---|
199 | ;;
|
---|
200 | *)
|
---|
201 | echo "Unsupported CPU"
|
---|
202 | exit 1
|
---|
203 | ;;
|
---|
204 | esac
|
---|
205 |
|
---|
206 | # Checking for CFLAGS
|
---|
207 | if test -z "$CFLAGS"; then
|
---|
208 | CFLAGS="-Wall -g -O2"
|
---|
209 | fi
|
---|
210 |
|
---|
211 | if test "$mingw32" = "yes" ; then
|
---|
212 | if test "$source_path_used" = "no"; then
|
---|
213 | source_path="."
|
---|
214 | fi
|
---|
215 | if test "$cc" = gcc; then
|
---|
216 | test -z "$LDFLAGS" && LDFLAGS="-static"
|
---|
217 | fi
|
---|
218 | test -z "$prefix" && prefix="C:/Program Files/tcc"
|
---|
219 | test -z "$tccdir" && tccdir="${prefix}"
|
---|
220 | test -z "$bindir" && bindir="${tccdir}"
|
---|
221 | test -z "$docdir" && docdir="${tccdir}/doc"
|
---|
222 | test -z "$libdir" && libdir="${tccdir}/libtcc"
|
---|
223 | confvars="$confvars WIN32"
|
---|
224 | LIBSUF=".lib"
|
---|
225 | EXESUF=".exe"
|
---|
226 | DLLSUF=".dll"
|
---|
227 | else
|
---|
228 | if test -z "$prefix" ; then
|
---|
229 | prefix="/usr/local"
|
---|
230 | fi
|
---|
231 | if test -z "$sharedir" ; then
|
---|
232 | sharedir="${prefix}/share"
|
---|
233 | fi
|
---|
234 | if test x"$execprefix" = x""; then
|
---|
235 | execprefix="${prefix}"
|
---|
236 | fi
|
---|
237 | if test x"$libdir" = x""; then
|
---|
238 | libdir="${execprefix}/lib"
|
---|
239 | fi
|
---|
240 | if test x"$bindir" = x""; then
|
---|
241 | bindir="${execprefix}/bin"
|
---|
242 | fi
|
---|
243 | if test x"$docdir" = x""; then
|
---|
244 | docdir="${sharedir}/doc"
|
---|
245 | fi
|
---|
246 | if test x"$mandir" = x""; then
|
---|
247 | mandir="${sharedir}/man"
|
---|
248 | fi
|
---|
249 | if test x"$infodir" = x""; then
|
---|
250 | infodir="${sharedir}/info"
|
---|
251 | fi
|
---|
252 | if test x"$tccdir" = x""; then
|
---|
253 | tccdir="${libdir}/tcc"
|
---|
254 | fi
|
---|
255 | if test x"$includedir" = x""; then
|
---|
256 | includedir="${prefix}/include"
|
---|
257 | fi
|
---|
258 | fi # mingw32
|
---|
259 |
|
---|
260 | if test x"$show_help" = "xyes" ; then
|
---|
261 | cat << EOF
|
---|
262 | Usage: configure [options]
|
---|
263 | Options: [defaults in brackets after descriptions]
|
---|
264 |
|
---|
265 | Standard options:
|
---|
266 | --help print this message
|
---|
267 | --prefix=PREFIX install in PREFIX [$prefix]
|
---|
268 | --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
---|
269 | [same as prefix]
|
---|
270 | --bindir=DIR user executables in DIR [EPREFIX/bin]
|
---|
271 | --libdir=DIR object code libraries in DIR [EPREFIX/lib]
|
---|
272 | --tccdir=DIR installation directory [EPREFIX/lib/tcc]
|
---|
273 | --includedir=DIR C header files in DIR [PREFIX/include]
|
---|
274 | --sharedir=DIR documentation root DIR [PREFIX/share]
|
---|
275 | --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]
|
---|
276 | --mandir=DIR man documentation in DIR [SHAREDIR/man]
|
---|
277 | --infodir=DIR info documentation in DIR [SHAREDIR/info]
|
---|
278 |
|
---|
279 | Advanced options (experts only):
|
---|
280 | --source-path=PATH path of source code [$source_path]
|
---|
281 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
|
---|
282 | --sysroot=PREFIX prepend PREFIX to library/include paths []
|
---|
283 | --cc=CC use C compiler CC [$cc]
|
---|
284 | --ar=AR create archives using AR [$ar]
|
---|
285 | --extra-cflags= specify compiler flags [$CFLAGS]
|
---|
286 | --extra-ldflags= specify linker options []
|
---|
287 | --cpu=CPU CPU [$cpu]
|
---|
288 | --strip-binaries strip symbol tables from resulting binaries
|
---|
289 | --disable-static make libtcc.so instead of libtcc.a
|
---|
290 | --enable-static make libtcc.a instead of libtcc.dll (win32)
|
---|
291 | --disable-rpath disable use of -rpath with the above
|
---|
292 | --with-libgcc use libgcc_s.so.1 instead of libtcc1.a
|
---|
293 | --enable-cross build cross compilers
|
---|
294 | --with-selinux use mmap for executable memory (with tcc -run)
|
---|
295 | --sysincludepaths=... specify system include paths, colon separated
|
---|
296 | --libpaths=... specify system library paths, colon separated
|
---|
297 | --crtprefix=... specify locations of crt?.o, colon separated
|
---|
298 | --elfinterp=... specify elf interpreter
|
---|
299 | --triplet=... specify system library/include directory triplet
|
---|
300 | --config-uClibc,-musl,-mingw32... enable system specific configurations
|
---|
301 | EOF
|
---|
302 | #echo "NOTE: The object files are build at the place where configure is launched"
|
---|
303 | exit 1
|
---|
304 | fi
|
---|
305 |
|
---|
306 | cc="${cross_prefix}${cc}"
|
---|
307 | ar="${cross_prefix}${ar}"
|
---|
308 | strip="${cross_prefix}${strip}"
|
---|
309 |
|
---|
310 | if test -z "$cross_prefix" ; then
|
---|
311 | CONFTEST=./conftest$EXESUF
|
---|
312 | if ! $cc -o $CONFTEST $source_path/conftest.c 2>/dev/null ; then
|
---|
313 | echo "configure: error: '$cc' failed to compile conftest.c."
|
---|
314 | else
|
---|
315 | gcc_major="$($CONFTEST version)"
|
---|
316 | gcc_minor="$($CONFTEST minor)"
|
---|
317 | fi
|
---|
318 | bigendian="$($CONFTEST bigendian)"
|
---|
319 | if test "$mingw32" = "no" ; then
|
---|
320 |
|
---|
321 | if test -z "$triplet"; then
|
---|
322 | tt="$($CONFTEST triplet)"
|
---|
323 | if test -n "$tt" -a -f "/usr/lib/$tt/crti.o" ; then
|
---|
324 | triplet="$tt"
|
---|
325 | fi
|
---|
326 | fi
|
---|
327 |
|
---|
328 | if test -z "$triplet"; then
|
---|
329 | if test $cpu = "x86_64" -o $cpu = "aarch64" ; then
|
---|
330 | if test -f "/usr/lib64/crti.o" ; then
|
---|
331 | tcc_lddir="lib64"
|
---|
332 | fi
|
---|
333 | fi
|
---|
334 | fi
|
---|
335 |
|
---|
336 | if test "$cpu" = "arm" ; then
|
---|
337 | if test "${triplet%eabihf}" != "$triplet" ; then
|
---|
338 | confvars="$confvars arm_eabihf"
|
---|
339 | elif test "${triplet%eabi}" != "$triplet" ; then
|
---|
340 | confvars="$confvars arm_eabi"
|
---|
341 | fi
|
---|
342 | if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
|
---|
343 | confvars="$confvars arm_vfp"
|
---|
344 | fi
|
---|
345 | fi
|
---|
346 |
|
---|
347 | if test "$suggest" = "yes"; then
|
---|
348 | if test -f "/lib/ld-uClibc.so.0" ; then
|
---|
349 | echo "Perhaps you want ./configure --config-uClibc"
|
---|
350 | fi
|
---|
351 | if test -f "/lib/ld-musl-$cpu.so.1"; then
|
---|
352 | echo "Perhaps you want ./configure --config-musl"
|
---|
353 | fi
|
---|
354 | fi
|
---|
355 | fi
|
---|
356 | else
|
---|
357 | # if cross compiling, cannot launch a program, so make a static guess
|
---|
358 | case $cpu in
|
---|
359 | ppc|mips|s390) bigendian=yes;;
|
---|
360 | esac
|
---|
361 | fi
|
---|
362 |
|
---|
363 | if test "$bigendian" = "yes" ; then
|
---|
364 | confvars="$confvars BIGENDIAN"
|
---|
365 | fi
|
---|
366 |
|
---|
367 | # a final configuration tuning
|
---|
368 | if ! echo "$cc" | grep -q "tcc"; then
|
---|
369 | OPT1="-Wdeclaration-after-statement -fno-strict-aliasing"
|
---|
370 | # we want -Wno- but gcc does not always reject unknown -Wno- options
|
---|
371 | OPT2="-Wpointer-sign -Wsign-compare -Wunused-result"
|
---|
372 | if echo "$cc" | grep -q "clang"; then
|
---|
373 | OPT1="$OPT1 -fheinous-gnu-extensions"
|
---|
374 | OPT2="$OPT2 -Wstring-plus-int"
|
---|
375 | fi
|
---|
376 | $cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1
|
---|
377 | for o in $OPT1; do # enable these options
|
---|
378 | if ! grep -q -- $o cc_msg.txt; then CFLAGS="$CFLAGS $o"; fi
|
---|
379 | done
|
---|
380 | for o in $OPT2; do # disable these options
|
---|
381 | if ! grep -q -- $o cc_msg.txt; then CFLAGS="$CFLAGS -Wno-${o#-W*}"; fi
|
---|
382 | done
|
---|
383 | # cat cc_msg.txt
|
---|
384 | # echo $CFLAGS
|
---|
385 | rm -f cc_msg.txt a.out
|
---|
386 | fi
|
---|
387 |
|
---|
388 | fcho() { if test -n "$2"; then echo "$1$2"; fi }
|
---|
389 |
|
---|
390 | fcho "Binary directory " "$bindir"
|
---|
391 | fcho "TinyCC directory " "$tccdir"
|
---|
392 | fcho "Library directory " "$libdir"
|
---|
393 | fcho "Include directory " "$includedir"
|
---|
394 | fcho "Manual directory " "$mandir"
|
---|
395 | fcho "Info directory " "$infodir"
|
---|
396 | fcho "Doc directory " "$docdir"
|
---|
397 | fcho "Target root prefix " "$sysroot"
|
---|
398 | echo "Source path $source_path"
|
---|
399 | echo "C compiler $cc ($gcc_major.$gcc_minor)"
|
---|
400 | echo "Target OS $targetos"
|
---|
401 | echo "CPU $cpu"
|
---|
402 | fcho "Triplet " "$triplet"
|
---|
403 | fcho "Config " "${confvars# }"
|
---|
404 | echo "Creating config.mak and config.h"
|
---|
405 |
|
---|
406 | cat >config.mak <<EOF
|
---|
407 | # Automatically generated by configure - do not modify
|
---|
408 | prefix=$prefix
|
---|
409 | bindir=\$(DESTDIR)$bindir
|
---|
410 | tccdir=\$(DESTDIR)$tccdir
|
---|
411 | libdir=\$(DESTDIR)$libdir
|
---|
412 | includedir=\$(DESTDIR)$includedir
|
---|
413 | mandir=\$(DESTDIR)$mandir
|
---|
414 | infodir=\$(DESTDIR)$infodir
|
---|
415 | docdir=\$(DESTDIR)$docdir
|
---|
416 | CC=$cc
|
---|
417 | GCC_MAJOR=$gcc_major
|
---|
418 | GCC_MINOR=$gcc_minor
|
---|
419 | AR=$ar
|
---|
420 | STRIP=$strip -s -R .comment -R .note
|
---|
421 | CFLAGS=$CFLAGS
|
---|
422 | LDFLAGS=$LDFLAGS
|
---|
423 | LIBSUF=$LIBSUF
|
---|
424 | EXESUF=$EXESUF
|
---|
425 | DLLSUF=$DLLSUF
|
---|
426 | EOF
|
---|
427 |
|
---|
428 | print_inc() {
|
---|
429 | if test -n "$2"; then
|
---|
430 | echo "#ifndef $1" >> $TMPH
|
---|
431 | echo "# define $1 \"$2\"" >> $TMPH
|
---|
432 | echo "#endif" >> $TMPH
|
---|
433 | fi
|
---|
434 | }
|
---|
435 |
|
---|
436 | print_mak() {
|
---|
437 | if test -n "$2"; then
|
---|
438 | echo "NATIVE_DEFINES+=-D$1=\"\\\"$2\\\"\"" >> config.mak
|
---|
439 | fi
|
---|
440 | }
|
---|
441 |
|
---|
442 | print_mak_int() {
|
---|
443 | if test -n "$2"; then
|
---|
444 | echo "NATIVE_DEFINES+=-D$1=$2" >> config.mak
|
---|
445 | fi
|
---|
446 | }
|
---|
447 |
|
---|
448 | echo "/* Automatically generated by configure - do not modify */" > $TMPH
|
---|
449 |
|
---|
450 | print_inc CONFIG_SYSROOT "$sysroot"
|
---|
451 | print_inc CONFIG_TCCDIR "$tccdir"
|
---|
452 | print_mak CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
|
---|
453 | print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
---|
454 | print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
---|
455 | print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
|
---|
456 | print_mak CONFIG_LDDIR "$tcc_lddir"
|
---|
457 | print_mak CONFIG_TRIPLET "$triplet"
|
---|
458 | print_mak_int TCC_CPU_VERSION "$cpuver"
|
---|
459 |
|
---|
460 | if test "$cpu" = "aarch64" ; then
|
---|
461 | echo "ARCH=arm64" >> config.mak
|
---|
462 | else
|
---|
463 | echo "ARCH=$cpu" >> config.mak
|
---|
464 | fi
|
---|
465 | echo "TARGETOS=$targetos" >> config.mak
|
---|
466 |
|
---|
467 | for v in $confvars ; do
|
---|
468 | if test "${v%=*}" = "$v"; then
|
---|
469 | echo "CONFIG_$v=yes" >> config.mak
|
---|
470 | else
|
---|
471 | echo "CONFIG_$v" >> config.mak
|
---|
472 | fi
|
---|
473 | done
|
---|
474 |
|
---|
475 | version=`head $source_path/VERSION`
|
---|
476 | echo "VERSION = $version" >> config.mak
|
---|
477 | echo "#define TCC_VERSION \"$version\"" >> $TMPH
|
---|
478 | echo "@set VERSION $version" > config.texi
|
---|
479 |
|
---|
480 | if test "$source_path_used" = "yes" ; then
|
---|
481 | case $source_path in
|
---|
482 | /*) echo "TOPSRC=$source_path";;
|
---|
483 | *) echo "TOPSRC=\$(TOP)/$source_path";;
|
---|
484 | esac >>config.mak
|
---|
485 | else
|
---|
486 | echo 'TOPSRC=$(TOP)' >>config.mak
|
---|
487 | fi
|
---|
488 |
|
---|
489 | diff $TMPH config.h >/dev/null 2>&1
|
---|
490 | if test $? -ne 0 ; then
|
---|
491 | mv -f $TMPH config.h
|
---|
492 | else
|
---|
493 | echo "config.h is unchanged"
|
---|
494 | fi
|
---|
495 |
|
---|
496 | rm -f $TMPN* $CONFTEST
|
---|
497 |
|
---|
498 | # ---------------------------------------------------------------------------
|
---|
499 | # build tree in object directory if source path is different from current one
|
---|
500 |
|
---|
501 | fn_makelink()
|
---|
502 | {
|
---|
503 | tgt=$1/$2
|
---|
504 | case $2 in
|
---|
505 | */*) dn=${2%/*}
|
---|
506 | test -d $dn || mkdir -p $dn
|
---|
507 | case $1 in
|
---|
508 | /*) ;;
|
---|
509 | *) while test $dn ; do
|
---|
510 | tgt=../$tgt; dn=${dn#${dn%%/*}}; dn=${dn#/}
|
---|
511 | done
|
---|
512 | ;;
|
---|
513 | esac
|
---|
514 | ;;
|
---|
515 | esac
|
---|
516 |
|
---|
517 | ln -sfn $tgt $2 || ( echo "ln failed. Using cp instead."; cp -f $1/$2 $2 )
|
---|
518 | }
|
---|
519 |
|
---|
520 | if test "$source_path_used" = "yes" ; then
|
---|
521 | FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile tests/pp/Makefile"
|
---|
522 | for f in $FILES ; do
|
---|
523 | fn_makelink $source_path $f
|
---|
524 | done
|
---|
525 | fi
|
---|
526 |
|
---|
527 | # ---------------------------------------------------------------------------
|
---|