diff options
author | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2019-11-23 00:22:01 +0300 |
---|---|---|
committer | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2019-11-23 00:22:01 +0300 |
commit | b9fc30e5483f5f54ae1f71f4baf6cf8d057683c4 (patch) | |
tree | c415037642806350c486454c65ddc0bd6ff03712 /m4 | |
parent | fb73064f220ec77376c19f6e0591083ce82550ae (diff) |
....I..... [DEV-1343] m4 OSX support
Diffstat (limited to 'm4')
-rw-r--r-- | m4/iconv.m4 | 16 | ||||
-rw-r--r-- | m4/ldap.m4 | 45 | ||||
-rw-r--r-- | m4/libcurl.m4 | 11 | ||||
-rw-r--r-- | m4/libopenssl.m4 | 8 | ||||
-rw-r--r-- | m4/pcre.m4 | 13 |
5 files changed, 81 insertions, 12 deletions
diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 3e0dfa243f4..0b06254a1db 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -41,8 +41,9 @@ AC_HELP_STRING([--with-iconv@<:@=DIR@:>@], [use iconv from given base install di ICONV_LDFLAGS="-L/usr/lib" _iconv_dir_set=$withval elif test "$withval" != "no"; then + _iconv_dir_lib="$withval/lib" ICONV_CFLAGS="-I$withval/include" - ICONV_LDFLAGS="-L$withval/lib" + ICONV_LDFLAGS="-L$_iconv_dir_lib" _iconv_dir_set="yes" fi ] @@ -64,6 +65,7 @@ AC_HELP_STRING([--with-iconv@<:@=DIR@:>@], [use iconv from given base install di ), [ ICONV_LDFLAGS="-L$withval" + _iconv_dir_lib="-L$withval" _iconv_dir_set="yes" ] ) @@ -94,7 +96,17 @@ AC_HELP_STRING([--with-iconv@<:@=DIR@:>@], [use iconv from given base install di if test "x$found_iconv" = "xno"; then ICONV_LIBS="-liconv" if test "x$enable_static_libs" = "xyes"; then - ICONV_LIBS="-Wl,-Bstatic $ICONV_LIBS -Wl,-Bdynamic" + test "x$static_linking_support" = "xno" -a -z "$_iconv_dir_lib" && AC_MSG_ERROR(["Compiler not support statically linked libs from default folders"]) + + if test "x$static_linking_support" = "xno" -a "x$ARCH" = "xaix"; then + ICONV_LIBS="$_iconv_dir_lib/libiconv_a" + elif test "x$static_linking_support" = "xno"; then + ICONV_LIBS="$_iconv_dir_lib/libiconv.a" + elif test "x$ARCH" = "xaix"; then + ICONV_LIBS="-Wl,-Bstatic -liconv_a -Wl,-Bdynamic" + else + ICONV_LIBS="-Wl,-Bstatic $ICONV_LIBS -Wl,-Bdynamic" + fi fi LIBS="$LIBS $ICONV_LIBS" LIBICONV_TRY_LINK([no]) diff --git a/m4/ldap.m4 b/m4/ldap.m4 index aa7d83ec196..d691a58cf54 100644 --- a/m4/ldap.m4 +++ b/m4/ldap.m4 @@ -97,6 +97,8 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> if test -f $_libldap_with/include/ldap.h; then LDAP_INCDIR=$_libldap_with/include LDAP_LIBDIR=$_libldap_with/lib + _ldap_dir_lib="$LDAP_LIBDIR" + found_ldap="yes" else found_ldap="no" @@ -115,9 +117,20 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> LDAP_LIBS="$LDAP_LIBS -lgnutls -lpthread -lsasl2" elif test "x$enable_static_libs" = "xyes"; then AC_MSG_CHECKING([compatibility of static LDAP libs]) + test "x$static_linking_support" = "xno" -a -z "$_ldap_dir_lib" && AC_MSG_ERROR(["Compiler not support statically linked libs from default folders"]) + + if test "x$static_linking_support" = "xno" -a "x$ARCH" = "xaix"; then + LDAP_LIBS=`echo "$LDAP_LIBS"|sed "s|-lldap|$_ldap_dir_lib/libldap_a|g"|sed "s|-llber|$_ldap_dir_lib/liblber_a|g"` + elif test "x$static_linking_support" = "xno"; then + LDAP_LIBS=`echo "$LDAP_LIBS"|sed "s|-lldap|$_ldap_dir_lib/libldap.a|g"|sed "s|-llber|$_ldap_dir_lib/liblber.a|g"` + fi # without SSL - TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lpthread -lsasl2" + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lpthread -lsasl2" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lpthread -lsasl2" + fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS AC_MSG_RESULT([without SSL]) @@ -125,7 +138,11 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> # with system GnuTLS if test "x$ldap_link" = "xno"; then - TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lgnutls -lsasl2 -lgssapi_krb5 -lpthread" + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lgnutls -lsasl2 -lgssapi_krb5 -lpthread" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lgnutls -lsasl2 -lgssapi_krb5 -lpthread" + fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS AC_MSG_RESULT([with system GnuTLS dynamic linking]) @@ -134,7 +151,11 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> # with static OpenSSL if test "x$ldap_link" = "xno" -a "x$want_openssl" = "xyes"; then - OSSL_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic $OPENSSL_LIBS -lsasl2" + if test "x$static_linking_support" = "xno"; then + OSSL_LDAP_LIBS="$LDAP_LIBS $OPENSSL_LIBS -lsasl2" + else + OSSL_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic $OPENSSL_LIBS -lsasl2" + fi OSSL_LDAP_CPPFLAGS="$LDAP_CPPFLAGS $OPENSSL_CPPFLAGS" OSSL_LDAP_CFLAGS="$LDAP_CPPFLAGS $OPENSSL_CFLAGS" OSSL_LDAP_LDFLAGS="$LDAP_LDFLAGS $OPENSSL_LDFLAGS" @@ -146,7 +167,11 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> # with static OpenSSL for Solaris if test "x$ldap_link" = "xno" -a "x$want_openssl" = "xyes"; then - OSSL_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic $OPENSSL_LIBS -lsasl" + if test "x$static_linking_support" = "xno"; then + OSSL_LDAP_LIBS="$LDAP_LIBS $OPENSSL_LIBS -lsasl" + else + OSSL_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic $OPENSSL_LIBS -lsasl" + fi OSSL_LDAP_CPPFLAGS="$LDAP_CPPFLAGS $OPENSSL_CPPFLAGS" OSSL_LDAP_CFLAGS="$LDAP_CPPFLAGS $OPENSSL_CFLAGS" OSSL_LDAP_LDFLAGS="$LDAP_LDFLAGS $OPENSSL_LDFLAGS" @@ -160,7 +185,11 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> # with system OpenSSL if test "x$ldap_link" = "xno"; then - TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lssl -lsasl2 -lcrypto" + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lssl -lsasl2 -lcrypto" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lssl -lsasl2 -lcrypto" + fi LIBLDAP_TRY_LINK([$TRY_LDAP_LIBS], [$LDAP_LDFLAGS], [$LDAP_CPPFLAGS], ,[ LDAP_LIBS=$TRY_LDAP_LIBS AC_MSG_RESULT([with system OpenSSL dynamic linking]) @@ -169,7 +198,11 @@ AC_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:> # with system OpenSSL for Solaris if test "x$ldap_link" = "xno"; then - TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lssl -lsasl -lcrypto" + if test "x$static_linking_support" = "xno"; then + TRY_LDAP_LIBS="$LDAP_LIBS -lssl -lsasl -lcrypto" + else + TRY_LDAP_LIBS="-Wl,-Bstatic $LDAP_LIBS -Wl,-Bdynamic -lssl -lsasl -lcrypto" + 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]) diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 index f10e6721d60..e83e5952465 100644 --- a/m4/libcurl.m4 +++ b/m4/libcurl.m4 @@ -111,6 +111,8 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ fi if test "x$LIBCURL_LIBS" = "x"; then + _curl_dir_lib=`$_libcurl_config --prefix` + _curl_dir_lib="$_curl_dir_lib/lib" _full_libcurl_libs=`$_libcurl_config --libs` for i in $_full_libcurl_libs; do case $i in @@ -121,7 +123,11 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ LIBCURL_LDFLAGS="$LIBCURL_LDFLAGS -Wl,$i" ;; -lcurl) - test "x$enable_static_libs" = "xyes" && i="-Wl,-Bstatic $i -Wl,-Bdynamic" + if test "x$enable_static_libs" = "xyes" -a "x$static_linking_support" = "xno"; then + i="$_curl_dir_lib/libcurl.a" + elif test "x$enable_static_libs" = "xyes"; then + i="-Wl,-Bstatic $i -Wl,-Bdynamic" + fi LIBCURL_LIBS="$LIBCURL_LIBS $i" ;; -l*) @@ -169,6 +175,9 @@ AC_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@ AC_MSG_ERROR([static library $_lib_name required for linking libcurl not found]) ]) ;; + -framework|CoreFoundation|Security) + test "x$static_linking_support" = "xno" && LIBCURL_LIBS="$LIBCURL_LIBS $i" + ;; esac done fi # "x$enable_static" or "x$enable_static_libs" diff --git a/m4/libopenssl.m4 b/m4/libopenssl.m4 index 08447095526..df7f66b3db9 100644 --- a/m4/libopenssl.m4 +++ b/m4/libopenssl.m4 @@ -87,12 +87,14 @@ AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[use OpenSSL package @<:@default=no@ else want_openssl="yes" _libopenssl_dir=$withval + _libopenssl_dir_lib="$withval/lib" fi accept_openssl_version="no" ],[want_openssl=ifelse([$1],,[no],[$1])] ) if test "x$enable_static_libs" = "xyes"; then + test "x$static_linking_support" = "xno" -a -z "$_libopenssl_dir_lib" && AC_MSG_ERROR(["OpenSSL: Compiler not support statically linked libs from default folders"]) AC_REQUIRE([PKG_PROG_PKG_CONFIG]) PKG_PROG_PKG_CONFIG() test -z $PKG_CONFIG && AC_MSG_ERROR([Not found pkg-config library]) @@ -149,7 +151,11 @@ AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[use OpenSSL package @<:@default=no@ OPENSSL_LIBS=`PKG_CONFIG_LIBDIR="$_libopenssl_dir/lib/pkgconfig" $PKG_CONFIG --static --libs openssl` fi - if test "x$ARCH" = "xaix"; then + if test "x$static_linking_support" = "xno" -a "x$ARCH" = "xaix"; then + OPENSSL_LIBS=`echo "$OPENSSL_LIBS"|sed "s|-lssl_a|$_libopenssl_dir_lib/ssl_a|g"|sed "s|-lcrypto_a|$_libopenssl_dir_lib/crypto_a|g"` + elif test "x$static_linking_support" = "xno"; then + OPENSSL_LIBS=`echo "$OPENSSL_LIBS"|sed "s|-lssl|$_libopenssl_dir_lib/libssl.a|g"|sed "s|-lcrypto|$_libopenssl_dir_lib/libcrypto.a|g"` + elif test "x$ARCH" = "xaix"; then OPENSSL_LIBS=`echo "$OPENSSL_LIBS"|sed 's/-lssl_a/-Wl,-Bstatic -lssl_a -Wl,-Bdynamic/g'|sed 's/-lcrypto_a/-Wl,-Bstatic -lcrypto_a -Wl,-Bdynamic/g'` else OPENSSL_LIBS=`echo "$OPENSSL_LIBS"|sed 's/-lssl/-Wl,-Bstatic -lssl -Wl,-Bdynamic/g'|sed 's/-lcrypto/-Wl,-Bstatic -lcrypto -Wl,-Bdynamic/g'` diff --git a/m4/pcre.m4 b/m4/pcre.m4 index 00bdf861a75..168edeeedad 100644 --- a/m4/pcre.m4 +++ b/m4/pcre.m4 @@ -33,9 +33,10 @@ 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.])], [ _libpcre_dir="$withval" + _libpcre_dir_lib="$withval/lib" test "x$withval" = "xyes" && withval=/usr LIBPCRE_CFLAGS="-I$withval/include" - LIBPCRE_LDFLAGS="-L$withval/lib" + LIBPCRE_LDFLAGS="-L$_libpcre_dir_lib" _libpcre_dir_set="yes" ] ) @@ -56,6 +57,7 @@ AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base instal ), [ _libpcre_dir="$withval" + _libpcre_dir_lib="$withval" LIBPCRE_LDFLAGS="-L$withval" _libpcre_dir_set="yes" ] @@ -75,6 +77,9 @@ AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base instal if test "x$enable_static" = "xyes"; then LIBPCRE_LIBS=" $LIBPCRE_LIBS -lpthread" 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"]) + if test "x$_libpcre_dir" = "xyes" -o -z "$_libpcre_dir"; then PKG_CHECK_EXISTS(libpcre,[ LIBPCRE_LIBS=`$PKG_CONFIG --static --libs libpcre` @@ -86,7 +91,11 @@ AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base instal LIBPCRE_LIBS=`PKG_CONFIG_LIBDIR="$_libpcre_dir/lib/pkgconfig" $PKG_CONFIG --static --libs libpcre` fi - if test "x$ARCH" = "xaix"; then + if test "x$static_linking_support" = "xno" -a "x$ARCH" = "xaix"; then + LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s|-lpcre_a|$_libpcre_dir_lib/libpcre_a|g"` + elif test "x$static_linking_support" = "xno"; then + LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed "s|-lpcre|$_libpcre_dir_lib/libpcre.a|g"` + elif test "x$ARCH" = "xaix"; then LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed 's/-lpcre_a/-Wl,-Bstatic -lpcre_a -Wl,-Bdynamic/g'` else LIBPCRE_LIBS=`echo "$LIBPCRE_LIBS"|sed 's/-lpcre/-Wl,-Bstatic -lpcre -Wl,-Bdynamic/g'` |