changeset 14113:a852b7d09546

derive an installable config.h for libposix
author Bruce Korb <bkorb@gnu.org>
date Wed, 17 Nov 2010 15:03:14 -0800
parents aa63a2324d15
children 3b33c82c8c95 ca7dbca5f7c7
files .gitignore ChangeLog libposix/lib/Makefile.am libposix/lib/mk-lpx-config-h.sh libposix/mk-tarball
diffstat 5 files changed, 78 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
 amsnippet.tmp
 testdir*
 *.diff
+*.patch
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-17  Bruce Korb  <bkorb@gnu.org>
+
+	* libposix/lib/Makefile.am (lpx-config.h): generate the new header
+	and install it.
+	* libposix/lib/mk-lpx-config-h.sh: script for creating the header
+	by massaging the config.h header.
+
 2010-11-17  Bruce Korb  <bkorb@gnu.org>
 
 	* libposix/mk-tarball: script to make a libposix distribution
--- a/libposix/lib/Makefile.am
+++ b/libposix/lib/Makefile.am
@@ -1,18 +1,22 @@
-BUILT_SOURCES =
+BUILT_SOURCES = lpx-config.h
 SUFFIXES =
 
-EXTRA_DIST =
+EXTRA_DIST = mk-lpx-config-h.sh
 EXTRA_HEADERS =
-nodist_pkginclude_HEADERS =
+nodist_pkginclude_HEADERS = lpx-config.h
 nobase_nodist_pkginclude_HEADERS =
 pkginclude_HEADERS = version.h
 
 CLEANFILES =
 MOSTLYCLEANDIRS =
-MOSTLYCLEANFILES =
+MOSTLYCLEANFILES = lpx-config.h
 MAINTAINERCLEANFILES =
 
 include gnulib.mk
 
 libposix_la_LDFLAGS += -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE)
 libposix_la_SOURCES += version.c
+
+version.o : lpx-config.h
+lpx-config.h : $(top_builddir)/config.h
+	$(SHELL) $(srcdir)/mk-lpx-config-h.sh $(top_builddir)/config.h $@
new file mode 100755
--- /dev/null
+++ b/libposix/lib/mk-lpx-config-h.sh
@@ -0,0 +1,54 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+infile=$1
+outfile=$2
+
+{
+    echo '/*'
+    sed '1,/^$/d;s/^#/ */;/http:\/\/www\.gnu\.org/q' $0
+
+    g='_LPX_CONFIG_H_GUARD'
+    cat <<EOF
+ */
+#ifndef $g
+#define $g 1
+/* derived from the libposix config.h by $0 */
+EOF
+
+    # 1. strip comments for eyeball verification of name changes
+    # 2. Change the #define names
+    # 3. Change the #ifdef names
+    # 4. Change the "defined XXX" names in "#if" directives
+    # 5. Clean up whatever we figure out we've missed.
+    #
+    sedcmd='
+	/^\/\*.*\*\/$/d
+	/^\/\*/,/\*\/$/d
+	/^$/d
+	s/^\(# *define *\)\([A-Za-z]\)/\1LPX_\2/
+	/^#if/s/\(defined *\)\([A-Za-z]\)/\1LPX_\2/g
+	s/^\(# *ifn*def *\)\([A-Za-z]\)/\1LPX_\2/
+	s/>DIR_FD_MEMBER_NAME/>LPX_DIR_FD_MEMBER_NAME/
+	s/_GL_UNUSED/_LPX_UNUSED/
+	'
+
+    sed "${sedcmd}" $infile
+
+    echo "#endif /* $g */"
+} > $outfile
--- a/libposix/mk-tarball
+++ b/libposix/mk-tarball
@@ -47,8 +47,10 @@
     git --version >/dev/null 2>&1 \
         || func_die "git is not operational"
 
+    test -d _b && rm -rf _b
+
     case "$*" in
-    *'--clean'* )
+    *'--clean'* | *'--clob'* )
         git clean -f -x -d .
         ;;
     esac
@@ -101,12 +103,12 @@
 
 func_mkdistro()
 {
-    mkdir _b || die mkdir _b
+    mkdir _b               || func_die mkdir _b
     cd _b
-    ../configure || die configure
-    make || die make
-    make distcheck || die make distcheck
-    mv libposix*.tar.gz .. || die cannot move tarball
+    ../configure           || func_die configure
+    make                   || func_die make
+    make distcheck         || func_die make distcheck
+    mv libposix*.tar.gz .. || func_die cannot move tarball
 }
 
 func_init ${1+"$@"}