]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: glob.h requires GCC to compile on Linux.
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:51:49 +0000 (05:51 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 18 Apr 2011 11:51:49 +0000 (05:51 -0600)
compat/os/linux.h

index 21f6663b4b762df5de2463055ed07a1a73dbe920..b5e93283c0b825bba740bf08a32164c19dbbcab7 100644 (file)
@@ -44,6 +44,29 @@ typedef uint32_t __u32;
 #include <sys/capability.h>
 #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 */