Hi Philip,

On Tue, 23 Oct 2012, Philip Hazel wrote:

This is why I was pushing to move the generation of config.h.generic into the top-level makefile, and out of the PrepareRelease script. See this thread:

The problem I have with this is that there is a circularity.

. You can't run "make anything" until you have run configure.

. You need to run configure with default options before creating
 config.h.generic ... because that's what it is. It is the default
 config.h. It is provided for people who build PCRE "by hand" without
 using configure or CMake.

. Therefore, logically, "make config.h.generic" should first of all run
 "./configure", but of course you can't re-run configure from within a
 makefile created by configure because it re-creates that very
 makefile. (And it would also mess up your existing configuration.)

If "make config.h.generic" just does stuff without running configure,
the resulting config.h.generic will contain whatever the current
configuration is, which may not be the default.

Currently config.h.generic is created, essentially by hand, in the
script PrepareRelease. A basic configure is done and then the generic
files config.h.generic and pcre.h.generic are created. When I run this
script, I know I am going to destroy my existing configuration (and the
script outputs comments to say so, as well).

I've prepared a new patch that should address these concerns. My proposed rule for config.h.generic is now as follows:

config.h.generic: configure.ac
        rm -rf $@ _generic
        mkdir _generic
        cd _generic && $(abs_top_srcdir)/configure
        perl -pe '<insert Perl one-liner here>' _generic/config.h >$@
        rm -rf _generic

So regardless of how the build tree is currently configured, this re-runs the configure script with default settings, but in a temporary subdirectory so that the existing configuration remains untouched.


--Daniel


--
Daniel Richard G. || [email protected] || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/
Index: PrepareRelease
===================================================================
--- PrepareRelease	(revision 1168)
+++ PrepareRelease	(working copy)
@@ -248,34 +248,6 @@
 echo Detrailing
 perl ./Detrail $files doc/p* doc/html/*
 
-echo Doing basic configure to get default pcre.h and config.h
-# This is in case the caller has set aliases (as I do - PH)
-unset cp ls mv rm
-./configure >/dev/null
-
-echo Converting pcre.h and config.h to generic forms
-cp -f pcre.h pcre.h.generic
-
-perl <<'END'
-  open(IN, "<config.h") || die "Can't open config.h: $!\n";
-  open(OUT, ">config.h.generic") || die "Can't open config.h.generic: $!\n";
-  while (<IN>)
-    {
-    if (/^#define\s(?!PACKAGE)(\w+)/)
-      {
-      print OUT "#ifndef $1\n";
-      print OUT;
-      print OUT "#endif\n";
-      }
-    else
-      {
-      print OUT;
-      }
-    }
-  close IN;
-  close OUT;
-END
-
 echo Done
 
 #End
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 1168)
+++ Makefile.am	(working copy)
@@ -132,11 +132,18 @@
   pcre.h.generic \
   config.h.generic
 
-pcre.h.generic: configure.ac
+pcre.h.generic: pcre.h.in configure.ac
 	rm -f $@
 	cp -p pcre.h $@
 
-MAINTAINERCLEANFILES += pcre.h.generic
+config.h.generic: configure.ac
+	rm -rf $@ _generic
+	mkdir _generic
+	cd _generic && $(abs_top_srcdir)/configure
+	perl -pe 'if(/^#define\s(?!PACKAGE)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$_="";}' _generic/config.h >$@
+	rm -rf _generic
+
+MAINTAINERCLEANFILES += pcre.h.generic config.h.generic
 
 # These are the header files we'll install. We do not distribute pcre.h because
 # it is generated from pcre.h.in.
-- 
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to