?? configure
字號:
#!/bin/sh## tcc configure script (c) 2003 Fabrice Bellard## set temporary file nameif test ! -z "$TMPDIR" ; then TMPDIR1="${TMPDIR}"elif test ! -z "$TEMPDIR" ; then TMPDIR1="${TEMPDIR}"else TMPDIR1="/tmp"fiTMPC="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c"TMPO="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.o"TMPE="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}"TMPS="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.S"TMPH="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.h"# default parametersprefix="/usr/local"execprefix=""bindir=""libdir=""includedir=""mandir=""cross_prefix=""cc="gcc"host_cc="gcc"ar="ar"make="make"strip="strip"cpu=`uname -m`case "$cpu" in i386|i486|i586|i686|i86pc|BePC) cpu="x86" ;; armv4l) cpu="armv4l" ;; alpha) cpu="alpha" ;; "Power Macintosh"|ppc|ppc64) cpu="powerpc" ;; mips) cpu="mips" ;; s390) cpu="s390" ;; *) cpu="unknown" ;;esacgprof="no"bigendian="no"# OS specifictargetos=`uname -s`case $targetos in*) ;;esac# find source path# XXX: we assume an absolute path is given when launching configure, # except in './configure' case.source_path=${0%configure}source_path=${source_path%/}source_path_used="yes"if test -z "$source_path" -o "$source_path" = "." ; then source_path=`pwd` source_path_used="no"fifor opt do case "$opt" in --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` ;; --exec-prefix=*) execprefix=`echo $opt | cut -d '=' -f 2` ;; --bindir=*) bindir=`echo $opt | cut -d '=' -f 2` ;; --libdir=*) libdir=`echo $opt | cut -d '=' -f 2` ;; --includedir=*) includedir=`echo $opt | cut -d '=' -f 2` ;; --mandir=*) mandir=`echo $opt | cut -d '=' -f 2` ;; --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` ;; --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` ;; --cc=*) cc=`echo $opt | cut -d '=' -f 2` ;; --make=*) make=`echo $opt | cut -d '=' -f 2` ;; --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" ;; --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" ;; --extra-libs=*) extralibs=${opt#--extra-libs=} ;; --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` ;; --enable-gprof) gprof="yes" ;; esacdone# Checking for CFLAGSif test -z "$CFLAGS"; then CFLAGS="-O2"ficc="${cross_prefix}${cc}"ar="${cross_prefix}${ar}"strip="${cross_prefix}${strip}"if test -z "$cross_prefix" ; then# ---# big/little endian testcat > $TMPC << EOF#include <inttypes.h>int main(int argc, char ** argv){ volatile uint32_t i=0x01234567; return (*((uint8_t*)(&i))) == 0x67;}EOFif $cc -o $TMPE $TMPC 2>/dev/null ; then$TMPE && bigendian="yes"elseecho big/little test failedfielse# if cross compiling, cannot launch a program, so make a static guessif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" ; then bigendian="yes"fifi# check gcc versioncat > $TMPC <<EOFint main(void) {#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)return 0;#else#error gcc < 3.2#endif}EOFgcc_major="2"if $cc -o $TMPO $TMPC 2> /dev/null ; then gcc_major="3"fiif test x"$1" = x"-h" -o x"$1" = x"--help" ; thencat << EOFUsage: configure [options]Options: [defaults in brackets after descriptions]EOFecho "Standard options:"echo " --help print this message"echo " --prefix=PREFIX install in PREFIX [$prefix]"echo " --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX"echo " [same as prefix]"echo " --bindir=DIR user executables in DIR [EPREFIX/bin]"echo " --libdir=DIR object code libraries in DIR [EPREFIX/lib]"echo " --includedir=DIR C header files in DIR [PREFIX/include]"echo " --mandir=DIR man documentation in DIR [PREFIX/man]"echo ""echo "Advanced options (experts only):"echo " --source-path=PATH path of source code [$source_path]"echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"echo " --cc=CC use C compiler CC [$cc]"echo " --make=MAKE use specified make [$make]"echo ""#echo "NOTE: The object files are build at the place where configure is launched"exit 1fiif test x"$execprefix" = x""; thenexecprefix="${prefix}"fiif test x"$bindir" = x""; thenbindir="${execprefix}/bin"fiif test x"$libdir" = x""; thenlibdir="${execprefix}/lib"fiif test x"$includedir" = x""; thenincludedir="${prefix}/include"fiif test x"$mandir" = x""; thenmandir="${prefix}/man"fiecho "Binary directory $bindir"echo "Library directory $libdir"echo "Include directory $includedir"echo "Manual directory $mandir"echo "Source path $source_path"echo "C compiler $cc"echo "make $make"echo "CPU $cpu"echo "Big Endian $bigendian"echo "gprof enabled $gprof"echo "Creating config.mak and config.h"echo "# Automatically generated by configure - do not modify" > config.makecho "/* Automatically generated by configure - do not modify */" > $TMPHecho "prefix=$prefix" >> config.makecho "bindir=$bindir" >> config.makecho "libdir=$libdir" >> config.makecho "includedir=$includedir" >> config.makecho "mandir=$mandir" >> config.makecho "#define CONFIG_TCC_LIBDIR \"$libdir\"" >> $TMPHecho "MAKE=$make" >> config.makecho "CC=$cc" >> config.makecho "GCC_MAJOR=$gcc_major" >> config.makecho "#define GCC_MAJOR $gcc_major" >> $TMPHecho "HOST_CC=$host_cc" >> config.makecho "AR=$ar" >> config.makecho "STRIP=$strip -s -R .comment -R .note" >> config.makecho "CFLAGS=$CFLAGS" >> config.makecho "LDFLAGS=$LDFLAGS" >> config.makif test "$cpu" = "x86" ; then echo "ARCH=i386" >> config.mak echo "#define HOST_I386 1" >> $TMPHelif test "$cpu" = "armv4l" ; then echo "ARCH=arm" >> config.mak echo "#define HOST_ARM 1" >> $TMPHelif test "$cpu" = "powerpc" ; then echo "ARCH=ppc" >> config.mak echo "#define HOST_PPC 1" >> $TMPHelif test "$cpu" = "mips" ; then echo "ARCH=mips" >> config.mak echo "#define HOST_MIPS 1" >> $TMPHelif test "$cpu" = "s390" ; then echo "ARCH=s390" >> config.mak echo "#define HOST_S390 1" >> $TMPHelif test "$cpu" = "alpha" ; then echo "ARCH=alpha" >> config.mak echo "#define HOST_ALPHA 1" >> $TMPHelse echo "Unsupported CPU" exit 1fiif test "$bigendian" = "yes" ; then echo "WORDS_BIGENDIAN=yes" >> config.mak echo "#define WORDS_BIGENDIAN 1" >> $TMPHfiif test "$gprof" = "yes" ; then echo "TARGET_GPROF=yes" >> config.mak echo "#define HAVE_GPROF 1" >> $TMPHfiversion=`head $source_path/VERSION`echo "VERSION=$version" >>config.makecho "#define TCC_VERSION \"$version\"" >> $TMPHecho "@set VERSION $version" > config.texi# build tree in object directory if source path is different from current oneif test "$source_path_used" = "yes" ; then DIRS="tests" FILES="Makefile tests/Makefile" for dir in $DIRS ; do mkdir -p $dir done for f in $FILES ; do ln -sf $source_path/$f $f donefiecho "SRC_PATH=$source_path" >> config.makdiff $TMPH config.h >/dev/null 2>&1if test $? -ne 0 ; then mv -f $TMPH config.helse echo "config.h is unchanged"firm -f $TMPO $TMPC $TMPE $TMPS $TMPH
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -