diff options
author | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2019-11-25 16:43:22 +0300 |
---|---|---|
committer | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2019-11-25 16:43:22 +0300 |
commit | fc306f7f0ea49955a2bf000f3c003279c05a1b6e (patch) | |
tree | 05ae5b9205b5e63a09654c7424984ded27d82db5 /m4 | |
parent | 531eed229c06fee65069e0ac2f952a737cd8bc9b (diff) |
....I..... [DEV-1343] m4 xBSD improvements
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ldap.m4 | 50 | ||||
-rw-r--r-- | m4/libcurl.m4 | 32 | ||||
-rw-r--r-- | m4/pcre.m4 | 7 |
3 files changed, 74 insertions, 15 deletions
diff --git a/m4/ldap.m4 b/m4/ldap.m4 index d691a58cf54..52059f36de6 100644 --- a/m4/ldap.m4 +++ b/m4/ldap.m4 @@ -136,6 +136,19 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> AC_MSG_RESULT([without SSL]) ]) + # without SSL for Solaris + if test "x$ldap_link" = "xno"; then + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lpthread -lsasl" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lpthread -lsasl" + fi + LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ + LDAP_LIBS=$TRY_LDAP_LIBS + AC_MSG_RESULT([without SSL and with sasl]) + ]) + fi + # with system GnuTLS if test "x$ldap_link" = "xno"; then if test "x$static_linking_support" = "xno"; then @@ -145,7 +158,23 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS - AC_MSG_RESULT([with system GnuTLS dynamic linking]) + AC_MSG_RESULT([with system GnuTLS linking]) + ]) + fi + + # with static OpenSSL and SASL2 + if test "x$ldap_link" = "xno" -a "x$want_openssl" = "xyes"; then + if test "x$static_linking_support" = "xno"; then + OSSL_LDAP_LIBS="$LDAP_LIBS $OPENSSL_LIBS -lsasl2" + else + OSSL_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -lsasl2 -Wl,-Bdynamic $OPENSSL_LIBS" + fi + OSSL_LDAP_CPPFLAGS="$LDAP_CPPFLAGS $OPENSSL_CPPFLAGS" + OSSL_LDAP_CFLAGS="$LDAP_CPPFLAGS $OPENSSL_CFLAGS" + OSSL_LDAP_LDFLAGS="$LDAP_LDFLAGS $OPENSSL_LDFLAGS" + LIBLDAP_TRY_LINK([$OSSL_LDAP_LIBS], [$OSSL_LDAP_LDFLAGS], [$OSSL_LDAP_CPPFLAGS], [$OSSL_LDAP_CFLAGS],[ + LDAP_LIBS="$OSSL_LDAP_LIBS" + AC_MSG_RESULT([with static OpenSSL and static sasl2]) ]) fi @@ -177,12 +206,25 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> OSSL_LDAP_LDFLAGS="$LDAP_LDFLAGS $OPENSSL_LDFLAGS" LIBLDAP_TRY_LINK([$OSSL_LDAP_LIBS], [$OSSL_LDAP_LDFLAGS], [$OSSL_LDAP_CPPFLAGS], [$OSSL_LDAP_CFLAGS],[ LDAP_LIBS="$OSSL_LDAP_LIBS" - AC_MSG_RESULT([with static OpenSSL for Solaris]) + AC_MSG_RESULT([with static OpenSSL and sasl]) ],[ AC_MSG_ERROR([Not compatible with static OpenLDAP libs version of static OpenSSL: "$OPENSSL_LDFLAGS"]) ]) fi + # with system OpenSSL and SASL2 + if test "x$ldap_link" = "xno"; then + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lssl -lsasl2 -lcrypto" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -lsasl2 -Wl,-Bdynamic -lssl -lcrypto" + fi + LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ + LDAP_LIBS=$TRY_LDAP_LIBS + AC_MSG_RESULT([with system OpenSSL and static sasl2 linking]) + ]) + fi + # with system OpenSSL if test "x$ldap_link" = "xno"; then if test "x$static_linking_support" = "xno"; then @@ -192,7 +234,7 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS - AC_MSG_RESULT([with system OpenSSL dynamic linking]) + AC_MSG_RESULT([with system OpenSSL linking]) ]) fi @@ -205,7 +247,7 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS - AC_MSG_RESULT([with system OpenSSL for Solaris dynamic linking]) + AC_MSG_RESULT([with system OpenSSL and sasl linking]) ]) fi diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 index 650e055703a..a6e383e5e0a 100644 --- a/m4/libcurl.m4 +++ b/m4/libcurl.m4 @@ -131,11 +131,27 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ LIBCURL_LIBS="$LIBCURL_LIBS $i" ;; -l*) + if test "x$enable_static_libs" = "xyes"; then + _lib_name=`echo "$i" | cut -b3-` + test -f "$_curl_dir_lib/lib$_lib_name.a" && i="$_curl_dir_lib/lib$_lib_name.a" + fi LIBCURL_LIBS="$LIBCURL_LIBS $i" ;; esac done + _save_curl_cflags="$CFLAGS" + _save_curl_ldflags="$LDFLAGS" + _save_curl_libs="$LIBS" + CFLAGS="$CFLAGS $LIBCURL_CFLAGS" + LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" + if test "x$enable_static_libs" = "xyes"; then + test "x$want_openssl" = "xyes" && CFLAGS="$OPENSSL_CFLAGS $CFLAGS" + test "x$want_openssl" = "xyes" && LDFLAGS="$OPENSSL_LDFLAGS $LDFLAGS" + test "x$want_ldap" = "xyes" && CFLAGS="$LDAP_CPPFLAGS $CFLAGS" + test "x$want_ldap" = "xyes" && LDFLAGS="$LDAP_LDFLAGS $LDFLAGS" + fi + if test "x$enable_static" = "xyes" -o "x$enable_static_libs" = "xyes"; then _full_libcurl_libs=`$_libcurl_config --static-libs` @@ -152,6 +168,7 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ -lcurl) ;; -l*) + _lib_i=$i _lib_name=`echo "$i" | cut -b3-` AC_CHECK_LIB($_lib_name , main,[ if test "x$enable_static_libs" = "xyes"; then @@ -168,8 +185,12 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ -lldap_a|-lldap_r_a|-llber_a) test "x$want_ldap" = "xyes" && i="$LDAP_LIBS" ;; + -l*) + test -f "$_curl_dir_lib/lib$_lib_name.a" && i="$_curl_dir_lib/lib$_lib_name.a" + ;; esac fi + test -z "${LIBCURL_LIBS##*$_lib_i*}" && LIBCURL_LIBS=`echo "$LIBCURL_LIBS"|sed "s|$_lib_i||g"` test -z "${LIBCURL_LIBS##*$i*}" || LIBCURL_LIBS="$LIBCURL_LIBS $i" ],[ AC_MSG_ERROR([static library $_lib_name required for linking libcurl not found]) @@ -182,18 +203,7 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ done fi # "x$enable_static" or "x$enable_static_libs" - _save_curl_cflags="$CFLAGS" - _save_curl_ldflags="$LDFLAGS" - _save_curl_libs="$LIBS" - CFLAGS="$CFLAGS $LIBCURL_CFLAGS" - LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS" LIBS="$LIBS $LIBCURL_LIBS" - if test "x$enable_static_libs" = "xyes"; then - test "x$want_openssl" = "xyes" && CFLAGS="$OPENSSL_CFLAGS $CFLAGS" - test "x$want_openssl" = "xyes" && LDFLAGS="$OPENSSL_LDFLAGS $LDFLAGS" - test "x$want_ldap" = "xyes" && CFLAGS="$LDAP_CPPFLAGS $CFLAGS" - test "x$want_ldap" = "xyes" && LDFLAGS="$LDAP_LDFLAGS $LDFLAGS" - fi AC_CHECK_LIB(curl, main, , [AC_MSG_ERROR([libcurl library not found])]) diff --git a/m4/pcre.m4 b/m4/pcre.m4 index 168edeeedad..ff3119a729a 100644 --- a/m4/pcre.m4 +++ b/m4/pcre.m4 @@ -32,6 +32,13 @@ AC_DEFUN([LIBPCRE_CHECK_CONFIG], 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.])], [ + if test "$withval" = "yes"; then + if test -f /usr/local/include/pcre.h; then + withval="/usr/local" + else + withval="/usr" + fi + fi _libpcre_dir="$withval" _libpcre_dir_lib="$withval/lib" test "x$withval" = "xyes" && withval=/usr |