📄 configure.in
字号:
dnl
dnl $Id: configure.in,v 1.14 2001/10/20 01:02:42 dallen Exp $
dnl
dnl This file in input to autoconf. It consists of a series of m4
dnl macros which expand to produce the shell script "configure".
dnl Anything which is not an m4 macro is copied directly to the output.
dnl
dnl Start things up. If the specified file doesn't exist, configure
dnl will complain.
AC_INIT(common/pgpBase.h)
dnl The following tests need to know that we intend to produce a config.h
dnl file, even though this won't expand to any shell script code until
dnl AC_OUTPUT time.
AC_CONFIG_HEADER(unix/pgpPFLConfig.h)
dnl The following directory is where we will find the ancillary scripts,
dnl like install-sh, config.sub, and config.guess.
AC_CONFIG_AUX_DIR(unix/config)
AC_CANONICAL_HOST
SHELL=/bin/sh
dnl check for a compiler first here so that the stat64 check in the following
dnl host specific section doesn't fail out if the $CC variable isn't set.
dnl AC_PROG_CC
case "$host" in
*-*-solaris*)
PGPARCH=PGP_UNIX_SOLARIS
LARGEFILEDEFS=-DHAVE_64BIT_FILES=1
dnl AC_CHECK_FUNC(stat64,
dnl LARGEFILEDEFS=-DHAVE_64BIT_FILES=1,
dnl LARGEFILEDEFS=)
REENTRANT=-D_REENTRANT=1
;;
*-*-linux*)
PGPARCH=PGP_UNIX_LINUX
LARGEFILEDEFS=
REENTRANT=-D_REENTRANT=1
;;
*-*-hpux*)
PGPARCH=PGP_UNIX_HPUX
LARGEFILEDEFS="-DHAVE_64BIT_FILES=1 -D_LARGEFILE64_SOURCE=1 -D__STDC_EXT__=1"
REENTRANT=-D_REENTRANT=1
;;
*-*-aix*)
PGPARCH=PGP_UNIX_AIX
LARGEFILEDEFS="-DHAVE_64BIT_FILES=1 -D_LARGE_FILES=1"
REENTRANT=-D_THREAD_SAFE=1
;;
*-*-darwin*)
PGPARCH=PGP_UNIX_DARWIN
;;
*)
PGPARCH=PGP_UNIX_UNKNOWN
REENTRANT=""
;;
esac
AC_SUBST(LARGEFILEDEFS)
AC_SUBST(REENTRANT)
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 -r "$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*
fi
AC_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;
#endif
EOF
if ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi])
if test $ac_cv_prog_gcc = yes; then
if test "${CFLAGS+set}" != set; then
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
fi
rm -f conftest*
])
fi
fi
dnl This is a rather ugly way to find out we are using the latest Sun compiler
AC_CACHE_CHECK(whether we are using Sun CC, ac_cv_prog_suncc,
[
if $CC -flags 2>&1 | grep sun.com >/dev/null 2>&1; then
ac_cv_prog_suncc=yes
else
ac_cv_prog_suncc=no
fi
])
dnl check version of Sun's CC
AC_CACHE_CHECK(what version of Sun's CC, ac_cv_suncc_ver,
[
if test $ac_cv_prog_suncc = yes; then
$CC -V 2> /tmp/ccver.$$ > /dev/null
ac_cv_suncc_ver=`cat /tmp/ccver.$$ | grep Compiler | awk '{print $4;}' | cut -d. -f1`
rm -f /tmp/ccver.$$
fi
])
dnl check for HP-UX cc
AC_CACHE_CHECK(whether we are using HP-UX cc, ac_cv_prog_hpuxcc,
[ac_cv_prog_hpuxcc=no
if test $ac_cv_prog_gcc = no; then
case $host_os in
*hpux*) ac_cv_prog_hpuxcc=yes;;
esac
fi])
dnl Set up the COMPILER define value
if test "${COMPILER+set}" != set; then
if test $ac_cv_prog_gcc = yes; then
COMPILER="-DPGP_COMPILER_GCC=1"
elif test $ac_cv_prog_suncc = yes; then
COMPILER="-DPGP_COMPILER_SUN=1 -DPGP_COMPILER_SUN_VER=$ac_cv_suncc_ver"
elif test $ac_cv_prog_hpuxcc = yes; then
COMPILER="-DPGP_COMPILER_HPUX=1"
fi
fi
AC_SUBST(COMPILER)
# Now, figure out what CFLAGS we want. If the user didn't ask specifically,
# we're going to use some ideas of our own.
if test "${CFLAGS+set}" != set; then
# Prefer optimizing, with debugging a second
if test $ac_cv_prog_gcc$ac_cv_prog_gcc_g = yesyes; then
if test $PGPARCH = PGP_UNIX_AIX; then
CFLAGS="-mminimal-toc -O"
else
CFLAGS="-O -g"
fi
elif test $ac_cv_prog_suncc = yes; then
CFLAGS="-O -g"
elif test $ac_cv_prog_hpuxcc = yes; then
CFLAGS="-O -Dinline= -Ae"
else
CFLAGS=-O
fi
dnl Set other (non-optimizing/debug) compiler options
if test $PGPARCH = PGP_UNIX_DARWIN; then
CCOPTS="-fno-common"
elif test $PGPARCH = PGP_UNIX_HPUX; then
CCOPTS="-fPIC"
else
CCOPTS=""
fi
AC_SUBST(CCOPTS)
dnl This is to get warnings enabled where possible.
AC_MSG_CHECKING(for useful warning options (\$WARN))
if test "${WARN+set}" != set; then
if test $ac_cv_prog_gcc = yes; then
WARN="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
-Wwrite-strings"
elif test $ac_cv_prog_suncc = yes; then
WARN="-v -Xc -xstrconst"
fi
# Any other compiler's warning flags?
fi
AC_MSG_RESULT(${WARN-none})
AC_SUBST(WARN)
fi
# ^^ end of CFLAGS inference section
AC_REQUIRE_CPP
# Finally, figure out the command to generate dependencies.
AC_CACHE_CHECK(how to make dependencies, ac_cv_prog_DEPEND,
[if test -n "$DEPEND"; then
ac_cv_prog_DEPEND="$DEPEND"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
echo '#include "confdefs.h"' > conftest.c
for ac_prog in "$CPP -M" "$CC -xM" "$CC -M"; do
echo $ac_prog $CPPFLAGS conftest.c 1>&AC_FD_CC;
if $ac_prog $CPPFLAGS conftest.c 2>&AC_FD_CC \
| egrep "conftest\.o" >/dev/null 2>&1; then
ac_cv_prog_DEPEND="$ac_prog $CPPFLAGS"
break
fi
done
if test ! -n "$ac_cv_prog_DEPEND"; then
ac_cv_prog_DEPEND=:
fi
IFS="$ac_save_ifs"
rm -f conftest*
fi])
DEPEND="$ac_cv_prog_DEPEND"
AC_SUBST(DEPEND)
# Find a BSD-compatibile install program, with install-sh as a fallback.
AC_PROG_INSTALL
# Find "ranlib". Sone systems don't have or need ranlib. If so,
# ":" (do nothing) is used instead.
AC_PROG_RANLIB
# Use symlinks (ln -s) if possible. If not, use hard links (ln).
AC_PROG_LN_S
# Figure out how to test for symlinks... Check 'test -L' and then 'test -h'
AC_CACHE_CHECK(how to test for symlinks, ac_cv_prog_TEST_L,
[rm -f conftest
$ac_cv_prog_LN_S foo conftest
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
if ( test -L conftest ); then
ac_cv_prog_TEST_L="test -L"
elif ( test -h conftest ); then
ac_cv_prog_TEST_L="test -h"
else
ac_cv_prog_TEST_L="test ! -f"
fi
IFS="$ac_save_ifs"
rm -f conftest*])
TEST_L="$ac_cv_prog_TEST_L"
AC_SUBST(TEST_L)
dnl Checks for libraries.
AC_CHECK_LIB(thread, thr_create)
AC_CHECK_LIB(pthread, pthread_create)
dnl Checks for library functions.
AC_CHECK_FUNCS(gethrtime clock_gettime clock_getres gettimeofday \
getitimer setitimer ftime mktemp mkstemp thr_create \
pthread_create pthread_attr_create sem_init semget)
dnl Checks for header files.
# Check that this system has a set of properly working ANSI C header files.
# In particular, check for the existence of <stdlib.h>, <stdarg.h>,
# <string.h> and <float.h>. Also check that <string.h> declares mem*,
# that <stdlib.h> declares free, and that the <ctype.h> macros work
# with values >= 128.
AC_HEADER_STDC
# Check for which system headers are available
AC_CHECK_HEADERS(fcntl.h limits.h stdarg.h stdlib.h unistd.h paths.h \
dirent.h sys/ioctl.h sys/time.h sys/timeb.h sys/param.h sys/stat.h \
sys/types.h)
AC_HEADER_TIME
dnl Checks for typedefs, structures, and compiler characteristics.
# Verify that the compiler supports const, and that it works.
# A lot of compilers sort of support const, but they have bugs
# that will prevent valid programs from compiling.
AC_C_CONST
# See if we have off_t in <sys/types.h> or <stdlib.h>.
# If not, define it as "long".
AC_TYPE_OFF_T
# See if we have size_t similarly. If not, define it as unsigned.
AC_TYPE_SIZE_T
# Check for our style of unsigned typedefs in sys/types.h
AC_EGREP_HEADER([[^a-zA-Z0-9_]uchar[^a-zA-Z0-9_]], sys/types.h,
AC_DEFINE(HAVE_UCHAR))
AC_EGREP_HEADER([[^a-zA-Z0-9_]ushort[^a-zA-Z0-9_]], sys/types.h,
AC_DEFINE(HAVE_USHORT))
AC_EGREP_HEADER([[^a-zA-Z0-9_]uint[^a-zA-Z0-9_]], sys/types.h,
AC_DEFINE(HAVE_UINT))
AC_EGREP_HEADER([[^a-zA-Z0-9_]ulong[^a-zA-Z0-9_]], sys/types.h,
AC_DEFINE(HAVE_ULONG))
# 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 is
dnl used here.
PGP_AC_OUTPUT(
Makefile
common/Makefile,
unix/config/pre.in, unix/config/post.in)
cat >> unix/pgpPFLConfig.h << END
#ifndef $PGPARCH
#define $PGPARCH 1
#endif
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -