summaryrefslogtreecommitdiff
path: root/genif.sh
blob: b074f84ed804562ee7756bacc5e97c06cfd6197a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh

# $Id: genif.sh,v 1.4 1999-05-08 22:00:02 sas Exp $
# replacement for genif.pl

infile="$1"
shift
srcdir="$1"
shift

if test "$infile" = "" -o "$srcdir" = ""; then
	echo "please supply infile and srcdir"
	exit 1
fi

module_ptrs=""
includes=""

for ext in ${1+"$@"} ; do
	module_ptrs="	phpext_${ext}_ptr,\\\n$module_ptrs"
	for pre in php3 php php4 zend; do
		hdrfile="ext/$ext/${pre}_${ext}.h"
		if test -f $hdrfile ; then
			includes="#include \"$hdrfile\"\\\n$includes"
		fi
	done
done

cat $infile | \
	sed \
	-e "s'@EXT_INCLUDE_CODE@'$includes'" \
	-e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
	-e 's/\\n/\
/g'