dnl **************************************************************************
dnl * ocaml-gettext: a library to translate messages *
dnl * *
dnl * Copyright (C) 2003-2008 Sylvain Le Gall <sylvain@le-gall.net> *
dnl * *
dnl * This library is free software; you can redistribute it and/or *
dnl * modify it under the terms of the GNU Lesser General Public *
dnl * License as published by the Free Software Foundation; either *
dnl * version 2.1 of the License, or (at your option) any later version; *
dnl * with the OCaml static compilation exception. *
dnl * *
dnl * This library is distributed in the hope that it will be useful, *
dnl * but WITHOUT ANY WARRANTY; without even the implied warranty of *
dnl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
dnl * Lesser General Public License for more details. *
dnl * *
dnl * You should have received a copy of the GNU Lesser General Public *
dnl * License along with this library; if not, write to the Free Software *
dnl * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
dnl * USA *
dnl **************************************************************************
AC_INIT(ocaml-gettext, 0.3.7)
AC_PROG_INSTALL
AC_ARG_WITH(tmpbuilddir,
AC_HELP_STRING([--with-tmpbuilddir=dir], [Location of the temporary build dir. Default: ${topdir}/build]),
TMPBUILDDIR=$withval, [TMPBUILDDIR='${abs_top_srcdir}/_build'])
AC_ARG_WITH(defaultlocaledir,
AC_HELP_STRING([--with-defaultlocaledir=dir], [Location of the default locale dir. Default: /usr/share/locale]),
DEFAULTLOCALEDIR="\"$withval\"", DEFAULTLOCALEDIR="\"/usr/share/locale\"")
AC_ARG_WITH(localedir,
AC_HELP_STRING([--with-localedir=dir], [Additional location of the locale dir. Default: "/usr/local/share/locale"]),
LOCALEDIR=$LOCALEDIR '"$withval";', LOCALEDIR='"/usr/local/share/locale"')
AC_ARG_WITH(stub-cflags,
AC_HELP_STRING([--with-stub-cflags=flags], [Flags to use when compiling gettext-stub]),
STUB_CFLAGS=$withval, STUB_CFLAGS="")
AC_ARG_WITH(stub-ldflags,
AC_HELP_STRING([--with-stub-ldflags=flags], [Flags to use when linking gettext-stub. Default: -L(OCAMLLIB)]),
STUB_LDFLAGS=$withval, STUB_LDFLAGS="")
AC_ARG_WITH(docbook-stylesheet,
AC_HELP_STRING([--with-docbook-stylesheet=dir], [Where to find the docbook stylesheets]),
DOCBOOK_STYLESHEET=$withval, DOCBOOK_STYLESHEET=/usr/share/xml/docbook/stylesheet/nwalsh)
AC_ARG_ENABLE(camomile,
AC_HELP_STRING([--enable-camomile], [Build camomile extension. Default: yes]),
BUILD_CAMOMILE=$enableval, BUILD_CAMOMILE="yes")
AC_ARG_ENABLE(stub,
AC_HELP_STRING([--enable-stub], [Build stub extension. Default: yes]),
BUILD_STUB=$enableval, BUILD_STUB="yes")
AC_ARG_ENABLE(test,
AC_HELP_STRING([--enable-test], [Build program test. Default: no]),
BUILD_TEST=$enableval, BUILD_TEST="no")
AC_ARG_ENABLE(bench,
AC_HELP_STRING([--enable-bench], [Build program benchmark. Default: no]),
BUILD_BENCH=$enableval, BUILD_BENCH="no")
AC_ARG_ENABLE(doc,
AC_HELP_STRING([--enable-doc], [Build the documentation. Default: yes]),
BUILD_DOC=$enableval, BUILD_DOC="yes")
AC_ARG_ENABLE(doc-pdf,
AC_HELP_STRING([--enable-doc-pdf], [Build the PDF documentation. Default: no]),
BUILD_DOC_PDF=$enableval, BUILD_DOC_PDF="no")
AC_ARG_WITH(ocamlfind-install-flags,
AC_HELP_STRING([--with-ocamlfind-install-flags], [Flags to use when installing with ocamlfind (e.g. -destdir, -ldconf). Default:]),
OCAMLFIND_INSTALL_FLAGS=$withval, OCAMLFIND_INSTALL_FLAGS="")
AC_ARG_WITH(ocamlfind-remove-flags,
AC_HELP_STRING([--with-ocamlfind-remove-flags], [Flags to use when uninstalling with ocamlfind (e.g. -destdir, -ldconf). Default: (OCAMLFIND_INSTALL_FLAGS)]),
OCAMLFIND_REMOVE_FLAGS=$withval, OCAMLFIND_REMOVE_FLAGS='${OCAMLFIND_INSTALL_FLAGS}')
AC_CHECK_OCAMLC([],[AC_MSG_ERROR(Cannot find ocamlc.)])
AC_CHECK_OCAMLOPT([],[AC_MSG_WARN(Cannot find ocamlopt, byte compilation only)])
AC_CHECK_OCAMLLEX([],[AC_MSG_ERROR(Cannot find ocamllex.)])
AC_CHECK_OCAMLYACC([],[AC_MSG_ERROR(Cannot find ocamlyacc.)])
AC_CHECK_OCAMLFIND([],[AC_MSG_ERROR(Cannot find ocamlfind.)])
AC_CHECK_CAMLP4([],[AC_MSG_ERROR(Cannot find camlp4.)])
AC_CHECK_CAMLP4O([],[AC_MSG_ERROR(Cannot find camlp4o.)])
AC_CHECK_CAMLP4OF([],[AC_MSG_ERROR(Cannot find camlp4of.)])
AC_CHECK_OCAMLMKLIB([],[AC_MSG_ERROR(Cannot find ocamlmklib.)])
if test "x$BUILD_DOC" = "xyes"; then
AC_CHECK_OCAMLDOC([],[AC_MSG_ERROR(Cannot find ocamldoc.)])
AC_CHECK_HTMLXSL($DOCBOOK_STYLESHEET/xhtml/chunk.xsl,[],[AC_MSG_ERROR(Cannot generate HTML pages.)])
AC_CHECK_MANXSL($DOCBOOK_STYLESHEET/manpages/docbook.xsl,[],[AC_MSG_ERROR(Cannot generate manpages.)])
if test "x$BUILD_DOC_PDF" = "xyes"; then
AC_CHECK_PDFXSL($DOCBOOK_STYLESHEET/fo/docbook.xsl,[],[AC_MSG_ERROR(Cannot generate PDF files.)])
fi
fi
OCAMLFIND_CHECK_MODULE(fileutils,[],[AC_MSG_ERROR(Cannot find ocaml-fileutils)])
OCAMLFIND_CHECK_MODULE(camomile,[],
[
if test "x$BUILD_CAMOMILE" = "xyes"; then
AC_MSG_ERROR(Cannot build libgettext-camomile-ocaml.)
fi
])
if test "x$BUILD_TEST" = "xyes"; then
OCAMLFIND_CHECK_MODULE(oUnit,[],[AC_MSG_ERROR(Cannot build test.)])
fi
if test "x$BUILD_BENCH" = "xyes"; then
OCAMLFIND_CHECK_MODULE(benchmark,[],[AC_MSG_ERROR(Cannot build benchmark)])
fi
AC_LIB_OCAML()
# check if we build at least one of stub | camomile for building ocaml-gettext
if test "$BUILD_STUB" = "no" || test "$BUILD_CAMOMILE" = "no"; then
if test "$BUILD_TEST" = "yes"; then
AC_MSG_ERROR(Cannot build test since it depends on both gettext-stub and gettext-camomile)
fi
if test "$BUILD_BENCH" = "yes"; then
AC_MSG_ERROR(Cannot build bench since it depends on both gettext-stub and gettext-camomile)
fi
fi
# substitutions to perform
AC_SUBST(TMPBUILDDIR)
AC_SUBST(DOCDIR)
AC_SUBST(EXE)
AC_SUBST(DEFAULTLOCALEDIR)
AC_SUBST(LOCALEDIR)
AC_SUBST(CODESET)
AC_SUBST(STUB_CFLAGS)
AC_SUBST(STUB_LDFLAGS)
AC_SUBST(BUILD_CAMOMILE)
AC_SUBST(BUILD_STUB)
AC_SUBST(BUILD_TEST)
AC_SUBST(BUILD_BENCH)
AC_SUBST(BUILD_DOC)
AC_SUBST(BUILD_DOC_PDF)
AC_SUBST(OCAMLFIND_INSTALL_FLAGS)
AC_SUBST(OCAMLFIND_REMOVE_FLAGS)
# Finally create the Makefile from Makefile.in
OUTPUT="ConfMakefile libgettext-ocaml/gettextConfig.ml libgettext-ocaml/META"
AC_OUTPUT([$OUTPUT])