Debian Codegraph @

texk/lcdf-typetools/configure.ac

raw
1 dnl $Id: configure.ac 76585 2025-10-16 14:46:21Z karl $
2 dnl Process this file with autoconf to produce a configure script.
3 dnl
4 dnl Copyright 2014-2025 Karl Berry <[email protected]>
5 dnl Copyright 2009-2014 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 Adapted for TeX Live from lcdf-typetools-src/configure.ac
14 dnl Copyright (c) 1997-2011 Eddie Kohler
15 dnl
16 dnl *********************************************************************
17 dnl
18 m4_include([version.ac])[] dnl define lcdf_typetools_version
19 AC_INIT([LCDF typetools (TeX Live)],[lcdf_typetools_version],[[email protected]])
20 AC_PREREQ([2.71])
21 AC_CONFIG_SRCDIR([lcdf-typetools-src/NEWS.md])
22 AC_CONFIG_AUX_DIR([../../build-aux])
23 AC_CONFIG_MACRO_DIRS([../../m4 m4])
24
25 dnl Common code for all programs using libkpathsea.
26 KPSE_COMMON([lcdf-typetools])
27
28 AC_SUBST([LCDF_TYPETOOLS_VERSION], lcdf_typetools_version)
29
30 AC_CONFIG_HEADERS([autoconf.h])
31
32 AC_PROG_CXX
33 AC_PROG_CXXCPP
34
35 CC="$CC $WARNING_CFLAGS"
36 CXX="$CXX $WARNING_CXXFLAGS"
37
38 AC_ARG_ENABLE([precondition-checking],
39 [AS_HELP_STRING([--enable-precondition-checking], [include precondition checking assertions])],
40 [if test "$enableval" = yes; then
41 AC_DEFINE([HAVE_PRECONDITION_CHECKING], [1], [Define to include precondition checking assertions.])
42 fi])
43
44 AC_ARG_ENABLE([adobe-code],
45 [AS_HELP_STRING([--disable-adobe-code], [do not include Adobe code])],
46 [], [enable_adobe_code=yes])
47 if test "$enable_adobe_code" = yes; then
48 AC_DEFINE([HAVE_ADOBE_CODE], [1], [Define to include Adobe code in output fonts.])
49 fi
50
51 AC_CXX_TEMPLATE_OBJS
52
53 KPSE_CXX_HACK
54
55
56 dnl
57 dnl directory searching
58 dnl
59
60 AC_LANG([C])
61 AC_HEADER_DIRENT
62 AC_CHECK_HEADERS([fcntl.h unistd.h sys/time.h sys/wait.h])
63
64
65 dnl
66 dnl <new> and/or <new.h>
67 dnl
68
69 AC_LANG([C++])
70 AC_CACHE_CHECK([whether <new> works], ac_cv_good_new_hdr,
71 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <new>]], [[
72 int a;
73 int *b = new(&a) int;
74 return 0;
75 ]])],[ac_cv_good_new_hdr=yes],[ac_cv_good_new_hdr=no])])
76 if test "$ac_cv_good_new_hdr" = yes; then
77 AC_DEFINE([HAVE_NEW_HDR], [1], [Define if <new> exists and works.])
78 fi
79 AC_CHECK_HEADERS([new.h])
80
81
82 dnl
83 dnl `nullptr`
84 dnl
85
86 AC_MSG_CHECKING([for nullptr])
87 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
88 int* x = nullptr;
89 return !!x;
90 ]])],[AC_MSG_RESULT([supported])],[AC_MSG_RESULT([not supported])
91 AC_MSG_CHECKING([for nullptr with -std=gnu++11])
92 OLD_CXX="$CXX"
93 CXX="$CXX -std=gnu++11"
94 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
95 int* x = nullptr;
96 return !!x;
97 ]])],[AC_MSG_RESULT([supported])],[AC_MSG_RESULT([not supported])
98 AC_MSG_ERROR([The $OLD_CXX compiler does not support the C++11 `nullptr` keyword.])])])
99
100
101 dnl
102 dnl endianness
103 dnl
104
105 AC_DEFINE([WORDS_BIGENDIAN_SET], [1], [Define if WORDS_BIGENDIAN has been set.])
106 AC_C_BIGENDIAN()
107
108
109 dnl
110 dnl functions such as strerror, working strtod, working strnlen, strtoul,
111 dnl time headers such as unistd.h
112 dnl
113
114 AC_LANG([C])
115 need_fixlibc=0
116 AC_CHECK_FUNCS([strerror], [], [need_fixlibc=1])
117
118 AC_CACHE_CHECK([for broken strtod], [ac_cv_broken_strtod],
119 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
120 #include <stdlib.h>
121 int main(int c, char **v) {
122 char s[] = "12 ";
123 char *endp;
124 double d = strtod(s, &endp);
125 return (s + 2) == endp;
126 }]])],[ac_cv_broken_strtod=yes],[ac_cv_broken_strtod=no],[ac_cv_broken_strtod=no])])
127 if test "x$ac_cv_broken_strtod" = xyes; then
128 need_fixlibc=1
129 AC_DEFINE([HAVE_BROKEN_STRTOD], [1], [Define if strtod is broken.])
130 fi
131
132 AC_LANG([C++])
133 AC_CHECK_DECLS([strnlen], [], [], [#include <string.h>])
134 AC_CHECK_FUNCS([strnlen], [have_strnlen=1], [need_fixlibc=1])
135 if test "x$have_strnlen" = x1; then
136 AC_CACHE_CHECK([for broken strnlen], [ac_cv_broken_strnlen],
137 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <string.h>
138 #include <stdio.h>
139 int main(int c, char **v) {
140 char s[] = "01234567891";
141 return strnlen(s, 10) == 10;
142 }]])],[ac_cv_broken_strnlen=yes],[ac_cv_broken_strnlen=no],[ac_cv_broken_strnlen=no])])
143 if test "x$ac_cv_broken_strnlen" = xyes; then
144 need_fixlibc=1
145 AC_DEFINE([HAVE_BROKEN_STRNLEN], [1], [Define if strnlen is broken.])
146 fi
147 fi
148 AC_LANG([C])
149
150 AC_CHECK_FUNCS([ctime ftruncate mkstemp sigaction strdup strtoul vsnprintf waitpid])
151 AC_CHECK_FUNC([floor], [], [AC_CHECK_LIB([m], [floor])])
152 AC_CHECK_FUNC([fabs], [], [AC_CHECK_LIB([m], [fabs])])
153 AM_CONDITIONAL([FIXLIBC], [test x$need_fixlibc = x1])
154
155
156 dnl
157 dnl integer types
158 dnl
159
160 AC_CHECK_HEADERS(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no)
161 AC_CHECK_HEADERS(sys/types.h, have_sys_types_h=yes, have_sys_types_h=no)
162
163 if test $have_inttypes_h = no -a $have_sys_types_h = yes; then
164 AC_CACHE_CHECK([for uintXX_t typedefs], ac_cv_uint_t,
165 [AC_EGREP_HEADER(dnl
166 changequote(<<,>>)<<(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]>>changequote([,]),
167 sys/types.h, ac_cv_uint_t=yes, ac_cv_uint_t=no)])
168 fi
169 if test $have_inttypes_h = no -a $have_sys_types_h = yes -a "$ac_cv_uint_t" = no; then
170 AC_CACHE_CHECK([for u_intXX_t typedefs], ac_cv_u_int_t,
171 [AC_EGREP_HEADER(dnl
172 changequote(<<,>>)<<(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]>>changequote([,]),
173 sys/types.h, ac_cv_u_int_t=yes, ac_cv_u_int_t=no)])
174 fi
175 if test $have_inttypes_h = yes -o "$ac_cv_uint_t" = yes; then
176 :
177 elif test "$ac_cv_u_int_t" = yes; then
178 AC_DEFINE(HAVE_U_INT_TYPES, 1, [Define if you have u_intXX_t types but not uintXX_t types.])
179 else
180 AC_MSG_WARN([
181 =========================================
182
183 Neither uint32_t nor u_int32_t defined by <inttypes.h> or <sys/types.h>!
184 Assuming "short" has 16 bits and "int" has 32 bits.
185
186 =========================================])
187 AC_DEFINE(HAVE_FAKE_INT_TYPES, 1, [Define if intXX_t types are not available.])
188 fi
189
190 AC_CHECK_TYPES(uintptr_t, [], [],
191 [#if HAVE_INTTYPES_H
192 # include <inttypes.h>
193 #endif
194 #if HAVE_SYS_TYPES_H
195 # include <sys/types.h>
196 #endif
197 ])
198
199 AC_CHECK_SIZEOF(void *)
200 AC_CHECK_SIZEOF(unsigned long)
201 AC_CHECK_SIZEOF(unsigned int)
202
203
204 dnl
205 dnl ntohs, ntohl (need them in C++ code)
206 dnl
207
208 AC_LANG([C++])
209 AC_CHECK_HEADERS(byteorder.h netinet/in.h sys/param.h)
210 AC_MSG_CHECKING([whether ntohs and ntohl are defined])
211 ac_ntoh_defined=no
212 AC_COMPILE_IFELSE(
213 [AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
214 # include <sys/types.h>
215 #endif
216 #if HAVE_BYTEORDER_H
217 # include <byteorder.h>
218 #elif HAVE_NETINET_IN_H
219 # include <netinet/in.h>
220 #elif HAVE_SYS_PARAM_H
221 # include <sys/param.h>
222 #endif
223 #ifdef WIN32
224 # ifdef __MSC_VER
225 # pragma warning (disable: 4290)
226 # endif
227 # include <winsock2.h>
228 #endif
229 ]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
230 [AC_MSG_RESULT(yes)
231 ac_ntoh_defined=yes],
232 [AC_MSG_RESULT(no)])
233 if test $ac_ntoh_defined = no; then
234 AC_CHECK_HEADERS([arpa/inet.h], [have_arpa_inet_h=yes], [have_arpa_inet_h=no])
235 if test $have_arpa_inet_h = yes; then
236 AC_MSG_CHECKING([whether ntohs and ntohl are defined in <arpa/inet.h>])
237 AC_COMPILE_IFELSE(
238 [AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
239 # include <sys/types.h>
240 #endif
241 #include <arpa/inet.h>
242 ]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
243 [AC_MSG_RESULT(yes)
244 AC_DEFINE(NEED_ARPA_INET_H, 1, [Define to 1 if you must include <arpa/inet.h> to get `ntohl'.])
245 ac_ntoh_defined=yes],
246 [AC_MSG_RESULT(no)])
247 fi
248 fi
249 if test $ac_ntoh_defined = no; then
250 AC_MSG_WARN([
251 =========================================
252
253 Cannot find a definition for ntohs and/or ntohl!
254
255 =========================================])
256 if test "x$enable_build" != xno; then
257 AC_MSG_ERROR([exiting])
258 fi
259 fi
260 AC_LANG([C])
261 AC_SEARCH_LIBS([ntohs], [-lnet -lwinsock32])
262
263 KPSE_CHECK_WIN32
264 if test "x$kpse_cv_have_win32" != xno; then
265 LIBS="$LIBS -lwsock32"
266 fi
267
268 dnl
269 dnl is va_list addressable?
270 dnl
271
272 AC_LANG([C++])
273 AC_CACHE_CHECK([for addressable va_list type],
274 ac_cv_va_list_addr,
275 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
276 void f(va_list *) {
277 }
278 void g(va_list val) {
279 f(&val);
280 }
281 void h(int a, ...) {
282 va_list val;
283 va_start(val, a);
284 g(val);
285 va_end(val);
286 }]], [[h(2, 3, 4);]])],[ac_cv_va_list_addr=yes],[ac_cv_va_list_addr=no])])
287 if test "x$ac_cv_va_list_addr" = xyes; then
288 AC_DEFINE(HAVE_ADDRESSABLE_VA_LIST, 1, [Define if the va_list type is addressable.])
289 fi
290
291
292 dnl
293 dnl select programs to be compiled and automatically run
294 dnl
295
296 m4_include([ac/lcdf-typetools.ac])
297
298 SELECTED_SUBDIRS=
299 m4_foreach_w([Kpse_Prog],[kpse_lcdf_typetools_progs],[test "x$enable_[]Kpse_Prog" = xno || SELECTED_SUBDIRS="$SELECTED_SUBDIRS Kpse_Prog"
300 ])
301 AC_SUBST(SELECTED_SUBDIRS)
302
303 m4_foreach_w([Kpse_Opt],kpse_otftotfm_auto_opts,[AS_IF([test "x$enable_auto_]Kpse_Opt[" != xno],
304 [AC_DEFINE([HAVE_AUTO_]AS_TR_CPP(Kpse_Opt), 1,
305 [Define to run ]Kpse_Opt[ from otftotfm.])])
306 ])
307
308
309 dnl
310 dnl kpathsea
311 dnl
312
313 dnl The configure option '--enable-texlive-build' is inherited
314 dnl and automatically enabled, when built as part of TeX Live.
315
316 AM_CONDITIONAL([texlive_build], [test "x$enable_texlive_build" = xyes])
317
318 AC_ARG_WITH([kpathsea],
319 AS_HELP_STRING([--without-kpathsea],
320 [build otftotfm without kpathsea]))
321
322 KPSE_KPATHSEA_FLAGS
323
324 if test "x$enable_build" != xno || test -f config.force; then
325
326 KPSE_ADD_FLAGS([kpathsea])
327
328 if test "x$with_kpathsea" != xno; then
329 AC_MSG_CHECKING([for kpathsea headers and library])
330 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <kpathsea/kpathsea.h>]],
331 [[kpse_tfm_format;]])],
332 [AC_MSG_RESULT([yes])
333 AC_CHECK_DECLS([kpse_opentype_format], , ,
334 [#include <kpathsea/kpathsea.h>])
335 AC_CHECK_DECLS([kpse_enc_format], , ,
336 [#include <kpathsea/kpathsea.h>])],
337 [AC_MSG_RESULT([no])
338 with_kpathsea=no])
339
340 if test "x$with_kpathsea" = xno; then
341 AC_MSG_ERROR([
342 =========================================
343
344 I can't find the kpathsea library and/or header files. Tell me where to look
345 using the --with-kpathsea-libdir=DIR option (library under DIR) and
346 --with-kpathsea-includes=DIR option (header files under DIR/kpathsea), or
347 disable kpathsea support using --without-kpathsea.
348
349 =========================================])
350 fi
351 AC_DEFINE(HAVE_KPATHSEA, 1, [Define if you want to use kpathsea.])
352 fi
353
354 KPSE_RESTORE_FLAGS
355
356 echo timestamp >config.force
357 fi
358
359 AM_CONDITIONAL([have_kpathsea], [test "x$with_kpathsea" != xno])
360
361 AC_ARG_ENABLE([selfauto-set],
362 AS_HELP_STRING([--disable-selfauto-set], [disable setting SELFAUTO variables from kpsewhich]),
363 [], [enable_selfauto_set=yes])
364
365 if test "x$enable_selfauto_set" = xyes -a "x$kpathsea" != xno -a "x$enable_texlive_build" != xyes; then
366 kpsewhich='kpsewhich'
367 test "x$kpathsea" != xyes -a -x "$kpathsea/bin/kpsewhich" && kpsewhich="$kpathsea/bin/kpsewhich"
368 SELFAUTOLOC="`$kpsewhich --expand-var='$SELFAUTOLOC' 2>/dev/null`"
369 SELFAUTODIR="`$kpsewhich --expand-var='$SELFAUTODIR' 2>/dev/null`"
370 SELFAUTOPARENT="`$kpsewhich --expand-var='$SELFAUTOPARENT' 2>/dev/null`"
371 SELFAUTOGRANDPARENT="`$kpsewhich --expand-var='$SELFAUTOGRANDPARENT' 2>/dev/null`"
372 if test -z "$SELFAUTODIR"; then
373 AC_MSG_WARN([
374 =========================================
375
376 Could not extract SELFAUTO variables from $kpsewhich.
377 Either supply the correct PREFIX to --with-kpathsea, or supply
378 --disable-selfauto-loc.
379
380 =========================================])
381 fi
382 AC_DEFINE_UNQUOTED([SELFAUTOLOC], "$SELFAUTOLOC", [kpsewhich's $SELFAUTOLOC variable])
383 AC_DEFINE_UNQUOTED([SELFAUTODIR], "$SELFAUTODIR", [kpsewhich's $SELFAUTODIR variable])
384 AC_DEFINE_UNQUOTED([SELFAUTOPARENT], "$SELFAUTOPARENT", [kpsewhich's $SELFAUTOPARENT variable])
385 if test -n "$SELFAUTOGRANDPARENT" -a "$SELFAUTOGRANDPARENT" != '$SELFAUTOGRANDPARENT'; then
386 AC_DEFINE_UNQUOTED([SELFAUTOGRANDPARENT], "$SELFAUTOGRANDPARENT", [kpsewhich's $SELFAUTOGRANDPARENT variable])
387 fi
388 fi
389
390
391 dnl
392 dnl glyphlist.txt and *.enc installation locations
393 dnl
394 glyphlistdir='${datarootdir}/texmf-dist/fonts/map/glyphlist'
395 encdir='${datarootdir}/texmf-dist/fonts/enc/dvips/base'
396 AC_SUBST([glyphlistdir])
397 AC_SUBST([encdir])
398
399
400 dnl
401 dnl verbatim portions of the header
402 dnl
403
404 AC_DEFINE(HAVE_PERMSTRING, 1, [Define if PermStrings are available.])
405 AC_DEFINE(MMAFM_RUN_MMPFB, 1, [Define to 0 if you don't want mmafm to run mmpfb when it needs to get an intermediate master conversion program.])
406 dnl PATHNAME_SEPARATOR?
407
408
409 dnl
410 dnl set path variables
411 dnl
412
413 shell_expand () {
414 val=`eval echo '$'"$1"`
415 while echo "x$val" | grep '\$' >/dev/null 2>&1; do val=`eval echo "$val"`; done
416 eval "$1='$val'"
417 }
418
419 dnl Preset $prefix and $exec_prefix.
420 test "x$prefix" = xNONE && prefix=$ac_default_prefix
421 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
422
423 shell_expand datadir
424
425 if test "x$enable_native_texlive_build" = xyes; then
426 gdir=/nonesuch
427 else
428 gdir="$glyphlistdir"
429 for i in data dataroot pkgdata g; do shell_expand ${i}dir; done
430 fi
431 AC_DEFINE_UNQUOTED([GLYPHLISTDIR], ["$gdir"], [Directory for glyphlist.txt files.])
432
433
434 dnl
435 dnl Output
436 dnl
437
438 AC_SUBST([LCDF_TYPETOOLS_TREE], [lcdf-typetools-src])
439
440 AC_CONFIG_FILES([Makefile
441 lcdf-typetools-src/Makefile
442 lcdf-typetools-src/liblcdf/Makefile
443 lcdf-typetools-src/libefont/Makefile
444 lcdf-typetools-src/cfftot1/Makefile
445 lcdf-typetools-src/mmafm/Makefile
446 lcdf-typetools-src/mmpfb/Makefile
447 lcdf-typetools-src/otfinfo/Makefile
448 lcdf-typetools-src/otftotfm/Makefile
449 lcdf-typetools-src/t1dotlessj/Makefile
450 lcdf-typetools-src/t1lint/Makefile
451 lcdf-typetools-src/t1rawafm/Makefile
452 lcdf-typetools-src/t1reencode/Makefile
453 lcdf-typetools-src/t1testpage/Makefile
454 lcdf-typetools-src/ttftotype42/Makefile
455 ])
456 AC_OUTPUT