Debian Codegraph @

texk/web2c/configure.ac

raw ◀ ▶
1 Debian patch touch this file
1 dnl $Id: configure.ac 76982 2025-11-30 22:39:49Z karl $
2 dnl Process this file with Autoconf to produce a configure script for Web2c.
3 dnl
4 dnl Copyright 2015-2025 Karl Berry <[email protected]>
5 dnl Copyright 2009-2015 Peter Breitenlohner <[email protected]>
6 dnl
7 dnl This file is free software; the copyright holder
8 dnl gives unlimited permission to copy and/or distribute it,
9 dnl with or without modifications, as long as this notice is preserved.
10 dnl
11 dnl --------------------------------------------------------
12 dnl
13 dnl Some things are no longer configurable:
14 dnl - SMALL{TeX,MF,BibTeX}: too painful to maintain the separate patch
15 dnl files, and, for TeX, texmfmem.h would have to be fixed to support
16 dnl more than 256 fonts.
17 dnl - NONASCII: necessary for the character translation feature.
18 dnl - REGFIX: modern compilers mostly ignore register declarations, anyway.
19 dnl The code for these things remains (where applicable), so you can
20 dnl get these features if you are willing to hack the sources.
21 dnl
22 m4_include([../../version.ac])[] dnl define tex_live_version
23 AC_INIT([Web2C], tex_live_version(), [[email protected]])
24 AC_PREREQ([2.65])
25 dnl
26 dnl We don't use (for example) tex/tex.web because people who only want
27 dnl to build part of the distribution may not have any given program.
28 dnl Even cpascal.h isn't guaranteed, but then nothing is, really ...
29 AC_CONFIG_SRCDIR([cpascal.h])
30 AC_CONFIG_AUX_DIR([../../build-aux])
31 AC_CONFIG_MACRO_DIRS([../../m4 m4])
32
33 WEB2CVERSION=tex_live_version()
34 AC_SUBST([WEB2CVERSION])
35
36 # LuaTeX requires system extensions for socket support.
37 # Must be at the very beginning or warnings about compiler tests.
38 # SyncTeX and plenty of others unconditionally define GNU_SOURCE,
39 # so it's probably more consistent to always use it.
40
41 # Also, we can't easily make it conditional on LuaTeX only because then
42 # OBJEXT ends up defined as the empty string (error: no way to make
43 # "basechsuffix."), which seems odd, but whatever.
44 AC_MSG_NOTICE([using system extensions])
45 AC_USE_SYSTEM_EXTENSIONS
46
47 KPSE_COMMON([web2c programs])
48
49 AM_CONDITIONAL([cross], [test "x$cross_compiling" = xyes])
50
51 AC_PROG_CXX
52 AC_PROG_OBJCXX
53 KPSE_CXX_HACK
54 KPSE_LT_HACK
55
56 # Include additional code for web2c.
57 KPSE_WEB2C_PREPARE
58 m4_include([ac/web2c.ac])
59
•60 # XeTeX requires C++17 because ICU 76+ does.
61 if test "x$enable_xetex" = xyes; then
•62 AC_MSG_NOTICE([checking for C++17, since XeTeX is enabled])
63 AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
64 fi
65
66 AS_IF([test "x$enable_texlive_build" = xyes],
67 [banner_pre='TeX Live'],
68 [banner_pre='Web2C'])
69 AC_DEFINE_UNQUOTED([WEB2CVERSION],
70 [" ($banner_pre $WEB2CVERSION$with_banner_add)"])
71
72 dnl For tests
73 AC_CHECK_PROGS([KPSEWHICH], [kpsewhich], [false])
74
75 KPSE_ASM_UNDERSCORE
76 KPSE_COND_MINGW32
77 KPSE_WIN32_CALL
78
79 AS_CASE([$with_editor],
80 [''|yes|no], [AS_IF([test "x$kpse_cv_have_win32" = xno],
81 [with_editor="vi +%d '%s'"],
82 [with_editor='texworks --position=%d \"%s\"'])])
83 AC_DEFINE_UNQUOTED([EDITOR], ["$with_editor"],
84 [web2c: Default editor for interactive `e' option.])
85
86 AS_IF([test "x$enable_auto_core" = xyes],
87 [AC_DEFINE([FUNNY_CORE_DUMP], 1,
88 [web2c: Define to enable HackyInputFileNameForCoreDump.tex.])])
89
90 AS_IF([test "x$enable_dump_share" = xno],
91 [AC_DEFINE([NO_DUMP_SHARE], 1,
92 [web2c: Define to disable architecture-independent dump files.
93 Faster on LittleEndian architectures.])])
94
95 AS_CASE([$enable_ipc],
96 [yes|no], [],
97 [enable_ipc=yes])
98
99 KPSE_CHECK_SOCKET_LIBS
100 AS_CASE([$ac_cv_search_connect],
101 ["none required"], [],
102 [no], [WEB2C_DISABLE([luatex], [no socket library])
103 WEB2C_DISABLE([luatex53], [no socket library])
104 WEB2C_DISABLE([ipc], [no socket library])],
105 [socketlibs=$ac_cv_search_connect])
106 if test "x$enable_ipc" = xyes; then
107 ipc_socketlibs=$socketlibs
108 AC_DEFINE([IPC], 1, [tex: Define to enable --ipc.])
109 fi
110
111 # We may need additional libraries for LuaTeX.
112 # On Solaris -lnsl for gethostbyname(), -lrt for nanosleep(),
113 # and maybe -lresolv for inet_aton().
114 lua_socketlibs=$socketlibs
115 kpse_save_LIBS=$LIBS
116 KPSE_LUA53_DEFINES
117 KPSE_LUA52_DEFINES
118 KPSE_LUAJIT_DEFINES
119 KPSE_LARGEFILE([LUA53_DEFINES], [_LARGEFILE64_SOURCE])
120 KPSE_LARGEFILE([LUA52_DEFINES], [_LARGEFILE64_SOURCE])
121 KPSE_LARGEFILE([LUAJIT_DEFINES], [_LARGEFILE64_SOURCE])
122 LIBS=$kpse_save_LIBS
123 if test "x$kpse_cv_have_win32" = xno; then
124 AC_SEARCH_LIBS([gethostbyname], [nsl])
125 AC_SEARCH_LIBS([hstrerror], [resolv])
126 AC_SEARCH_LIBS([inet_aton], [resolv])
127 LIBS=$kpse_save_LIBS
128 AC_SEARCH_LIBS([nanosleep], [rt])
129 LIBS=$kpse_save_LIBS
130 AS_CASE([$ac_cv_header_dlfcn_h],
131 [yes], [AS_CASE([$ac_cv_search_dlopen],
132 [no*], [],
133 [lua_socketlibs="$lua_socketlibs $ac_cv_search_dlopen"])])
134 AS_CASE([$ac_cv_search_hstrerror],
135 ["none required"], [],
136 [no], [WEB2C_DISABLE([luatex], [no hstrerror()]) WEB2C_DISABLE([luatex53], [no hstrerror()])],
137 [lua_socketlibs="$lua_socketlibs $ac_cv_search_hstrerror"])
138 AS_CASE([$ac_cv_search_inet_aton],
139 ["none required"], [],
140 [no], [WEB2C_DISABLE([luatex], [no inet_aton()]) WEB2C_DISABLE([luatex53], [no inet_aton()])],
141 [lua_socketlibs="$lua_socketlibs $ac_cv_search_inet_aton"])
142 AS_CASE([$ac_cv_search_gethostbyname],
143 ["none required"], [],
144 [no], [WEB2C_DISABLE([luatex], [no gethostbyname()]) WEB2C_DISABLE([luatex53], [no gethostbyname()])],
145 [lua_socketlibs="$lua_socketlibs $ac_cv_search_gethostbyname"])
146 AS_CASE([$ac_cv_search_nanosleep],
147 ["none required"], [],
148 [no], [WEB2C_DISABLE([luatex], [no nanosleep()]) WEB2C_DISABLE([luatex53], [no nanosleep()])],
149 [lua_socketlibs="$lua_socketlibs $ac_cv_search_nanosleep"])
150 else
151 AC_CHECK_LIB([ws2_32], [main],
152 [lua_socketlibs="$socketlibs -lws2_32"],
153 [WEB2C_DISABLE([luatex], [no getaddrinfo()]) WEB2C_DISABLE([luatex53], [no getaddrinfo()])])
154 fi
155 AM_CONDITIONAL([USE_DLOPEN], [test "x$ac_cv_header_dlfcn_h" = xyes])
156 AC_SUBST([lua_socketlibs])
157 AC_SUBST([ipc_socketlibs])
158
159 dnl Generate *TEX and ALEPH conditionals.
160 m4_foreach([Kpse_Prog], [kpse_tex_progs],
161 [m4_ifset([Kpse_Prog],
162 [KPSE_XTEX_COND(Kpse_Prog)])])[]dnl
163
164 test "x$enable_omfonts" = xno || enable_omfonts=yes
165
166 AS_IF([test "x$enable_aleph:$enable_xetex:$enable_omfonts" = xno:no:yes],
167 [enable_otangle=no],
168 [enable_otangle=yes])
169 AM_CONDITIONAL([OTANGLE],
170 [test "x$enable_otangle" = xyes])[]dnl
171
172 # Handle --with-mf-x-toolkit and --with-x
173 AS_CASE([$with_mf_x_toolkit],
174 [yes|no], [],
175 [''], [with_mf_x_toolkit=no],
176 [y|ye], [with_mf_x_toolkit=yes],
177 [n], [with_mf_x_toolkit=no],
178 [AC_MSG_WARN([unknown --with-mf-x-toolkit argument \`$with_mf_x_toolkit'; using no.])
179 with_mf_x_toolkit=no])
180 test "x$with_x_toolkit" = xyes && with_x=yes
181 test "x$with_x" = xno && with_x_toolkit=no
182
183 dnl Generate MF* conditionals and set with_x.
184 m4_foreach([Kpse_Prog], [kpse_mf_progs],
185 [m4_ifset([Kpse_Prog],
186 [KPSE_XMF_COND(Kpse_Prog)])])[]dnl
187 : ${with_x=yes}
188
189 # Distinguish no X at all, no toolkit, or toolkit.
190 AC_PATH_XTRA
191 if test "x$with_x" = xyes; then
192 if test "x$no_x" = xyes; then
193 AC_MSG_ERROR([Sorry, could not find X include and library files required for Metafont.])
194 fi
195 test -n "$x_libraries" && XLFLAG="-L$x_libraries"
196 wlibs="$XLFLAG -lX11"
197 if test -z "$x_ext_lib"; then # allow envvar override
198 AC_CHECK_LIB([Xext], [XextCreateExtension],
199 [x_ext_lib=-lXext], ,
200 [$wlibs $X_EXTRA_LIBS])
201 fi
202 test "x$with_mf_x_toolkit" = xyes && x_tool_libs="-lXt"
203 AC_DEFINE([X11WIN], 1, [Define to include X11 window in Metafont.])
204 fi # have X
205 AM_CONDITIONAL([MFXT], [test "x$with_mf_x_toolkit" = xyes])
206 AC_SUBST([x_ext_lib])
207 AC_SUBST([x_tool_libs])
208 AC_SUBST([wlibs])
209
210 dnl Generate MetaFont *WIN defines.
211 m4_foreach([Kpse_Win], [kpse_mf_win],
212 [m4_ifset([Kpse_Win],
213 [KPSE_MFWIN_DEFINE(Kpse_Win)])])[]dnl
214
215 AM_CONDITIONAL([WEB], [test "x$enable_web_progs" != xno])
216
217 AS_IF([test "x$enable_eptex" = xno:no],
218 [enable_pweb_progs=no],
219 [enable_pweb_progs=$enable_web_progs])
220 AM_CONDITIONAL([PWEB], [test "x$enable_pweb_progs" != xno])
221
222 AS_IF([test "x$enable_euptex" = xno:no],
223 [enable_upweb_progs=no],
224 [enable_upweb_progs=$enable_web_progs])
225 AM_CONDITIONAL([UPWEB], [test "x$enable_upweb_progs" != xno])
226
227 AC_PROG_YACC
228 KPSE_PROG_LEX
229
230 # Needed on A/UX 3.0. I don't want to pull in other -lposix's, though.
231 # From: [email protected] (Bernt Guldbrandtsen)
232 if test `(uname) 2>/dev/null` = aux; then
233 AC_CHECK_LIB([posix], [sigemptyset])
234 fi
235
236 AC_C_CHAR_UNSIGNED
237 AC_CHECK_SIZEOF([int])
238 if test $ac_cv_sizeof_int -lt 4; then
239 AC_MSG_ERROR([Sorry, need `int' with at least 4 bytes.])
240 fi
241 AC_CHECK_SIZEOF([long])
242 AC_SEARCH_LIBS([pow], [m])
243 AC_CHECK_FUNCS([access atoi fmax ftime gettimeofday fabs labs mkdtemp setlocale strerror strlcat strlcpy strndup])
244 AC_CHECK_DECLS([strndup])
245 AC_CHECK_HEADERS([errno.h langinfo.h locale.h sys/time.h sys/timeb.h sys/wait.h time.h])
246 AC_CHECK_SIZEOF([void *])
247 AC_TYPE_UINTPTR_T
248 AC_TYPE_LONG_DOUBLE
249 AC_HEADER_STDBOOL
250
251 dnl sharable format files.
252 AC_C_BIGENDIAN
253
254 dnl FIXME: obsolete
255 AC_TYPE_SIGNAL
256
257 # kpse_kpathsea_flags needs to pull in pkg-config, in case of a system
258 # kpathsea being used. So nothing above should use pkg-config.
259 KPSE_KPATHSEA_FLAGS
260
261 KPSE_PTEXENC_FLAGS
262 KPSE_PPLIB_FLAGS
263 KPSE_ZLIB_FLAGS
264 KPSE_LUA53_FLAGS
265 KPSE_LUA52_FLAGS
266 KPSE_LUAJIT_FLAGS
267 KPSE_LIBPNG_FLAGS
268 KPSE_FREETYPE2_FLAGS
269 KPSE_PIXMAN_FLAGS
270 KPSE_CAIRO_FLAGS
271 KPSE_POTRACE_FLAGS
272 KPSE_GMP_FLAGS
273 KPSE_MPFR_FLAGS
274 KPSE_MPFI_FLAGS
275 KPSE_XPDF_FLAGS
276 KPSE_ZZIPLIB_FLAGS
277 KPSE_TECKIT_FLAGS
278
279 # XeTeX and lua[jit]hbtex and hitex need harfbuzz, though regular
280 # luatex[53] does not.
281 if test "x$enable_xetex" = xyes \
282 || test "x$enable_luahbtex" = xyes \
283 || test "x$enable_luajithbtex" = xyes \
284 || test "x$enable_hitex" = xyes; then
285 KPSE_HARFBUZZ_FLAGS
286 fi # end xetex/luatex for harfbuzz
287
288 # XeTeX, but not LuaTeX, needs icu and graphite.
289 if test "x$enable_xetex" = xyes; then
290 KPSE_ICU_FLAGS
291 KPSE_GRAPHITE2_FLAGS
292
293 # XeTeX also needs fontconfig or the Mac ApplicationServices.
294 KPSE_CHECK_FRAMEWORK([ApplicationServices], [CTFontRef font])
295 KPSE_FONTCONFIG_FLAGS
296 AS_IF([test "x$kpse_cv_have_ApplicationServices:$kpse_cv_have_fontconfig" = xno:no],
297 [WEB2C_DISABLE([xetex],
298 [neither ApplicationServices framework nor fontconfig library])])
299
300 fi # end xetex for icu/graphite and fontconfig/mac font lookups.
301
302 # Are we building XeTeX on Mac? Automake conditional required regardless.
303 AM_CONDITIONAL([XETEX_MACOSX],
304 [(test "x$enable_xetex" = xyes \
305 && test "x$kpse_cv_have_ApplicationServices" = xyes)])
306
307 # Check size of off_t (using <kpathsea/config.h>)
308 KPSE_ADD_FLAGS([kpathsea])
309 AC_CHECK_SIZEOF([off_t], , AC_INCLUDES_DEFAULT
310 [#include <kpathsea/config.h>])
311
312 if test "x$with_system_kpathsea" = xyes; then
313 # We want to support building Web2C (TeX & co.)
314 # using installed (system) kpathsea headers and library.
315 # In that case we need the location of <kpathsea/paths.h>.
316 list="/usr/include /usr/local/include `echo $KPATHSEA_INCLUDES | sed 's/-I//g'`"
317 found=no
318 for KPATHSEA_PATHS_H in $list; do
319 if test -r "$KPATHSEA_PATHS_H/kpathsea/paths.h"; then
320 found=yes
321 break
322 fi
323 done
324 if test "x$found" = xno; then
325 AC_MSG_NOTICE([You requested to build `web2c' using an installed `kpathsea' version,])
326 AC_MSG_NOTICE([ which requires to locate the <kpathsea/paths.h> header file.])
327 AC_MSG_ERROR([Sorry, not found under any of: $list *****])
328 fi
329 else
330 KPATHSEA_PATHS_H='${top_builddir}/..'
331 fi
332 AC_SUBST([KPATHSEA_PATHS_H])
333
334 dnl Check for Object::initCmd(const char *) etc
335 AC_LANG_PUSH([C++])
336 AC_MSG_CHECKING([for Object::[initCmd(const char*)] etc])
337 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Object.h>]],
338 [[Object *obj; const char *name;
339 obj->initCmd(name)->isStream(name);]])],
340 [kpse_cv_have_Object_initCmd_const_charp=yes],
341 [kpse_cv_have_Object_initCmd_const_charp=no])
342 AC_MSG_RESULT([$kpse_cv_have_Object_initCmd_const_charp])
343 AC_LANG_POP([C++])
344 if test "x$kpse_cv_have_Object_initCmd_const_charp" = xyes; then
345 AC_DEFINE([HAVE_OBJECT_INITCMD_CONST_CHARP], 1,
346 [Define to 1 if you have the `Object::initCmd(const char*)' function.])
347 fi
348 KPSE_RESTORE_FLAGS
349
350 dnl Write output here, instead of putting a zillion -D's on the command line.
351 AC_CONFIG_HEADERS([w2c/c-auto.h:c-auto.in],
352 [sed -e 's/^#define PACKAGE/#define WEB2C_PACKAGE/' \
353 -e 's/^#define VERSION/#define WEB2C_VERSION/' w2c/c-auto.h >c-auto.tmp \
354 && mv -f c-auto.tmp w2c/c-auto.h])
355
356 AH_TOP([/* w2c/c-auto.h: defines for web2c, as determined by configure.
357
358 Copyright 1994-97, 2008-2021 Karl Berry.
359 Copyright 1997-99, 2002, 2005 Olaf Weber.
360
361 This program is free software: you can redistribute it and/or modify
362 it under the terms of the GNU General Public License as published by
363 the Free Software Foundation, either version 3 of the License, or
364 (at your option) any later version.
365
366 This program is distributed in the hope that it will be useful,
367 but WITHOUT ANY WARRANTY; without even the implied warranty of
368 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
369 GNU General Public License for more details.
370
371 You should have received a copy of the GNU General Public License
372 along with this program. If not, see <http://www.gnu.org/licenses/>. */
373
374 /* Guard against double inclusion. */
375 #ifndef WEB2C_C_AUTO_H
376 #define WEB2C_C_AUTO_H
377
378 /* web2c: the version string. */
379 #define WEB2CVERSION "REPLACE-WITH-WEB2CVERSION"])
380 AH_BOTTOM([#endif /* !WEB2C_C_AUTO_H */])
381
382 dnl Additional config header for LuaTeX
383 AC_CONFIG_HEADERS([ff-config.h:luatexdir/luafontloader/ff-config.in])
384
385 # For cross-compilation. Put at the end so there is a fair chance
386 # these are still visible when the configure script has finished.
387
388 # The supporting programs we need to have available on the build machine.
389 # make variable cross native
390 KPSE_CROSS_PATH_PROG([TANGLEBOOT], [tangle], [./tangleboot])
391 KPSE_CROSS_PATH_PROG([TANGLE], [tangle], [./tangle])
392 KPSE_CROSS_PATH_PROG([CTANGLEBOOT], [ctangle], [./ctangleboot])
393 KPSE_CROSS_PATH_PROG([CTANGLE], [ctangle], [./ctangle])
394 KPSE_CROSS_PATH_PROG([TIE], [tie], [./tie])
395 dnl Required for Aleph and XeTeX
396 KPSE_CROSS_PATH_PROG([OTANGLE], [otangle], [./otangle])
397
398 if test "x$cross_compiling" = xyes; then
399 AC_MSG_CHECKING([if your tie supports WEBINPUTS])
400 ( WEBINPUTS=$srcdir/tiedir
401 export WEBINPUTS
402 $TIE -c tie.outc tie.tie tie.cf1 tie.cf2 tie.cf3
403 $TIE -m tie.outm tie.tie tie.cf1 tie.cf2 tie.cf3 ) >/dev/null 2>&1
404 if diff tie.outc $srcdir/tiedir/tie.chf.gen >/dev/null 2>&1 && \
405 diff tie.outm $srcdir/tiedir/tie.master.gen >/dev/null 2>&1; then
406 tool_ok=yes
407 else
408 tool_ok=no
409 fi
410 AC_MSG_RESULT([$tool_ok])
411 if test "x$tool_ok" != xyes; then
412 AC_MSG_ERROR([Sorry, your $TIE is too old and does not support WEBINPUTS])
413 fi
414 rm -f tie.outc tie.outm
415 if test "x$enable_otangle" = xyes; then
416 AC_MSG_CHECKING([if your otangle supports WEBINPUTS])
417 ( WEBINPUTS=$srcdir/cftests
418 export WEBINPUTS
419 $OTANGLE cftest cftest ) >/dev/null 2>&1
420 if diff cftest.p $srcdir/cftests/ocftest.p >/dev/null 2>&1; then
421 tool_ok=yes
422 else
423 tool_ok=no
424 fi
425 AC_MSG_RESULT([$tool_ok])
426 if test "x$tool_ok" != xyes; then
427 AC_MSG_ERROR([Sorry, your $OTANGLE is too old and does not support WEBINPUTS])
428 fi
429 rm -f cftest.p
430 fi
431 fi
432
433 AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile man/Makefile
434 omegafonts/Makefile otps/Makefile otps/win32/Makefile
435 window/Makefile])
436 AC_CONFIG_FILES([web2c-sh], [chmod +x web2c-sh])
437 AC_CONFIG_FILES([tangle-sh], [chmod +x tangle-sh])
438 AC_CONFIG_FILES([ctangleboot-sh], [chmod +x ctangleboot-sh])
439 AC_CONFIG_FILES([silent-sh], [chmod +x silent-sh])
440
441 dnl Additional code for synctex
442 m4_sinclude([synctexdir/ac/synctex.ac])
443
444 dnl The subdirectory web2c must be configured for the build system.
445 KPSE_NATIVE_SUBDIRS([web2c])
446
447 AC_OUTPUT