This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
configure.in
188 lines (162 loc) · 5.05 KB
/
configure.in
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# +----------------------------------------------------------------------+
# | PHP Version 4.0 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1999-2006 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.0.1 of the PHP license, |
# | that is bundled with this package in the file LICENSE and is |
# | available online at http://www.php.net/license/3_0_1.txt. |
# | If you did not receive a copy of the PHP license and are unable to |
# | obtain it through the world wide web, please send a note to |
# | license@php.net so we can mail you a copy immediately |
# +----------------------------------------------------------------------+
# | Authors: James Moore <jmoore@php.net>, Steph Fox <sfox@php.net> |
# +----------------------------------------------------------------------+
#
# $Id$
AC_INIT([manual/global.ent])
make_command=""
for a in "$MAKE" make gmake gnumake; do
[ test -z "$a" ] && continue
if (sh -c "$a --version" 2>/dev/null | grep GNU >/dev/null); then
make_command=$a;
break;
fi
done
if [ test -z $make_command ]; then
AC_MSG_ERROR(GNU make is required)
fi
AC_PATH_PROG(XSLTPROC, xsltproc, no)
if [ test "$XSLTPROC" = "no" ]; then
AC_MSG_ERROR(cannot find xsltproc)
fi
# need to offer a way to set a PHP path
AC_ARG_WITH(php,
[ --with-php=PATH path to PHP binary],
[
if ! (sh -c "$withval -v" 2>/dev/null | grep PHP >/dev/null); then
AC_MSG_ERROR($withval is not a PHP executable)
fi
PHP=$withval
],
[PHP="no"]
)
AC_PATH_PROG(PHP, php, $PHP)
if [ test "$PHP" = "no" ]; then
AC_MSG_ERROR(Unable to locate a PHP executable. Please use --with-php=PATH)
fi
DOCBOOK_DOCTYPE="-//PHP Group//DTD DocBk XML V3.1.7-Based Extension//EN"
AC_SUBST(DOCBOOK_DOCTYPE)
SCRIPT_DIR="./scripts"
AC_SUBST(SCRIPT_DIR)
STYLESHEET_DIR="./stylesheets/html"
AC_SUBST(STYLESHEET_DIR)
MANUAL="manual"
AC_SUBST(MANUAL)
PHP_GTK2_DOC_BUILD_DATE=`date`
AC_SUBST(PHP_GTK2_DOC_BUILD_DATE)
TS=`date -u +%Y%m%d`
AC_SUBST(TS)
AC_MSG_CHECKING(for language)
AC_ARG_WITH(lang,
[ --with-lang=LANG choose a language to work with],
[
if [ test ! -d "$MANUAL/$withval" ]; then
AC_MSG_RESULT()
AC_MSG_ERROR(Language "$withval" not supported!)
fi
LANG=$withval
AC_MSG_RESULT($withval)
],[
LANG=en
AC_MSG_RESULT([en (default)])
])
AC_SUBST(LANG)
LANGDIR=$MANUAL/$LANG
AC_SUBST(LANGDIR)
# need an old copy of the source to check against for updates
AC_ARG_WITH(history,
[ --with-history=PATH path to archived module copy (for updates)],
[
HISTORY=$withval
AC_MSG_CHECKING(for archive path)
AC_MSG_RESULT($withval)
if [ test -d $HISTORY/manual/$LANG ]; then
for xmlfile in `find $LANGDIR -name "*.xml" | sed -e"s%^$LANGDIR\/%%g" | sort`; do
if [ test -f $LANGDIR/$xmlfile ]; then
newfilepath=$LANGDIR/$xmlfile
oldfilepath=$HISTORY/manual/$LANG/$xmlfile
if [ test $newfilepath -nt $oldfilepath ]; then
echo Updating "$xmlfile"...
updates="$updates $newfilepath"
fi
fi
done;
else
HISTORY="no"
fi
],
[HISTORY="no"])
AC_SUBST(HISTORY)
# - or we could just check against our local directory
AC_ARG_ENABLE(updates-only,
[ --enable-updates-only whether to only build updated files],
[
UPDATES_ONLY=yes
if [ test -e ./build/$LANG/html/index.html ]; then
for xmlfile in `find $LANGDIR -name "*.xml" | sed -e"s%^$LANGDIR\/%%g" | sort`; do
if [ test -f $LANGDIR/$xmlfile ]; then
filepath=$LANGDIR/$xmlfile
if [test $filepath -nt ./build/$LANG/html/index.html ]; then
echo Updating "$xmlfile"...
updates="$updates $filepath"
fi
fi
done;
else
AC_MSG_ERROR(You need to create a full HTML build before you can run updates against it!)
fi
],
[UPDATES_ONLY=no])
AC_SUBST(UPDATES_ONLY)
# make quiet builds optional
AC_MSG_CHECKING(whether to build silently)
AC_ARG_ENABLE(output,
[ --disable-output whether to build silently],
[
RESULT=yes
QUIET=1
],
[
RESULT=no
QUIET=0
])
AC_MSG_RESULT($RESULT)
AC_SUBST(QUIET)
AC_OUTPUT([ \
Makefile \
$SCRIPT_DIR/manual.xml \
$SCRIPT_DIR/mtoc.xml \
$SCRIPT_DIR/testmanual.xml \
$STYLESHEET_DIR/chunk.xsl \
$STYLESHEET_DIR/phpweb.xsl \
$STYLESHEET_DIR/updates.xsl \
$SCRIPT_DIR/genchapterents.php ])
echo creating chapters.ent
$PHP -q -C $SCRIPT_DIR/genchapterents.php > $MANUAL/chapters.ent
echo creating name_to_id.xsl
$XSLTPROC $SCRIPT_DIR/gen_name_to_id.xsl $SCRIPT_DIR/manual.xml > $STYLESHEET_DIR/name_to_id.xsl
#now add the list of updated files to the testclasses.xml
# this has to be done after chapters.ent is created
if [ test -n "$updates" ]; then
echo creating $SCRIPT_DIR/testclasses.xml
for updatedfile in $updates; do
updatedfile=`echo $updatedfile | sed -e "s/$MANUAL\///g"`
ref=`grep -e "$updatedfile" $MANUAL/chapters.ent | sed "s/^<!ENTITY //" | sed "s/ .*//"`
if [ test -n "$ref"]; then
refs="$refs \&$ref;"
fi
done
sed "s/@TEST_REFERENCES@/$refs/g" $SCRIPT_DIR/testclasses.xml.in > $SCRIPT_DIR/testclasses.xml
fi
chmod +x $SCRIPT_DIR/genchapterents.php