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.
This commit is contained in:
Brian Behlendorf 2009-03-17 14:55:59 -07:00
parent e11d6c5f50
commit 0cbaeb117a
12 changed files with 57 additions and 63 deletions

View File

@ -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

View File

@ -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

View File

@ -7,17 +7,6 @@ dnl # Chris Dunlap <cdunlap@llnl.gov>
dnl # Brian Behlendorf <behlendorf1@llnl.gov>
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"

62
configure vendored
View File

@ -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 </dev/null >&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 <<EOF
#line 9391 "configure"
#line 9389 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -9488,7 +9486,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 9491 "configure"
#line 9489 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11831,11 +11829,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:11834: $lt_compile\"" >&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=$?

View File

@ -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 <spl_unconfig.h>])
AM_MAINTAINER_MODE
AC_PROG_INSTALL

View File

@ -2,7 +2,7 @@
#define _SPL_ATOMIC_COMPAT_H
#include <asm/atomic.h>
#include "spl_config.h"
#include <spl_config.h>
#ifndef HAVE_ATOMIC64_T
#include <linux/spinlock.h>

View File

@ -7,7 +7,7 @@ extern "C" {
#include <linux/types.h>
#include <sys/sysmacros.h>
#include "spl_config.h"
#include <spl_config.h>
#include <linux/uaccess_compat.h>
#include <linux/file_compat.h>

View File

@ -26,7 +26,7 @@
#ifdef HAVE_CONFIG_H
# include "spl_config.h"
# include <spl_config.h>
#endif /* HAVE_CONFIG_H */
#ifdef WITH_PTHREADS

View File

@ -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();

View File

@ -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);

View File

@ -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 <spl_unconfig.h>

12
spl_unconfig.h Normal file
View File

@ -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