📄 configure
字号:
:#!/bin/sh# The above : is necessary on some buggy systems.# configure: Guess values for system-dependent variables# Output the flag definitions to the file "flags".# Parameters: $1 = $CC, $2 = $CFLAGS# To construct zip automatically using this file, type# "make -f unix/Makefile generic".# If this fails, then type "make list" to get a list of special targets.trap "rm -f conftest* core a.out; exit 1" 1 2 3 15CC=${1-cc}CFLAGS=${2-"-I. -DUNIX"}LFLAGS1=""LN="ln -s"echo "Check C compiler type (optimization option)"cat > conftest.c << _EOF_int main(){#ifndef __SUNPRO_C bad code#endif return 0;}_EOF_$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/nullif test $? -eq 0; then echo ' Sun C (-xO3)' CFLAGS="${CFLAGS} -xO3"else cat > conftest.c << _EOF_int main(){#ifndef __DECC bad code#endif return 0;}_EOF_ $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null if test $? -eq 0; then echo ' DEC C (-O3)' CFLAGS="${CFLAGS} -O3" else echo ' Other (gcc?) (-O2)' CFLAGS="${CFLAGS} -O2" fifiecho Check for the C preprocessor# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.CPP="${CC} -E"# solaris as(1) needs -P, maybe others as well ?[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp[ -f /lib/cpp ] && CPP=/lib/cpp[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp[ -f /xenix ] && CPP="${CC} -E"[ -f /lynx.os ] && CPP="${CC} -E"echo "#include <stdio.h>" > conftest.c$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"echo Check if we can use asm codeOBJA=""if eval "$CPP match.S > _match.s 2>/dev/null"; then if test ! -s _match.s || grep error < _match.s > /dev/null; then : elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then CFLAGS="${CFLAGS} -DASMV" OBJA="match.o" echo "int foo() { return 0;}" > conftest.c $CC -c conftest.c >/dev/null 2>/dev/null echo Check if compiler generates underlines nm conftest.o | grep "(^|[^_])foo" >/dev/null 2>/dev/null [ $? -eq 0 ] && CPP="${CPP} -DNO_UNDERLINE" if eval "$CPP crc_i386.S > _crc_i386.s 2>/dev/null"; then if eval "$CC -c _crc_i386.s >/dev/null 2>/dev/null" && [ -f _crc_i386.o ] then OBJA="$OBJA crc_i386.o" CFLAGS="${CFLAGS} -DASM_CRC" fi fi fifirm -f _match.s _match.o _crc_i386.s _crc_i386.o# ANSI options for compilers that don't have __STDC__ defined by default# Currently HPUX, pyramid, Dynix, AIX, OSF/1 and ultrixecho Check for ANSI optionscat > conftest.c << _EOF_int main(){#ifndef __STDC__ forget it#endif return 0;}_EOF_$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/nullif [ $? -ne 0 ]; then for OPT in "-Aa -D_HPUX_SOURCE" -Xa -qlanglvl=ansi -std1 -std do $CC $CFLAGS $OPT -c conftest.c > /dev/null 2>/dev/null [ $? -eq 0 ] && CFLAGS="${CFLAGS} ${OPT}" && break donefiecho Check for prototypesecho "int main(int argc, char *argv[]) { return 0; }" > conftest.c$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO"# const check currently handles mips cc and non ANSI compilers.# does it need more ?echo Check the handling of constcat > conftest.c << _EOF_typedef int charset[2];int main(){ const charset x; const char *foo; return 0;}_EOF_$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST"echo Check for time_tcat > conftest.c << _EOF_#include <sys/types.h>#include <time.h>int main(){ time_t t; return 0;}_EOF_$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T"echo Check for size_tcat > conftest.c << _EOF_#include <sys/types.h>int main(){ size_t s; return 0;}_EOF_$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T"echo Check for gcc no-builtin flag# -fno-builtin since version 2cat > conftest.c << _EOF_int main(){#if __GNUC__ >= 2 return 0;#else forget it#endif}_EOF_$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null[ $? -eq 0 ] && BFLAG="-fno-builtin"# Check for missing functions# add NO_'function_name' to flags if missingfor func in rmdir strchr strrchr rename mktemp mktime mkstempdo echo Check for $func echo "int main(){ $func(); return 0; }" > conftest.c $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"doneecho Check for memsetecho "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c$CC -o conftest conftest.c >/dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"echo Check for errno declarationcat > conftest.c << _EOF_#include <errno.h>main(){ errno = 0; return 0;}_EOF_$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"echo Check for directory librariescat > conftest.c << _EOF_int main() { return closedir(opendir(".")); }_EOF_$CC -o conftest conftest.c >/dev/null 2>/dev/nullif [ $? -ne 0 ]; then OPT="" for lib in ndir dir ucb bsd BSD PW x dirent do $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null [ $? -eq 0 ] && OPT=-l$lib && break done if [ ${OPT} ]; then LFLAGS2="${LFLAGS2} ${OPT}" else CFLAGS="${CFLAGS} -DNO_DIR" fifi# Dynix/ptx 1.3 needed thisecho Check for readlinkecho "int main(){ return readlink(); }" > conftest.c$CC -o conftest conftest.c >/dev/null 2>/dev/nullif [ $? -ne 0 ]; then $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"fiecho Check for directory include fileOPT=""for inc in dirent.h sys/ndir.h ndir.h sys/dir.hdo echo "#include <$inc>" > conftest.c $CPP conftest.c > /dev/null 2>/dev/null [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && breakdoneCFLAGS="${CFLAGS} ${OPT}"echo Check for non existent include filesfor inc in stdlib.h stddef.h unistd.h fcntl.h string.hdo echo "#include <$inc>" > conftest.c $CPP conftest.c >/dev/null 2>/dev/null [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"doneecho Check for terminal I/O include fileOPT=""for inc in termios.h termio.h sgtty.hdo echo "#include <$inc>" > conftest.c $CPP conftest.c > /dev/null 2>/dev/null [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && breakdoneCFLAGS="${CFLAGS} ${OPT}"# needed for AIX (and others ?) when mmap is usedecho Check for valloccat > conftest.c << _EOF_main(){#ifdef MMAP valloc();#endif}_EOF_$CC ${CFLAGS} conftest.c > /dev/null 2>/dev/null[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"echo Check for 64bit fseekfor func in fseeko fseek64docat > conftest.c << _EOF_#include <stdio.h>main(){$func(stdin, 0, 0);}_EOF_$CC ${CFLAGS} conftest.c > /dev/null 2>/dev/null[ $? -eq 0 ] && OPT="-DHAVE_`echo $func | tr '[a-z]' '[A-Z]'`" && breakdoneCFLAGS="${CFLAGS} ${OPT}"echo Check for /usr/local/bin and /usr/local/manBINDIR=$HOME/bin[ -d /usr/local/bin ] && BINDIR=/usr/local/binMANDIR=manl[ -d /usr/man/manl ] && MANDIR=/usr/man/manl[ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl[ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1echo Check for OS-specific flagsif [ -f /usr/bin/hostinfo ]; then if /usr/bin/hostinfo | grep NeXT > /dev/null; then CFLAGS="${CFLAGS} -posix" LFLAGS1="${LFLAGS1} -posix -object" fi# XXX ATT6300, Crayelif [ -f /xenix ]; then if uname -p | grep 286 > /dev/null; then CFLAGS="${CFLAGS} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384 -DNO_VOID" LFLAGS1="${LFLAGS1} -LARGE -Mel2" fielif uname -X >/dev/null 2>/dev/null; then# SCO shared library check echo "int main() { return 0;}" > conftest.c $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"else SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown" echo "int main() { return 0;}" > conftest.c case $SYSTEM in OSF1|ULTRIX) echo Check for -Olimit option $CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null [ $? -eq 0 ] && CFLAGS="${CFLAGS} -Olimit 1000" ;; HP-UX) echo Check for +Onolimit option $CC ${CFLAGS} +Onolimit -o conftest conftest.c >/dev/null 2>/dev/null [ $? -eq 0 ] && CFLAGS="${CFLAGS} +Onolimit" ;; esacfiecho Check for symbolic linksln -s /dev/null null > /dev/null 2>/dev/null || LN=lnrm -f a.out conftest.c conftest.o conftest nullecho CC=\"${CC}\" CFLAGS=\"${CFLAGS}\" CPP=\"${CPP}\" OBJA=\"${OBJA}\" \ BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS1=\"${LFLAGS1}\" \ LFLAGS2=\"${LFLAGS2}\" LN=\"${LN}\" > flags
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -