xref: /unit/auto/pcre (revision 2228:f403dc1e3ec1)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
61721Saxel.duch@nginx.comnxt_found=no
71721Saxel.duch@nginx.comNXT_HAVE_PCRE2=NO
81721Saxel.duch@nginx.com
91721Saxel.duch@nginx.comif [ $NXT_TRY_PCRE2 = YES ]; then
101721Saxel.duch@nginx.com    if /bin/sh -c "(pcre2-config --version)" >> $NXT_AUTOCONF_ERR 2>&1; then
110Sigor@sysoev.ru
121721Saxel.duch@nginx.com        NXT_PCRE_CFLAGS=`pcre2-config --cflags`
131721Saxel.duch@nginx.com        NXT_PCRE_LIB=`pcre2-config --libs8`
141721Saxel.duch@nginx.com
151721Saxel.duch@nginx.com        nxt_feature="PCRE2 library"
161721Saxel.duch@nginx.com        nxt_feature_name=NXT_HAVE_PCRE2
171721Saxel.duch@nginx.com        nxt_feature_run=no
181721Saxel.duch@nginx.com        nxt_feature_incs="-DPCRE2_CODE_UNIT_WIDTH=8 $NXT_PCRE_CFLAGS"
191721Saxel.duch@nginx.com        nxt_feature_libs=$NXT_PCRE_LIB
201721Saxel.duch@nginx.com        nxt_feature_test="#include <pcre2.h>
210Sigor@sysoev.ru
221721Saxel.duch@nginx.com                          int main(void) {
231721Saxel.duch@nginx.com                              pcre2_code  *re;
241721Saxel.duch@nginx.com
251721Saxel.duch@nginx.com                              re = pcre2_compile((PCRE2_SPTR)\"\",
261721Saxel.duch@nginx.com                                                 PCRE2_ZERO_TERMINATED, 0,
271721Saxel.duch@nginx.com                                                 NULL, NULL, NULL);
281721Saxel.duch@nginx.com                              return (re == NULL);
291721Saxel.duch@nginx.com                          }"
300Sigor@sysoev.ru
311721Saxel.duch@nginx.com        . auto/feature
320Sigor@sysoev.ru
331721Saxel.duch@nginx.com        if [ $nxt_found = yes ]; then
341721Saxel.duch@nginx.com            NXT_HAVE_PCRE2=YES
351721Saxel.duch@nginx.com            $echo " + PCRE2 version: `pcre2-config --version`"
361721Saxel.duch@nginx.com        fi
371721Saxel.duch@nginx.com    fi
381721Saxel.duch@nginx.comfi
391721Saxel.duch@nginx.com
401721Saxel.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
53*2228Sa.clayton@nginx.com                          int main(void) {
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
621721Saxel.duch@nginx.com
631721Saxel.duch@nginx.com        if [ $nxt_found = yes ]; then
641721Saxel.duch@nginx.com            $echo " + PCRE version: `pcre-config --version`"
651721Saxel.duch@nginx.com        fi
660Sigor@sysoev.ru    fi
671721Saxel.duch@nginx.comfi
680Sigor@sysoev.ru
691721Saxel.duch@nginx.comif [ $nxt_found = yes ]; then
701721Saxel.duch@nginx.com    nxt_have=NXT_HAVE_REGEX . auto/have
710Sigor@sysoev.ru
721721Saxel.duch@nginx.comelse
731721Saxel.duch@nginx.com    $echo
741721Saxel.duch@nginx.com    $echo $0: error: no PCRE library found.
751721Saxel.duch@nginx.com    $echo
761721Saxel.duch@nginx.com    exit 1;
770Sigor@sysoev.rufi
78