# Copyright (C) Igor Sysoev # Copyright (C) NGINX, Inc. NJS_PCRE_CFLAGS= NJS_PCRE_LIB= NJS_HAVE_PCRE=NO if [ $NJS_PCRE = YES ]; then njs_found=no if [ $NJS_TRY_PCRE2 = YES ]; then njs_feature="PCRE2 library" njs_feature_name=NJS_HAVE_PCRE2 njs_feature_run=no njs_feature_incs= njs_feature_libs= njs_feature_test="#define PCRE2_CODE_UNIT_WIDTH 8 #include int main(void) { pcre2_code *re; re = pcre2_compile((PCRE2_SPTR)\"\", PCRE2_ZERO_TERMINATED, 0, NULL, NULL, NULL); return (re == NULL); }" . auto/feature if [ $njs_found = no ]; then # pcre2-config if /bin/sh -c "(pcre2-config --version)" >> $NJS_AUTOCONF_ERR 2>&1; then NJS_PCRE_CFLAGS=`pcre2-config --cflags` NJS_PCRE_LIB=`pcre2-config --libs8` njs_feature="PCRE2 library in `pcre2-config --prefix 2>/dev/null`" njs_feature_incs=$NJS_PCRE_CFLAGS njs_feature_libs=$NJS_PCRE_LIB . auto/feature fi fi if [ $njs_found = yes ]; then njs_feature="PCRE2 version" njs_feature_name=NJS_PCRE2_VERSION njs_feature_run=value njs_feature_test="#define PCRE2_CODE_UNIT_WIDTH 8 #include #include int main(void) { printf(\"%d.%d\", PCRE2_MAJOR, PCRE2_MINOR); return 0; }" . auto/feature NJS_HAVE_PCRE=YES fi fi if [ $njs_found = no ]; then njs_feature="PCRE library" njs_feature_name=NJS_HAVE_PCRE njs_feature_run=no njs_feature_incs= njs_feature_libs= njs_feature_test="#include int main(void) { pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL); if (re == NULL) return 1; return 0; }" . auto/feature if [ $njs_found = no ]; then # pcre-config njs_pcre_prefix=`pcre-config --prefix 2>/dev/null` if [ -n "$njs_pcre_prefix" ]; then NJS_PCRE_CFLAGS=`pcre-config --cflags` NJS_PCRE_LIB=`pcre-config --libs` njs_feature="PCRE library in $njs_pcre_prefix" njs_feature_incs="$NJS_PCRE_CFLAGS" njs_feature_libs=$NJS_PCRE_LIB . auto/feature fi fi if [ $njs_found = yes ]; then njs_feature="PCRE version" njs_feature_name=NJS_PCRE_VERSION njs_feature_run=value njs_feature_test="#include #include int main(void) { printf(\"%d.%d\", PCRE_MAJOR, PCRE_MINOR); return 0; }" . auto/feature NJS_HAVE_PCRE=YES fi fi if [ $njs_found = no ]; then echo echo $0: error: no PCRE library found. echo exit 1; fi fi NJS_LIB_AUX_CFLAGS="$NJS_LIB_AUX_CFLAGS $NJS_PCRE_CFLAGS" NJS_LIB_AUX_LIBS="$NJS_LIB_AUX_LIBS $NJS_PCRE_LIB"