From 0cbaeb117ae0e77d05c7709a4f5dbfad9daa799f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 17 Mar 2009 14:55:59 -0700 Subject: [PATCH] Allow spl_config.h to be included by dependant packages We need dependent packages to be able to include spl_config.h so they can leverage the configure checks the SPL has done. This is important because several of the spl headers need the results of these checks to work properly. Unfortunately, the autoheader build product is always private to a particular build and defined certain common things. (PACKAGE, VERSION, etc). This prevents other packages which also use autoheader from being include because the definitions conflict. To avoid this problem the SPL build system leverage AH_BOTTOM to include a spl_unconfig.h at the botton of the autoheader build product. This custom include undefs all known shared symbols to prevent the confict. This does however mean that those definition are also not availble to the SPL package either. The SPL package therefore uses the equivilant SPL_META_* definitions. --- Makefile.am | 3 +- Makefile.in | 3 +- config/spl-meta.m4 | 11 ------- configure | 62 ++++++++++++++++++------------------- configure.ac | 1 + include/asm/atomic_compat.h | 2 +- include/sys/types.h | 2 +- lib/list.c | 2 +- module/spl/spl-generic.c | 8 ++--- module/splat/splat-ctl.c | 4 +-- spl_config.h.in | 10 +----- spl_unconfig.h | 12 +++++++ 12 files changed, 57 insertions(+), 63 deletions(-) create mode 100644 spl_unconfig.h diff --git a/Makefile.am b/Makefile.am index 37182fe7f5..63d6ba7e40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = lib cmd module include scripts AUTOMAKE_OPTIONS = foreign dist-zip EXTRA_DIST = autogen.sh spl.spec.in META DISCLAIMER -noinst_HEADERS = spl_config.h +noinst_HEADERS = spl_config.h spl_unconfig.h distclean-local:: -$(RM) -R autom4te*.cache @@ -17,6 +17,7 @@ distclean-local:: install-data-local: $(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h + $(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h ctags: $(RM) $(top_srcdir)/tags diff --git a/Makefile.in b/Makefile.in index 6b212bb659..27825361ea 100644 --- a/Makefile.in +++ b/Makefile.in @@ -203,7 +203,7 @@ target_vendor = @target_vendor@ SUBDIRS = lib cmd module include scripts AUTOMAKE_OPTIONS = foreign dist-zip EXTRA_DIST = autogen.sh spl.spec.in META DISCLAIMER -noinst_HEADERS = spl_config.h +noinst_HEADERS = spl_config.h spl_unconfig.h all: spl_config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -661,6 +661,7 @@ distclean-local:: install-data-local: $(INSTALL) -D spl_config.h $(DESTDIR)/$(LINUX)/include/spl/spl_config.h + $(INSTALL) -D spl_unconfig.h $(DESTDIR)/$(LINUX)/include/spl/spl_unconfig.h ctags: $(RM) $(top_srcdir)/tags diff --git a/config/spl-meta.m4 b/config/spl-meta.m4 index 54c9ac38fc..84b41757d5 100644 --- a/config/spl-meta.m4 +++ b/config/spl-meta.m4 @@ -7,17 +7,6 @@ dnl # Chris Dunlap dnl # Brian Behlendorf dnl # AC_DEFUN([SPL_AC_META], [ - - AH_BOTTOM([ -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef STDC_HEADERS -#undef VERSION]) - AC_MSG_CHECKING([metadata]) META="$srcdir/META" diff --git a/configure b/configure index f3deee9c88..3c63443244 100755 --- a/configure +++ b/configure @@ -1510,10 +1510,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - echo "$as_me:$LINENO: checking metadata" >&5 echo $ECHO_N "checking metadata... $ECHO_C" >&6 @@ -2212,6 +2208,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers spl_config.h" + + echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. @@ -3988,7 +3986,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3991 "configure"' > conftest.$ac_ext + echo '#line 3989 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5587,7 +5585,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5590:" \ +echo "$as_me:5588:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6650,11 +6648,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6653: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6651: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6657: \$? = $ac_status" >&5 + echo "$as_me:6655: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6918,11 +6916,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6921: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6919: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6925: \$? = $ac_status" >&5 + echo "$as_me:6923: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7022,11 +7020,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7025: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7023: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7029: \$? = $ac_status" >&5 + echo "$as_me:7027: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8491,7 +8489,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8494 "configure"' > conftest.$ac_ext + echo '#line 8492 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9388,7 +9386,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11832: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11838: \$? = $ac_status" >&5 + echo "$as_me:11836: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11935,11 +11933,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11938: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11936: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11942: \$? = $ac_status" >&5 + echo "$as_me:11940: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12471,7 +12469,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12474 "configure"' > conftest.$ac_ext + echo '#line 12472 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13529,11 +13527,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13532: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13530: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13536: \$? = $ac_status" >&5 + echo "$as_me:13534: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13633,11 +13631,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13636: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13634: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13640: \$? = $ac_status" >&5 + echo "$as_me:13638: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15082,7 +15080,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15085 "configure"' > conftest.$ac_ext + echo '#line 15083 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15860,11 +15858,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15863: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15861: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15867: \$? = $ac_status" >&5 + echo "$as_me:15865: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16128,11 +16126,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16131: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16135: \$? = $ac_status" >&5 + echo "$as_me:16133: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16232,11 +16230,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16235: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16233: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16239: \$? = $ac_status" >&5 + echo "$as_me:16237: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17701,7 +17699,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17704 "configure"' > conftest.$ac_ext + echo '#line 17702 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? diff --git a/configure.ac b/configure.ac index bdec31c4bf..b6abe7a8c1 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,7 @@ AC_CONFIG_AUX_DIR([config]) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([$SPL_META_NAME], [$SPL_META_VERSION]) AC_CONFIG_HEADERS([spl_config.h]) +AH_BOTTOM([#include ]) AM_MAINTAINER_MODE AC_PROG_INSTALL diff --git a/include/asm/atomic_compat.h b/include/asm/atomic_compat.h index 9aa248b061..2f7376925a 100644 --- a/include/asm/atomic_compat.h +++ b/include/asm/atomic_compat.h @@ -2,7 +2,7 @@ #define _SPL_ATOMIC_COMPAT_H #include -#include "spl_config.h" +#include #ifndef HAVE_ATOMIC64_T #include diff --git a/include/sys/types.h b/include/sys/types.h index 699efe648b..5fd3a93767 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -7,7 +7,7 @@ extern "C" { #include #include -#include "spl_config.h" +#include #include #include diff --git a/lib/list.c b/lib/list.c index ee6b33a836..08b1f631ff 100644 --- a/lib/list.c +++ b/lib/list.c @@ -26,7 +26,7 @@ #ifdef HAVE_CONFIG_H -# include "spl_config.h" +# include #endif /* HAVE_CONFIG_H */ #ifdef WITH_PTHREADS diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index c23abf6ff7..76a8de472e 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -43,7 +43,7 @@ #define DEBUG_SUBSYSTEM S_GENERIC -char spl_version[16] = "SPL v" VERSION; +char spl_version[16] = "SPL v" SPL_META_VERSION; long spl_hostid = 0; EXPORT_SYMBOL(spl_hostid); @@ -340,7 +340,7 @@ static int __init spl_init(void) if ((rc = set_kallsyms_lookup_name())) GOTO(out7, rc = -EADDRNOTAVAIL); - printk("SPL: Loaded Solaris Porting Layer v%s\n", VERSION); + printk("SPL: Loaded Solaris Porting Layer v%s\n", SPL_META_VERSION); RETURN(rc); out7: kstat_fini(); @@ -358,7 +358,7 @@ out: debug_fini(); printk("SPL: Failed to Load Solaris Porting Layer v%s, " - "rc = %d\n", VERSION, rc); + "rc = %d\n", SPL_META_VERSION, rc); return rc; } @@ -366,7 +366,7 @@ static void spl_fini(void) { ENTRY; - printk("SPL: Unloaded Solaris Porting Layer v%s\n", VERSION); + printk("SPL: Unloaded Solaris Porting Layer v%s\n", SPL_META_VERSION); kstat_fini(); proc_fini(); vn_fini(); diff --git a/module/splat/splat-ctl.c b/module/splat/splat-ctl.c index d7aed023c9..2ff62ffb00 100644 --- a/module/splat/splat-ctl.c +++ b/module/splat/splat-ctl.c @@ -638,7 +638,7 @@ splat_init(void) NULL, SPLAT_NAME); printk(KERN_INFO "SPLAT: Loaded Solaris Porting LAyer " - "Tests v%s\n", VERSION); + "Tests v%s\n", SPL_META_VERSION); return 0; error: printk(KERN_ERR "SPLAT: Error registering splat device, %d\n", rc); @@ -671,7 +671,7 @@ splat_fini(void) ASSERT(list_empty(&splat_module_list)); printk(KERN_INFO "SPLAT: Unloaded Solaris Porting LAyer " - "Tests v%s\n", VERSION); + "Tests v%s\n", SPL_META_VERSION); } module_init(splat_init); diff --git a/spl_config.h.in b/spl_config.h.in index 4d11efb3c0..8cfcff5c69 100644 --- a/spl_config.h.in +++ b/spl_config.h.in @@ -186,12 +186,4 @@ /* Version number of package */ #undef VERSION - -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef STDC_HEADERS -#undef VERSION +#include diff --git a/spl_unconfig.h b/spl_unconfig.h new file mode 100644 index 0000000000..b50a0be0c1 --- /dev/null +++ b/spl_unconfig.h @@ -0,0 +1,12 @@ +/* + * Undefine these symbols to allow other autoheader enabled packages + * to leverage the SPL configure checks without a header conflict. + */ +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef VERSION +#undef STDC_HEADERS