test PCRE in FreeBSD, Linux, and NetBSD

This commit is contained in:
Igor Sysoev 2006-11-27 11:07:09 +00:00
parent 9a29d129f2
commit 0ec09f9196
13 changed files with 137 additions and 20 deletions

View File

@ -113,6 +113,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
@ -129,6 +130,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, args...) sprintf(args)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
@ -144,6 +146,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, ...) sprintf(__VA_ARGS__)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
@ -156,6 +159,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
# ngx_feature_name=
# ngx_feature_run=no
# ngx_feature_incs="int inline f(void) { return 1 }"
# ngx_feature_path=
# ngx_feature_libs=
# ngx_feature_test=
# . auto/feature

View File

@ -23,6 +23,7 @@ ngx_feature="gcc -pipe switch"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature

View File

@ -20,6 +20,7 @@ case "$NGX_MACHINE" in
ngx_feature_name=
ngx_feature_run=bug
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='__asm ("pause")'

View File

@ -18,6 +18,10 @@ if test -n "$ngx_feature_name"; then
| tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
fi
if test -n "$ngx_feature_path"; then
ngx_feature_inc_path="-I $ngx_feature_path"
fi
cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
@ -32,9 +36,11 @@ int main() {
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
ngx_feature_inc_path=
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"

View File

@ -53,6 +53,7 @@ else
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <md5.h>"
ngx_feature_path=
ngx_feature_libs="-lmd5"
ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
. auto/feature
@ -70,6 +71,7 @@ else
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <md5.h>"
ngx_feature_path=
ngx_feature_libs="-lmd"
ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
. auto/feature
@ -85,15 +87,16 @@ else
else
if [ $MD5 = NO ]; then
# OpenSSL crypto library
# OpenSSL crypto library
ngx_feature="OpenSSL md5 crypto library"
ngx_feature_name="NGX_OPENSSL_MD5"
ngx_feature_run=no
ngx_feature_incs="#include <openssl/md5.h>"
ngx_feature_libs="-lcrypto"
ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
. auto/feature
ngx_feature="OpenSSL md5 crypto library"
ngx_feature_name="NGX_OPENSSL_MD5"
ngx_feature_run=no
ngx_feature_incs="#include <openssl/md5.h>"
ngx_feature_path=
ngx_feature_libs="-lcrypto"
ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
. auto/feature
fi
fi

View File

@ -47,6 +47,7 @@ else
ngx_feature_name="NGX_OPENSSL"
ngx_feature_run=no
ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_path=
ngx_feature_libs="-lssl -lcrypto"
ngx_feature_test="SSL_library_init()"
. auto/feature

View File

@ -64,13 +64,11 @@ else
if [ "$NGX_PLATFORM" != win32 ]; then
PCRE=NO
# FreeBSD PCRE port requires --with-cc-opt="-I /usr/local/include"
# --with-ld-opt="-L /usr/local/lib"
ngx_feature="PCRE library"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path=
ngx_feature_libs="-lpcre"
ngx_feature_test="pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL)"
. auto/feature
@ -81,6 +79,73 @@ else
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
ngx_found=no
else
# FreeBSD port
ngx_feature="PCRE library in /usr/local/"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path="/usr/local/include"
ngx_feature_libs="-L /usr/local/lib -lpcre"
ngx_feature_test="pcre *re;
re = pcre_compile(NULL, 0, NULL, 0, NULL)"
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
ngx_found=no
else
# Linux package
ngx_feature="PCRE library in /usr/include/pcre/"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path="/usr/include/pcre"
ngx_feature_libs="-lpcre"
ngx_feature_test="pcre *re;
re = pcre_compile(NULL, 0, NULL, 0, NULL)"
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
ngx_found=no
else
# NetBSD port
ngx_feature="PCRE library in /usr/pkg/"
ngx_feature_name="NGX_PCRE"
ngx_feature_run=no
ngx_feature_incs="#include <pcre.h>"
ngx_feature_path="/usr/pkg/include"
ngx_feature_libs="-L /usr/pkg/lib -lpcre"
ngx_feature_test="pcre *re;
re = pcre_compile(NULL, 0, NULL, 0, NULL)"
. auto/feature
fi
if [ $ngx_found = yes ]; then
CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
ngx_found=no
fi
fi
fi

View File

@ -43,6 +43,7 @@ else
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <sha.h>"
ngx_feature_path=
ngx_feature_libs="-lmd"
ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
. auto/feature
@ -57,15 +58,16 @@ else
else
if [ $SHA1 = NO ]; then
# OpenSSL crypto library
# OpenSSL crypto library
ngx_feature="OpenSSL sha1 crypto library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <openssl/sha.h>"
ngx_feature_libs="-lcrypto"
ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
. auto/feature
ngx_feature="OpenSSL sha1 crypto library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <openssl/sha.h>"
ngx_feature_path=
ngx_feature_libs="-lcrypto"
ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
. auto/feature
fi
fi

View File

@ -47,6 +47,7 @@ else
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <zlib.h>"
ngx_feature_path=
ngx_feature_libs="-lz"
ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)"
. auto/feature

View File

@ -30,6 +30,7 @@ ngx_feature="poll()"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <poll.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int n, dp; struct pollfd pl;
dp = 0;
@ -48,6 +49,7 @@ ngx_feature="/dev/poll"
ngx_feature_name="NGX_HAVE_DEVPOLL"
ngx_feature_run=no
ngx_feature_incs="#include <sys/devpoll.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int n, dp; struct dvpoll dvp;
dp = 0;
@ -69,6 +71,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_name="NGX_HAVE_KQUEUE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/event.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int kq; kq = kqueue()"
. auto/feature
@ -84,6 +87,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
ngx_feature_run=no
ngx_feature_incs="#include <sys/event.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct kevent kev;
kev.fflags = NOTE_LOWAT;"
@ -95,6 +99,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_run=yes
ngx_feature_incs="#include <sys/event.h>
#include <sys/time.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int kq;
struct kevent kev;
@ -126,6 +131,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_run=bug
ngx_feature_incs="#include <sys/event.h>
#include <sys/time.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int kq;
struct kevent kev;
@ -174,6 +180,7 @@ ngx_feature="crypt()"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="crypt(\"test\", \"salt\");"
. auto/feature
@ -182,6 +189,10 @@ ngx_feature_test="crypt(\"test\", \"salt\");"
if [ $ngx_found = no ]; then
ngx_feature="crypt() in libcrypt"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=-lcrypt
. auto/feature

View File

@ -40,6 +40,7 @@ ngx_feature="epoll"
ngx_feature_name="NGX_HAVE_EPOLL"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/epoll.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int efd = 0, fd = 1, n;
struct epoll_event ee;
@ -65,6 +66,7 @@ ngx_feature_name="NGX_HAVE_SENDFILE"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/sendfile.h>
#include <errno.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int s = 0, fd = 1;
ssize_t n; off_t off = 0;
@ -85,6 +87,7 @@ ngx_feature_name="NGX_HAVE_SENDFILE64"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/sendfile.h>
#include <errno.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int s = 0, fd = 1;
ssize_t n; off_t off = 0;
@ -101,6 +104,7 @@ ngx_feature="prctl(PR_SET_DUMPABLE)"
ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/prctl.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1"
. auto/feature
@ -112,6 +116,7 @@ ngx_feature="sched_setaffinity()"
ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
ngx_feature_run=no
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="long mask = 0;
sched_setaffinity(0, 32, (cpu_set_t *) &mask)"

View File

@ -28,6 +28,7 @@ ngx_feature="sendfilev()"
ngx_feature_name="NGX_HAVE_SENDFILE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/sendfile.h>"
ngx_feature_path=
ngx_feature_libs="-lsendfile"
ngx_feature_test="int fd = 1; sendfilevec_t vec[1];
size_t sent; ssize_t n;
@ -45,6 +46,7 @@ ngx_feature="event ports"
ngx_feature_name="NGX_HAVE_EVENTPORT"
ngx_feature_run=no
ngx_feature_incs="#include <port.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int n = port_create()"
. auto/feature

View File

@ -68,6 +68,7 @@ ngx_feature="setproctitle()"
ngx_feature_name="NGX_HAVE_SETPROCTITLE"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=$NGX_SETPROCTITLE_LIB
ngx_feature_test="setproctitle(\"test\");"
. auto/feature
@ -77,6 +78,7 @@ ngx_feature="pread()"
ngx_feature_name="NGX_HAVE_PREAD"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0)"
. auto/feature
@ -86,6 +88,7 @@ ngx_feature="pwrite()"
ngx_feature_name="NGX_HAVE_PWRITE"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0)"
. auto/feature
@ -95,6 +98,7 @@ ngx_feature="strerror_r()"
ngx_feature_name="NGX_HAVE_STRERROR_R"
ngx_feature_run=yes
ngx_feature_incs="#include <string.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024);
if (n < 0 || n > 1024) return 1;"
@ -107,6 +111,7 @@ ngx_feature="gnu style strerror_r()"
ngx_feature_name="NGX_HAVE_GNU_STRERROR_R"
ngx_feature_run=yes
ngx_feature_incs="#include <string.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[1024]; long n; n = strerror_r(1, buf, 1024);
if (n >= 0 && n < 1024) return 1;"
@ -117,6 +122,7 @@ ngx_feature="localtime_r()"
ngx_feature_name="NGX_HAVE_LOCALTIME_R"
ngx_feature_run=no
ngx_feature_incs="#include <time.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
. auto/feature
@ -126,6 +132,7 @@ ngx_feature="posix_memalign()"
ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN"
ngx_feature_run=no
ngx_feature_incs="#include <stdlib.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="void *p; int n; n = posix_memalign(&p, 4096, 4096)"
. auto/feature
@ -135,6 +142,7 @@ ngx_feature="memalign()"
ngx_feature_name="NGX_HAVE_MEMALIGN"
ngx_feature_run=no
ngx_feature_incs="#include <stdlib.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="void *p; p = memalign(4096, 4096)"
. auto/feature
@ -144,6 +152,7 @@ ngx_feature="sched_yield()"
ngx_feature_name="NGX_HAVE_SCHED_YIELD"
ngx_feature_run=no
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="sched_yield()"
. auto/feature
@ -153,6 +162,7 @@ ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
ngx_feature_name="NGX_HAVE_MAP_ANON"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/mman.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="void *p;
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
@ -167,6 +177,7 @@ ngx_feature_run=yes
ngx_feature_incs="#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='void *p; int fd;
fd = open("/dev/zero", O_RDWR);
@ -180,6 +191,7 @@ ngx_feature_name="NGX_HAVE_SYSVSHM"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/ipc.h>
#include <sys/shm.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int id;
id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
@ -192,6 +204,7 @@ ngx_feature="struct msghdr.msg_control"
ngx_feature_name="NGX_HAVE_MSGHDR_MSG_CONTROL"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct msghdr msg; msg.msg_control = NULL"
. auto/feature
@ -202,6 +215,7 @@ ngx_feature_name="NGX_HAVE_FIONBIO"
ngx_feature_run=no
ngx_feature_incs="#include <sys/ioctl.h>
$NGX_INCLUDE_SYS_FILIO_H"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int i; i = FIONBIO"
. auto/feature
@ -211,6 +225,7 @@ ngx_feature="struct tm.tm_gmtoff"
ngx_feature_name="NGX_HAVE_GMTOFF"
ngx_feature_run=no
ngx_feature_incs="#include <time.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct tm tm; tm.tm_gmtoff = 0"
. auto/feature