diff options
author | Jurijs Klopovskis <jurijs.klopovskis@zabbix.com> | 2022-05-18 17:20:58 +0300 |
---|---|---|
committer | Jurijs Klopovskis <jurijs.klopovskis@zabbix.com> | 2022-05-18 17:20:58 +0300 |
commit | d495c0fc7972ebc1e9e4040ef5c4703a190dd249 (patch) | |
tree | 5514fb30fda89646f66172b48cd708e7ffbf212e /m4 | |
parent | a5c43c05b9b2a733dd593e69e782bb008602cce9 (diff) |
....I..... [ZBX-21064] reworked pcre.m4 file to resemble changes in pcre2.m4
Diffstat (limited to 'm4')
-rw-r--r-- | m4/pcre.m4 | 176 |
1 files changed, 91 insertions, 85 deletions
diff --git a/m4/pcre.m4 b/m4/pcre.m4 index 05469c2882f..46a6c7ddc10 100644 --- a/m4/pcre.m4 +++ b/m4/pcre.m4 @@ -28,20 +28,24 @@ found_libpcre="yes") AC_DEFUN([LIBPCRE_CHECK_CONFIG], [ - AC_ARG_WITH([libpcre],[ -If you want to specify libpcre installation directories: -AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base install directory (DIR), default is to search through a number of common places for the libpcre files.])], + pcre_help_string="use libpcre from given base install directory (DIR), default is to search through a number of common places for the libpcre files." + + AC_ARG_WITH([libpcre],[If you want to specify libpcre installation directories: AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], ["$pcre_help_string"])], [ - if test "$withval" = "yes"; then + if test "$withval" = "no"; then + want_libpcre=no + else want_libpcre=yes - if test -f /usr/local/include/pcre.h; then - withval="/usr/local" + + if test "$withval" = "yes"; then + if test -f /usr/local/include/pcre.h; then + withval="/usr/local" + else + withval="/usr" + fi else - withval="/usr" + _libpcre_dir_lib="$withval/lib" fi - else - want_libpcre=no - _libpcre_dir_lib="$withval/lib" fi _libpcre_dir="$withval" test "x$withval" = "xyes" && withval=/usr @@ -73,95 +77,97 @@ AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base instal ] ) - if test "x$enable_static_libs" = "xyes"; then - AC_REQUIRE([PKG_PROG_PKG_CONFIG]) - PKG_PROG_PKG_CONFIG() - test -z "$PKG_CONFIG" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR([Not found pkg-config library]) - m4_pattern_allow([^PKG_CONFIG_LIBDIR$]) - fi + if test "$want_libpcre" = "yes"; then + AC_MSG_CHECKING(for libpcre support) - AC_MSG_CHECKING(for libpcre support) + if test "x$enable_static_libs" = "xyes"; then + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + PKG_PROG_PKG_CONFIG() + test -z "$PKG_CONFIG" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR([Not found pkg-config library]) + m4_pattern_allow([^PKG_CONFIG_LIBDIR$]) + fi - LIBPCRE_LIBS="-lpcre" + LIBPCRE_LIBS="-lpcre" - if test "x$enable_static" = "xyes"; then - LIBPCRE_LIBS=" $LIBPCRE_LIBS -lpthread" - elif test "x$enable_static_libs" = "xyes" -a -z "$PKG_CONFIG"; then - LIBPCRE_LIBS="$_libpcre_dir_lib/libpcre.a" - elif test "x$enable_static_libs" = "xyes"; then + if test "x$enable_static" = "xyes"; then + LIBPCRE_LIBS=" $LIBPCRE_LIBS -lpthread" + elif test "x$enable_static_libs" = "xyes" -a -z "$PKG_CONFIG"; then + LIBPCRE_LIBS="$_libpcre_dir_lib/libpcre.a" + elif test "x$enable_static_libs" = "xyes"; then - test "x$static_linking_support" = "xno" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR(["Compiler not support statically linked libs from default folders"]) + test "x$static_linking_support" = "xno" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR(["Compiler not support statically linked libs from default folders"]) - if test -z "$_libpcre_dir_lib"; then - PKG_CHECK_EXISTS(libpcre,[ - LIBPCRE_LIBS=`$PKG_CONFIG --static --libs libpcre` - ],[ - AC_MSG_ERROR([Not found libpcre package]) - ]) - else - AC_RUN_LOG([PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --exists --print-errors libpcre]) || AC_MSG_ERROR(["Not found libpcre package in $_libpcre_dir/lib/pkgconfig"]) - LIBPCRE_LIBS=`PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --static --libs libpcre` - test -z "$LIBPCRE_LIBS" && LIBPCRE_LIBS=`PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --libs libpcre` - fi + if test -z "$_libpcre_dir_lib"; then + PKG_CHECK_EXISTS(libpcre,[ + LIBPCRE_LIBS=`$PKG_CONFIG --static --libs libpcre` + ],[ + AC_MSG_ERROR([Not found libpcre package]) + ]) + else + AC_RUN_LOG([PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --exists --print-errors libpcre]) || AC_MSG_ERROR(["Not found libpcre package in $_libpcre_dir/lib/pkgconfig"]) + LIBPCRE_LIBS=`PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --static --libs libpcre` + test -z "$LIBPCRE_LIBS" && LIBPCRE_LIBS=`PKG_CONFIG_LIBDIR="$_libpcre_dir_lib/pkgconfig" $PKG_CONFIG --libs libpcre` + fi - if test "x$static_linking_support" = "xno"; then - LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s|-lpcre|$_libpcre_dir_lib/libpcre.a|g"` - else - LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s/-lpcre/${static_linking_support}static -lpcre ${static_linking_support}dynamic/g"` + if test "x$static_linking_support" = "xno"; then + LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s|-lpcre|$_libpcre_dir_lib/libpcre.a|g"` + else + LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s/-lpcre/${static_linking_support}static -lpcre ${static_linking_support}dynamic/g"` + fi fi - fi - if test -n "$_libpcre_dir_set" -o -f /usr/include/pcre.h; then - found_libpcre="yes" - elif test -f /usr/local/include/pcre.h; then - LIBPCRE_CFLAGS="-I/usr/local/include" - LIBPCRE_LDFLAGS="-L/usr/local/lib" - found_libpcre="yes" - elif test -f /usr/pkg/include/pcre.h; then - LIBPCRE_CFLAGS="-I/usr/pkg/include" - LIBPCRE_LDFLAGS="-L/usr/pkg/lib" - LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS -Wl,-R/usr/pkg/lib" - found_libpcre="yes" - elif test -f /opt/csw/include/pcre.h; then - LIBPCRE_CFLAGS="-I/opt/csw/include" - LIBPCRE_LDFLAGS="-L/opt/csw/lib" - if $(echo "$CFLAGS"|grep -q -- "-m64") ; then - LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS/64 -Wl,-R/opt/csw/lib/64" + if test -n "$_libpcre_dir_set" -o -f /usr/include/pcre.h; then + found_libpcre="yes" + elif test -f /usr/local/include/pcre.h; then + LIBPCRE_CFLAGS="-I/usr/local/include" + LIBPCRE_LDFLAGS="-L/usr/local/lib" + found_libpcre="yes" + elif test -f /usr/pkg/include/pcre.h; then + LIBPCRE_CFLAGS="-I/usr/pkg/include" + LIBPCRE_LDFLAGS="-L/usr/pkg/lib" + LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS -Wl,-R/usr/pkg/lib" + found_libpcre="yes" + elif test -f /opt/csw/include/pcre.h; then + LIBPCRE_CFLAGS="-I/opt/csw/include" + LIBPCRE_LDFLAGS="-L/opt/csw/lib" + if $(echo "$CFLAGS"|grep -q -- "-m64") ; then + LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS/64 -Wl,-R/opt/csw/lib/64" + else + LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS -Wl,-R/opt/csw/lib" + fi + found_libpcre="yes" else - LIBPCRE_LDFLAGS="$LIBPCRE_LDFLAGS -Wl,-R/opt/csw/lib" + found_libpcre="no" + AC_MSG_RESULT(no) fi - found_libpcre="yes" - else - found_libpcre="no" - AC_MSG_RESULT(no) - fi - if test "x$found_libpcre" = "xyes"; then - am_save_CFLAGS="$CFLAGS" - am_save_LDFLAGS="$LDFLAGS" - am_save_LIBS="$LIBS" + if test "x$found_libpcre" = "xyes"; then + am_save_CFLAGS="$CFLAGS" + am_save_LDFLAGS="$LDFLAGS" + am_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $LIBPCRE_CFLAGS" - LDFLAGS="$LDFLAGS $LIBPCRE_LDFLAGS" - LIBS="$LIBS $LIBPCRE_LIBS" + CFLAGS="$CFLAGS $LIBPCRE_CFLAGS" + LDFLAGS="$LDFLAGS $LIBPCRE_LDFLAGS" + LIBS="$LIBS $LIBPCRE_LIBS" - found_libpcre="no" - LIBPCRE_TRY_LINK([no]) + found_libpcre="no" + LIBPCRE_TRY_LINK([no]) - CFLAGS="$am_save_CFLAGS" - LDFLAGS="$am_save_LDFLAGS" - LIBS="$am_save_LIBS" - fi + CFLAGS="$am_save_CFLAGS" + LDFLAGS="$am_save_LDFLAGS" + LIBS="$am_save_LIBS" + fi - if test "x$found_libpcre" = "xyes"; then - AC_MSG_RESULT(yes) - else - LIBPCRE_CFLAGS="" - LIBPCRE_LDFLAGS="" - LIBPCRE_LIBS="" - fi + if test "x$found_libpcre" = "xyes"; then + AC_MSG_RESULT(yes) + else + LIBPCRE_CFLAGS="" + LIBPCRE_LDFLAGS="" + LIBPCRE_LIBS="" + fi - AC_SUBST(LIBPCRE_CFLAGS) - AC_SUBST(LIBPCRE_LDFLAGS) - AC_SUBST(LIBPCRE_LIBS) + AC_SUBST(LIBPCRE_CFLAGS) + AC_SUBST(LIBPCRE_LDFLAGS) + AC_SUBST(LIBPCRE_LIBS) + fi ])dnl |