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