xref: /unit/auto/pcre (revision 1721:53b6ab9b324b)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
6*1721Saxel.duch@nginx.comnxt_found=no
7*1721Saxel.duch@nginx.comNXT_HAVE_PCRE2=NO
8*1721Saxel.duch@nginx.com
9*1721Saxel.duch@nginx.comif [ $NXT_TRY_PCRE2 = YES ]; then
10*1721Saxel.duch@nginx.com    if /bin/sh -c "(pcre2-config --version)" >> $NXT_AUTOCONF_ERR 2>&1; then
110Sigor@sysoev.ru
12*1721Saxel.duch@nginx.com        NXT_PCRE_CFLAGS=`pcre2-config --cflags`
13*1721Saxel.duch@nginx.com        NXT_PCRE_LIB=`pcre2-config --libs8`
14*1721Saxel.duch@nginx.com
15*1721Saxel.duch@nginx.com        nxt_feature="PCRE2 library"
16*1721Saxel.duch@nginx.com        nxt_feature_name=NXT_HAVE_PCRE2
17*1721Saxel.duch@nginx.com        nxt_feature_run=no
18*1721Saxel.duch@nginx.com        nxt_feature_incs="-DPCRE2_CODE_UNIT_WIDTH=8 $NXT_PCRE_CFLAGS"
19*1721Saxel.duch@nginx.com        nxt_feature_libs=$NXT_PCRE_LIB
20*1721Saxel.duch@nginx.com        nxt_feature_test="#include <pcre2.h>
210Sigor@sysoev.ru
22*1721Saxel.duch@nginx.com                          int main(void) {
23*1721Saxel.duch@nginx.com                              pcre2_code  *re;
24*1721Saxel.duch@nginx.com
25*1721Saxel.duch@nginx.com                              re = pcre2_compile((PCRE2_SPTR)\"\",
26*1721Saxel.duch@nginx.com                                                 PCRE2_ZERO_TERMINATED, 0,
27*1721Saxel.duch@nginx.com                                                 NULL, NULL, NULL);
28*1721Saxel.duch@nginx.com                              return (re == NULL);
29*1721Saxel.duch@nginx.com                          }"
300Sigor@sysoev.ru
31*1721Saxel.duch@nginx.com        . auto/feature
320Sigor@sysoev.ru
33*1721Saxel.duch@nginx.com        if [ $nxt_found = yes ]; then
34*1721Saxel.duch@nginx.com            NXT_HAVE_PCRE2=YES
35*1721Saxel.duch@nginx.com            $echo " + PCRE2 version: `pcre2-config --version`"
36*1721Saxel.duch@nginx.com        fi
37*1721Saxel.duch@nginx.com    fi
38*1721Saxel.duch@nginx.comfi
39*1721Saxel.duch@nginx.com
40*1721Saxel.duch@nginx.comif [ $nxt_found = no ]; then
410Sigor@sysoev.ru    if /bin/sh -c "(pcre-config --version)" >> $NXT_AUTOCONF_ERR 2>&1; then
420Sigor@sysoev.ru
430Sigor@sysoev.ru        NXT_PCRE_CFLAGS=`pcre-config --cflags`
440Sigor@sysoev.ru        NXT_PCRE_LIB=`pcre-config --libs`
450Sigor@sysoev.ru
460Sigor@sysoev.ru        nxt_feature="PCRE library"
470Sigor@sysoev.ru        nxt_feature_name=NXT_HAVE_PCRE
480Sigor@sysoev.ru        nxt_feature_run=no
490Sigor@sysoev.ru        nxt_feature_incs=$NXT_PCRE_CFLAGS
500Sigor@sysoev.ru        nxt_feature_libs=$NXT_PCRE_LIB
510Sigor@sysoev.ru        nxt_feature_test="#include <pcre.h>
520Sigor@sysoev.ru
530Sigor@sysoev.ru                          int main() {
540Sigor@sysoev.ru                              pcre  *re;
550Sigor@sysoev.ru
560Sigor@sysoev.ru                              re = pcre_compile(NULL, 0, NULL, 0, NULL);
570Sigor@sysoev.ru                              if (re == NULL)
580Sigor@sysoev.ru                                  return 1;
590Sigor@sysoev.ru                              return 0;
600Sigor@sysoev.ru                          }"
610Sigor@sysoev.ru        . auto/feature
62*1721Saxel.duch@nginx.com
63*1721Saxel.duch@nginx.com        if [ $nxt_found = yes ]; then
64*1721Saxel.duch@nginx.com            $echo " + PCRE version: `pcre-config --version`"
65*1721Saxel.duch@nginx.com        fi
660Sigor@sysoev.ru    fi
67*1721Saxel.duch@nginx.comfi
680Sigor@sysoev.ru
69*1721Saxel.duch@nginx.comif [ $nxt_found = yes ]; then
70*1721Saxel.duch@nginx.com    nxt_have=NXT_HAVE_REGEX . auto/have
710Sigor@sysoev.ru
72*1721Saxel.duch@nginx.comelse
73*1721Saxel.duch@nginx.com    $echo
74*1721Saxel.duch@nginx.com    $echo $0: error: no PCRE library found.
75*1721Saxel.duch@nginx.com    $echo
76*1721Saxel.duch@nginx.com    exit 1;
770Sigor@sysoev.rufi
78