| @@ -31,6 +31,7 @@ includedir="" · 30 unmodified lines |
| 31 | mandir="" | 31 | mandir="" |
| 32 | infodir="" | 32 | infodir="" |
| 33 | sysroot="" | 33 | sysroot="" |
| | 34 | multiarch_triplet="" |
| 34 | cross_prefix="" | 35 | cross_prefix="" |
| 35 | cc="gcc" | 36 | cc="gcc" |
| 36 | host_cc="gcc" | 37 | host_cc="gcc" |
| @@ -120,6 +121,8 @@ for opt do · 83 unmodified lines |
| 120 | ;; | 121 | ;; |
| 121 | --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2` | 122 | --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2` |
| 122 | ;; | 123 | ;; |
| | 124 | --multiarch-triplet=*) multiarch_triplet=`echo $opt | cut -d '=' -f 2` |
| | 125 | ;; |
| 123 | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` | 126 | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` |
| 124 | ;; | 127 | ;; |
| 125 | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` | 128 | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` |
| @@ -235,36 +238,37 @@ Options: [defaults in brackets after descriptions] · 109 unmodified lines |
| 235 | | 238 | |
| 236 | EOF | 239 | EOF |
| 237 | echo "Standard options:" | 240 | echo "Standard options:" |
| 238 | echo " --help print this message" | 241 | echo " --help print this message" |
| 239 | echo " --prefix=PREFIX install in PREFIX [$prefix]" | 242 | echo " --prefix=PREFIX install in PREFIX [$prefix]" |
| 240 | echo " --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX" | 243 | echo " --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX" |
| 241 | echo " [same as prefix]" | 244 | echo " [same as prefix]" |
| 242 | echo " --bindir=DIR user executables in DIR [EPREFIX/bin]" | 245 | echo " --bindir=DIR user executables in DIR [EPREFIX/bin]" |
| 243 | echo " --libdir=DIR object code libraries in DIR [EPREFIX/lib]" | 246 | echo " --libdir=DIR object code libraries in DIR [EPREFIX/lib]" |
| 244 | echo " --tccdir=DIR installation directory [EPREFIX/lib/tcc]" | 247 | echo " --tccdir=DIR installation directory [EPREFIX/lib/tcc]" |
| 245 | echo " --includedir=DIR C header files in DIR [PREFIX/include]" | 248 | echo " --includedir=DIR C header files in DIR [PREFIX/include]" |
| 246 | echo " --sharedir=DIR documentation root DIR [PREFIX]/share" | 249 | echo " --sharedir=DIR documentation root DIR [PREFIX]/share" |
| 247 | echo " --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]" | 250 | echo " --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]" |
| 248 | echo " --mandir=DIR man documentation in DIR [SHAREDIR/man]" | 251 | echo " --mandir=DIR man documentation in DIR [SHAREDIR/man]" |
| 249 | echo " --infodir=DIR info documentation in DIR [SHAREDIR/info]" | 252 | echo " --infodir=DIR info documentation in DIR [SHAREDIR/info]" |
| 250 | echo "" | 253 | echo "" |
| 251 | echo "Advanced options (experts only):" | 254 | echo "Advanced options (experts only):" |
| 252 | echo " --source-path=PATH path of source code [$source_path]" | 255 | echo " --source-path=PATH path of source code [$source_path]" |
| 253 | echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" | 256 | echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" |
| 254 | echo " --sysroot=PREFIX prepend PREFIX to library/include paths []" | 257 | echo " --sysroot=PREFIX prepend PREFIX to library/include paths []" |
| 255 | echo " --cc=CC use C compiler CC [$cc]" | 258 | echo " --multiarch-triplet=SUFFIX append SUFFIX to library/include paths []" |
| 256 | echo " --disable-static make libtcc.so instead of libtcc.a" | 259 | echo " --cc=CC use C compiler CC [$cc]" |
| 257 | echo " --disable-rpath disable use of -rpath with the above" | 260 | echo " --disable-static make libtcc.so instead of libtcc.a" |
| 258 | echo " --strip-binaries strip symbol tables from resulting binaries" | 261 | echo " --disable-rpath disable use of -rpath with the above" |
| 259 | echo " --with-libgcc use /lib/libgcc_s.so.1 instead of libtcc.a" | 262 | echo " --strip-binaries strip symbol tables from resulting binaries" |
| 260 | echo " --enable-mingw32 build windows version on linux with mingw32" | 263 | echo " --with-libgcc use /lib/libgcc_s.so.1 instead of libtcc.a" |
| 261 | echo " --enable-cygwin build windows version on windows with cygwin" | 264 | echo " --enable-mingw32 build windows version on linux with mingw32" |
| 262 | echo " [requires cygwin and mingw32-make]" | 265 | echo " --enable-cygwin build windows version on windows with cygwin" |
| 263 | echo " --enable-cross build cross compilers" | 266 | echo " [requires cygwin and mingw32-make]" |
| 264 | echo " --extra-cflags= extra compiler flags" | 267 | echo " --enable-cross build cross compilers" |
| 265 | echo " --extra-ldflags= extra linker options" | 268 | echo " --extra-cflags= extra compiler flags" |
| 266 | echo " --with-selinux use mmap instead of exec mem" | 269 | echo " --extra-ldflags= extra linker options" |
| 267 | echo " [requires write access to /tmp]" | 270 | echo " --with-selinux use mmap instead of exec mem" |
| | 271 | echo " [requires write access to /tmp]" |
| 268 | echo "" | 272 | echo "" |
| 269 | #echo "NOTE: The object files are build at the place where configure is launched" | 273 | #echo "NOTE: The object files are build at the place where configure is launched" |
| 270 | exit 1 | 274 | exit 1 |
| @@ -330,13 +334,14 @@ echo "Manual directory $mandir" · 59 unmodified lines |
| 330 | echo "Info directory $infodir" | 334 | echo "Info directory $infodir" |
| 331 | echo "Doc directory $docdir" | 335 | echo "Doc directory $docdir" |
| 332 | echo "Target root prefix $sysroot" | 336 | echo "Target root prefix $sysroot" |
| 333 | echo "Source path $source_path" | 337 | echo "Multiarch triplet $multiarch_triplet" |
| 334 | echo "C compiler $cc" | 338 | echo "Source path $source_path" |
| 335 | echo "CPU $cpu" | 339 | echo "C compiler $cc" |
| 336 | echo "Big Endian $bigendian" | 340 | echo "CPU $cpu" |
| 337 | echo "gprof enabled $gprof" | 341 | echo "Big Endian $bigendian" |
| 338 | echo "cross compilers $build_cross" | 342 | echo "gprof enabled $gprof" |
| 339 | echo "use libgcc $use_libgcc" | 343 | echo "cross compilers $build_cross" |
| | 344 | echo "use libgcc $use_libgcc" |
| 340 | | 345 | |
| 341 | echo "Creating config.mak and config.h" | 346 | echo "Creating config.mak and config.h" |
| 342 | | 347 | |
| @@ -356,9 +361,93 @@ echo "docdir=\$(DESTDIR)$docdir" >> config.mak · 13 unmodified lines |
| 356 | echo "#ifndef CONFIG_SYSROOT" >> $TMPH | 361 | echo "#ifndef CONFIG_SYSROOT" >> $TMPH |
| 357 | echo "#define CONFIG_SYSROOT \"$sysroot\"" >> $TMPH | 362 | echo "#define CONFIG_SYSROOT \"$sysroot\"" >> $TMPH |
| 358 | echo "#endif" >> $TMPH | 363 | echo "#endif" >> $TMPH |
| | 364 | echo "" >> $TMPH |
| | 365 | |
| | 366 | # Set default include and library paths |
| | 367 | win_incpaths="\\\b/include;\\\b/include/winapi" |
| | 368 | unix_incpaths="/usr/local/include:/usr/include:\\\b/include" |
| | 369 | win_libpaths="\\\b/lib" |
| | 370 | unix_libpaths="CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX" |
| | 371 | unix_libpaths="$unix_libpaths\":\"CONFIG_SYSROOT CONFIG_TCC_LDDIR" |
| | 372 | unix_libpaths="$unix_libpaths\":\"CONFIG_SYSROOT \"/usr/local\" CONFIG_TCC_LDDIR" |
| | 373 | |
| | 374 | # sep: path separator in paths |
| | 375 | # tmp: paths multiarchified (one path per line) |
| | 376 | # q: quote (if sep contains ") |
| | 377 | # r: carriage return pattern (if sep contains ") |
| | 378 | # s: space (if sep contains ") |
| | 379 | multiarchify() |
| | 380 | { |
| | 381 | local sep tmp |
| | 382 | |
| | 383 | paths="$1" |
| | 384 | sep="$2" |
| | 385 | tmp="" |
| | 386 | q="" |
| | 387 | r="" |
| | 388 | s="" |
| | 389 | if [ -z "${sep%%\"*}" ] ; then |
| | 390 | q="\"" |
| | 391 | r=" \\\\\n " |
| | 392 | s=" " |
| | 393 | fi |
| | 394 | paths="$paths$sep" |
| | 395 | while test -n "$paths" ; do |
| | 396 | tmp="$tmp${tmp:+$r$sep$s}${paths%%$sep*}$s$q/$multiarch_triplet$q" |
| | 397 | tmp="$tmp$r$sep$s${paths%%$sep*}" |
| | 398 | paths="${paths#*$sep}" |
| | 399 | done |
| | 400 | paths="$tmp" |
| | 401 | } |
| | 402 | |
| | 403 | if test -n "$multiarch_triplet" ; then |
| | 404 | multiarchify "$win_incpaths" ";" |
| | 405 | win_incpaths="\"$paths\"" |
| | 406 | multiarchify "$unix_incpaths" ":" |
| | 407 | unix_incpaths="\"$paths\"" |
| | 408 | multiarchify "$win_libpaths" ";" |
| | 409 | win_libpaths="\"$paths\"" |
| | 410 | multiarchify "$unix_libpaths" "\":\"" |
| | 411 | unix_libpaths="$paths" |
| | 412 | echo "#define CONFIG_TCC_MULTIARCH_TRIPLET \"$multiarch_triplet\"" >> $TMPH |
| | 413 | fi |
| | 414 | |
| | 415 | echo "#ifndef CONFIG_TCC_LDDIR" >> $TMPH |
| | 416 | echo " #if defined(TCC_TARGET_X86_64_CENTOS)" >> $TMPH |
| | 417 | echo " #define CONFIG_TCC_LDDIR \"/lib64\"" >> $TMPH |
| | 418 | echo " #else" >> $TMPH |
| | 419 | echo " #define CONFIG_TCC_LDDIR \"/lib\"" >> $TMPH |
| | 420 | echo " #endif" >> $TMPH |
| | 421 | echo "#endif" >> $TMPH |
| | 422 | echo "" >> $TMPH |
| | 423 | |
| | 424 | echo "/* path to find crt1.o, crti.o and crtn.o */" >> $TMPH |
| | 425 | echo "#ifndef CONFIG_TCC_CRT_PREFIX" >> $TMPH |
| | 426 | echo "# define CONFIG_TCC_CRT_PREFIX \"/usr\" CONFIG_TCC_LDDIR" >> $TMPH |
| | 427 | echo "#endif" >> $TMPH |
| | 428 | echo "" >> $TMPH |
| | 429 | |
| | 430 | echo "#ifndef CONFIG_TCC_SYSINCLUDE_PATHS" >> $TMPH |
| | 431 | echo "# ifdef TCC_TARGET_PE" >> $TMPH |
| | 432 | echo "# define CONFIG_TCC_SYSINCLUDE_PATHS $win_incpaths" >> $TMPH |
| | 433 | echo "# else" >> $TMPH |
| | 434 | echo "# define CONFIG_TCC_SYSINCLUDE_PATHS $unix_incpaths" >> $TMPH |
| | 435 | echo "# endif" >> $TMPH |
| | 436 | echo "#endif" >> $TMPH |
| | 437 | echo "" >> $TMPH |
| | 438 | echo "#ifndef CONFIG_TCC_LIBPATH" >> $TMPH |
| | 439 | echo "# ifdef TCC_TARGET_PE" >> $TMPH |
| | 440 | echo "# define CONFIG_TCC_LIBPATH $win_libpaths" >> $TMPH |
| | 441 | echo "# else" >> $TMPH |
| | 442 | echo "# define CONFIG_TCC_LIBPATH $unix_libpaths" >> $TMPH |
| | 443 | echo "# endif" >> $TMPH |
| | 444 | echo "#endif" >> $TMPH |
| | 445 | echo "" >> $TMPH |
| | 446 | |
| 359 | echo "#ifndef CONFIG_TCCDIR" >> $TMPH | 447 | echo "#ifndef CONFIG_TCCDIR" >> $TMPH |
| 360 | echo "#define CONFIG_TCCDIR \"$tccdir\"" >> $TMPH | 448 | echo "#define CONFIG_TCCDIR \"$tccdir\"" >> $TMPH |
| 361 | echo "#endif" >> $TMPH | 449 | echo "#endif" >> $TMPH |
| | 450 | echo "" >> $TMPH |
| 362 | echo "CC=$cc" >> config.mak | 451 | echo "CC=$cc" >> config.mak |
| 363 | echo "GCC_MAJOR=$gcc_major" >> config.mak | 452 | echo "GCC_MAJOR=$gcc_major" >> config.mak |
| 364 | echo "#define GCC_MAJOR $gcc_major" >> $TMPH | 453 | echo "#define GCC_MAJOR $gcc_major" >> $TMPH |