]> mj.ucw.cz Git - libucw.git/commitdiff
LibUCW: Entrust generation of ucw/autoconf.h to the configure machinery.
authorMartin Mares <mj@ucw.cz>
Thu, 30 Oct 2008 21:33:38 +0000 (22:33 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 30 Oct 2008 21:33:38 +0000 (22:33 +0100)
This is much nicer than the sed script invoked from ucw/Makefile.

ucw/Makefile
ucw/filter-autoconf.sed [deleted file]
ucw/perl/UCW/Configure/LibUCW.pm

index 0af1d71d0aa64a07a192d7bbb2b4866f96a07d31..e536663f00b42b8be4f61da7004a11e988385e7e 100644 (file)
@@ -137,12 +137,9 @@ $(o)/ucw/.include-stamp: $(addprefix $(s)/ucw/,$(LIBUCW_INCLUDES)) $(o)/ucw/auto
 run/lib/pkgconfig/libucw.pc: $(o)/ucw/libucw.pc
 
 # The version of autoconf.h that is a part of the public API needs to have
-# the internal symbols filtered out.
-$(o)/ucw/autoconf.h: $(o)/autoconf.h
-       $(M)"FILTER $< -> $@"
-       $(Q)sed -f $(s)/ucw/filter-autoconf.sed <$< >$@
-
-# Also, public config.h needs to refer to <ucw/autoconf.h> instead of "autoconf.h"
+# the internal symbols filtered out, so we generate ucw/autoconf.h in the
+# configure script and let the public config.h refer to <ucw/autoconf.h>
+# instead of plain "autoconf.h".
 $(o)/ucw/config.h: $(s)/ucw/config.h
        $(M)"FILTER $< -> $@"
        $(Q)sed -e 's/^#include "autoconf\.h"/#include <ucw\/autoconf.h>/' <$< >$@
diff --git a/ucw/filter-autoconf.sed b/ucw/filter-autoconf.sed
deleted file mode 100644 (file)
index f6b598e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# A sed script to weed out private symbols from <ucw/autoconf.h>
-
-/^\//n
-
-# Excluded symbols (danger of collision)
-/^#define CONFIG_DEBUG$/d
-
-# Included symbols
-/^#define CONFIG_/n
-/^#define CPU_/n
-
-d
index 3d17ac7a08d36ac1018680b497086a7b58a8ea4e..fe3350e4f2618f386d7c0ee9b9547858afd985f7 100644 (file)
@@ -43,5 +43,20 @@ if (Get("CPU_ARCH") eq "default" || Get("CPU_ARCH") =~ /^i[345]86$/) {
        Set("CONFIG_UCW_RADIX_SORTER_BITS" => 12);
 }
 
+PostConfig {
+       AtWrite {
+               UCW::Configure::C::ConfigHeader("ucw/autoconf.h", [
+                       # Excluded symbols (danger of collision)
+                       '^CONFIG_DEBUG$' => 0,
+
+                       # Included symbols
+                       '^CONFIG_' => 1,
+                       '^CPU_' => 1,
+                       '^SHERLOCK_VERSION_' => 1,
+
+               ]);
+       } if Get("CONFIG_INSTALL_API");
+};
+
 # We succeeded
 1;