CONFIG_H_IS_FROM_SAMBA patch for SAMBA_3_0

Michael Adam ma at sernet.de
Tue Jan 2 12:40:20 GMT 2007


Hi, 

I stubled into a pitfall last week: I had run configure
in lib/replace in the SAMBA_3_0 source. Then "make" in
the samba top level dir gave strange errors because
lib/replace/replace.h included "config.h" from lib/replace
instead of the one from the top level.

Metze told me about the CONFIG_H_IS_FROM_SAMBA tick in SAMBA_4_0. 
Here is a patch that takes this to current SAMBA_3_0.

Cheers, Michael

-------------- next part --------------
Index: include/includes.h
===================================================================
--- include/includes.h	(revision 20469)
+++ include/includes.h	(working copy)
@@ -28,6 +28,14 @@
 
 #include "lib/replace/replace.h"
 
+/* make sure we have included the correct config.h */
+#ifndef NO_CONFIG_H /* for some tests */
+#ifndef CONFIG_H_IS_FROM_SAMBA
+#error "make sure you have removed all config.h files from standalone builds!"
+#error "the included config.h isn't from samba!"
+#endif
+#endif /* NO_CONFIG_H */
+
 /* only do the C++ reserved word check when we compile
    to include --with-developer since too many systems
    still have comflicts with their header files (e.g. IRIX 6.4) */
Index: configure.in
===================================================================
--- configure.in	(revision 20469)
+++ configure.in	(working copy)
@@ -4,6 +4,7 @@
 AC_PREREQ(2.53)
 AC_INIT(include/includes.h)
 AC_CONFIG_HEADER(include/config.h)
+AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
 
 SMB_VERSION_STRING=`cat $srcdir/include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
 echo "SAMBA VERSION: ${SMB_VERSION_STRING}"


More information about the samba-technical mailing list