📄 configure.in
字号:
dnl This file in input to autoconf. It consists of a series of m4dnl macros which expand to produce the shell script "configure".dnl Anything which is not an m4 macro is copied directly to the output.dnldnl Start things up. If the specified file doesn't exist, configurednl will complain.AC_INIT(lbn16.c)dnl The following tests need to know that we intend to produce a config.hdnl file, even though this won't expand to any shell script code untildnl AC_OUTPUT time. Name it config.hin to avoid MS-LOSS.AC_CONFIG_HEADER(config.h:config.hin)dnl Checks for programs.# Find a compiler to use.# Check 1) The $CC environment varaible, 2) gcc, 3) acc, and 4) cc.dnl This used to be just AC-CHECK-PROGS(CC, gcc acc, cc), but...# This deals with brain-damaged Sun systems that place a bogus cc or# acc executable in the $PATH, which just prints an error and exit.# We deal with this by actually trying to compile a trivial test program.if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then AC_MSG_CHECKING(For C compiler (cached)) CC="$ac_cv_prog_CC" AC_MSG_RESULT($CC)elif test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. AC_MSG_CHECKING(For C compiler) AC_MSG_RESULT($CC)else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" echo 'main(){return 0;}' > conftest.$ac_ext for ac_prog in gcc acc cc; do# Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 AC_MSG_CHECKING(for $ac_word) for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -x "$ac_dir/$ac_word"; then CC="$ac_prog" if eval $ac_compile; then ac_cv_prog_CC="$ac_prog" fi break fi done CC="$ac_cv_prog_CC" if test -n "$CC"; then AC_MSG_RESULT($ac_dir/$CC) break; fi AC_MSG_RESULT(no) done if test ! -n "$CC"; then AC_MSG_ERROR(no C compiler found) fi IFS="$ac_save_ifs" rm -f conftest*fiAC_SUBST(CC)AC_CACHE_CHECK(whether we are using GNU CC, ac_cv_prog_gcc,[dnl The semicolon is to pacify NeXT's syntax-checking cpp.cat > conftest.c <<EOF#ifdef __GNUC__ yes;#endifEOFif ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yeselse ac_cv_prog_gcc=nofi])if test $ac_cv_prog_gcc = yes; then if test "${CFLAGS+set}" != set; thenAC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g,[echo 'void f(){}' > conftest.cif test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_gcc_g=yeselse ac_cv_prog_gcc_g=nofirm -f conftest*]) fi # If we're using GCC, perform some Deep Magic to enable the result to # link cleanly with code compiled with a compiler that doesn't understand # GCC's support library (-lgcc). Do a link, to relocatable object form, # with just -lgcc. If it's not GCC, do the normal -c thing. # These substitutions are used in the Makefile to force that behaviour. GCCMAGIC1='-Wl,-r -nostdlib' GCCMAGIC2=-lgccelse GCCMAGIC1=-c GCCMAGIC2=fiAC_SUBST(GCCMAGIC1)AC_SUBST(GCCMAGIC2)# Now, figure out the CFLAGS we want. If the user didn't *ask*# for CFLAGS, we're going to use some ideas of our own.if test "$(CFLAGS+set)" != set; then# First, remember one useful thing that was just figured out,# namely whether the compiler can take -g with -O. (Most compilers# seem to do the opposite of what I want here - if you give both, -g# overrides and disables optimization.) This is only done for# gcc at the moment, and the no/yes combination is possible but# misleadingif test $ac_cv_prog_gcc$ac_cv_prog_gcc_g = yesyes; then CFLAGS=-gelse CFLAGS=""fi# Now, the whole raison d'e^tre of this library is that it's *fast*.# So we are *not* happy with autoconf's normal conservative compilation# flags. Try to figure out what kind the compiler we're using and soup# things up a bit. Also turn on warnings if possible.# If it's GCC, crank up optimization to -O6, and try to add some# -m options, too.# Otherwise, it gets even more ad-hoc, but the test below works for the# SunPro C compiler and cranks it up to maximum optimization.dnldnl Note that the situation here is actually *worse* than the usualdnl CPU-COMPANY-SYSTEM system type can detect, because it depends ondnl the C compiler. For example, all of the options below (as of thednl time this is written) are available on a single machine!dnl Using compiler-specific checks rather than config.guess seemsdnl entirely appropriate here.AC_MSG_CHECKING(for useful tuning options (\$TUNE))if test $ac_cv_prog_gcc = yes; then : ${WARN="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"} if test "${TUNE+set}" != set; then TUNE=-O6 case `$CC -v 2>&1` in *gcc-lib/sparc-*) # Try to use the architecture-detecting tool with SunPro CC. if bn_tune=`(fpversion -foption) 2>/dev/null`; then if test "$bn_tune" = xcg92 || test "$bn_tune" = cg92; then TUNE="$TUNE -mv8" elif test "$bn_tune" != xcg89 && test "$bn_tune" != cg89; then TUNE="$TUNE -mv8" bn_tune_guess=yes fi else TUNE="$TUNE -mv8" bn_tune_guess=yes fi esac fielif $CC -flags 2>&1 | grep SunSoft >/dev/null 2>&1; then if test "${WARN+set}" != set; then if $CC -flags 2>&1 | grep 'checking' | grep '^-vc' > /dev/null 2>&1; then WARN=-vc elif $CC -flags 2>&1 | grep 'checking' | grep '^-v ' > /dev/null 2>&1; then WARN=-v fi if $CC -flags 2>&1 | grep '^-xstrconst' > /dev/null 2>&1; then WARN="${WARN}${WARN+ }-xstrconst" fi fi # SunPro C compiler - now grok version and platform if test "${TUNE+set}" != set; then if $CC -flags 2>&1 | grep '^-xO.*5' >/dev/null 2>&1; then TUNE=-xO5 else TUNE=-xO4 fi # Architecture: -native iv avail., else as fpversion says, else guess -mv8 if $CC -flags 2>&1 | grep '^-native' >/dev/null 2>&1; then TUNE="$TUNE -native" elif bn_tune=`(fpversion -foption) 2>/dev/null`; then TUNE="$TUNE -$bn_tune" elif $CC -flags 2>&1 | grep '^-xcg92' >/dev/null 2>&1; then TUNE="$TUNE -xcg92" bn_tune_guess=yes fi fifibn_tune_set=${TUNE+set}# If nothing better is available, turn on -O: ${TUNE=-O}AC_MSG_RESULT(${TUNE-none})if test "$bn_tune_set" != set; then AC_MSG_WARN(not optimizing heavily - try setting \$CFLAGS)elif test "$bn_tune_guess" = yes; then AC_MSG_WARN([architecture guessed. If incorrect, use explicit \$TUNE.])fiAC_MSG_CHECKING(for useful warning options (\$WARN))AC_MSG_RESULT(${WARN-none})fi # ^^ End of "$(CFLAGS+set)" != set conditionAC_SUBST(TUNE)AC_SUBST(WARN)# Find "ranlib". Sone systems don't have or need ranlib. If so,# ":" (do nothing) is used instead.AC_PROG_RANLIBdnl Checks for libraries.dnl (we don't have any)dnl Checks for header files.AC_HEADER_STDCif test $ac_cv_header_stdc = yes; then AC_DEFINE(HAVE_ASSERT_H) AC_DEFINE(HAVE_LIMITS_H) AC_DEFINE(HAVE_STDLIB_H) AC_DEFINE(HAVE_STRING_H)else # If non-ANSI, check for other brokenness.AC_CHECK_HEADERS(assert.h limits.h stdlib.h string.h)# Do we want to include memory.h?if test $ac_cv_header_string_h = no; thenAC_CHECK_HEADERS(strings.h)ac_found=noelseAC_MSG_CHECKING(whether string.h declares mem functions)AC_EGREP_HEADER(memset, string.h, ac_found=yes, ac_found=no)AC_MSG_RESULT($ac_found)fi# ac_found is now "yes" if string.h exists and declares the mem*# functions. If not, see if memory.h exists and include that# as well.if test $ac_found = no; thenAC_CHECK_HEADER(memory,h. [AC_DEFINE(NEED_MEMORY_H)])fiAC_CACHE_CHECK(whether <stdio.h> provides prototypes,bn_cv_header_stdio_protos,[AC_EGREP_HEADER(printf, stdio.h, bn_cv_header_stdio_protos=yes, bn_cv_header_stdio_protos=no)])if test $bn_cv_header_stdio_protos = no; then AC_DEFINE(NO_STDIO_PROTOS)fifi# ^^ End of non-ANSI header brokenness tests (first part)AC_CACHE_CHECK(whether <string.h> declares mem* wrong.,bn_cv_header_mem_broken,[AC_EGREP_HEADER(memcpy.*char, string.h, bn_cv_header_mem_broken=yes, bn_cv_header_mem_broken=no)])if test $bn_cv_header_mem_broken = yes; then AC_DEFINE(MEM_PROTOS_BROKEN)fi# SunOS 4.1.x acc's <assert.h> is brokenAC_CACHE_CHECK(whether <assert.h> is broken and needs <stdio.h>,bn_cv_header_assert_needs_stdio,[AC_EGREP_CPP(stderr,[#include <assert.h>assert(foo)], bn_cv_header_assert_needs_stdio=yes, bn_cv_header_assert_needs_stdio=no)])if test $bn_cv_header_assert_needs_stdio = yes; then AC_DEFINE(ASSERT_NEEDS_STDIO)fiAC_CACHE_CHECK(whether <assert.h> is broken and needs <stdlib.h>,bn_cv_header_assert_needs_stdlib,[AC_EGREP_CPP(exit,[#include <assert.h>assert(foo)], bn_cv_header_assert_needs_stdlib=yes, bn_cv_header_assert_needs_stdlib=no)])if test $bn_cv_header_assert_needs_stdlib = yes; then AC_DEFINE(ASSERT_NEEDS_STDLIB)fi# Check that we have <sys/time.h> explicitly.AC_CHECK_HEADERS(sys/time.h)AC_HEADER_TIMEdnl Checks for typedefs, structures, and compiler characteristics.# Verify that the compiler supports const, and that it works.# A number of compilers sort of support const, but they have bugs# that will prevent valid programs from compiling.AC_C_CONST# See if we have size_t. (If not, define it as unsigned.)AC_TYPE_SIZE_Tdnl Checks for library functions.AC_CHECK_FUNCS(clock_gettime gethrvtime getrusage)dnl The following are for real-time clocks only as of yet.dnl AC_CHECK_FUNCS(clock_getres gethrtime gettimeofday getitimer setitimer ftime)# If we don't have ANSI C, see if a few functions are missing that# we've noticed the lack of before.if test $ac_cv_header_stdc = yes; then AC_DEFINE(HAVE_CLOCK) AC_DEFINE(HAVE_TIME) AC_DEFINE(HAVE_MEMMOVE) AC_DEFINE(HAVE_MEMCPY)elseAC_CHECK_FUNCS(clock time memmove memcpy)fi# ^^ End of non-ANSI header brokenness tests (second part)# The big bang! Produce the output files. This is config.cache, and# config.status, which builds the config.h file and a long list of# Makefiles.dnl The value specified to AC_CONFIG_HEADER at the top if the file isdnl used here to produce config.h.AC_OUTPUT(Makefile)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -