From: Adam Dickmeiss Date: Wed, 25 May 2011 13:11:08 +0000 (+0200) Subject: Add script to add config.h (AC_CONFIG_HEADERS) X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=3bea7dd3830f18336c244bc1871b9b735aa31d89;p=git-tools-moved-to-github.git Add script to add config.h (AC_CONFIG_HEADERS) --- diff --git a/fixup-headers/add-config-h.sh b/fixup-headers/add-config-h.sh new file mode 100755 index 0000000..b672b59 --- /dev/null +++ b/fixup-headers/add-config-h.sh @@ -0,0 +1,8 @@ +#!/bin/sh +H=`dirname $0`/add-file-config.tcl +for f in `find . \( -name '*.c' -or -name '*.cpp' \) -print`; do + echo $f + $H < $f >${f}_new + mv -f ${f}_new $f +done + diff --git a/fixup-headers/add-file-config.tcl b/fixup-headers/add-file-config.tcl new file mode 100755 index 0000000..2ad96c6 --- /dev/null +++ b/fixup-headers/add-file-config.tcl @@ -0,0 +1,16 @@ +#!/usr/bin/tclsh +set have_config 0 +while {[gets stdin line] >= 0} { + set must_make_config 0 + if {[string match "\#if HAVE_CONFIG_H*" $line]} { + set have_config 1 + } elseif {[string match "\#*" $line]} { + if {!$have_config} { + puts "\#if HAVE_CONFIG_H" + puts "\#include " + puts "\#endif" + } + set have_config 1 + } + puts $line +}