summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/configure.ac
blob: d7e2437f48f6e3d7978dc0bbe759b9855b6aa801 (plain)
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
dnl Process this file with Autoconf to produce a configure script for Web2c.
dnl
dnl   Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl   This file is free software; the copyright holder
dnl   gives unlimited permission to copy and/or distribute it,
dnl   with or without modifications, as long as this notice is preserved.
dnl
dnl --------------------------------------------------------
dnl
dnl Some things are no longer configurable:
dnl - SMALL{TeX,MF,BibTeX}: too painful to maintain the separate patch
dnl   files, and, for TeX, texmfmem.h would have to be fixed to support
dnl   more than 256 fonts.
dnl - NONASCII: necessary for the character translation feature.
dnl - REGFIX: modern compilers mostly ignore register declarations, anyway.
dnl The code for these things remains (where applicable), so you can
dnl get these features if you are willing to hack the sources. If not,
dnl it'll take a good argument to convince me to invest the time to make
dnl them configurable.
dnl
m4_define([web2_version], [7.5.7])
AC_INIT([Web2C], web2_version(), [tex-k@tug.org])
AC_PREREQ([2.63])
dnl 
dnl We don't use (for example) tex/tex.web because people who only want
dnl to build part of the distribution may not have any given program.
dnl Even cpascal.h isn't guaranteed, but then nothing is, really ...
AC_CONFIG_SRCDIR([cpascal.h])
AC_CONFIG_AUX_DIR([../../build-aux])
AC_CONFIG_MACRO_DIR([../../m4])

WEB2CVERSION=web2_version()
AC_SUBST([WEB2CVERSION])
AC_DEFINE_UNQUOTED([WEB2CVERSION], [" (Web2C $WEB2CVERSION)"])

dnl Common code for all programs using libkpathsea.
KPSE_COMMON([web2c programs])
dnl Include additional code for web2c.
KPSE_WEB2C_PREPARE
m4_include([ac/web2c.ac])

KPSE_ASM_UNDERSCORE

AC_PROG_CXX

AS_CASE([$with_editor], [''|yes|no], [with_editor='vi +%d %s'])
AC_DEFINE_UNQUOTED([EDITOR], ["$with_editor"],
                   [web2c: Default editor for interactive `e' option.])

AS_IF([test "x$enable_auto_core" = xyes],
      [AC_DEFINE([FUNNY_CORE_DUMP], 1,
                 [web2c: Define to enable HackyInputFileNameForCoreDump.tex.])])

AS_IF([test "x$enable_dump_share" = xno],
      [AC_DEFINE([NO_DUMP_SHARE], 1,
                 [web2c: Define to disable architecture-independent dump files.
                  Faster on LittleEndian architectures.])])

AM_CONDITIONAL([FMU], [test "x$enable_fmtutil" = xyes])

AS_IF([test "x$enable_ipc" = xyes], [
# -lsocket is needed on Solaris, at least.  Maybe -lnsl on SCO, too?
# See ac_path_xtra.
AC_CHECK_FUNC([connect], ,
              [AC_CHECK_LIB([socket], [connect],
                            [socketlibs="-lsocket"],
                            [AC_CHECK_LIB([nsl], [connect],
                                          [socketlibs="-lnsl"],
                                          [AC_MSG_WARN([no socket library: disabling ipc])
                                           enable_ipc=no])])])
AS_IF([test "x$enable_ipc" = xyes],
      [AC_DEFINE([IPC], 1, [tex: Define to enable --ipc.])])
])
AC_SUBST([socketlibs])

dnl Generate *TEX, OMEGA, and ALEPH conditionals.
m4_foreach([Kpse_Prog], [kpse_tex_progs],
           [m4_ifset([Kpse_Prog],
                     [KPSE_XTEX_COND(Kpse_Prog)])])[]dnl
dnl Disable SyncTeX support for TeX.
AM_CONDITIONAL([TEX_SYNCTEX], [false])[]dnl
AS_IF([test "x$enable_omega:$enable_aleph:$enable_xetex" = xno:no:no],
      [enable_otangle=no],
      [enable_otangle=yes])
AM_CONDITIONAL([OTANGLE],
               [test "x$enable_otangle" = xyes])[]dnl

AM_CONDITIONAL([OMFONTS], [true])

AM_CONDITIONAL([MF], [test "x$enable_mf" != xno])
AM_CONDITIONAL([MFN], [test "x$enable_mf_nowin" = xyes])

# Handle --with-mf-x-toolkit and --with-x
AS_CASE([$with_mf_x_toolkit],
        [''|yes|no], ,
        [''|y|ye],   [with_mf_x_toolkit=yes],
        [n],         [with_mf_x_toolkit=no],
        [AC_MSG_WARN([unknown --with-mf-x-toolkit argument \`$with_mf_x_toolkit'; using yes.])
         with_mf_x_toolkit=yes])
test "x$with_x_toolkit" = xyes && with_x=yes
test "x$with_x" = xno && with_x_toolkit=no
: ${with_x=no} # tell PATH_XTRA no X by default, if not specified.

# Distinguish no X at all, no toolkit, or toolkit.
AC_PATH_XTRA
if test "x$with_x" = xyes; then
  if test "x$no_x" = xyes; then
    AC_MSG_ERROR([Sorry, could not find required X include and library files.])
  fi
  test -n "$x_libraries" && XLFLAG="-L$x_libraries"
  wlibs="$XLFLAG -lX11"
  if test -z "$x_ext_lib"; then # allow envvar override
    AC_CHECK_LIB([Xext], [XextCreateExtension],
                 [x_ext_lib=-lXext], ,
                 [$wlibs $X_EXTRA_LIBS])
  fi
  test "x$with_mf_x_toolkit" = xyes && x_tool_libs="-lXt"
  AC_DEFINE([X11WIN], 1, [Define to include X11 window in Metafont.])
fi
AM_CONDITIONAL([MFXT], [test "x$with_mf_x_toolkit" = xyes])
AC_SUBST([x_ext_lib])
AC_SUBST([x_tool_libs])
AC_SUBST([wlibs])

dnl Generate *WIN defines.
m4_foreach([Kpse_Win], [kpse_mf_win],
           [m4_ifset([Kpse_Win],
                     [KPSE_MFWIN_DEFINE(Kpse_Win)])])[]dnl

AM_CONDITIONAL([MP], [test "x$enable_mp" != xno])

AM_CONDITIONAL([WEB], [test "x$enable_web_progs" != xno])

dnl Although quite unusual, it is possible to build Web2C (TeX & Co)
dnl using installed (system) kpathsea headers and library.
dnl In that case we need the location of <kpathsea/paths.h>.
if test "x$with_system_kpathsea" = xyes; then
  if test "x$with_kpathsea_includes" = x; then
    list="/usr/include /usr/local/include"
  else
    list=$with_kpathsea_includes
  fi
  found=no
  for KPATHSEA_PATHS_H in $list; do
    if test -r "$KPATHSEA_PATHS_H/kpathsea/paths.h"; then
      found=yes
      break
    fi
  done
  if test "x$found" = xno; then
    AC_MSG_NOTICE([You requested to build `web2c' using an installed `kpathsea' version,])
    AC_MSG_NOTICE([    which requires to locate the <kpathsea/paths.h> header file.])
    AC_MSG_ERROR([Sorry, not found under any of: $list *****])
  fi
else
  KPATHSEA_PATHS_H='${top_builddir}/..'
fi
AC_SUBST([KPATHSEA_PATHS_H])

AC_PROG_YACC
KPSE_PROG_LEX

# Needed on A/UX 3.0. I don't want to pull in other -lposix's, though.
# From: bernt@weinberg.pop.bio.aau.dk (Bernt Guldbrandtsen)
if test `(uname) 2>/dev/null` = aux; then
  AC_CHECK_LIB([posix], [sigemptyset])
fi

AC_CHECK_SIZEOF([int])
AC_CHECK_FUNCS([strerror])
AC_CHECK_HEADERS([errno.h])

dnl FIXME: needed for libpdf -> xpdf ?
AC_CHECK_HEADERS([time.h])

AC_SEARCH_LIBS([pow], [m])

dnl FIXME: obsolete
AC_TYPE_SIGNAL

KPSE_KPATHSEA_FLAGS
KPSE_ZLIB_FLAGS
KPSE_LIBPNG_FLAGS
KPSE_XPDF_FLAGS
KPSE_OBSDCOMPAT_FLAGS

dnl Write output here, instead of putting a zillion -D's on the command line.
AC_CONFIG_HEADERS([c-auto.h:c-auto.in],
 [sed -e 's/^#define PACKAGE/#define WEB2C_PACKAGE/' \
      -e 's/^#define VERSION/#define WEB2C_VERSION/' c-auto.h >c-auto.tmp && mv -f c-auto.tmp c-auto.h])

AH_TOP([/* c-auto.h: defines for web2c, as determined by configure.

   Copyright 1994-97, 2008, 2009 Karl Berry.
   Copyright 1997-99, 2002, 2005 Olaf Weber.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* Guard against double inclusion. */
#ifndef WEB2C_C_AUTO_H
#define WEB2C_C_AUTO_H

/* web2c: the version string. */
#define WEB2CVERSION "REPLACE-WITH-WEB2CVERSION"])
AH_BOTTOM([#endif /* !WEB2C_C_AUTO_H */])

KPSE_CHECK_WIN32
AM_CONDITIONAL([WIN32], [test "x$kpse_cv_have_win32" != xno])
AM_CONDITIONAL([MINGW32], [test "x$kpse_cv_have_win32" = xmingw32])

AS_IF([test "x$enable_luatex" = xyes],
[AC_CONFIG_HEADERS([ff-config.h:luatexdir/luafontforge/ff-config.in])
AC_CHECK_HEADERS([langinfo_h])
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_LONG_INT
])

# For cross-compilation.  Put at the end so there is a fair chance
# these are still visible when the configure script has finished.

# The supporting programs we need to have available on the build machine.
#                     make variable  cross      native  
KPSE_CROSS_PATH_PROG([TANGLEBOOT],  [tangle],  [./tangleboot])
KPSE_CROSS_PATH_PROG([TANGLE],      [tangle],  [./tangle])
KPSE_CROSS_PATH_PROG([CTANGLEBOOT], [ctangle], [./ctangleboot])
KPSE_CROSS_PATH_PROG([CTANGLE],     [ctangle], [./ctangle])
KPSE_CROSS_PATH_PROG([TIE],         [tie],     [./tie])
AS_IF([test "x$enable_otangle" = xyes],
      [KPSE_CROSS_PATH_PROG([OTANGLE],   [otangle],   [./otangle])])
AS_IF([test "x$enable_luatex" = xyes],
      [KPSE_CROSS_PATH_PROG([LUATANGLE], [luatangle], [./luatangle])])

AC_CONFIG_SUBDIRS([web2c])

AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile man/Makefile
                 mpware/Makefile omegafonts/Makefile otps/Makefile
                 window/Makefile])

if test "x$cross_compiling" = xyes; then
  AC_MSG_CHECKING([if your tie supports WEBINPUTS])
  ( WEBINPUTS=$srcdir/tiedir
    export WEBINPUTS
    $TIE -c tie.outc tie.tie tie.cf1 tie.cf2 tie.cf3
    $TIE -m tie.outm tie.tie tie.cf1 tie.cf2 tie.cf3 ) >/dev/null 2>&1
  if diff tie.outc $srcdir/tiedir/tie.chf.gen >/dev/null 2>&1 && \
     diff tie.outm $srcdir/tiedir/tie.master.gen >/dev/null 2>&1; then
    tool_ok=yes
  else
    tool_ok=no
  fi
  AC_MSG_RESULT([$tool_ok])
  if test "x$tool_ok" != xyes; then
    AC_MSG_ERROR([Sorry, your $TIE is too old and does not support WEBINPUTS])
  fi
  rm -f tie.outc tie.outm
  if test "x$enable_otangle" = xyes; then
    AC_MSG_CHECKING([if your otangle supports WEBINPUTS])
    ( WEBINPUTS=$srcdir/cftests
      export WEBINPUTS
      $OTANGLE cftest cftest ) >/dev/null 2>&1
    if diff cftest.p $srcdir/cftests/ocftest.p >/dev/null 2>&1; then
      tool_ok=yes
    else
      tool_ok=no
    fi
    AC_MSG_RESULT([$tool_ok])
    if test "x$tool_ok" != xyes; then
      AC_MSG_ERROR([Sorry, your $OTANGLE is too old and does not support WEBINPUTS])
    fi
    rm -f cftest.p
  fi
  if test "x$enable_luatex" = xyes; then
    AC_MSG_CHECKING([if your luatangle supports WEBINPUTS])
    ( WEBINPUTS=$srcdir/cftests
      export WEBINPUTS
      $LUATANGLE cftest cftest ) >/dev/null 2>&1
    if diff cftest.p $srcdir/cftests/lcftest.p >/dev/null 2>&1; then
      tool_ok=yes
    else
      tool_ok=no
    fi
    AC_MSG_RESULT([$tool_ok])
    if test "x$tool_ok" != xyes; then
      AC_MSG_ERROR([Sorry, your $LUATANGLE is too old and does not support WEBINPUTS])
    fi
    rm -f cftest.p
  fi
fi

dnl The subdirectory web2c must be configured for the build system.
dnl Can not share the cache file with the subdirectory!
AC_CONFIG_COMMANDS_POST([AS_IF([test "x$cross_compiling" = xyes],
[cache_file=/dev/null
 ac_configure_args="$ac_configure_args --host='$build_alias' \
 CC='$BUILDCC' CPPFLAGS='$BUILDCPPFLAGS'\
 CFLAGS='$BUILDCFLAGS' LDFLAGS='$BUILDLDFLAGS'"])])

AC_OUTPUT