head	1.16;
access;
symbols
	REL9_0_0:1.16
	REL9_1_ALPHA1:1.16
	REL9_0_RC1:1.16
	REL9_0_BETA4:1.16
	REL9_0_STABLE:1.16.0.18
	REL9_0_BETA3:1.16
	REL9_0_BETA2:1.16
	REL7_4_29:1.3
	REL8_0_25:1.3
	REL8_1_21:1.3
	REL8_2_17:1.16
	REL8_3_11:1.16
	REL8_4_4:1.16
	REL9_0_BETA1:1.16
	REL9_0_ALPHA5_BRANCH:1.16.0.16
	REL9_0_ALPHA5:1.16
	REL7_4_28:1.3
	REL8_0_24:1.3
	REL8_1_20:1.3
	REL8_2_16:1.16
	REL8_3_10:1.16
	REL8_4_3:1.16
	REL9_0_ALPHA4:1.16
	REL9_0_ALPHA4_BRANCH:1.16.0.14
	REL8_5_ALPHA3:1.16
	REL8_5_ALPHA3_BRANCH:1.16.0.12
	REL7_4_27:1.3
	REL8_0_23:1.3
	REL8_1_19:1.3
	REL8_2_15:1.16
	REL8_3_9:1.16
	REL8_4_2:1.16
	REL8_5_ALPHA2:1.16
	REL8_5_ALPHA2_BRANCH:1.16.0.10
	REL7_4_26:1.3
	REL8_0_22:1.3
	REL8_1_18:1.3
	REL8_2_14:1.16
	REL8_3_8:1.16
	REL8_4_1:1.16
	REL8_5_ALPHA1:1.16
	REL8_5_ALPHA1_BRANCH:1.16.0.8
	REL8_4_STABLE:1.16.0.6
	REL8_4_0:1.16
	REL8_4_RC2:1.16
	REL8_4_RC1:1.16
	REL8_4_BETA2:1.16
	REL8_4_BETA1:1.16
	REL7_4_25:1.3
	REL8_0_21:1.3
	REL8_1_17:1.3
	REL8_2_13:1.16
	REL8_3_7:1.16
	REL7_4_24:1.3
	REL8_0_20:1.3
	REL8_1_16:1.3
	REL8_2_12:1.16
	REL8_3_6:1.16
	REL7_4_23:1.3
	REL8_0_19:1.3
	REL8_1_15:1.3
	REL8_2_11:1.16
	REL8_3_5:1.16
	REL7_4_22:1.3
	REL8_0_18:1.3
	REL8_1_14:1.3
	REL8_2_10:1.16
	REL8_3_4:1.16
	REL7_4_21:1.3
	REL8_0_17:1.3
	REL8_1_13:1.3
	REL8_2_9:1.16
	REL8_3_3:1.16
	REL7_4_20:1.3
	REL8_0_16:1.3
	REL8_1_12:1.3
	REL8_2_8:1.16
	REL8_3_2:1.16
	REL8_2_7:1.16
	REL8_3_1:1.16
	REL8_3_STABLE:1.16.0.4
	REL8_3_0:1.16
	REL8_3_RC2:1.16
	REL7_3_21:1.3
	REL7_4_19:1.3
	REL8_0_15:1.3
	REL8_1_11:1.3
	REL8_2_6:1.16
	REL8_3_RC1:1.16
	REL8_3_BETA4:1.16
	REL8_3_BETA3:1.16
	REL8_3_BETA2:1.16
	REL8_3_BETA1:1.16
	REL7_3_20:1.3
	REL7_4_18:1.3
	REL8_0_14:1.3
	REL8_1_10:1.3
	REL8_2_5:1.16
	REL7_3_19:1.3
	REL7_4_17:1.3
	REL8_0_13:1.3
	REL8_1_9:1.3
	REL8_2_4:1.16
	REL8_0_12:1.3
	REL8_1_8:1.3
	REL8_2_3:1.16
	REL7_3_18:1.3
	REL7_4_16:1.3
	REL8_0_11:1.3
	REL8_1_7:1.3
	REL8_2_2:1.16
	REL8_0_10:1.3
	REL8_1_6:1.3
	REL8_2_1:1.16
	REL7_4_15:1.3
	REL7_3_17:1.3
	REL8_2_STABLE:1.16.0.2
	REL8_2_0:1.16
	REL8_2_RC1:1.16
	REL8_2_BETA3:1.16
	REL8_2_BETA2:1.16
	REL8_1_5:1.3
	REL8_0_9:1.3
	REL7_4_14:1.3
	REL7_3_16:1.3
	REL8_2_BETA1:1.16
	REL7_3_15:1.3
	REL7_4_13:1.3
	REL8_0_8:1.3
	REL8_1_4:1.3
	REL7_3_14:1.3
	REL7_4_12:1.3
	REL8_0_7:1.3
	REL8_1_3:1.3
	REL7_3_13:1.3
	REL7_4_11:1.3
	REL8_0_6:1.3
	REL8_1_2:1.3
	REL7_3_12:1.3
	REL7_4_10:1.3
	REL8_0_5:1.3
	REL8_1_1:1.3
	REL8_1_STABLE:1.3.0.14
	REL8_1_0:1.3
	REL8_1_0RC1:1.3
	REL8_1_0BETA4:1.3
	REL8_1_0BETA3:1.3
	REL7_3_11:1.3
	REL7_4_9:1.3
	REL8_0_4:1.3
	REL8_1_0BETA2:1.3
	REL8_1_0BETA1:1.3
	REL7_2_8:1.3
	REL7_3_10:1.3
	REL7_4_8:1.3
	REL8_0_3:1.3
	REL8_0_2:1.3
	REL7_2_7:1.3
	REL7_3_9:1.3
	REL7_4_7:1.3
	REL8_0_1:1.3
	REL8_0_STABLE:1.3.0.12
	REL8_0_0:1.3.0.10
	REL8_0_0RC5:1.3
	REL8_0_0RC4:1.3
	REL8_0_0RC3:1.3
	REL8_0_0RC2:1.3
	REL8_0_0RC1:1.3
	REL8_0_0BETA5:1.3
	REL8_0_0BETA4:1.3
	REL7_4_6:1.3
	REL7_3_8:1.3
	REL7_2_6:1.3
	REL8_0_0BETA3:1.3
	REL8_0_0BETA2:1.3
	REL7_2_5:1.3
	REL7_4_5:1.3
	REL7_3_7:1.3
	REL7_4_4:1.3
	REL8_0_0BETA1:1.3
	REL7_4_3:1.3
	REL7_4_2:1.3
	REL7_3_6:1.3
	REL7_4_1:1.3
	REL7_3_5:1.3
	REL7_4:1.3
	REL7_4_RC2:1.3
	REL7_4_STABLE:1.3.0.8
	REL7_4_RC1:1.3
	REL7_4_BETA5:1.3
	REL7_4_BETA4:1.3
	REL7_4_BETA3:1.3
	REL7_4_BETA2:1.3
	WIN32_DEV:1.3.0.6
	REL7_4_BETA1:1.3
	REL7_3_4:1.3
	REL7_3_2:1.3
	REL7_2_4:1.3
	REL7_3_STABLE:1.3.0.4
	REL7_2_3:1.3
	REL7_2_STABLE:1.3.0.2
	REL7_2:1.3
	REL7_2_RC2:1.3
	REL7_2_RC1:1.3
	REL7_2_BETA5:1.3
	REL7_2_BETA4:1.3
	REL7_2_BETA3:1.3
	REL7_2_BETA2:1.3
	REL7_2_BETA1:1.3
	REL7_1_2:1.2
	REL7_1_STABLE:1.2.0.2
	REL7_1_BETA:1.2
	REL7_1_BETA3:1.2
	REL7_1_BETA2:1.2
	REL7_1:1.2;
locks; strict;
comment	@# @;


1.16
date	2006.07.14.01.05.14;	author momjian;	state Exp;
branches;
next	1.15;

1.15
date	2006.07.13.18.25.09;	author momjian;	state Exp;
branches;
next	1.14;

1.14
date	2006.07.13.16.39.20;	author momjian;	state Exp;
branches;
next	1.13;

1.13
date	2006.07.12.16.28.27;	author momjian;	state Exp;
branches;
next	1.12;

1.12
date	2006.07.11.20.51.25;	author momjian;	state Exp;
branches;
next	1.11;

1.11
date	2006.07.11.20.12.29;	author momjian;	state Exp;
branches;
next	1.10;

1.10
date	2006.07.11.19.45.16;	author momjian;	state Exp;
branches;
next	1.9;

1.9
date	2006.07.11.19.34.34;	author momjian;	state Exp;
branches;
next	1.8;

1.8
date	2006.07.11.19.31.29;	author momjian;	state Exp;
branches;
next	1.7;

1.7
date	2006.07.11.19.30.05;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	2006.07.11.19.25.41;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	2006.07.10.16.45.44;	author momjian;	state Exp;
branches;
next	1.4;

1.4
date	2006.03.11.04.38.42;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	2001.08.24.14.07.50;	author petere;	state Exp;
branches;
next	1.2;

1.2
date	2000.06.15.03.33.12;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	2000.06.14.22.28.16;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Move CFLAGS for pginclude to the end of the command line.
@
text
@:
# remove extra #include's

# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.15 2006/07/13 18:25:09 momjian Exp $

trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
find . \( -name CVS -a -prune \) -o -type f -name '*.[ch]' -print | 
grep -v '\./postgres.h' |
grep -v '\./pg_config.h' |
grep -v '\./c.h' |
while read FILE
do
	if [ `expr $FILE : '.*\.h$'` -ne 0 ]
	then	IS_INCLUDE="Y"
	else	IS_INCLUDE="N"
	fi
	
	# loop through all includes
	cat "$FILE" | grep "^#include" |
	sed 's/^#include[ 	]*[<"]\([^>"]*\).*$/\1/g' |
	while read INCLUDE
	do
		if [ "$1" = "-v" ]
		then	echo "checking $FILE $INCLUDE"
		fi

		[ -s /usr/include/$INCLUDE ] && continue
		[ "$INCLUDE" = postgres.h ] && continue
		[ "$INCLUDE" = postgres_fe.h ] && continue
		[ "$INCLUDE" = config.h ] && continue
		[ "$INCLUDE" = c.h ] && continue

		# preserve configure-specific includes
		# these includes are surrounded by #ifdef's
		grep -B1 '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
		     egrep -q '^#if|^#else' && continue
		grep -A1 '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
		     egrep -q '^#else|^#endif' && continue

		# remove defines from include files
		if [ "$IS_INCLUDE" = "Y" ]
		then	cat "$FILE" | grep -v "^#if" | grep -v "^#else" | 
			grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
		else	cat "$FILE" >/tmp/$$a
		fi

		# set up initial file contents
		grep -v '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' \
			/tmp/$$a >/tmp/$$b

		if [ "$IS_INCLUDE" = "Y" ]
		then	echo "#include \"postgres.h\"" >/tmp/$$.c
		else	>/tmp/$$.c
		fi

		echo "#include \"/tmp/$$b\"" >>/tmp/$$.c
		echo "void include_test(void);" >>/tmp/$$.c
		echo "void include_test() {" >>/tmp/$$.c
		if [ "$IS_INCLUDE" = "Y" ]
		then	pgdefine "$FILE" >>/tmp/$$.c
		fi
		echo "}" >>/tmp/$$.c

		cc -fsyntax-only -Werror -Wall -Wmissing-prototypes \
			-Wmissing-declarations -I/pg/include -I/pg/backend \
			-I/pg/interfaces/libpq -I`dirname $FILE` $CFLAGS -c /tmp/$$.c \
			-o /tmp/$$.o >/tmp/$$ 2>&1
		if [ "$?" -eq 0 ]
		then	echo "$FILE $INCLUDE"
			if [ "$1" = "-v" ]
			then	cat /tmp/$$
				cat /tmp/$$b
				cat /tmp/$$.c
			fi
			grep -v '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' \
				"$FILE" >/tmp/$$b
			mv /tmp/$$b "$FILE"
		fi
	done
done
@


1.15
log
@Skip stripping postgres_fe.h include file.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.14 2006/07/13 16:39:20 momjian Exp $
d64 1
a64 1
		cc $CFLAGS -fsyntax-only -Werror -Wall -Wmissing-prototypes \
d66 1
a66 1
			-I/pg/interfaces/libpq -I`dirname $FILE` -c /tmp/$$.c \
@


1.14
log
@Improve pginclude tools to process include file usage by other include files.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.13 2006/07/12 16:28:27 momjian Exp $
d29 1
@


1.13
log
@Fix pgrminclude to work for stripping include files.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.12 2006/07/11 20:51:25 momjian Exp $
d74 2
@


1.12
log
@Improve pginclude tests.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.11 2006/07/11 20:12:29 momjian Exp $
a17 7
	# remove defines
	if [ "$IS_INCLUDE" = "Y" ]
	then	cat "$FILE" | grep -v "^#if" | grep -v "^#else" | 
		grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
	else	cat "$FILE" >/tmp/$$a
	fi

d19 1
a19 1
	cat /tmp/$$a | grep "^#include" |
d23 4
d39 7
d47 3
a49 2
		cat /tmp/$$a |
		grep -v '^#include[ 	]*[<"]'"$INCLUDE"'[>"]' >/tmp/$$b
a73 1
			grep -v '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" >/tmp/$$b
a74 2
		elif [ "$1" = "-v" ]
		then	echo "$FILE"
a75 1

@


1.11
log
@Improve pginclude compile flags.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.10 2006/07/11 19:45:16 momjian Exp $
d38 1
a38 1
		     egrep -q '^#if|^#else' && continue		
d40 1
a40 1
		     egrep -q '^#else|^#endif' && continue		
d64 5
d71 2
d74 1
a74 4
		if [ "$1" = "-v" ]
		then	cat /tmp/$$
			cat /tmp/$$.c
		fi
@


1.10
log
@Have pgrminclude process include files too.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.9 2006/07/11 19:34:34 momjian Exp $
d60 2
a61 1
			-c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
@


1.9
log
@Add $CFLAGS support to pgrminclude.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.8 2006/07/11 19:31:29 momjian Exp $
d63 2
a64 4
			if [ "$IS_INCLUDE" = "N" ]
			then	grep -v '^#include[ 	][ 	]*[<"]'"$INCLUDE"'[>"]' "$FILE" >/tmp/$$b
				mv /tmp/$$b "$FILE"
			fi
@


1.8
log
@Move pgrminclude debug code to be more effective.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.7 2006/07/11 19:30:05 momjian Exp $
d58 1
a58 1
		cc -fsyntax-only -Werror -Wall -Wmissing-prototypes \
@


1.7
log
@Improve shell script wrapping.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.6 2006/07/11 19:25:41 momjian Exp $
d67 4
a70 4
			if [ "$1" = "-v" ]
			then	cat /tmp/$$
				cat /tmp/$$.c
			fi
@


1.6
log
@Add comments to pgrminclude.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.5 2006/07/10 16:45:44 momjian Exp $
d58 3
a60 1
		cc -fsyntax-only -Werror -Wall -Wmissing-prototypes -Wmissing-declarations -I/pg/include -I/pg/backend -c /tmp/$$.c -o /tmp/$$.o >/tmp/$$ 2>&1
@


1.5
log
@Improve tool coding.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.4 2006/03/11 04:38:42 momjian Exp $
d42 1
d49 1
d57 1
@


1.4
log
@Add CVS tag lines to files that were lacking them.
@
text
@d4 1
a4 1
# $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.314 2006/03/07 02:54:23 momjian Exp $
d7 1
a7 1
find . \( -name CVS -a -prune \) -o -type f -print | 
d13 1
a13 1
	if [ "`echo $FILE | sed -n 's/^.*\.\([^\.]*\)$/\1/p'`" = "h" ]
@


1.3
log
@Rename config.h to pg_config.h and os.h to pg_config_os.h, fix a number of
places that were including the wrong files.
@
text
@d4 2
@


1.2
log
@Clean up #include's.
@
text
@d7 1
a7 1
grep -v '\./config.h' |
@


1.1
log
@Update include scripts
@
text
@d15 2
a16 1

d22 2
d32 1
d34 1
d39 1
a58 6
				# reload after #include removal
				if [ "$IS_INCLUDE" = "Y" ]
				then	cat "$FILE" | grep -v "^#if" | grep -v "^#else" |
					grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
				else	cat "$FILE" >/tmp/$$a
				fi
@
