Files
doc-gtk/configure.in
2007-01-04 21:09:12 +00:00

189 lines
5.0 KiB
Plaintext

# +----------------------------------------------------------------------+
# | 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