📄 configure.ac
字号:
# Process this file with autoconf to produce a configure script.AC_INIT(lids, [1.1.1r2-2.4.18], pbi@cartel-info.fr)AM_INIT_AUTOMAKE(lids, [1.1.1r2-2.4.18])AC_SUBST(KERNEL_VERSION,[2.4.18])AC_SUBST(LIDS_VERSION,[1.1.1r2])AC_SUBST(PATCH_FILE,[lids-$VERSION.patch])AC_CONFIG_SRCDIR([lidstools/lidsadm.c])AM_CONFIG_HEADER([config.h])AH_TEMPLATE([NOVIEW],[disable VIEW command in lidsadm])AH_TEMPLATE([DEBUG],[enable debug messages])AH_TEMPLATE([KERNEL_VERSION],[kernel version needed])AC_DEFINE_UNQUOTED(KERNEL_VERSION,["$KERNEL_VERSION"])AC_SUBST(PATCH_FILE)AC_PREFIX_DEFAULT(/usr/local)sbindir=/sbinAC_ARG_ENABLE(view, [AC_HELP_STRING([--disable-view],[Disable LIDS state listing (lidsadm -V)])], [if test $enableval = no; then AC_DEFINE(NOVIEW) fi],)AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[Enable debug messages])], [if test $enableval = yes; then AC_DEFINE(DEBUG) fi],)CHKVERSIONS=[yes]AC_ARG_ENABLE(versions-checks, [AC_HELP_STRING([--disable-versions-checks],[Don't check kernel and LIDS patch versions])], CHKVERSIONS=$enableval,)AC_ARG_VAR(KERNEL_DIR, [Path to kernel sources])# Checks for programs.AC_PROG_CCAC_PROG_CPP# Check kernel directorycase $KERNEL_DIR in /*) # Absolute KERNEL_INC=$KERNEL_DIR/include ;; ?*) # Relative KERNEL_INC=../$KERNEL_DIR/include ;; *) # Empty KERNEL_DIR="/usr/src/linux" KERNEL_INC=$KERNEL_DIR/include ;;esacAC_SUBST(KERNEL_INC)AC_CHECK_FILES([$KERNEL_DIR/include/linux/kernel.h $KERNEL_DIR/kernel/fork.c],, [AC_MSG_ERROR([Kernel sources not found.You must supply a path to a kernel source.For example : ./configure KERNEL_DIR=/usr/src/linuxYou can download linux kernel sources on ftp.kernel.org or mirrors.],1)])# XXX: What's better : only checking and asking to run the commands if# they need to be done ?# make version.h and symlinks for includes to work#OLDPWD=$PWD#cd $KERNEL_DIR#make include/linux/version.h symlinks #cd $OLDPWDAC_CHECK_FILES([$KERNEL_DIR/include/linux/version.h $KERNEL_DIR/include/asm/ptrace.h],, [AC_MSG_ERROR([You need to preconfigure your kernel sources to configure LIDS.Just type cd $KERNEL_DIR make include/linux/version.h symlinks cd -and rerun configure script. ],1)])# Check kernel sources versionecho $ECHO_N "Checking for kernel sources version being $KERNEL_VERSION... $ECHO_C"AC_EGREP_CPP([^>> \"$KERNEL_VERSION\" +<<$], [ #include "$KERNEL_DIR/include/linux/version.h">> UTS_RELEASE <<],[echo "ok"], [echo "no"; if test $CHKVERSIONS = yes then AC_MSG_ERROR([Bad kernel sources version. Should be $KERNEL_VERSION.Download the correct kernel sources version, untar them andmake KERNEL_DIR variable point to them. Then rerun the configure script.])]else [AC_MSG_WARN([Bad kernel sources version. Should be $KERNEL_VERSION.I hope you know what you're doing.])] fi)# Checking for the sources being patchedAC_CHECK_FILES([$KERNEL_DIR/include/linux/lids.h $KERNEL_DIR/include/linux/lidsif.h],, [AC_MSG_ERROR([You need to patch your kernel sources with LIDS patch to configure LIDS.Just type cd $KERNEL_DIR patch -p1 < $PWD/$PATCH_FILE cd -and rerun configure script. ],1)])# Checking LIDS patch versionecho $ECHO_N "Checking for LIDS patch version being $LIDS_VERSION... $ECHO_C"AC_EGREP_CPP([^>> \"$LIDS_VERSION\" +<<$], [ #include "$KERNEL_DIR/include/linux/lids.h">> LIDS_VERSION <<],[echo "ok"], [echo "no"; if test $CHKVERSIONS = yes then AC_MSG_ERROR([Bad LIDS patch version. Should be a $LIDS_VERSION.Download a vanilla $KERNEL_VERSION kernel and untar it.Then rerun the configure script with KERNEL_DIR variable pointing to thekernel and follow intructions.])]else [AC_MSG_WARN([Bad LIDS patch version. Should be a $LIDS_VERSION.I hope you know what you're doing.])] fi)#"# Checks for libraries.# Checks for header files.AC_HEADER_STDCAC_HEADER_MAJORAC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/file.h termio.h unistd.h])# Checks for typedefs, structures, and compiler characteristics.AC_C_CONSTAC_STRUCT_TM# Checks for library functions.AC_FUNC_MALLOCAC_FUNC_MKTIMEAC_TYPE_SIGNALAC_FUNC_STATAC_CHECK_FUNCS([memset realpath strchr])# Check wether LIDS config files already exist or need to be installedAC_SUBST(CFG_FILES,[])AC_SUBST(UPD_INODES,0)AC_SUBST(UPD_PASSWD,0)AC_CHECK_FILE([/etc/lids/lids.conf],,[CFG_FILES="$CFG_FILES example/lids.conf";UPD_INODES=1])AC_CHECK_FILE([/etc/lids/lids.cap],,[CFG_FILES="$CFG_FILES example/lids.cap"])AC_CHECK_FILE([/etc/lids/lids.net],,[CFG_FILES="$CFG_FILES example/lids.net"])AC_CHECK_FILE([/etc/lids/lids.pw],,[CFG_FILES="$CFG_FILES example/lids.pw";UPD_PASSWD=1])AC_CONFIG_FILES([Makefile lidstools/Makefile])AC_OUTPUT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -