From: Francesco Chemolli Date: Mon, 23 Aug 2010 13:15:48 +0000 (+0200) Subject: Compatibility fixes for Solaris/gcc X-Git-Tag: take1~345 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a05af87908bad6c69f34834b10c3d8bdf470c9d0;p=thirdparty%2Fsquid.git Compatibility fixes for Solaris/gcc --- diff --git a/compat/compat.h b/compat/compat.h index 0830219dfb..e0bc1db9b1 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -27,7 +27,10 @@ #include "compat/osdetect.h" /* ugly hack. But we need to set this REALLY soon in the header */ -#if _SQUID_SOLARIS_ +#if _SQUID_SOLARIS_ && !defined(__GNUC__) && !defined(__GNUG__) +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 1 #endif diff --git a/compat/os/solaris.h b/compat/os/solaris.h index 0e4e26b064..0a718d3bbe 100644 --- a/compat/os/solaris.h +++ b/compat/os/solaris.h @@ -18,17 +18,6 @@ #endif /* wcsstr */ #define wcsstr wcswcs -/* - * we need some standard-based extensions - */ -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 1 -#endif -#ifndef _XOPEN_SOURCE_EXTENDED -#define _XOPEN_SOURCE_EXTENDED 1 -#endif - - /* * On Solaris 9 x86, gcc may includes a "fixed" set of old system * include files that is incompatible with the updated Solaris diff --git a/configure.in b/configure.in index 78e203d9ed..61500805ef 100644 --- a/configure.in +++ b/configure.in @@ -75,7 +75,9 @@ AC_SUBST(AR_R) # this needs to be before any test is run, to have more standard # functions available on some Unix sysems (e.g. Solaris) -AC_USE_SYSTEM_EXTENSIONS +if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then + AC_USE_SYSTEM_EXTENSIONS +fi AC_ARG_ENABLE(strict-error-checking, AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled @@ -1717,12 +1719,16 @@ if test "x$ac_krb5_config" = "xyes" ; then AC_CHECK_HEADERS(gssapi/gssapi_generic.h) AC_CHECK_HEADERS(profile.h) fi - AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h) SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H if test "x$squid_cv_broken_krb5_h" = "xyes"; then - AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if krb5.h is broken for C++]) + AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if krb5.h is broken for C++]) + AC_MSG_WARN([You have a broken Solaris system include.]) + AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512]) + AC_MSG_WARN([If you need Kerberos support you'll have to patch]) + AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch]) fi + AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h) ac_com_error_message=no if test "x$ac_cv_header_com_err_h" == "xyes" ; then diff --git a/contrib/solaris/solaris-krb5-include.patch b/contrib/solaris/solaris-krb5-include.patch new file mode 100644 index 0000000000..0421ec62e8 --- /dev/null +++ b/contrib/solaris/solaris-krb5-include.patch @@ -0,0 +1,19 @@ +--- /usr/include/kerberosv5/krb5.h.orig Mon Aug 23 04:09:23 2010 ++++ /usr/include/kerberosv5/krb5.h Mon Aug 23 04:10:53 2010 +@@ -171,6 +171,7 @@ + #define KRB5INT_END_DECLS + #endif + #endif ++KRB5INT_BEGIN_DECLS + + #if TARGET_OS_MAC + # pragma options align=mac68k +@@ -3246,8 +3247,4 @@ + /* for compatibility with older versions... */ + #define asn1_err_base ERROR_TABLE_BASE_asn1 + +-#ifdef __cplusplus +-} +-#endif +- + #endif /* _KRB5_H */ diff --git a/helpers/external_acl/kerberos_ldap_group/support.h b/helpers/external_acl/kerberos_ldap_group/support.h index b6fd582ac6..996b752526 100644 --- a/helpers/external_acl/kerberos_ldap_group/support.h +++ b/helpers/external_acl/kerberos_ldap_group/support.h @@ -24,24 +24,28 @@ #define KERBEROS_LDAP_GROUP_VERSION "1.2.2sq" -#ifdef HAVE_STRING_H +#if HAVE_STRING_H #include #endif -#ifdef HAVE_HEIMDAL_KERBEROS -#ifdef HAVE_GSSAPI_GSSAPI_H +#if HAVE_HEIMDAL_KERBEROS +#if HAVE_GSSAPI_GSSAPI_H #include -#elif defined(HAVE_GSSAPI_H) +#elif HAVE_GSSAPI_H #include -#endif -#ifdef HAVE_KRB5_H +#endif /* HAVE_GSSAPI_GSSAPI_H/HAVE_GSSAPI_H */ +#if HAVE_KRB5_H +#if HAVE_BROKEN_SOLARIS_KRB5_H +#warn "Warning! You have a broken Solaris fsystem header" +#warn "http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512" +#endif /* HAVE_BROKEN_SOLARIS_KRB5_H */ #include -#endif -#ifdef HAVE_COM_ERR_H +#endif /* HAVE_KRB5_H */ +#if HAVE_COM_ERR_H #include #else #define error_message(code) krb5_get_err_text(kparam.context,code) -#endif +#endif /* HAVE_COM_ERR_H */ #else /*MIT */ #ifdef HAVE_GSSAPI_GSSAPI_H #include diff --git a/lib/rfc1035.c b/lib/rfc1035.c index 9f0df23bba..cc84fa4981 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -44,6 +44,9 @@ #if HAVE_STDIO_H #include #endif +#if HAVE_STRING_H +#include +#endif #if HAVE_UNISTD_H #include #endif