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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
dnl Process this file with autoconf to produce a configure script.
dnl Adapted for TeX Live.
m4_include([version.ac])[] dnl define lcdf_typetools_version
AC_INIT([LCDF typetools for TeX Live], lcdf_typetools_version, [tex-k@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([lcdf-typetools-]lcdf_typetools_version[/NEWS])
AC_CONFIG_AUX_DIR([../../build-aux])
AC_CONFIG_MACRO_DIR([../../m4])
dnl Common code for all programs using libkpathsea.
KPSE_COMMON([lcdf-typetools])
LCDF_TYPETOOLS_VERSION=lcdf_typetools_version
AC_SUBST([LCDF_TYPETOOLS_VERSION])
AM_CONFIG_HEADER([autoconf.h])
AC_PROG_CXX
AC_PROG_CXXCPP
CC="$CC $WARNING_CFLAGS"
CXX="$CXX $WARNING_CXXFLAGS"
AC_CXX_TEMPLATE_OBJS
KPSE_CXX_HACK
dnl
dnl directory searching
dnl
AC_LANG_C
AC_HEADER_DIRENT
AC_CHECK_HEADERS([fcntl.h unistd.h sys/time.h sys/wait.h])
dnl
dnl <new> and/or <new.h>
dnl
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK([whether <new> works], ac_cv_good_new_hdr,
[AC_TRY_LINK([#include <new>], [
int a;
int *b = new(&a) int;
return 0;
], ac_cv_good_new_hdr=yes, ac_cv_good_new_hdr=no)])
if test "$ac_cv_good_new_hdr" = yes; then
AC_DEFINE([HAVE_NEW_HDR], [1], [Define if <new> exists and works.])
fi
AC_CHECK_HEADERS([new.h])
dnl
dnl endianness
dnl
AC_C_BIGENDIAN(, [AC_DEFINE([WORDS_LITTLEENDIAN], 1, [Define to 1 if your processor stores words with the least significant byte
first (like Intel and VAX, unlike Motorola and SPARC).])])
dnl
dnl functions such as strerror, working strtod, working strnlen, strtoul,
dnl time headers such as unistd.h
dnl
AC_LANG_C
need_fixlibc=0
AC_CHECK_FUNCS([strerror], [], [need_fixlibc=1])
AC_CACHE_CHECK([for broken strtod], [ac_cv_broken_strtod],
[AC_TRY_RUN([#include <stdio.h>
#include <stdlib.h>
int main(int c, char **v) {
char s[] = "12 ";
char *endp;
double d = strtod(s, &endp);
return (s + 2) == endp;
}], [ac_cv_broken_strtod=yes], [ac_cv_broken_strtod=no],
[ac_cv_broken_strtod=no])])
if test "x$ac_cv_broken_strtod" = xyes; then
need_fixlibc=1
AC_DEFINE([HAVE_BROKEN_STRTOD], [1], [Define if strtod is broken.])
fi
AC_LANG_CPLUSPLUS
AC_CHECK_DECLS([strnlen], [], [], [#include <string.h>])
AC_CHECK_FUNCS([strnlen], [have_strnlen=1], [need_fixlibc=1])
if test "x$have_strnlen" = x1; then
AC_CACHE_CHECK([for broken strnlen], [ac_cv_broken_strnlen],
[AC_TRY_RUN([#include <string.h>
#include <stdio.h>
int main(int c, char **v) {
char s[] = "01234567891";
return strnlen(s, 10) == 10;
}], [ac_cv_broken_strnlen=yes], [ac_cv_broken_strnlen=no],
[ac_cv_broken_strnlen=no])])
if test "x$ac_cv_broken_strnlen" = xyes; then
need_fixlibc=1
AC_DEFINE([HAVE_BROKEN_STRNLEN], [1], [Define if strnlen is broken.])
fi
fi
AC_LANG_C
AC_CHECK_FUNCS([ctime ftruncate mkstemp sigaction strdup strtoul vsnprintf waitpid])
AC_CHECK_FUNC([floor], [], [AC_CHECK_LIB([m], [floor])])
AC_CHECK_FUNC([fabs], [], [AC_CHECK_LIB([m], [fabs])])
AM_CONDITIONAL([FIXLIBC], [test x$need_fixlibc = x1])
dnl
dnl integer types
dnl
AC_CHECK_HEADERS(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no)
AC_CHECK_HEADERS(sys/types.h, have_sys_types_h=yes, have_sys_types_h=no)
if test $have_inttypes_h = no -a $have_sys_types_h = yes; then
AC_CACHE_CHECK([for uintXX_t typedefs], ac_cv_uint_t,
[AC_EGREP_HEADER(dnl
changequote(<<,>>)<<(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]>>changequote([,]),
sys/types.h, ac_cv_uint_t=yes, ac_cv_uint_t=no)])
fi
if test $have_inttypes_h = no -a $have_sys_types_h = yes -a "$ac_cv_uint_t" = no; then
AC_CACHE_CHECK([for u_intXX_t typedefs], ac_cv_u_int_t,
[AC_EGREP_HEADER(dnl
changequote(<<,>>)<<(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]>>changequote([,]),
sys/types.h, ac_cv_u_int_t=yes, ac_cv_u_int_t=no)])
fi
if test $have_inttypes_h = yes -o "$ac_cv_uint_t" = yes; then
:
elif test "$ac_cv_u_int_t" = yes; then
AC_DEFINE(HAVE_U_INT_TYPES, 1, [Define if you have u_intXX_t types but not uintXX_t types.])
else
AC_MSG_WARN([
=========================================
Neither uint32_t nor u_int32_t defined by <inttypes.h> or <sys/types.h>!
Assuming "short" has 16 bits and "int" has 32 bits.
=========================================])
AC_DEFINE(HAVE_FAKE_INT_TYPES, 1, [Define if intXX_t types are not available.])
fi
AC_CHECK_TYPES(uintptr_t, [], [],
[#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned int)
dnl
dnl ntohs, ntohl (need them in C++ code)
dnl
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(byteorder.h netinet/in.h sys/param.h)
AC_MSG_CHECKING([whether ntohs and ntohl are defined])
ac_ntoh_defined=no
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_BYTEORDER_H
# include <byteorder.h>
#elif HAVE_NETINET_IN_H
# include <netinet/in.h>
#elif HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef WIN32
# ifdef __MSC_VER
# pragma warning (disable: 4290)
# endif
# include <winsock2.h>
#endif
]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
[AC_MSG_RESULT(yes)
ac_ntoh_defined=yes],
[AC_MSG_RESULT(no)])
if test $ac_ntoh_defined = no; then
AC_CHECK_HEADERS([arpa/inet.h], [have_arpa_inet_h=yes], [have_arpa_inet_h=no])
if test $have_arpa_inet_h = yes; then
AC_MSG_CHECKING([whether ntohs and ntohl are defined in <arpa/inet.h>])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <arpa/inet.h>
]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(NEED_ARPA_INET_H, 1, [Define to 1 if you must include <arpa/inet.h> to get `ntohl'.])
ac_ntoh_defined=yes],
[AC_MSG_RESULT(no)])
fi
fi
if test $ac_ntoh_defined = no; then
AC_MSG_WARN([
=========================================
Cannot find a definition for ntohs and/or ntohl!
=========================================])
if test "x$enable_build" != xno; then
AC_MSG_ERROR([exiting])
fi
fi
AC_LANG_C
KPSE_CHECK_WIN32
if test "x$kpse_cv_have_win32" != xno; then
LIBS="$LIBS -lwsock32"
fi
dnl
dnl is va_list addressable?
dnl
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK([for addressable va_list type],
ac_cv_va_list_addr,
[AC_TRY_COMPILE([#include <stdarg.h>
void f(va_list *) {
}
void g(va_list val) {
f(&val);
}
void h(int a, ...) {
va_list val;
va_start(val, a);
g(val);
va_end(val);
}], [h(2, 3, 4);], ac_cv_va_list_addr=yes, ac_cv_va_list_addr=no)])
if test "x$ac_cv_va_list_addr" = xyes; then
AC_DEFINE(HAVE_ADDRESSABLE_VA_LIST, 1, [Define if the va_list type is addressable.])
fi
dnl
dnl select programs to be compiled and automatically run
dnl
m4_include([ac/lcdf-typetools.ac])
SELECTED_SUBDIRS=
AC_FOREACH([Kpse_Prog], kpse_lcdf_typetools_progs,
[test "x$enable_[]Kpse_Prog" = xno || SELECTED_SUBDIRS="$SELECTED_SUBDIRS Kpse_Prog"
])
AC_SUBST(SELECTED_SUBDIRS)
AC_FOREACH([Kpse_Opt], kpse_otftotfm_auto_opts,
[AS_IF([test "x$enable_auto_]Kpse_Opt[" != xno],
[AC_DEFINE([HAVE_AUTO_]AS_TR_CPP(Kpse_Opt), 1,
[Define to run ]Kpse_Opt[ from otftotfm.])])
])
dnl
dnl kpathsea
dnl
dnl The configure option '--enable-texlive-build' is inherited
dnl and automatically enabled, when built as part of TeX Live.
AM_CONDITIONAL([texlive_build], [test "x$enable_texlive_build" = xyes])
AC_ARG_WITH([kpathsea],
AS_HELP_STRING([--without-kpathsea],
[build otftotfm without kpathsea]))
KPSE_KPATHSEA_FLAGS
if test "x$enable_build" != xno || test -f config.force; then
KPSE_ADD_FLAGS([kpathsea])
if test "x$with_kpathsea" != xno; then
AC_MSG_CHECKING([for kpathsea headers and library])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <kpathsea/kpathsea.h>]],
[[kpse_tfm_format;]])],
[AC_MSG_RESULT([yes])
AC_CHECK_DECLS([kpse_opentype_format], , ,
[#include <kpathsea/kpathsea.h>])
AC_CHECK_DECLS([kpse_enc_format], , ,
[#include <kpathsea/kpathsea.h>])],
[AC_MSG_RESULT([no])
with_kpathsea=no])
if test "x$with_kpathsea" = xno; then
AC_MSG_ERROR([
=========================================
I can't find the kpathsea library and/or header files. Tell me where to look
using the --with-kpathsea-libdir=DIR option (library under DIR) and
--with-kpathsea-includes=DIR option (header files under DIR/kpathsea), or
disable kpathsea support using --without-kpathsea.
=========================================])
fi
AC_DEFINE(HAVE_KPATHSEA, 1, [Define if you want to use kpathsea.])
fi
KPSE_RESTORE_FLAGS
echo timestamp >config.force
fi
AM_CONDITIONAL([have_kpathsea], [test "x$with_kpathsea" != xno])
AC_ARG_ENABLE([selfauto-set],
AS_HELP_STRING([--disable-selfauto-set], [disable setting SELFAUTO variables from kpsewhich]),
[], [enable_selfauto_set=yes])
if test "x$enable_selfauto_set" = xyes -a "x$kpathsea" != xno -a "x$enable_texlive_build" != xyes; then
kpsewhich='kpsewhich'
test "x$kpathsea" != xyes -a -x "$kpathsea/bin/kpsewhich" && kpsewhich="$kpathsea/bin/kpsewhich"
SELFAUTOLOC=`$kpsewhich --expand-var='$SELFAUTOLOC' 2>/dev/null`
SELFAUTODIR=`$kpsewhich --expand-var='$SELFAUTODIR' 2>/dev/null`
SELFAUTOPARENT=`$kpsewhich --expand-var='$SELFAUTOPARENT' 2>/dev/null`
if test -z "$SELFAUTODIR"; then
AC_MSG_WARN([
=========================================
Could not extract SELFAUTO variables from $kpsewhich.
Either supply the correct PREFIX to --with-kpathsea, or supply
--disable-selfauto-loc.
=========================================])
fi
AC_DEFINE_UNQUOTED([SELFAUTOLOC], "$SELFAUTOLOC", [kpsewhich's $SELFAUTOLOC variable])
AC_DEFINE_UNQUOTED([SELFAUTODIR], "$SELFAUTODIR", [kpsewhich's $SELFAUTODIR variable])
AC_DEFINE_UNQUOTED([SELFAUTOPARENT], "$SELFAUTOPARENT", [kpsewhich's $SELFAUTOPARENT variable])
fi
dnl
dnl glyphlist.txt and *.enc installation locations
dnl
glyphlistdir='${datarootdir}/texmf-dist/fonts/map/glyphlist'
encdir='${datarootdir}/texmf-dist/fonts/enc/dvips/base'
AC_SUBST([glyphlistdir])
AC_SUBST([encdir])
dnl
dnl verbatim portions of the header
dnl
AC_DEFINE(HAVE_PERMSTRING, 1, [Define if PermStrings are available.])
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.])
dnl PATHNAME_SEPARATOR?
dnl
dnl set path variables
dnl
shell_expand () {
val=`eval echo '$'"$1"`
while echo "x$val" | fgrep '$' >/dev/null 2>&1; do val=`eval echo "$val"`; done
eval "$1='$val'"
}
dnl Preset $prefix and $exec_prefix.
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
shell_expand datadir
if test "x$enable_native_texlive_build" = xyes; then
gdir=/nonesuch
else
gdir="$glyphlistdir"
for i in data dataroot pkgdata g; do shell_expand ${i}dir; done
fi
AC_DEFINE_UNQUOTED([GLYPHLISTDIR], ["$gdir"], [Directory for glyphlist.txt files.])
dnl
dnl Output
dnl
AC_SUBST([LCDF_TYPETOOLS_TREE], [lcdf-typetools-]lcdf_typetools_version)
AC_CONFIG_FILES([Makefile lcdf-typetools-]lcdf_typetools_version[/Makefile])
AC_FOREACH([Kpse_Prog], [liblcdf libefont] kpse_lcdf_typetools_progs,
[AC_CONFIG_FILES([lcdf-typetools-]lcdf_typetools_version[/]Kpse_Prog[/Makefile])])
AC_OUTPUT
|