📄 aclocal.m4
字号:
dnldnl Use dmalloc if requesteddnlAC_DEFUN(SFS_DMALLOC,[dnl AC_ARG_WITH(small-limits,dnl --with-small-limits Try to trigger memory allocation bugs,dnl CPPFLAGS="$CPPFLAGS -DSMALL_LIMITS"dnl test "${with_dmalloc+set}" = set || with_dmalloc=yesdnl )AC_CHECK_HEADERS(memory.h)AC_ARG_WITH(dmalloc,--with-dmalloc use debugging malloc from ftp.letters.com (set MAX_FILE_LEN to 1024 when installing),pref=$prefixtest "$pref" = NONE && pref=$ac_default_prefixtest "$withval" = yes && withval="${pref}"test "$withval" || withval="${pref}"using_dmalloc=noif test "$withval" != no; then AC_DEFINE(DMALLOC, 1, Define if compiling with dmalloc. )dnl CPPFLAGS="$CPPFLAGS -DDMALLOC" CPPFLAGS="$CPPFLAGS -I${withval}/include" LIBS="$LIBS -L${withval}/lib -ldmalloc" using_dmalloc=yesfi)AM_CONDITIONAL(DMALLOC, test "$using_dmalloc" = yes)])dnldnl Find perldnlAC_DEFUN(SFS_PERLINFO,[AC_ARG_WITH(perl,--with-perl=PATH Specify perl executable to use,[case "$withval" in yes|no|"") ;; *) PERL="$withval" ;;esac])if test -z "$PERL" || test ! -x "$PERL"; then AC_PATH_PROGS(PERL, perl5 perl)fiif test -x "$PERL" && $PERL -e 'require 5.004'; then :; else AC_MSG_ERROR("Can\'t find perl 5.004 or later")fiAC_CACHE_CHECK(for perl includes, sfs_cv_perl_ccopts, sfs_cv_perl_ccopts=`$PERL -MExtUtils::Embed -e ccopts` sfs_cv_perl_ccopts=`echo $sfs_cv_perl_ccopts`)AC_CACHE_CHECK(for perl libraries, sfs_cv_perl_ldopts, sfs_cv_perl_ldopts=`$PERL -MExtUtils::Embed -e ldopts -- -std` sfs_cv_perl_ldopts=`echo $sfs_cv_perl_ldopts`)AC_CACHE_CHECK(for perl xsubpp, sfs_cv_perl_xsubpp, sfs_cv_perl_xsubpp="$PERL "`$PERL -MConfig -e 'print qq(\ -I$Config{"installarchlib"} -I$Config{"installprivlib"}\ $Config{"installprivlib"}/ExtUtils/xsubpp\ -typemap $Config{"installprivlib"}/ExtUtils/typemap)'` sfs_cv_perl_xsubpp=`echo $sfs_cv_perl_xsubpp`)XSUBPP="$sfs_cv_perl_xsubpp"PERL_INC="$sfs_cv_perl_ccopts"PERL_LIB="$sfs_cv_perl_ldopts"PERL_XSI="$PERL -MExtUtils::Embed -e xsinit -- -std"AC_SUBST(PERL)AC_SUBST(PERL_INC)AC_SUBST(PERL_LIB)AC_SUBST(PERL_XSI)AC_SUBST(XSUBPP)])dnl'dnl Various warning flags for gcc. This must go at the very top,dnl right after AC_PROG_CC and AC_PROG_CXX.dnlAC_DEFUN(SFS_WFLAGS,[AC_SUBST(NW)AC_SUBST(WFLAGS)AC_SUBST(CXXWFLAGS)AC_SUBST(DEBUG)AC_SUBST(CXXDEBUG)AC_SUBST(ECFLAGS)AC_SUBST(ECXXFLAGS)AC_SUBST(CXXNOERR)test -z "${CXXWFLAGS+set}" -a "${WFLAGS+set}" && CXXWFLAGS="$WFLAGS"test -z "${CXXDEBUG+set}" -a "${DEBUG+set}" && CXXDEBUG="$DEBUG"test "${DEBUG+set}" || DEBUG="$CFLAGS"export DEBUGtest "${CXXDEBUG+set}" || CXXDEBUG="$CXXFLAGS"export CXXDEBUGcase $host_os in openbsd*) sfs_gnu_WFLAGS="-ansi -Wall -Wsign-compare -Wchar-subscripts -Werror" sfs_gnu_CXXWFLAGS="$sfs_gnu_WFLAGS" ;; linux*|freebsd*) sfs_gnu_WFLAGS="-Wall -Werror" sfs_gnu_CXXWFLAGS="$sfs_gnu_WFLAGS" ;; *) sfs_gnu_WFLAGS="-Wall" sfs_gnu_CXXWFLAGS="$sfs_gnu_WFLAGS" ;;esacexpr "$DEBUG" : '.*-O' > /dev/null \ || sfs_gnu_WFLAGS="$sfs_gnu_WFLAGS -Wno-unused"expr "$CXXDEBUG" : '.*-O' > /dev/null \ || sfs_gnu_CXXWFLAGS="$sfs_gnu_CXXWFLAGS -Wno-unused"NW='-w'test "$GCC" = yes -a -z "${WFLAGS+set}" && WFLAGS="$sfs_gnu_WFLAGS"test "$GXX" = yes -a -z "${CXXWFLAGS+set}" && CXXWFLAGS="$sfs_gnu_CXXWFLAGS"CXXNOERR=test "$GXX" = yes && CXXNOERR='-Wno-error'# Temporarily set CFLAGS to ansi so tests for things like __inline go correctlyif expr "$DEBUG $WFLAGS $ECFLAGS" : '.*-ansi' > /dev/null; then CFLAGS="$CFLAGS -ansi" ac_cpp="$ac_cpp -ansi"fiexpr "$CXXDEBUG $CXXWFLAGS $ECXXFLAGS" : '.*-ansi' > /dev/null \ && CXXFLAGS="$CXXFLAGS -ansi"])dnldnl SFS_CFLAGS puts the effects of SFS_WFLAGS into place.dnl This must be called after all tests have been run.dnlAC_DEFUN(SFS_CFLAGS,[unset CFLAGSunset CXXFLAGSCFLAGS='$(DEBUG) $(WFLAGS) $(ECFLAGS)'CXXFLAGS='$(CXXDEBUG) $(CXXWFLAGS) $(ECXXFLAGS)'])dnldnl Check for xdr_u_intNN_t, etcdnlAC_DEFUN(SFS_CHECK_XDR,[dnl AC_CACHE_CHECK([for a broken <rpc/xdr.h>], sfs_cv_xdr_broken,dnl AC_EGREP_HEADER(xdr_u_int32_t, [rpc/xdr.h], dnl sfs_cv_xdr_broken=no, sfs_cv_xdr_broken=yes))dnl if test "$sfs_cv_xdr_broken" = "yes"; thendnl AC_DEFINE(SFS_XDR_BROKEN)dnl dnl We need to know the following in order to fix rpc/xdr.h: dnl AC_CHECK_SIZEOF(short)dnl AC_CHECK_SIZEOF(int)dnl AC_CHECK_SIZEOF(long)dnl fiSFS_CHECK_DECL(xdr_callmsg, rpc/rpc.h)AC_CACHE_CHECK(what second xdr_getlong arg points to, sfs_cv_xdrlong_t,AC_EGREP_HEADER(\*x_getlong.* long *\*, [rpc/rpc.h], sfs_cv_xdrlong_t=long)if test -z "$sfs_cv_xdrlong_t"; then AC_EGREP_HEADER(\*x_getlong.* int *\*, [rpc/rpc.h], sfs_cv_xdrlong_t=int)elif test -z "$sfs_cv_xdrlong_t"; then sfs_cv_xdrlong_t=u_int32_tfi)AC_DEFINE_UNQUOTED(xdrlong_t, $sfs_cv_xdrlong_t, What the second argument of xdr_getlong points to)])dnldnl Check for random devicednlAC_DEFUN(SFS_DEV_RANDOM,[AC_CACHE_CHECK([for kernel random number generator], sfs_cv_dev_random,for dev in /dev/urandom /dev/srandom /dev/random /dev/srnd /dev/rnd; do if test -c "$dev"; then sfs_cv_dev_random=$dev break fi test "$sfs_cv_dev_random" || sfs_cv_dev_random=nodone)if test "$sfs_cv_dev_random" != no; thenpushdef([SFS_DEV_RANDOM], [[SFS_DEV_RANDOM]]) AC_DEFINE_UNQUOTED([SFS_DEV_RANDOM], "$sfs_cv_dev_random", [Path to the strongest random number device, if any.])popdef([SFS_DEV_RANDOM])fi])dnldnl Check for getgrouplist functiondnlAC_DEFUN(SFS_GETGROUPLIST,[AC_CHECK_FUNCS(getgrouplist)AC_CACHE_CHECK([whether getgrouplist uses int or gid_t], sfs_cv_grouplist_t, if test "$ac_cv_func_getgrouplist" = yes; then AC_EGREP_HEADER(getgrouplist.*gid_t *\*, unistd.h, sfs_cv_grouplist_t=gid_t, sfs_cv_grouplist_t=int) else sfs_cv_grouplist_t=gid_t fi)AC_DEFINE_UNQUOTED([GROUPLIST_T], $sfs_cv_grouplist_t, [Type pointed to by 3rd argument of getgrouplist.])])dnldnl Check if <grp.h> is needed for setgroups declaration (linux)dnlAC_DEFUN(SFS_SETGROUPS,[AC_CACHE_CHECK([for setgroups declaration in grp.h], sfs_cv_setgroups_grp_h, AC_EGREP_HEADER(setgroups, grp.h, sfs_cv_setgroups_grp_h=yes, sfs_cv_setgroups_grp_h=no))if test "$sfs_cv_setgroups_grp_h" = yes; thenAC_DEFINE([SETGROUPS_NEEDS_GRP_H], 1, [Define if setgroups is declared in <grp.h>.])fi])dnldnl Check if authunix_create is broken and takes a gid_t *dnlAC_DEFUN(SFS_AUTHUNIX_GROUP_T,[AC_CACHE_CHECK([what last authunix_create arg points to], sfs_cv_authunix_group_t,AC_EGREP_HEADER([auth(unix|sys)_create.*(uid_t|gid_t)], rpc/rpc.h, sfs_cv_authunix_group_t=gid_t, sfs_cv_authunix_group_t=int))if test "$sfs_cv_authunix_group_t" = gid_t; then AC_DEFINE_UNQUOTED(AUTHUNIX_GID_T, 1, [Define if last argument of authunix_create is a gid_t *.])fi])dnldnl Check the type of the x_ops field in XDRdnlAC_DEFUN(SFS_XDR_OPS_T,[AC_CACHE_CHECK([type of XDR::x_ops], sfs_cv_xdr_ops_t,AC_EGREP_HEADER([xdr_ops *\* *x_ops;], rpc/xdr.h, sfs_cv_xdr_ops_t=xdr_ops, sfs_cv_xdr_ops_t=XDR::xdr_ops))AC_DEFINE_UNQUOTED(xdr_ops_t, $sfs_cv_xdr_ops_t, [The C++ type name of the x_ops field in struct XDR.])])dnldnl Find installed SFS librariesdnl This is not for SFS, but for other packages that use SFS.dnlAC_DEFUN(SFS_SFS,[AC_ARG_WITH(sfs,--with-sfs[[=PATH]] specify location of SFS libraries)if test "$with_sfs" = yes -o "$with_sfs" = ""; then for dir in "$prefix" /usr/local /usr; do if test -f $dir/lib/sfs/libasync.la; then with_sfs=$dir break fi doneficase "$with_sfs" in /*) ;; *) with_sfs="$PWD/$with_sfs" ;;esacif test -f ${with_sfs}/Makefile -a -f ${with_sfs}/autoconf.h; then if egrep -q '#define DMALLOC' ${with_sfs}/autoconf.h > /dev/null; then test -z "$with_dmalloc" -o "$with_dmalloc" = no && with_dmalloc=yes elif test "$with_dmalloc" -a "$with_dmalloc" != no; then AC_MSG_ERROR("SFS libraries not compiled with dmalloc") fi sfssrcdir=`sed -ne 's/^srcdir *= *//p' ${with_sfs}/Makefile` case "$sfssrcdir" in /*) ;; *) sfssrcdir="${with_sfs}/${sfssrcdir}" ;; esac CPPFLAGS="$CPPFLAGS -I${with_sfs}" for lib in async arpc crypt sfsmisc; do CPPFLAGS="$CPPFLAGS -I${sfssrcdir}/$lib" done CPPFLAGS="$CPPFLAGS -I${with_sfs}/svc" LIBASYNC=${with_sfs}/async/libasync.la LIBARPC=${with_sfs}/arpc/libarpc.la LIBSFSCRYPT=${with_sfs}/crypt/libsfscrypt.la LIBSFSMISC=${with_sfs}/sfsmisc/libsfsmisc.la LIBSVC=${with_sfs}/svc/libsvc.la MALLOCK=${with_sfs}/sfsmisc/mallock.o RPCC=${with_sfs}/rpcc/rpccelif test -f ${with_sfs}/include/sfs/autoconf.h \ -a -f ${with_sfs}/lib/sfs/libasync.la; then sfsincludedir="${with_sfs}/include/sfs" sfslibdir=${with_sfs}/lib/sfs if egrep '#define DMALLOC' ${sfsincludedir}/autoconf.h > /dev/null; then test -z "$with_dmalloc" -o "$with_dmalloc" = no && with_dmalloc=yes else with_dmalloc=no fi CPPFLAGS="$CPPFLAGS -I${sfsincludedir}" LIBASYNC=${sfslibdir}/libasync.la LIBARPC=${sfslibdir}/libarpc.la LIBSFSCRYPT=${sfslibdir}/libsfscrypt.la LIBSFSMISC=${sfslibdir}/libsfsmisc.la LIBSVC=${sfslibdir}/libsvc.la MALLOCK=${sfslibdir}/mallock.o RPCC=${with_sfs}/bin/rpccelse AC_MSG_ERROR("Can\'t find SFS libraries")fiif test "$enable_static" = yes -a -z "${NOPAGING+set}"; then case "$host_os" in openbsd*) test "$ac_cv_prog_gcc" = yes && NOPAGING="-Wl,-Bstatic,-N" MALLOCK= # mallock.o panics the OpenBSD kernel ;; freebsd*) test "$ac_cv_prog_gcc" = yes && NOPAGING="-Wl,-Bstatic" ;; esacfisfslibdir='$(libdir)/sfs'sfsincludedir='$(libdir)/include'AC_SUBST(sfslibdir)AC_SUBST(sfsincludedir)AC_SUBST(LIBASYNC)AC_SUBST(LIBARPC)AC_SUBST(LIBSFSCRYPT)AC_SUBST(LIBSFSMISC)AC_SUBST(LIBSVC)AC_SUBST(RPCC)AC_SUBST(MALLOCK)AC_SUBST(NOPAGING)SFS_GMPSFS_DMALLOCLDEPS='$(LIBSFSMISC) $(LIBSVC) $(LIBSFSCRYPT) $(LIBARPC) $(LIBASYNC)'LDADD="$LDEPS "'$(LIBGMP)'AC_SUBST(LDEPS)AC_SUBST(LDADD)])# Define a conditional.AC_DEFUN(AM_CONDITIONAL,[AC_SUBST($1_TRUE)AC_SUBST($1_FALSE)if $2; then $1_TRUE= $1_FALSE='#'else $1_TRUE='#' $1_FALSE=fi])# Do all the work for Automake. This macro actually does too much --# some checks are only needed if your package does certain things.# But this isn't really a big deal.# serial 1dnl Usage:dnl AM_INIT_AUTOMAKE(package,version, [no-define])AC_DEFUN(AM_INIT_AUTOMAKE,[AC_REQUIRE([AC_PROG_INSTALL])PACKAGE=[$1]AC_SUBST(PACKAGE)VERSION=[$2]AC_SUBST(VERSION)dnl test to see if srcdir already configuredif test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first])fiifelse([$3],,AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))AC_REQUIRE([AM_SANITY_CHECK])AC_REQUIRE([AC_ARG_PROGRAM])dnl FIXME This is truly gross.missing_dir=`cd $ac_aux_dir && pwd`AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)AC_REQUIRE([AC_PROG_MAKE_SET])])## Check to make sure that the build environment is sane.#AC_DEFUN(AM_SANITY_CHECK,[AC_MSG_CHECKING([whether build environment is sane])# Just in casesleep 1echo timestamp > conftestfile# Do `set' in a subshell so we don't clobber the current shell's# arguments. Must try -L first in case configure is actually a# symlink; some systems play weird games with the mod time of symlinks# (eg FreeBSD returns the mod time of the symlink's containing# directory).if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a brokenalias in your environment]) fi test "[$]2" = conftestfile )then # Ok. :else AC_MSG_ERROR([newly created file is older than distributed files!Check your system clock])firm -f conftest*AC_MSG_RESULT(yes)])dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)dnl The program must properly implement --version.AC_DEFUN(AM_MISSING_PROG,[AC_MSG_CHECKING(for working $2)# Run test in a subshell; some versions of sh will print an error if# an executable is not found, even if stderr is redirected.# Redirect stdin to placate older versions of autoconf. Sigh.if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found)else $1="$3/missing $2" AC_MSG_RESULT(missing)fiAC_SUBST($1)])# Like AC_CONFIG_HEADER, but automatically create stamp file.AC_DEFUN(AM_CONFIG_HEADER,[AC_PREREQ([2.12])AC_CONFIG_HEADER([$1])dnl When config.status generates a header, we must update the stamp-h file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -