configure.ac

来自「功能强大的ftp服务器源代码」· AC 代码 · 共 1,327 行 · 第 1/3 页

AC
1,327
字号
AC_MSG_CHECKING(whether snprintf is C99 conformant)AC_TRY_RUN([#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h>#else# if HAVE_STDLIB_H#  include <stdlib.h># endif#endif#ifdef HAVE_UNISTD_H# include <unistd.h>#endifint main(void){    char buf[4];        (void) fprintf(fopen("conftestval", "w"), "%d\n",        (int) snprintf(buf, sizeof buf, "12345678"));    return 0;}],CONF_SNPRINTF_TYPE=`cat conftestval`)AC_MSG_RESULT(done)if test "x$CONF_SNPRINTF_TYPE" = "x" ; then  AC_MSG_WARN(your operating system doesn't implement snprintf)else  AC_DEFINE_UNQUOTED(CONF_SNPRINTF_TYPE, $CONF_SNPRINTF_TYPE, [return value of an overflowed snprintf])fiAC_MSG_CHECKING(whether getgroups 0 is sane)AC_TRY_RUN([#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h>#else# if HAVE_STDLIB_H#  include <stdlib.h># endif#endif#ifdef HAVE_UNISTD_H# include <unistd.h>#endifint main(void){    return getgroups(0, NULL) <= 0;}],[AC_MSG_RESULT(yes)AC_DEFINE(SAFE_GETGROUPS_0,,[Define is getgroups(0, NULL) works on your system])],AC_MSG_RESULT(no))AC_MSG_CHECKING(whether realpath likes unreadable directories)AC_TRY_RUN([#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h>#else# if HAVE_STDLIB_H#  include <stdlib.h># endif#endif#include <sys/types.h>#include <sys/stat.h>#ifdef HAVE_UNISTD_H# include <unistd.h>#endif#ifdef HAVE_LIMITS_H# include <limits.h>#endif#ifdef HAVE_SYS_PARAM_H# include <sys/param.h>#endif#ifndef MAXPATHLEN# define MAXPATHLEN PATH_MAX#endifint main(void){    char x[MAXPATHLEN];        if (mkdir("x", 0300) != 0) {        return 1;    }    if (mkdir("x/y", 0300) != 0) {        rmdir("x");        return 2;    }        if (chdir("x") != 0) {        rmdir("x/y");            rmdir("x");        return 3;    }    if (realpath("y", x) == NULL) {        rmdir("y");        rmdir("../x");        return 4;    }    rmdir("y");    rmdir("../x");        return 0;    }],[AC_MSG_RESULT(yes)AC_DEFINE(REALPATH_IGNORES_UNREADABLE_DIRECTORIES,,[Define if realpath() works on unreadable directories])],AC_MSG_RESULT(no)AC_DEFINE(USE_BUILTIN_REALPATH))AC_MSG_CHECKING(whether you already have a standard MD5 implementation)AC_TRY_RUN([#include <stdio.h>#include <stdio.h>#include <string.h>#include <sys/types.h>#include <md5.h>int main(void){    MD5_CTX ctx;    char b[33];        MD5Init(&ctx);    MD5Update(&ctx, (const unsigned char *) "test", 4U);    MD5End(&ctx, b);    b[32] = 0;    return strcasecmp(b, "098f6bcd4621d373cade4e832627b4f6");}],[AC_MSG_RESULT(yes)AC_DEFINE(USE_SYSTEM_CRYPT_MD5,,[Define if you already have standardMD5 functions])],AC_MSG_RESULT(no))AC_MSG_CHECKING(whether you already have a standard SHA1 implementation)AC_TRY_RUN([#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sha1.h>int main(void){    SHA1_CTX ctx;    char b[41];        SHA1Init(&ctx);    SHA1Update(&ctx, (const unsigned char *) "test", 4U);    SHA1End(&ctx, b);    b[40] = 0;        return strcasecmp(b, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3");}],[AC_MSG_RESULT(yes)AC_DEFINE(USE_SYSTEM_CRYPT_SHA1,,[Define if you already have standardSHA1 functions])],AC_MSG_RESULT(no))AC_MSG_CHECKING([whether we are inside a Virtuozzo virtual host])if test -d /proc/vz; then  AC_MSG_RESULT(yes)  AC_DEFINE(VIRTUOZZO,,[Define if you are inside a Virtuozzo virtualhost])else  AC_MSG_RESULT(no)fiAC_MSG_CHECKING(default TCP send buffer size)AC_TRY_RUN([#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h>#else# if HAVE_STDLIB_H#  include <stdlib.h># endif#endif#ifdef HAVE_UNISTD_H# include <unistd.h>#endif#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>int main(void){    int fd,val=0,len=sizeof(int);    if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) return 1;        if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;    if (val <= 0) return 1;        fprintf (fopen("conftestval", "w"), "%d\n", val);    return 0;}],CONF_TCP_SO_SNDBUF=`cat conftestval`,CONF_TCP_SO_SNDBUF=65536,CONF_TCP_SO_SNDBUF=65536)AC_MSG_RESULT($CONF_TCP_SO_SNDBUF)AC_DEFINE_UNQUOTED(CONF_TCP_SO_SNDBUF, $CONF_TCP_SO_SNDBUF, [default TCP send buffer])AC_MSG_CHECKING(default TCP receive buffer size)AC_TRY_RUN([#include <stdio.h>#ifdef STDC_HEADERS# include <stdlib.h># include <stddef.h>#else# if HAVE_STDLIB_H#  include <stdlib.h># endif#endif#ifdef HAVE_UNISTD_H# include <unistd.h>#endif#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>int main(void){    int fd,val=0,len=sizeof(int);    if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) return 1;        if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;    if (val <= 0) return 1;        fprintf (fopen("conftestval", "w"), "%d\n", val);    return 0;}],CONF_TCP_SO_RCVBUF=`cat conftestval`,CONF_TCP_SO_RCVBUF=65536,CONF_TCP_SO_RCVBUF=65536)AC_MSG_RESULT($CONF_TCP_SO_RCVBUF)AC_DEFINE_UNQUOTED(CONF_TCP_SO_RCVBUF, $CONF_TCP_SO_RCVBUF, [defaut TCP receive buffer])AC_ARG_WITH(ldap,[AC_HELP_STRING([--with-ldap],[Users database is an LDAP directory (see doc)])],[ if test "x$withval" != "xno" ; then    if test "x$withval" != "x" && test "x$withval" != "xyes" ; then      LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"      LDFLAGS="$LDFLAGS -L${withval}/lib"      CPPFLAGS="$CPPFLAGS -I${withval}/include"    fi    with_ldap="yes"    AC_DEFINE(WITH_LDAP,,[with ldap])    AC_CHECK_LIB(resolv, res_query)    AC_CHECK_LIB(lber, ber_init, ,     [AC_MSG_ERROR(liblber is needed for LDAP support)])    AC_CHECK_LIB(ldap, ldap_init, ,     [AC_MSG_WARN(Initial check for -lldap failed! May need -lssl -lcrypto)       AC_CHECK_LIB(ldap, ldap_bind, [ldap_ssl_libs=true],       [AC_MSG_ERROR(libldap is needed for LDAP support)], -lssl -lcrypto)     ])    if test "x$ldap_ssl_libs" = "xtrue" ; then      LDAP_SSL_LIBS='-lssl -lcrypto'    fi  fi ])AC_SUBST(LDAP_SSL_LIBS)AC_ARG_WITH(mysql,[AC_HELP_STRING([--with-mysql],[Users database is a MySQL database (see doc)])],[ if test "x$withval" != "xno" ; then    if test "x$withval" != "x" && test "x$withval" != "xyes" ; then      LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"          LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"      CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"    else      LD_RUN_PATH="/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/lib/mysql:/usr/mysql/lib:/usr/mysql/lib/mysql:/usr/local/lib/mysql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"      LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql"      CPPFLAGS="$CPPFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"    fi    AC_CHECK_LIB(m, floor)    AC_CHECK_LIB(z, gzclose)    with_mysql="yes"    AC_DEFINE(WITH_MYSQL,,[with mysql])    AC_CHECK_LIB(mysqlclient, mysql_init, ,      [AC_MSG_ERROR(libmysqlclient is needed for MySQL support)])    AC_MSG_CHECKING(whether mysql clients can run)    AC_TRY_RUN([      #include <stdio.h>      #include <mysql.h>          int main(void)      {          MYSQL *a = mysql_init(NULL);          return 0;      }      ], ,       [        AC_MSG_RESULT(no)        AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)      ]    )    AC_MSG_RESULT(yes)    AC_CHECK_FUNCS(mysql_real_escape_string)  fi ])AC_ARG_WITH(pgsql,[AC_HELP_STRING([--with-pgsql],[Users database is a PostgreSQL database (see doc)])],[ if test "x$withval" != "xno" ; then    if test "x$withval" != "x" && test "x$withval" != "xyes" ; then      LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"          LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"      CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"    else      LD_RUN_PATH="/usr/local/pgsql/lib:/usr/local/pgsql/lib/pgsql:/usr/lib/pgsql:/usr/pgsql/lib:/usr/pgsql/lib/pgsql:/usr/local/lib/pgsql:/usr/local/postgresql/lib:/usr/local/postgresql/lib/postgresql:/usr/lib/postgresql:/usr/postgresql/lib:/usr/postgresql/lib/postgresql:/usr/local/lib/postgresql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"      LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql"      CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql"    fi    AC_CHECK_LIB(m, floor)    AC_CHECK_LIB(z, gzclose)    with_pgsql="yes"    AC_DEFINE(WITH_PGSQL,,[with pgsql])    AC_CHECK_LIB(pq, PQconnectdb, ,      [AC_MSG_ERROR(libpq is needed for PostgreSQL support)])            AC_MSG_CHECKING(whether postgresql clients can run)    AC_TRY_RUN([      #include <stdio.h>      #include <libpq-fe.h>      int main(void)      {          PGconn *a = PQconnectdb("");          return 0;      }      ], ,       [        AC_MSG_RESULT(no)        AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)      ]    )        AC_MSG_RESULT(yes)  fi ])AC_ARG_WITH(privsep,[AC_HELP_STRING([--with-privsep],[Enable privilege separation])],[ if test "x$withval" = "xyes" ; then    AC_DEFINE(WITH_PRIVSEP,,[enable privilege separation])    with_privsep=yes  fi ])if test "x$with_privsep" = "xyes" && test "x$non_root_ftp" = "xyes" ; then  AC_MSG_ERROR(Privilege separation is incompatible with non-root.)fiAC_ARG_WITH(tls,[AC_HELP_STRING([--with-tls],[Enable SSL/TLS support (experimental, needs OpenSSL)])],[ if test "x$withval" = "xyes" ; then    with_tls="yes"  fi ])if test "x$with_tls" = "xyes" ; then  if test "x$ac_cv_header_openssl_ssl_h" != "xyes" ; then    AC_MSG_ERROR(OpenSSL headers not found.)    fi  AC_CHECK_LIB(crypto, DH_new)  AC_CHECK_LIB(ssl, SSL_accept)  AC_DEFINE(WITH_TLS,,[Enable TLS])fiAC_ARG_WITH(certfile,[AC_HELP_STRING([--with-certfile=],[certificate file (default: /etc/ssl/private/pure-ftpd.pem)])],[ if test "x$withval" != "x" ; then    certfile="$withval"    AC_SUBST(certfile)    CPPFLAGS="$CPPFLAGS -DTLS_CERTIFICATE_FILE='\"$certfile\"'"    if test -e "$certfile"; then      AC_MSG_WARN(No certificate is installed in $certfile yet)    fi  fi ])if test "x$sysconfdir" = 'xNONE' || test "x$sysconfdir" = 'x'; then  CONFDIR='/etc'else  if test "x$sysconfdir" = 'x${prefix}/etc'; then    if test "x$prefix" = 'xNONE' || test "x$prefix" = 'x/usr'; then      CONFDIR='/etc'    else      CONFDIR="$sysconfdir"    fi  else    CONFDIR="$sysconfdir"  fifi  if test -r /dev/arandom; then  AC_MSG_NOTICE([You have /dev/arandom - Great])  AC_DEFINE(HAVE_DEV_ARANDOM,,[Define if you have /dev/arandom])fiif test -r /dev/urandom; then  AC_MSG_NOTICE([You have /dev/urandom - Great])  AC_DEFINE(HAVE_DEV_URANDOM,,[Define if you have /dev/urandom])fiif test -r /dev/random; then  AC_MSG_NOTICE([You have /dev/random - Great])  AC_DEFINE(HAVE_DEV_RANDOM,,[Define if you have /dev/random])fisysconfdir="$CONFDIR"AC_SUBST(sysconfdir)CPPFLAGS="$CPPFLAGS -DCONFDIR='\"$sysconfdir\"'"AC_CONFIG_FILES(Makefile src/Makefile pam/Makefile man/Makefilegui/Makefile configuration-file/Makefile contrib/Makefile m4/Makefileconfiguration-file/pure-ftpd.conf configuration-file/pure-config.plconfiguration-file/pure-config.py puredb/Makefile puredb/src/Makefilepure-ftpd.spec)AC_OUTPUTAC_MSG_NOTICE([+--------------------------------------------------------+])AC_MSG_NOTICE([| You can subscribe to the Pure-FTPd users mailing-list  |])AC_MSG_NOTICE([| to ask for help and to stay informed of new releases.  |])AC_MSG_NOTICE([| Go to http://www.pureftpd.org/ml/ now!                 |])AC_MSG_NOTICE([+--------------------------------------------------------+])

⌨️ 快捷键说明

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