summaryrefslogtreecommitdiff
path: root/headers-sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'headers-sh.in')
-rwxr-xr-xheaders-sh.in35
1 files changed, 31 insertions, 4 deletions
diff --git a/headers-sh.in b/headers-sh.in
index 930f420a8ded6..906c018d83e6b 100755
--- a/headers-sh.in
+++ b/headers-sh.in
@@ -1,7 +1,7 @@
#! /bin/sh
-# $Id: headers-sh.in,v 1.5 2007/07/05 00:20:18 tom Exp $
+# $Id: headers-sh.in,v 1.9 2011/01/06 09:38:25 tom Exp $
##############################################################################
-# Copyright (c) 2004,2007 Thomas E. Dickey #
+# Copyright (c) 2004-2007,2011 Thomas E. Dickey #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -43,6 +43,7 @@
PACKAGE=@PACKAGE@
PKGNAME=@PACKAGE_PREFIX@
CONFIGH=@PACKAGE_CONFIG@
+SUB_INC=@SUB_INC@
TMPSED=headers.sed
@@ -54,6 +55,8 @@ alnum=_${DIGIT}${alpha}
ALNUM=_${DIGIT}${ALPHA}
MIXED=_${DIGIT}${ALPHA}${alpha}
+pkgname=`echo "$PKGNAME" | tr "$ALPHA" "$alpha"`
+
if test $# = 2 ; then
rm -f $TMPSED
DST=$1
@@ -71,7 +74,7 @@ if test $# = 2 ; then
done
;;
*)
- echo "" >> $TMPSED
+ touch $TMPSED
;;
esac
@@ -109,7 +112,8 @@ EOF
# pick up autoconf-defined symbols in the config.h file
for name in `
egrep '^#define[ ][ ]*['$ALNUM']' $REF/$CONFIGH \
- | sed -e 's/^#define[ ][ ]*//' \
+ | sed \
+ -e 's/^#define[ ][ ]*//' \
-e 's/[ ].*//' \
| egrep -v "^${PACKAGE}_" \
| sort -u \
@@ -118,6 +122,11 @@ EOF
echo "s/\\<$name\\>/${PKGNAME}_$name/g" >>$TMPSED
done
+ if test "$SUB_INC" = yes
+ then
+ echo "s,#include <${pkgname}_,#include <${PACKAGE}/${pkgname}_," >>$TMPSED
+ fi
+
# reduce the count if possible, since some old sed's limit is 100 lines
sort -u $TMPSED >headers.tmp
mv headers.tmp $TMPSED
@@ -145,6 +154,24 @@ else
# Just in case someone gzip'd manpages, remove the conflicting copy.
test -f $DST/$NAME.gz && rm -f $DST/$NAME.gz
+ if test "$SUB_INC" = yes
+ then
+ case $NAME in #(vi
+ ${pkgname}_*) #(vi
+ case "$PRG" in #(vi
+ *install*)
+ test -d $DST/$PACKAGE || mkdir -p $DST/$PACKAGE
+ ;;
+ esac
+ NAME=$PACKAGE/$NAME
+ ;;
+ *)
+ NAME=$PACKAGE.h
+ ;;
+ esac
+ fi
+
eval $PRG $TMPSRC $DST/$NAME
rm -f $TMPSRC
fi
+# vile:ts=4 sw=4