1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl   Copyright (C) 2009-2014 Peter Breitenlohner <tex-live@tug.org>
4dnl
5dnl   This file is free software; the copyright holder
6dnl   gives unlimited permission to copy and/or distribute it,
7dnl   with or without modifications, as long as this notice is preserved.
8dnl
9dnl *********************************************************************
10dnl
11dnl  Adapted for TeX Live from xindy-2.4-rc1/configure.ac
12dnl  Copyright (C) 2004-2005 by Gour.
13dnl  Copyright (C) 2008,2009 by Joachim Schrod.
14dnl
15dnl *********************************************************************
16dnl
17m4_include([version.ac])[] dnl define xindy_version
18AC_INIT([xindy (TeX Live)], xindy_version, [tex-k@tug.org])
19AC_PREREQ([2.65])
20AC_CONFIG_SRCDIR([xindy-]xindy_version[/ChangeLog.Gour])
21AC_CONFIG_AUX_DIR([../../build-aux])
22AC_CONFIG_MACRO_DIR([../../m4])
23
24KPSE_BASIC([xindy], [no-define])
25
26# Configure options for xindy also shown at the TeX Live top-level.
27m4_include([ac/xindy.ac])
28
29AS_CASE([$enable_xindy_rules],
30        [yes | no], ,
31        [AS_IF([test "x$enable_native_texlive_build" = xyes],
32               [enable_xindy_rules=no],
33               [enable_xindy_rules=yes])])
34AS_CASE([$enable_xindy_docs],
35        [yes | no], ,
36        [AS_IF([test "x$enable_native_texlive_build" = xyes],
37               [enable_xindy_docs=no],
38               [enable_xindy_docs=yes])])
39
40# Installation directories for TeX Live.
41memdir='$(bindir)'
42pkglibdir='$(datarootdir)/texmf-dist/xindy'
43docdir='$(datarootdir)/texmf-dist/doc/xindy'
44AC_SUBST([memdir])
45AC_SUBST([pkglibdir])
46AM_CONDITIONAL([TEXLIVE_BUILD], [test "x$enable_texlive_build" = xyes])
47
48# Checks for programs.
49AC_PROG_CC
50AC_PROG_LEX
51AC_PROG_LN_S
52
53# Check system type
54AC_CANONICAL_HOST
55
56AC_CHECK_PROGS([CLISP], [clisp], [no])
57KPSE_CHECK_PERL
58KPSE_CHECK_LATEX
59KPSE_CHECK_PDFLATEX
60
61if test "x$enable_build" != xno || test -f config.force; then
62
63if test "x$CLISP" = xno; then
64  AC_MSG_ERROR([CLISP is required to build and run xindy])
65fi
66
67if test "x$EXEEXT" = x.exe; then
68  XINDY_RUN=xindy-lisp.exe
69  LISP_RUN=lisp.exe
70else
71  XINDY_RUN=xindy.run
72  LISP_RUN=lisp.run
73fi
74
75if test "x$with_clisp_runtime" != xsystem; then
76  AC_MSG_CHECKING([for clisp runtime])
77  if test "x$with_clisp_runtime" = xdefault; then
78    # Convert dos line endings from cygwin clisp.
79    LISP_RUN=`echo '(format t "~a" *lib-directory*)' \
80              | $CLISP -q -norc - | tr -d '\r'`base/$LISP_RUN
81  else
82    LISP_RUN=$with_clisp_runtime
83  fi
84  AC_MSG_RESULT([$LISP_RUN])
85  if test ! -f "$LISP_RUN"; then
86    AC_MSG_ERROR([no such file: "$LISP_RUN"])
87  fi
88fi
89
90AC_SUBST([XINDY_RUN])
91AC_SUBST([LISP_RUN])
92
93if test "x$enable_xindy_rules:$PERL" = xyes:no; then
94  AC_MSG_ERROR([PERL is required to build xindy rules])
95fi
96
97if test "x$enable_xindy_rules:$LATEX" = xyes:no; then
98  AC_MSG_ERROR([LATEX is required to build xindy rules])
99fi
100
101if test "x$enable_xindy_rules:$enable_xindy_docs:$PDFLATEX" = xyes:yes:no; then
102  AC_MSG_ERROR([PDFLATEX is required to build xindy docs])
103fi
104
105# No checks for header files. We use stdio.h, unistd.h, and string.h.
106# Today, they are universally available if a C compiler is installed.
107
108# Checks for typedefs, structures, and compiler characteristics.
109
110# Checks for library functions.
111# The code in tex2indy.l simply assumes that strtoul() is there, would
112# need a replacement.
113AC_CHECK_FUNCS([strtoul], [],
114               [AC_MSG_ERROR([strtoul() is needed])])
115
116echo timestamp >config.force
117fi
118
119KPSE_COND_WIN32_WRAP
120
121AC_SUBST([XINDY_TREE], [xindy-]xindy_version)
122
123AM_CONDITIONAL([CLISP_RUNTIME], [test "x$with_clisp_runtime" != xsystem])
124AM_CONDITIONAL([BUILDRULES], [test "x$enable_xindy_rules" = xyes])
125AM_CONDITIONAL([BUILDDOCS], [test "x$enable_xindy_docs" = xyes])
126
127AC_CONFIG_FILES([Makefile \
128		xindy-]xindy_version[/Makefile \
129		xindy-]xindy_version[/src/Makefile \
130		xindy-]xindy_version[/tex2xindy/Makefile \
131		xindy-]xindy_version[/modules/Makefile \
132		xindy-]xindy_version[/user-commands/Makefile \
133		xindy-]xindy_version[/make-rules/Makefile \
134		xindy-]xindy_version[/make-rules/alphabets/Makefile \
135		xindy-]xindy_version[/make-rules/inputenc/Makefile \
136		xindy-]xindy_version[/doc/Makefile \
137])
138
139AC_OUTPUT
140