📄 configure.in
字号:
# -*- Autoconf -*- script for CIPEdnl Process this file with autoconf to produce a configure script.## Copyright 1999 Olaf Titz <olaf@bigred.inka.de>## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version# 2 of the License, or (at your option) any later version.#AC_REVISION($Id: configure.in,v 1.49 2004/08/04 13:51:13 olaf81825 Exp $)AC_PREREQ(2.13)AC_INIT(cipe/ciped.c)AC_CONFIG_HEADER($BUILD/config.h:conf/config.h.in pkcipe/config.h)dnl $BUILD is set below - this works for autoconf 2.13, somewhat undocumentedAC_SUBST(VERSION)VERSION=1.6.0AC_SUBST(PVNOTE)PVNOTE=beta1 dnl PKCIPE commentAC_PROG_CCtest "$GCC" || AC_ERROR(You would not have much luck compiling kernel code with non-gcc...)AC_PROG_CPPAC_CHECK_PROGS(TEXINFO, texinfo tex, :)AC_CHECK_PROGS(MAKEINFO, makeinfo, :)AC_CHECK_PROGS(MAKE, gmake make, :)$MAKE -v 2>&1 | grep -iqs 'GNU Make' || AC_ERROR(This compilation needs GNU make)dnl --- Find the Linux kernel ---AC_MSG_CHECKING(for kernel source tree)AC_SUBST(KSRC)AC_ARG_WITH(linux,[ --with-linux=DIR Path to Linux source tree], KSRC=$withval)dnl use default only if nothing specifiedif ! test "$KSRC" ; then KSRC=/usr/src/linuxfiAC_SUBST(KOBJ)AC_ARG_WITH(obj,[ --with-obj=DIR Path to Linux build tree], KOBJ=$withval)AC_SUBST(KINC)if test "$KOBJ" ; then KINC=$KOBJ/include KSINC=$KSRC/includeelse KINC=$KSRC/includefidnl attempt to follow symlinksif test -x /bin/pwd ; then test "$KSRC" && KSRC=`cd $KSRC; /bin/pwd` test "$KOBJ" && KOBJ=`cd $KOBJ; /bin/pwd` test "$KINC" && KINC=`cd $KINC; /bin/pwd` test "$KSINC" && KSINC=`cd $KSINC; /bin/pwd`fiif ! test -f $KINC/linux/version.h ; then AC_MSG_ERROR(no suitable configured kernel source tree found)fiAC_MSG_RESULT($KSRC)dnl --- Get Linux kernel version and compile parameters ---AC_SUBST(ASMOBJS)AC_SUBST(CCOBJS)ASMOBJS=CCOBJS=oldcppflags="$CPPFLAGS"CPPFLAGS="-I$KINC $CPPFLAGS"test "$KSINC" && CPPFLAGS="-I$KSINC $CPPFLAGS"AC_SUBST(KVERS)AC_MSG_CHECKING(for kernel version)AX_MACRO_STR(UTS_RELEASE, linux/version.h)KVERS=$ax_resultAC_MSG_RESULT($KVERS)AC_SUBST(ALL)case "$KVERS" in2.[[01234]].*) ALL=all24 ;;2.[[56]].*) ALL=all25 ;;*) AC_MSG_ERROR(Unsupported kernel version)esacdnl test compiler versiondnl unnecessary on 2.5 b/c insmod will do adequate checkingif test "$ALL" = "all24" ; then kcomp= if test -f $KINC/linux/compile.h; then AX_MACRO_STR(LINUX_COMPILER, linux/compile.h) kcomp=$ax_result fi if test -z "$kcomp" ; then AC_MSG_WARN(could not find kernel compiler version) else tcomp=`$CC -v 2>&1 | tail -1` if ! test "$kcomp" = "$tcomp" ; then AC_MSG_WARN(Compiler version mismatch - try using $kcomp) fi fifidnl find compiler parametersdnl unnecessary on 2.5 b/c we use the kernel compilation systemif test "$ALL" = "all24" ; then AC_MSG_CHECKING(for kernel compile parameters) cp $KSRC/Makefile conftest.make echo -e "conftest.CC:" >>conftest.make echo -e "\t@echo \$(CC)" >>conftest.make echo -e "conftest.CFLAGS:" >>conftest.make echo -e "\t@echo \$(CFLAGS) \$(MODFLAGS)" >>conftest.make here=`pwd` NKCC=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CC` NKCFLAGS=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CFLAGS` dnl some sanity checking echo "$NKCC $NKCFLAGS" | grep -qse '-I[[^ ]]*/include' || NKCC="" if test -z "$NKCC" ; then AC_MSG_ERROR(could not find kernel compile parameters) else AC_MSG_RESULT($NKCC $NKCFLAGS) fi rm -f conftest.makeelse NKCC="$CC"fidnl cancel -O arguments set by autoconfif ! test "$ac_test_CFLAGS" = set; then CFLAGS=`echo $CFLAGS | sed 's,-O[[0-9]]*,,g'`fiCFLAGS="-Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strength-reduce $CFLAGS"dnl We separate compilation parameters in kernel and user partAC_SUBST(KCPPFLAGS) KCPPFLAGS="$CPPFLAGS"AC_SUBST(KCFLAGS) KCFLAGS="-pipe -O3 -fomit-frame-pointer -funroll-loops $CFLAGS"AC_SUBST(KDEFS) KDEFS="-D__KERNEL__ -DMODULE $DEFS"AC_SUBST(KLDFLAGS) KLDFLAGS="-r -S"dnl For user part.AC_SUBST(UCPPFLAGS) UCPPFLAGS="$CPPFLAGS"AC_SUBST(UCFLAGS) UCFLAGS="-pipe -O3 $CFLAGS"AC_SUBST(UDEFS) UDEFS="$DEFS"AC_SUBST(ULDFLAGS) ULDFLAGS="$LDFLAGS"AC_SUBST(ULIBS) ULIBS="$LIBS"AC_MSG_CHECKING(for architecture)ARCH=`uname -m | sed -e 's/i.86/i386/;s/sun4u/sparc64/;s/arm.*/arm/;s/sa110/arm/'`AC_MSG_RESULT($ARCH)AC_MSG_CHECKING(for SMP)smp=0case "$KVERS" in2.[[01]].*) AX_EGREP([^ *SMP *= *1], $KSRC/Makefile, smp=1) ;;*) AX_PUSH CPPFLAGS="$KCPPFLAGS" AC_EGREP_CPP(yes, [ #include <linux/autoconf.h> #ifdef CONFIG_SMP yes #endif ], smp=1) AX_POP ;;esactest "$smp" = 1 && AC_DEFINE(__SMP__)AX_MSG_RESULT_YN($smp)AC_SUBST(KCC)CPPFLAGS="$oldcppflags"dnl make sure the config includes come firstUCPPFLAGS="-I$KINC -I. -include ./config.h $UCPPFLAGS"KCC="$NKCC"XKCC="$NKCC $NKCFLAGS $KCPPFLAGS"KCFLAGS="$NKCFLAGS"KDEFS="-DKCC_BUILD"KCPPFLAGS="-I. -include ./config.h $KCPPFLAGS"dnl 2.5 implements versioned symbols differently, no include any moreif test "$ALL" = "all24" ; then AC_MSG_CHECKING(for versioned symbols) mv=0 AX_PUSH CPPFLAGS="$KCPPFLAGS" AC_EGREP_CPP(yes, [ #include <linux/autoconf.h> #ifdef CONFIG_MODVERSIONS yes #endif ], mv=1) AX_POP AX_MSG_RESULT_YN($mv) test "$mv" = 1 && AC_DEFINE(MODVERSIONS)fidnl --- Check crypto API ---AC_MSG_CHECKING(for crypto API headers)AX_PUSHCPPFLAGS="$KCPPFLAGS"AC_EGREP_CPP(yes, [ #include <linux/crypto.h> #ifdef CRYPTO_ALG_TYPE_CIPHER yes #endif], capi=1, capi=0)AX_POPAX_MSG_RESULT_YN($capi)if test "$capi" = 1 ; then AC_DEFINE(HAVE_CRYPTO_H)fiAC_ARG_ENABLE(cryptoapi,[ --enable-cryptoapi Enable use of crypto API],test "$enableval" = "no" || usecapi=1) if test "$capi$usecapi" = 11 ; then AC_MSG_CHECKING(if crypto API is configured in) AX_PUSH CPPFLAGS="$KCPPFLAGS" AC_EGREP_CPP(yes, [ #include <linux/autoconf.h> #ifdef CONFIG_CRYPTO yes #endif ], capi=1, capi=0) AX_POP AX_MSG_RESULT_YN($capi) fiif test "$capi$usecapi" = 11 ; then AC_DEFINE(USE_CRYPTOAPI) crypt= else AC_DEFINE(Crypto_Blowfish) dnl backwards compatibility crypt=bfidnl --- Check for kernel CRC library ---AC_MSG_CHECKING(for kernel CRC function)AX_PUSHCPPFLAGS="$KCPPFLAGS"AC_EGREP_CPP(yes, [ #include <linux/autoconf.h> #if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE) yes #endif], kcrc=1, kcrc=0)AX_POPAX_MSG_RESULT_YN($kcrc)if test "$kcrc" = 1 ; then AC_DEFINE(HAVE_KERNEL_CRC)else CCOBJS="$CCOBJS crc32.o"fidnl --- Configuration parameters ---AC_SUBST(VERS)AC_ARG_ENABLE(protocol,[ --enable-protocol=n Use protocol n (default 3, or 4)],VERS=$enableval, VERS=3)test "$VERS" -lt 3 && AC_MSG_ERROR(Protocols less than 3 are deprecated)verl=`expr substr abcdef $VERS 1`AC_SUBST(CRYPTO)CRYPTO=Blowfish dnl backwards compatibilityAC_SUBST(MODULE)AC_SUBST(IMODULE)MODULE=cip$verl$crypt.ocase "$KVERS" in2.[[56]].*) IMODULE=cip$verl$crypt.ko ;;*) IMODULE=$MODULE ;;esacAC_SUBST(CIPED)CIPED=ciped-$verl$cryptAC_ARG_ENABLE(ctldir,[ --enable-ctldir=DIR Directory for config files [/etc/cipe]],AC_DEFINE_UNQUOTED(CTLDIR, "$enableval"))AC_ARG_ENABLE(debug,[ --disable-debug Disable debugging code in kernel module],test "$enableval" = "no" && e=0, e=1)test "$e" = "1" && AC_DEFINE(DEBUG)AC_ARG_ENABLE(dyndev,[ --disable-dyndev Disable dynamic device allocation],test "$enableval" = "no" && e=0, e=1)test "$e" = "0" && AC_DEFINE(NO_DYNDEV)AC_ARG_ENABLE(logfacility,[ --enable-logfacility=x Set syslog facility for ciped and pkcipe], [ f=`echo "$enableval" | sed 's,^log_,,i' | tr a-z A-Z` AC_DEFINE_UNQUOTED(LOGFAC, LOG_$f)], AC_DEFINE(LOGFAC, LOG_DAEMON))AC_DEFINE_UNQUOTED(ProtocolVersion, $VERS)AC_DEFINE_UNQUOTED(VERSION, "$VERSION")AC_ARG_ENABLE(bug-compatible,[ --enable-bug-compatible Use old, broken interpretation of keys],test "$enableval" = "no" || AC_DEFINE(BUG_COMPATIBLE))AC_ARG_ENABLE(send-config,[ --disable-send-config Do not send configuration information],test "$enableval" = "no" && e=0, e=1)test "$e" = "0" && AC_DEFINE(DONT_SEND_CONF)AC_ARG_ENABLE(regparm,[ --enable-regparm Enable regparm optimization (EXPERIMENTAL)],test "$enableval" = "no" || AC_DEFINE(USE_REGPARM))AC_ARG_ENABLE(keyfile,[ --enable-keyfile=FILE Location of default private key file],AC_DEFINE_UNQUOTED(KEYFILE, "$enableval"))AC_ARG_ENABLE(keydir,[ --enable-keydir=FILE Location (format string) of public key files],AX_FMTSTRING(KEYDIR, "$enableval"))AC_ARG_ENABLE(optdir,[ --enable-optdir=FILE Location (format string) of generated option files],AX_FMTSTRING(OPTDIR, "$enableval"))AC_ARG_ENABLE(ciped,[ --enable-ciped=FILE Use specified ciped daemon for PKCIPE],AC_DEFINE_UNQUOTED(CIPED, "$enableval"))dnl --- Determine assembler modules ---AC_ARG_ENABLE(asm,[ --disable-asm Disable use of assembler code],test "$enableval" = "no" && e=0, e=1)AC_MSG_CHECKING(for assembler parts) if test $e -eq 1 -a -f cipe/bf-$ARCH.S; then AC_DEFINE(ASM_BF_Crypt) ASMOBJS=bf-$ARCH.o fi CCOBJS="$CCOBJS bf.o"if test "$ASMOBJS" ; then AC_MSG_RESULT($ASMOBJS) ; else AC_MSG_RESULT(none) ; fiAC_CHECK_FUNCS(mlock mlockall)dnl --- Find OpenSSL ---BUILD_PKCIPE=1SSLINCS=""SSLLIBS=""AC_ARG_WITH(ssl-includes,[ --with-ssl-includes=DIR Location of OpenSSL includes],SSLINCS=$withval)AC_ARG_WITH(ssl-libs,[ --with-ssl-libs=DIR Location of OpenSSL libraries],SSLLIBS=$withval)AC_ARG_ENABLE(pkcipe,[ --disable-pkcipe Do not build PKCIPE],test "$enableval" = "no" && BUILD_PKCIPE="")if test "$BUILD_PKCIPE" ; thenAC_MSG_CHECKING(for OpenSSL)H=openssl/ssl.hfor i in /usr/local /local /opt /usr ; do dnl prefix for j in / /ssl /openssl /ssleay ; do dnl package test -z "$SSLINCS" -a -f $i$j/include/$H && SSLINCS="$i$j/include" test -z "$SSLINCS" -a -f $i/include$j/$H && SSLINCS="$i/include$j" test -z "$SSLLIBS" -a -f $i$j/lib/libssl.so && SSLLIBS="$i$j/lib" test -z "$SSLLIBS" -a -f $i/lib$j/libssl.so && SSLLIBS="$i/lib$j" test -z "$SSLLIBS" -a -f $i$j/lib/libssl.a && SSLLIBS="$i$j/lib" test -z "$SSLLIBS" -a -f $i/lib$j/libssl.a && SSLLIBS="$i/lib$j" donedoneif test "$SSLINCS" -a "$SSLLIBS" ; then SSLINCS=`echo $SSLINCS | sed 's,//,/,g;s,/$,,'` SSLLIBS=`echo $SSLLIBS | sed 's,//,/,g;s,/$,,'` AC_MSG_RESULT([includes $SSLINCS, libs $SSLLIBS]) if test "$SSLINCS" != "/usr/include" ; then CPPFLAGS="-I$SSLINCS $CPPFLAGS" fi if test "$SSLLIBS" != "/usr/lib" ; then LIBS="-L$SSLLIBS -lcrypto -ldl $LIBS" else LIBS="-lcrypto -ldl $LIBS" fi SSLBIN=`dirname $SSLLIBS`/bin AC_PATH_PROG(OPENSSL, openssl, no, "${SSLBIN}:${PATH}") test "$OPENSSL" = "no" && AC_MSG_ERROR(openssl binary not found) AC_MSG_CHECKING(OpenSSL version) set `$OPENSSL version` ov="$2" AC_MSG_RESULT($ov) case "$ov" in 0.9.[[6-9]]*) ;; 0.*) AC_MSG_WARN(Must have OpenSSL 0.9.6 or later) BUILD_PKCIPE="" ;; *) AC_MSG_WARN(Unknown OpenSSL version) BUILD_PKCIPE="" ;; esacelse AC_MSG_RESULT(no) BUILD_PKCIPE=""fitest "$BUILD_PKCIPE" || AC_MSG_WARN(not building PKCIPE)fidnl --- Check build dir name, do remaining defs ---name=""AC_ARG_ENABLE(name,[ --enable-name=n Set build directory name suffix],name="-$enableval")AC_SUBST(BUILD)if test "$smp" = "1"; then BUILD=$KVERS-$ARCH-SMP-$verl$crypt$nameelse BUILD=$KVERS-$ARCH-$verl$crypt$namefiAC_SUBST(BUILD_PKCIPE)set `echo $VERSION | tr . ' '`AC_DEFINE_UNQUOTED(VERSION_MAJ, $1)AC_DEFINE_UNQUOTED(VERSION_MIN, $2)AC_DEFINE_UNQUOTED(PVERSION, $PVERSION)AC_DEFINE_UNQUOTED(PVNOTE, "$PVNOTE")AC_OUTPUT(Makefile:conf/Makefile-top.in $BUILD/Makefile:conf/Makefile-obj.in lib/Makefile pkcipe/Makefile pkcipe/rsa-keygen, [chmod a+rx pkcipe/rsa-keygen])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -