acsfs.m4

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

M4
2,148
字号
  dirs="$with_sfs"fifor dir in $dirs; do	dnl	dnl sfs${sfstagdir} in there for bkwds comptability	dnl	sfsprefixes="sfs${sfstagdir} sfs"	dnl	dnl can turn off sfslite with the --with-heavy flag	dnl	if test ! "$with_heavy" -o "$with_heavy" = "no"; then	   sfsprefixes="sfslite${sfstagdir} $sfsprefixes"	fi	BREAKOUT=0	for sfsprfx in $sfsprefixes	do    if test -f $dir/lib/${sfsprfx}/libasync.la; then		with_sfs=$dir		BREAKOUT=1		break	    fi	done	if test $BREAKOUT -eq 1; then	    break	fi  sfsprfx=""donecase "$with_sfs" in    /*) ;;    *) with_sfs="$PWD/$with_sfs" ;;esacif test -f ${with_sfs}/Makefile -a -f ${with_sfs}/autoconf.h; then    if egrep '#define DMALLOC' ${with_sfs}/autoconf.h > /dev/null 2>&1; 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 libsfs; do	CPPFLAGS="$CPPFLAGS -I${sfssrcdir}/$lib"    done    CPPFLAGS="$CPPFLAGS -I${with_sfs}/svc"    LIBASYNC=${with_sfs}/async/libasync.la    LIBSVC=${with_sfs}/svc/libsvc.la    LIBARPC=${with_sfs}/arpc/libarpc.la    LIBSFSCRYPT=${with_sfs}/crypt/libsfscrypt.la    LIBSFSMISC=${with_sfs}/sfsmisc/libsfsmisc.la    LIBTAME=${with_sfs}/libtame/libtame.la    LIBSFS=${with_sfs}/libsfs/libsfs.a    MALLOCK=${with_sfs}/sfsmisc/mallock.o    TAME=${with_sfs}/tame/tame    RPCC=${with_sfs}/rpcc/rpcc    ARPCGEN=${with_sfs}/arpcgen/arpcgenelif test -f ${with_sfs}/include/${sfsprfx}/autoconf.h \	-a -f ${with_sfs}/lib/${sfsprfx}/libasync.la; then    sfsincludedir="${with_sfs}/include/${sfsprfx}"    sfslibdir=${with_sfs}/lib/${sfsprfx}    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    LIBTAME=${sfslibdir}/libtame.la    LIBSFS=${sfslibdir}/libsfs.a    MALLOCK=${sfslibdir}/mallock.o    RPCC=rpcc    SFS_PATH_PROG(rpcc, ${sfslibdir})    if test "$PATH_RPCC" -a -x "$PATH_RPCC"     then	RPCC="$PATH_RPCC"    fi    TAME=tame    SFS_PATH_PROG(tame, ${sfslibdir})    if test "$PATH_TAME" -a -x "$PATH_TAME"    then	TAME="$PATH_TAME"    fi    ARPCGEN=arpcgen    SFS_PATH_PROG(arpcgen, ${sfslibdir})    if test "$PATH_ARPCGEN" -a -x "$PATH_ARPCGEN"    then	ARPCGEN="$PATH_ARPCGEN"    fielse    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(LIBTAME)AC_SUBST(LIBSFS)AC_SUBST(RPCC)AC_SUBST(ARPCGEN)AC_SUBST(TAME)AC_SUBST(MALLOCK)AC_SUBST(NOPAGING)SFS_GMPSFS_DMALLOCif test "$LIBSVC" -a -f "$LIBSVC";then	LDEPS='$(LIBTAME) $(LIBSFSMISC) $(LIBSVC) $(LIBSFSCRYPT) $(LIBARPC) $(LIBASYNC)'else	LDEPS='$(LIBTAME) $(LIBSFSMISC) $(LIBSFSCRYPT) $(LIBARPC) $(LIBASYNC)'fiLDADD="$LDEPS "'$(LIBGMP) $(LIBPY)'AC_SUBST(LDEPS)AC_SUBST(LDADD)])dnldnl Test user ID and group ID required for SFSdnlAC_DEFUN([SFS_USER],[AC_SUBST(sfsuser)AC_SUBST(sfsgroup)sfsuser="$with_sfsuser"test -z "$sfsuser" && sfsuser=sfssfsgroup="$with_sfsgroup"test -z "$sfsgroup" && sfsgroup="$sfsuser"if test -z "${with_sfsuser+set}" -o -z "${with_sfsgroup+set}"; thenAC_CACHE_CHECK(for sfs user and group, sfs_cv_ugidok,    [changequote expr='[0-9][0-9]*$' changequote([,])]    uid_isnum=`expr $sfsuser : $expr`    if test "$uid_isnum" != 0; then	sfs_getpwd="getpwuid ($sfsuser)"    else	sfs_getpwd="getpwnam (\"$sfsuser\")"    fi    gid_isnum=`expr $sfsgroup : $expr`    if test "$gid_isnum" != 0; then	sfs_getgrp="getgrgid ($sfsgroup)"    else	sfs_getgrp="getgrnam (\"$sfsgroup\")"    fi    AC_TRY_RUN([changequote changequote([[,]])#include <stdio.h>#include <sys/types.h>#include <pwd.h>#include <grp.h>static int error;static voidbad (char *p){  if (error)    printf (" %s", p);  else {    error = 1;    printf ("[%s", p);  }}intmain (){  struct passwd *pw = $sfs_getpwd;  struct group *gr = $sfs_getgrp;  if (!$uid_isnum && !pw)    bad ("No user $sfsuser.");   if (!$gid_isnum && !gr)    bad ("No group $sfsgroup.");   else if (gr && gr->gr_mem[0])    bad ("Group $sfsgroup cannot have users.");   if (pw && gr && pw->pw_gid != gr->gr_gid)    bad ("Login group of $sfsuser must be $sfsgroup.");   if (error)    printf ("] ");  return error;}changequote([,])],    sfs_cv_ugidok=yes, sfs_cv_ugidok=no, sfs_cv_ugidok=skipped))    test "$sfs_cv_ugidok" = no \	&& AC_MSG_ERROR(Create sfs user/group or use --with-sfsuser/--with-sfsgroup)fi])dnldnl Check to find Python Headersdnldnl SFS_PYTHON(vers)dnlAC_DEFUN([SFS_PYTHON],[AC_ARG_WITH(python,--with-python[=prog]        specify a Python interpreter )if test "${with_python+set}"then	ac_save_CFLAGS=$CFLAGS	ac_save_LIBS=$LIBS	ac_save_CC=$CC	ac_save_CXX=$CXX	ac_save_LDFLAGS=$LDFLAGS	AC_CACHE_CHECK(for python memory allocation, sfs_cv_pymalloc,	[	if test "$with_python" = yes; then		py=python	else		py=$with_python	fi	pyfull=`which $py`	if test $? -ne 0; then		AC_MSG_ERROR(Cannot find path for Python interpreter)	fi	cfg="${srcdir}/py/configure.py"	inc=-I`$pyfull $cfg -I`	lib=`$pyfull $cfg -l`	CC=`$pyfull $cfg -c`	CXX=`$pyfull $cfg -x`	LDFLAGS=`$pyfull $cfg -F`	CFLAGS="${ac_save_CFLAGS} $inc"	LIBS="$lib ${ac_save_LIBS}"	sfs_cv_pymalloc="no"	AC_TRY_LINK([#include <Python.h>                    ],                    [(void )PyMem_Malloc (0); 		    PyMem_Free ((void *)0); 		    PyMem_Realloc ((void *)0, 0);                    ], sfs_cv_pymalloc="yes" )	])	if test "$sfs_cv_pymalloc" = "yes"	then		CPPFLAGS="$CPPFLAGS $inc"		LIBPY="$lib"		AC_DEFINE(PYMALLOC, 1, Use Python memory alloc funcs)		dnl clear out configure's cache		unset ac_cv_prog_CC		unset ac_cv_prog_ac_ct_CC		unset ac_cv_prog_LDFLAGS		unset ac_cv_prog_at_ct_LDFLAGS		AC_PROG_CC		AC_PROG_CPP		AC_PROG_CXX	else		CC=$ac_save_CC		CXX=$ac_save_CXX		LDFLAGS=$ac_save_LDFLAGS	fi	AC_SUBST(LIBPY)	LIBS=$ac_save_LIBS	CFLAGS=$ac_save_CFLAGSfi])dnl dnl SFS_TAG -- allows different builds of SFS to be installed ondnl the same machine (i.e., for optimzation, debug, etc)dnlAC_DEFUN([SFS_TAG],[AC_ARG_WITH(tag,--with-tag=TAG	    	Specify a custom SFS build tag)AC_ARG_WITH(mode,--with-mode=MODE        Specify a build mode for SFS (debug|shared|shdbg|lite))if test "${with_tag+set}" = "set" -a "$with_tag" != "no"; then	sfstag=$with_tagfiinstall_to_system_bin=0case $with_mode in	"debug" )		DEBUG=-g		CXXDEBUG=-g		sfstag=$with_mode		with_dmalloc=yes		;;	"std" )		sfstag=$with_mode		DEBUG=-g		CXXDEBUG=-g		;;	"shared" )		sfstag=$with_mode		enable_shared=yes		DEBUG=-g		CXXDEBUG=-g		;;	"shopt" )		sfstag=$with_mode		enable_shared=yes		DEBUG='-g -O2'		CXXDEBUG='-g -O2'		;;	"shdbg"  )		sfstag=$with_mode		enable_shared=yes		DEBUG=-g		CXXDEBUG=-g		with_dmalloc=yes		;;	"profile" )		sfstag=$with_mode		DEBUG='-g -pg -O2'		CXXDEBUG='-g -pg -O2'		;;	"pydbg" )		sfstag=$with_mode		DEBUG=-g		CXXDEBUG=-g		with_python=yes		enable_shared=yes		with_dmalloc=no		SFS_PYTHON		;;	"python")		sfstag=$with_mode		with_python=yes		enable_shared=yes		with_dmalloc=no		SFS_PYTHON		;;	"optmz" | "lite" )		dnl		dnl no-op, should go in the regular sfslite directory		dnl		;;	*)		if test "${with_mode+set}" = "set" ; then			AC_MSG_ERROR([Unrecognized SFS build mode])		fi		;;esacif test "${sfstag+set}" = "set" ; then	sfstagdir="/$sfstag"fi	AC_SUBST(sfstagdir)AC_SUBST(sfstag)])dnldnl SFS_MMAPdnldnl  check MMAP options dnlAC_DEFUN([SFS_MMAP],[AC_CACHE_CHECK(for MAP_NOSYNC option, sfs_map_nosync_opt,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/mman.h>], [int i = MAP_NOSYNC;], sfs_map_nosync_opt=yes, sfs_map_nosync_opt=no)])if test "$sfs_map_nosync_opt" = yes; then	AC_DEFINE(HAVE_MAP_NOSYNC, 1,	     Define if the MAP_NOSYNC option for mmap is available)fi])dnldnl AC_PROG_INSTALL_Cdnldnl  checks for install -C; uses it instead of install -cdnlAC_DEFUN([AC_PROG_INSTALL_C],[AC_PROG_INSTALLAC_CACHE_CHECK(for install -C, ac_cv_path_install_c,[echo $INSTALL | grep -e '/install -c' >/dev/nullif [ test $? -eq 0 ]then   INSTALL_C=`echo $INSTALL | sed -e 's/install -c/install -C/' `   TMP1=/tmp/tmp.sfslite1   TMP2=/tmp/tmp.sfslite2   if test -f $TMP2; then	rm -f $TMP2   fi   echo "foobar city" > $TMP1   $INSTALL_C $TMP1 $TMP2 > /dev/null 2>&1   diff $TMP1 $TMP2 > /dev/null 2>&1   if test $? -eq 0    then	INSTALL=$INSTALL_C	AC_SUBST($INSTALL)   fi   rm -f $TMP1 $TMP2 > /dev/null 2>&1fiac_cv_path_install_c=$INSTALL])])dnldnl Compile (optionally) tutorial functionsdnlAC_DEFUN([SFS_TUTORIAL],[AC_ARG_ENABLE(tutorial,--enable-tutorial  	compile tutorial files)test "${enable_tutorial+set}" = "set" && with_tutorial="yes"AM_CONDITIONAL(USE_TUTORIAL, test "$with_tutorial" = "yes")])dnldnl Compile (optionally) full sfsmiscdnlAC_DEFUN([SFS_MISC],[AC_ARG_ENABLE(sfsmisc,--enable-sfsmisc      compile the full sfsmisc/ library)test "${enable_sfsmisc+set}" = "set" && with_sfsmisc="yes"AM_CONDITIONAL(USE_SFSMISC, test "$with_sfsmisc" = "yes")if test "$with_sfsmisc" = "yes"then	AC_DEFINE(HAVE_SFSMISC, 1, 		  Define if we're compiling with full sfsmisc library)fi])dnldnl Compile (optionally) arpcgen and libsfsdnlAC_DEFUN([SFS_LIBSFS],[AC_ARG_ENABLE(libsfs,--enable-libsfs   compile the libsfs C library and arpcgen)test "${enable_libsfs+set}" = "set" && with_libsfs="yes"AM_CONDITIONAL(USE_LIBSFS, test "$with_libsfs" = "yes")])dnldnl Enable all optional directoriesdnlAC_DEFUN([SFS_ALL],[AC_ARG_ENABLE(all,--enable-all    enable full sfsmisc libsfs and tutorial)test "${enable_all+set}" = "set" && with_all="yes"if test "$with_all" = "yes"then	with_libsfs="yes"	AM_CONDITIONAL(USE_LIBSFS, test "$with_libsfs" = "yes")	with_sfsmisc="yes"	AM_CONDITIONAL(USE_SFSMISC, test "$with_sfsmisc" = "yes")	AC_DEFINE(HAVE_SFSMISC, 1, 		  Define if we're compiling with full sfsmisc library)	with_tutorial="yes"	AM_CONDITIONAL(USE_TUTORIAL, test "$with_tutorial" = "yes")fi])dnldnl SFS_SET_CLOCKdnldnl  Check for function in sfs that allows different types of clocksdnl  to be set.dnlAC_DEFUN([SFS_SET_CLOCK],[AC_CACHE_CHECK(for sfs_set_clock, sfs_cv_set_clock,[CC_REAL=$CCCC=$CXXAC_TRY_COMPILE([ #include "async.h" ], sfs_set_clock (SFS_CLOCK_TIMER);,	 	sfs_cv_set_clock=yes)CC=$CC_REAL])if test "$sfs_cv_set_clock" = "yes"then	AC_DEFINE(HAVE_SFS_SET_CLOCK, 1, Toggle SFS core clock)fi])dnldnl SFS_CALLBACKdnlAC_DEFUN([SFS_CALLBACK],[AC_ARG_ENABLE(callback2,--enable-callback2   use callback.h version 2)if test "${enable_callback2+set}" = "set" -o \ 	"${with_tutorial}" = "yes"; then \	AC_DEFINE(SFS_HAVE_CALLBACK2, 1, Toggle callback2.h with CB signaling)fi])dnldnl SFS_SYSTEM_BINdnlAC_DEFUN([SFS_SYSTEM_BIN],[AC_ARG_ENABLE(system-bin,--enabel-system-bin   Dump rpcc and tame into system-wide bin)test "${enable_system_bin+set}" = "set" && install_to_system_bin=1])

⌨️ 快捷键说明

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