acsfs.m4

来自「基于DHT的对等协议」· M4 代码 · 共 2,148 行 · 第 1/4 页

M4
2,148
字号
dnl     elsednl 	libdbrx='^libdb-?([[3.-]].*)?.(la|so|a)$'dnl 	libdbrxla='^libdb-?([[3.-]].*)?.la$'dnl 	libdbrxso='^libdb-?([[3.-]].*)?.so$'dnl 	libdbrxa='^libdb-?([[3.-]].*)?.a$'dnl 	if test "$with_db3" = yes; thendnl 	    for dir in "$prefix/BerkeleyDB.3.1" /usr/local/BerkeleyDB.3.1 \dnl 		    "$prefix/BerkeleyDB.3.0" /usr/local/BerkeleyDB.3.0 \dnl 		    /usr "$prefix" /usr/local; dodnl 		test -f $dir/include/db.h -o -f $dir/include/db3.h \dnl 			-o -f $dir/include/db3/db.h || continuednl 		if test -f $dir/lib/libdb.a \dnl 			|| ls $dir/lib | egrep "$libdbrx" >/dev/null 2>&1; thendnl 		    with_db3="$dir"dnl 		    breakdnl 		fidnl 	    donednl 	fidnl dnl 	if test -f $with_db3/include/db3.h; thendnl 	    AC_DEFINE(HAVE_DB3_H, 1, [Define if BerkeleyDB header is db3.h.])dnl    	    if test "$with_db3" != /usr; thendnl 	      CPPFLAGS="$CPPFLAGS -I${with_db3}/include"dnl 	    fidnl 	elif test -f $with_db3/include/db3/db.h; thendnl    	    if test "$with_db3" != /usr; thendnl 	      CPPFLAGS="$CPPFLAGS -I${with_db3}/include/db3"dnl 	    fidnl 	elif test -f $with_db3/include/db.h; thendnl 	    if test "$with_db3" != /usr; thendnl 	      CPPFLAGS="$CPPFLAGS -I${with_db3}/include"dnl 	    fidnl 	elsednl 	    AC_MSG_ERROR([Could not find BerkeleyDB library version 3])dnl 	fidnl dnl 	DB3_LIB=`ls $with_db3/lib | egrep "$libdbrxla" | tail -1`dnl 	test ! -f "$with_db3/lib/$DB3_LIB" \dnl 	    && DB3_LIB=`ls $with_db3/lib | egrep "$libdbrxso" | tail -1`dnl 	test ! -f "$with_db3/lib/$DB3_LIB" \dnl 	    && DB3_LIB=`ls $with_db3/lib | egrep "$libdbrxa" | tail -1`dnl 	if test -f "$with_db3/lib/$DB3_LIB"; thendnl 	    DB3_LIB="$with_db3/lib/$DB3_LIB"dnl 	elif test "$with_db3" = /usr; thendnl 	    with_db3=yesdnl 	    DB3_LIB="-ldb"dnl 	elsednl 	    DB3_LIB="-L${with_db3}/lib -ldb"dnl 	fidnl 	AC_MSG_RESULT([$with_db3])dnl     fidnl fidnl dnl AM_CONDITIONAL(USE_DB3, test "${with_db3}" != no)dnl ])dnl pushdef([arglist], [ifelse($#, 0, , $#, 1, [[$1]],dnl 		    [[$1] arglist(shift($@))])])dnldnldnl SFS_TRY_SLEEPYCAT_VERSION(vers, dir)dnlAC_DEFUN([SFS_TRY_SLEEPYCAT_VERSION],[vers=$1dir=$2majvers=`echo $vers | sed -e 's/\..*//'`minvers=`echo $vers | sed -e 's/[^.]*\.//' -e 's/\..*//'`escvers=`echo $vers | sed -e 's/\./\\./g'`catvers=`echo $vers | sed -e 's/\.//g'`: sfs_try_sleepycat_version $vers $dir $majvers $minvers $escvers $catversunset db_headerunset db_libraryfor header in \	$dir/include/db$vers/db.h $dir/include/db$catvers/db.h \	$dir/include/db$majvers/db.h \	$dir/include/db$catvers.h $dir/include/db$majvers.h \	$dir/include/db.hdo    test -f $header || continue    AC_EGREP_CPP(^db_version_is $majvers *\. *$minvers *\$,[#include "$header"db_version_is DB_VERSION_MAJOR.DB_VERSION_MINOR], db_header=$header; break)doneif test "$db_header"; then    for vdir in "$dir/lib/db$catvers" "$dir/lib/db$majvers" \		"$dir/lib/db" "$dir/lib"    do        for library in $vdir/libdb-$vers.la $vdir/libdb$catvers.la \	    $vdir/libdb.la $vdir/libdb-$vers.a $vdir/libdb$catvers.a        do    	if test -f $library; then    	    db_library=$library    	    break 2;    	fi        done    done    if test -z "$db_library"; then	case $db_header in	*/db.h)	    test -f $dir/lib/libdb.a && db_library=$dir/lib/libdb.a	    ;;	esac    fi    if test "$db_library"; then	case $db_header in	*/db.h)	    CPPFLAGS="$CPPFLAGS -I"`dirname $db_header`	    ;;	*)	    ln -s $db_header db.h	    ;;	esac	case $db_library in	*.la)	    DB_LIB=$db_library	    ;;	*.a)	    minusl=`echo $db_library | sed -e 's/^.*\/lib\(.*\)\.a$/-l\1/'`	    DB_LIB=-L`dirname $db_library`" $minusl"	    ;;	*/lib*.so.*)	    minusl=`echo $db_library | sed -e 's/^.*\/lib\(.*\)\.so\..*/-l\1/'`	    DB_LIB=-L`dirname $db_library`" $minusl"	    ;;	esac    fifi])dnldnl SFS_SLEEPYCAT(v1 v2 v3 ..., required)dnldnl   Find BekeleyDB version v1, v2, or v3...dnl      required can be "no" if DB is not requireddnlAC_DEFUN([SFS_SLEEPYCAT],[AC_ARG_WITH(db,--with-db[[[=/usr/local]]]    specify path for BerkeleyDB (from sleepycat.com))AC_SUBST(DB_DIR)AC_CONFIG_SUBDIRS($DB_DIR)AC_SUBST(DB_LIB)unset DB_LIBrm -f db.hfor vers in $1; do    DB_DIR=`cd $srcdir && echo db-$vers.*/dist/`    if test -d "$srcdir/$DB_DIR"; then        DB_DIR=`echo $DB_DIR | sed -e 's!/$!!'`	break    else	unset DB_DIR    fidonetest -z "${with_db+set}" && with_db=yesAC_MSG_CHECKING(for BerkeleyDB library)if test "$DB_DIR" -a "$with_db" = yes; then    CPPFLAGS="$CPPFLAGS "'-I$(top_builddir)/'"$DB_DIR/dist"    DB_LIB='$(top_builddir)/'"$DB_DIR/dist/.libs/libdb-*.a"    AC_MSG_RESULT([using distribution in $DB_DIR subdirectory])elif test x"$with_db" != xno; then    if test "$with_db" = yes; then	for vers in $1; do	    for dir in "$prefix/BerkeleyDB.$vers" \			"/usr/BerkeleyDB.$vers" \			"/usr/local/BerkeleyDB.$vers" \			$prefix /usr /usr/local; do		SFS_TRY_SLEEPYCAT_VERSION($vers, $dir)		test -z "$DB_LIB" || break 2	    done	done    else	for vers in $1; do	    SFS_TRY_SLEEPYCAT_VERSION($vers, $with_db)	    test -z "$DB_LIB" || break	done	test -z "$DB_LIB" && AC_MSG_ERROR(Cannot find BerkeleyDB in $with_db)    fifiif test x"$DB_LIB" != x; then    AC_MSG_RESULT($DB_LIB)    USE_DB=yeselse    AC_MSG_RESULT(no)    USE_DB=no    if test "$2" != "no"; then        AC_MSG_ERROR(Cannot find BerkeleyDB)    fifiAM_CONDITIONAL(USE_DB, test "$USE_DB" = yes)])dnldnl Find OpenSSLdnlAC_DEFUN([SFS_OPENSSL],[AC_SUBST(OPENSSL_DIR)AC_ARG_WITH(openssl,--with-openssl[[=/usr/local/openssl]]   Find OpenSSL libraries				      (DANGER--FOR BENCHMARKING ONLY))AC_MSG_CHECKING([for OpenSSL])test "$with_openssl" = "yes" && unset with_opensslunset OPENSSL_DIRif test -z "$with_openssl"; then    with_openssl=no    for dir in /usr/local/openssl/ /usr/local/ssl/ \		`ls -1d /usr/local/openssl-*/ 2>/dev/null | sed -ne '$p'`; do	if test -f $dir/lib/libssl.a -a -f $dir/include/openssl/ssl.h; then	    with_openssl=`echo $dir | sed -e 's/\/$//'`	    break	fi    donefiOPENSSL_DIR="$with_openssl"AC_MSG_RESULT([$with_openssl])if test "$with_openssl" = no; thendnl    if test -z "$with_openssl"; thendnl	AC_MSG_ERROR([Could not find OpenSSL libraries])dnl    fi     unset OPENSSL_DIRfi])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 www.dmalloc.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)])dnldnl Check for perl and for Pod::Man for generating man pagesdnlAC_DEFUN([SFS_PERL_POD],[if test -z "$PERL" || text ! -x "$PERL"; then	AC_PATH_PROGS(PERL, perl5 perl)fiAC_PATH_PROGS(POD2MAN, pod2man)if test "$PERL"; then	AC_CACHE_CHECK(for Pod::Man, sfs_cv_perl_pod_man,		$PERL -e '{ require Pod::Man }' >/dev/null 2>&1		if test $? = 0; then			sfs_cv_perl_pod_man="yes"		else			sfs_cv_perl_pod_man="no"		fi			)	PERL_POD_MAN="$sfs_cv_perl_pod_man"fiAC_SUBST(PERL_POD_MAN)])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 "x$DEBUG" : '.*-O' > /dev/null \    || sfs_gnu_WFLAGS="$sfs_gnu_WFLAGS -Wno-unused"expr "x$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 "x$DEBUG $WFLAGS $ECFLAGS" : '.*-ansi' > /dev/null; then	CFLAGS="$CFLAGS -ansi"	ac_cpp="$ac_cpp -ansi"fiexpr "x$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)fiif 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_TRYGID], [if test "$sfs_cv_grouplist_t" != gid_t; then    AC_TRY_COMPILE([#include <sys/types.h>#include <unistd.h>#include <grp.h>int getgrouplist ([$*]);		    ], 0, sfs_cv_grouplist_t=gid_t)fi])AC_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	sfs_cv_grouplist_t=int	AC_EGREP_HEADER(getgrouplist.*gid_t *\*, unistd.h,			sfs_cv_grouplist_t=gid_t)	if test "$sfs_cv_grouplist_t" != gid_t; then	    AC_EGREP_HEADER(getgrouplist.*gid_t *\*, grp.h,			    sfs_cv_grouplist_t=gid_t)	fi	SFS_GETGROUPLIST_TRYGID(const char *, gid_t, gid_t *, int *)	SFS_GETGROUPLIST_TRYGID(const char *, int , gid_t *, int *)	SFS_GETGROUPLIST_TRYGID(char *, gid_t, gid_t *, int *)	SFS_GETGROUPLIST_TRYGID(char *, int, gid_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([(authunix|authsys)_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 Set nopagingdnlAC_DEFUN([SFS_NOPAGING],[AC_SUBST(NOPAGING)if test "$enable_static" = yes -a -z "${NOPAGING+set}"; then    case "$host_os" in	openbsd3.[[3456789]]*|openbsd[[456789]]*)	    #MALLOCK=		# mallock.o may panic the OpenBSD kernel# ... unfortunately OMAGIC files don't work on OpenBSD	    #NOPAGING="-all-static"	;;	openbsd*)	    test "$ac_cv_prog_gcc" = yes && NOPAGING="-Wl,-Bstatic,-N"	    MALLOCK=		# mallock.o panics the OpenBSD kernel	;;	freebsd*)	    test yes = "$ac_cv_prog_gcc" -a yes != "$ac_cv_func_mlockall" \		 && NOPAGING="-all-static"	;;    esacfi])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)AC_ARG_WITH(heavy,--with-heavy                do not use sfslite)dnldnl Look for sfs and find out if sfs is installed with a sfsprfx likednl shdbg, debug, etcdnlif test "$with_sfs" = yes -o "$with_sfs" = ""; then  dirs="$prefix /usr/local /usr"else

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?