dnl $Id$ dnl autoconf initialisation AC_INIT() WORKDIR=`pwd` SRCDIR=$srcdir AC_SUBST(SRCDIR) AC_SUBST(WORKDIR) dnl debug output echo "file versions" for file in ./*.in; do fgrep '$Id' $file | head -1 | sed -e"s/^.*: //g" | sed -e"s/200.\/.*$//g" done echo "configure options: $@" echo "working directory: $WORKDIR" echo dnl {{{ check for support programs dnl {{{ check for PHP dnl use given argument, if any, else search in path AC_ARG_WITH(php, [ --with-php=PATH look for PHP executable needed for helper scripts], [ if test $withval != "yes"; then AC_MSG_CHECKING([for php]) if test -x $withval; then PHP=$withval AC_MSG_RESULT($PHP) else PHP=no AC_MSG_RESULT(no) AC_MSG_ERROR([$withval: not an executable file]) fi else if test -e ../../phpdoc-tools/php.bat ; then AC_MSG_CHECKING([for php]) PHP=../../phpdoc-tools/php.bat AC_MSG_RESULT($PHP) else AC_PATH_PROG(PHP,"php",no) if test $PHP = "no"; then AC_PATH_PROG(PHP4,"php4",no) PHP=$PHP4 fi fi fi ],[ if test -e ../../phpdoc-tools/php.bat ; then AC_MSG_CHECKING([for php]) PHP=../../phpdoc-tools/php.bat AC_MSG_RESULT($PHP) else AC_PATH_PROG(PHP,"php",no) if test $PHP = "no"; then AC_PATH_PROG(PHP4,"php4",no) PHP=$PHP4 fi fi ] ) if test $PHP = "no"; then AC_MSG_ERROR([no PHP binary found]) fi AC_SUBST(PHP) dnl }}} dnl {{{ check for the Jade or OpenJade DSSSL parser dnl use given argument, if any, else search in path AC_ARG_WITH(jade, [ --with-jade=PATH look for jade or openjade executable],[ if test $withval != "yes"; then AC_MSG_CHECKING([for jade]) if test -x $withval; then JADE=$withval AC_MSG_RESULT($JADE) else JADE=no AC_MSG_RESULT(no) AC_MSG_ERROR([$withval: not an executable file]) fi else if test -e ../../phpdoc-tools/jade/jade.exe ; then AC_MSG_CHECKING([for jade]) JADE=../../phpdoc-tools/jade/jade.exe AC_MSG_RESULT($JADE) else AC_PATH_PROG(OPENJADE,"openjade",no) if test $OPENJADE = "no"; then AC_PATH_PROG(JADE,"jade",no) else JADE=$OPENJADE fi fi fi ],[ if test -e ../../phpdoc-tools/jade/jade.exe ; then AC_MSG_CHECKING([for jade]) JADE=../../phpdoc-tools/jade/jade.exe AC_MSG_RESULT($JADE) else AC_PATH_PROG(OPENJADE,"openjade",no) if test $OPENJADE = "no"; then AC_PATH_PROG(JADE,"jade",no) else JADE=$OPENJADE fi fi ] ) if test $JADE = "no"; then AC_MSG_ERROR([can't find jade or openjade]) fi AC_SUBST(JADE) dnl }}} dnl {{{ check for nsgmls or onsgmls AC_ARG_WITH(nsgmls, [ --with-nsgmls=PATH look for nsgmls or onsgmls executable],[ if test $withval != "yes"; then AC_MSG_CHECKING([for nsgmls]) if test -x $withval; then NSGMLS=$withval AC_MSG_RESULT($NSGMLS) else NSGMLS=no AC_MSG_RESULT(no) AC_MSG_ERROR([$withval: not an executable file]) fi else if test -e ../../phpdoc-tools/jade/nsgmls.exe ; then AC_MSG_CHECKING([for nsgmls]) NSGMLS=../../phpdoc-tools/jade/nsgmls.exe AC_MSG_RESULT($NSGMLS) else AC_PATH_PROG(ONSGMLS,"onsgmls",no) if test $ONSGMLS = "no"; then AC_PATH_PROG(NSGMLS,"nsgmls",no) else NSGMLS=$ONSGMLS fi fi fi ],[ if test -e ../../phpdoc-tools/jade/nsgmls.exe ; then AC_MSG_CHECKING([for nsgmls]) NSGMLS=../../phpdoc-tools/jade/nsgmls.exe AC_MSG_RESULT($NSGMLS) else AC_PATH_PROG(ONSGMLS,"onsgmls",no) if test $ONSGMLS = "no"; then AC_PATH_PROG(NSGMLS,"nsgmls",no) else NSGMLS=$ONSGMLS fi fi ] ) if test $NSGMLS = "no"; then AC_MSG_ERROR([can't find nsgmls or onsgmls]) fi AC_SUBST(NSGMLS) dnl }}} dnl }}} dnl {{{ check for catalog files CATALOG="" dnl iso-ents catalog file dnl The 4.1.2 DocBook DTD also includes entity files, but they cannot be used with Jade! if test -e ./entities/ISO/catalog then CATALOG="$CATALOG -c ./entities/ISO/catalog" fi dnl DSSSL catalog file if test -e ./dsssl/docbook/catalog then CATALOG="$CATALOG -c ./dsssl/docbook/catalog" fi dnl For windows (and maybe *nix too?) users lacking catalog-files dnl jade catalog file # how about using JADEPATH? You should replace the last 4 chars ('jade') with catalog # !! JADEPATH may not properly be set on windows, so do not use it !! if test -e ../../phpdoc-tools/jade/catalog then CATALOG="$CATALOG -c ../../phpdoc-tools/jade/catalog" fi dnl SuSE openjade setup if test -e /usr/share/sgml/CATALOG.docbk41 then CATALOG="$CATALOG -c /usr/share/sgml/CATALOG.docbk41" fi if test -e /usr/share/sgml/CATALOG.jade_dsl then CATALOG="$CATALOG -c /usr/share/sgml/CATALOG.jade_dsl" fi dnl As a very last option, include default catalog files from phpdoc dnl (imported from the openjade distribution) if test -e $srcdir/dsssl/defaults/catalog then CATALOG="$CATALOG -c ./dsssl/defaults/catalog" fi AC_SUBST(CATALOG) dnl }}} dnl {{{ language specific stuff AC_MSG_CHECKING(for language) BUILD_DATE=`date '+%Y-%m-%d'` AC_ARG_WITH(lang, [ --with-lang=LANG choose a language to work with],[ if test "$withval" = "yes"; then LANG=en AC_MSG_RESULT([en (default)]) else if test ! -d "./$withval"; then AC_MSG_RESULT() AC_MSG_ERROR(Language \"$withval\" not supported!) else LANG=$withval AC_MSG_RESULT($LANG) fi BUILD_DATE=`date '+%d-%m-%Y'` fi ],[ LANG=en AC_MSG_RESULT([en (default)]) ]) AC_SUBST(LANG) AC_SUBST(BUILD_DATE) case "$LANG" in ru) ENCODING="windows-1251";; *) ENCODING="ISO-8859-1";; esac AC_SUBST(ENCODING) dnl }}} dnl {{{ makefile targets for configure-generated files rm -f autogenerated_rules ( for file in `find . -name "*.in"`; do case "$file" in ./configure.in) echo configure: configure.in printf '\t autoconf' echo ;; ./manual.xml.in) ;; *) echo `dirname $file`/`basename $file .in`: '$(srcdir)'/$file ./config.status printf '\t CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status' echo esac done ) > autogenerated_rules AUTOGENERATED_RULES=autogenerated_rules AC_SUBST_FILE(AUTOGENERATED_RULES) rm -f autogenerated_rules dnl }}} dnl {{{ generate output files dnl {{{ find all *.in files and process them with AC_OUTPUT for infile in `find $srcdir -name "*.in"` do if test `basename $infile` != "configure.in" then outfile=`basename $infile .in` outdir=`dirname $infile` outdir=`echo $outdir/ | sed -e"s|$srcdir/||"` OUTFILES="$OUTFILES ./$outdir$outfile" fi done AC_OUTPUT($OUTFILES) dnl }}} dnl {{{ generate entity mapping file, missing entities and IDs dnl if we have PHP use it for all of these things if test $PHP != "no" then dnl create entity mapping file $PHP -q ./scripts/file-entities.php else echo ERROR: configure process cannot continue, PHP is not found fi dnl }}} dnl }}}