From: Amos Jeffries Date: Thu, 7 Apr 2011 13:41:25 +0000 (+1200) Subject: Portability: glob.h requires GCC to compile on Linux. X-Git-Tag: take06~27^2~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92ca76f7f1a678462960655e370562d2e748292c;p=thirdparty%2Fsquid.git Portability: glob.h requires GCC to compile on Linux. --- diff --git a/compat/os/linux.h b/compat/os/linux.h index 34ff1a404c..d4ea1fb87d 100644 --- a/compat/os/linux.h +++ b/compat/os/linux.h @@ -40,6 +40,29 @@ typedef uint32_t __u32; #include #endif /* HAVE_SYS_CAPABILITY_H */ +/* + * glob.h is provided by GNU on Linux and contains some unavoidable preprocessor + * logic errors in its 64-bit definitions which are hit by non-GCC compilers. + * + * #if __USE_FILE_OFFSET64 && __GNUC__ < 2 + * # define glob glob64 + * #endif + * #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 + * extern "C" glob(...); + * #endif + * extern "C" glob64(...); + * + * ... and multiple "C" definitions of glob64 refuse to compile. + * Because __GNUC__ being undefined equates to 0 and (0 < 2) + */ +#if __USE_FILE_OFFSET64 && __GNUC__ < 2 +#if HAVE_GLOB_H +#undef HAVE_GLOB_H +#endif +#if HAVE_GLOB +#undef HAVE_GLOB +#endif +#endif #endif /* _SQUID_LINUX_ */ #endif /* SQUID_OS_LINUX_H */