Re: [pcre-dev] [PATCH] Generating config.h.generic

Top Page
Delete this message
Author: Daniel Richard G
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] [PATCH] Generating config.h.generic
I found after sending in my patch that it breaks "make distcheck". A
corrected patch is attached.


--Daniel


On Mon, 23 Jul 2012, Daniel Richard G. wrote:

> This is a small patch that I've been sitting on for some time. It moves
> the generation of config.h.generic from the PrepareRelease script to
> Makefile.am, for consistency with the existing pcre.h.generic rule.
> Also, it adds a missing backslash to PrepareRelease.


--
Daniel Richard G. || danielg@??? || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/Index: PrepareRelease
===================================================================
--- PrepareRelease    (revision 996)
+++ PrepareRelease    (working copy)
@@ -196,7 +196,7 @@
   pcreposix.c \
   pcreposix.h \
   pcre.h.in \
-  pcre_internal.h
+  pcre_internal.h \
   pcre_byte_order.c \
   pcre_compile.c \
   pcre_config.c \
@@ -244,34 +244,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 996)
+++ Makefile.am    (working copy)
@@ -123,11 +123,15 @@
   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 -f $@
+    perl -pe 'if(/^#define\s(?!PACKAGE)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$_="";}' config.h >$@
+
+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.