Debian Codegraph @

texk/lcdf-typetools/lcdf-typetools-src/configure.ac

raw
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([lcdf-typetools],[2.110])
3 AC_CONFIG_SRCDIR([NEWS.md])
4 AM_INIT_AUTOMAKE
5 AC_CONFIG_HEADERS([autoconf.h])
6 AM_MAINTAINER_MODE
7
8 AC_PROG_MAKE_SET
9
10 AC_PROG_CC
11 AC_PROG_CPP
12 AC_PROG_CXX
13 AC_PROG_CXXCPP
14
15 AC_ARG_ENABLE([warnings],
16 [AS_HELP_STRING([--enable-warnings], [compile with -W -Wall])],
17 [if test "$enableval" = yes; then
18 CFLAGS="$CFLAGS -W -Wall"; CXXFLAGS="$CXXFLAGS -W -Wall"
19 fi])
20
21 AC_ARG_ENABLE([precondition-checking],
22 [AS_HELP_STRING([--enable-precondition-checking], [include precondition checking assertions])],
23 [if test "$enableval" = yes; then
24 AC_DEFINE([HAVE_PRECONDITION_CHECKING], [1], [Define to include precondition checking assertions.])
25 fi])
26
27 AC_ARG_ENABLE([adobe-code],
28 [AS_HELP_STRING([--disable-adobe-code], [do not include Adobe code])],
29 [], [enable_adobe_code=yes])
30 if test "$enable_adobe_code" = yes; then
31 AC_DEFINE([HAVE_ADOBE_CODE], [1], [Define to incldue Adobe code in output fonts.])
32 fi
33
34
35 AM_PROG_AR
36 AC_PROG_RANLIB
37
38
39 dnl Available from the GNU Autoconf Macro Archive at:
40 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_template_objs.html
41 dnl
42 AC_DEFUN([AC_CXX_TEMPLATE_OBJS],
43 [AC_CACHE_CHECK(where template objects are stored, ac_cv_cxx_templobjs,
44 [ ac_cv_cxx_templobjs='unknown'
45 if test "$GXX" = yes; then
46 ac_cv_cxx_templobjs='nowhere'
47 else
48 case $CXX in
49 CC|*/CC)
50 cat > conftest.cc <<EOF
51 template<class T> class A { public : A () {} };
52 template<class T> void f (const A<T>&) {}
53 main()
54 { A<double> d;
55 A<int> i;
56 f (d);
57 f (i);
58 return 0;
59 }
60 EOF
61 if test "$ac_cv_cxx_templobjs" = 'unknown' ; then
62 if test -d Templates.DB ; then
63 rm -fr Templates.DB
64 fi
65 if $CXX $CXXFLAGS -ptr. -c conftest.cc 1> /dev/null 2>&1; then
66 if test -d Templates.DB ; then
67 # this should be Sun CC <= 4.2
68 CXXFLAGS="$CXXFLAGS -ptr."
69 if test x"$LIBTOOL" = x ; then
70 ac_cv_cxx_templobjs='Templates.DB/*.o'
71 else
72 ac_cv_cxx_templobjs='Templates.DB/*.lo'
73 fi
74 rm -fr Templates.DB
75 fi
76 fi
77 fi
78 if test "$ac_cv_cxx_templobjs" = 'unknown' ; then
79 if test -d SunWS_cache ; then
80 rm -fr SunWS_cache
81 fi
82 if $CXX $CXXFLAGS -c conftest.cc 1> /dev/null 2>&1; then
83 if test -d SunWS_cache ; then
84 # this should be Sun WorkShop C++ compiler 5.x
85 # or Sun Forte C++ compiler >= 6.x
86 if test x"$LIBTOOL" = x ; then
87 ac_cv_cxx_templobjs='SunWS_cache/*/*.o'
88 else
89 ac_cv_cxx_templobjs='SunWS_cache/*/*.lo'
90 fi
91 rm -fr SunWS_cache
92 fi
93 fi
94 fi
95 rm -f conftest* ;;
96 esac
97 fi
98 case "x$ac_cv_cxx_templobjs" in
99 xunknown|xnowhere)
100 TEMPLATE_OBJS="" ;;
101 *)
102 TEMPLATE_OBJS="$ac_cv_cxx_templobjs" ;;
103 esac])
104 AC_SUBST(TEMPLATE_OBJS)])
105
106 AC_CXX_TEMPLATE_OBJS
107
108
109 dnl
110 dnl standard headers
111 dnl (Though obsolete, AC_HEADER_STC changes the standard includes.)
112 dnl
113
114 AC_LANG([C])
115 AC_CHECK_INCLUDES_DEFAULT
116 AC_PROG_EGREP
117 AC_HEADER_DIRENT
118 AC_CHECK_HEADERS([fcntl.h unistd.h sys/time.h sys/wait.h])
119
120
121 dnl
122 dnl <new> and/or <new.h>
123 dnl
124
125 AC_LANG([C++])
126 AC_CACHE_CHECK([whether <new> works], ac_cv_good_new_hdr,
127 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <new>]], [[
128 int a;
129 int *b = new(&a) int;
130 return 0;
131 ]])],[ac_cv_good_new_hdr=yes],[ac_cv_good_new_hdr=no])])
132 if test "$ac_cv_good_new_hdr" = yes; then
133 AC_DEFINE([HAVE_NEW_HDR], [1], [Define if <new> exists and works.])
134 fi
135 AC_CHECK_HEADERS([new.h])
136
137
138 dnl
139 dnl endianness
140 dnl
141
142 AC_DEFINE([WORDS_BIGENDIAN_SET], [1], [Define if WORDS_BIGENDIAN has been set.])
143 AC_C_BIGENDIAN()
144
145
146 dnl
147 dnl functions such as strerror, working strtod, working strnlen, strtoul,
148 dnl time headers such as unistd.h
149 dnl
150
151 AC_LANG([C])
152 need_fixlibc=0
153 AC_CHECK_FUNCS([strerror], [], [need_fixlibc=1])
154
155 AC_CACHE_CHECK([for broken strtod], [ac_cv_broken_strtod],
156 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
157 #include <stdlib.h>
158 int main(int c, char **v) {
159 char s[] = "12 ";
160 char *endp;
161 double d = strtod(s, &endp);
162 return (s + 2) == endp;
163 }]])],[ac_cv_broken_strtod=yes],[ac_cv_broken_strtod=no],[ac_cv_broken_strtod=no])])
164 if test "x$ac_cv_broken_strtod" = xyes; then
165 need_fixlibc=1
166 AC_DEFINE([HAVE_BROKEN_STRTOD], [1], [Define if strtod is broken.])
167 fi
168
169 AC_LANG([C++])
170 AC_CHECK_DECLS([strnlen], [], [], [#include <string.h>])
171 AC_CHECK_FUNCS([strnlen], [have_strnlen=1], [need_fixlibc=1])
172 if test "x$have_strnlen" = x1; then
173 AC_CACHE_CHECK([for broken strnlen], [ac_cv_broken_strnlen],
174 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <string.h>
175 #include <stdio.h>
176 int main(int c, char **v) {
177 char s[] = "01234567891";
178 return strnlen(s, 10) == 10;
179 }]])],[ac_cv_broken_strnlen=yes],[ac_cv_broken_strnlen=no],[ac_cv_broken_strnlen=no])])
180 if test "x$ac_cv_broken_strnlen" = xyes; then
181 need_fixlibc=1
182 AC_DEFINE([HAVE_BROKEN_STRNLEN], [1], [Define if strnlen is broken.])
183 fi
184 fi
185 AC_LANG([C])
186
187 AC_CHECK_FUNCS([ctime ftruncate mkstemp sigaction strdup strtoul vsnprintf waitpid])
188 AC_CHECK_FUNC([floor], [], [AC_CHECK_LIB([m], [floor])])
189 AC_CHECK_FUNC([fabs], [], [AC_CHECK_LIB([m], [fabs])])
190 AM_CONDITIONAL([FIXLIBC], [test x$need_fixlibc = x1])
191
192
193 dnl
194 dnl integer types
195 dnl
196
197 AC_CHECK_HEADERS(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no)
198 AC_CHECK_HEADERS(sys/types.h, have_sys_types_h=yes, have_sys_types_h=no)
199
200 if test $have_inttypes_h = no -a $have_sys_types_h = yes; then
201 AC_CACHE_CHECK([for uintXX_t typedefs], ac_cv_uint_t,
202 [AC_EGREP_HEADER(dnl
203 changequote(<<,>>)<<(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]>>changequote([,]),
204 sys/types.h, ac_cv_uint_t=yes, ac_cv_uint_t=no)])
205 fi
206 if test $have_inttypes_h = no -a $have_sys_types_h = yes -a "$ac_cv_uint_t" = no; then
207 AC_CACHE_CHECK([for u_intXX_t typedefs], ac_cv_u_int_t,
208 [AC_EGREP_HEADER(dnl
209 changequote(<<,>>)<<(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]>>changequote([,]),
210 sys/types.h, ac_cv_u_int_t=yes, ac_cv_u_int_t=no)])
211 fi
212 if test $have_inttypes_h = yes -o "$ac_cv_uint_t" = yes; then
213 :
214 elif test "$ac_cv_u_int_t" = yes; then
215 AC_DEFINE(HAVE_U_INT_TYPES, 1, [Define if you have u_intXX_t types but not uintXX_t types.])
216 else
217 AC_MSG_WARN([
218 =========================================
219
220 Neither uint32_t nor u_int32_t defined by <inttypes.h> or <sys/types.h>!
221 Assuming "short" has 16 bits and "int" has 32 bits.
222
223 =========================================])
224 AC_DEFINE(HAVE_FAKE_INT_TYPES, 1, [Define if intXX_t types are not available.])
225 fi
226
227 AC_CHECK_TYPES(uintptr_t, [], [],
228 [#if HAVE_INTTYPES_H
229 # include <inttypes.h>
230 #endif
231 #if HAVE_SYS_TYPES_H
232 # include <sys/types.h>
233 #endif
234 ])
235
236 AC_CHECK_SIZEOF(void *)
237 AC_CHECK_SIZEOF(unsigned long)
238 AC_CHECK_SIZEOF(unsigned int)
239
240
241 dnl
242 dnl ntohs, ntohl (need them in C++ code)
243 dnl
244
245 AC_LANG([C])
246 AC_CHECK_HEADERS([byteorder.h netinet/in.h sys/param.h])
247 AC_MSG_CHECKING([whether ntohs and ntohl are defined])
248 ac_ntoh_defined=no
249 AC_COMPILE_IFELSE(
250 [AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
251 # include <sys/types.h>
252 #endif
253 #if HAVE_BYTEORDER_H
254 # include <byteorder.h>
255 #elif HAVE_NETINET_IN_H
256 # include <netinet/in.h>
257 #elif HAVE_SYS_PARAM_H
258 # include <sys/param.h>
259 #endif
260 #ifdef WIN32
261 # ifdef __MSC_VER
262 # pragma warning (disable: 4290)
263 # endif
264 # include <winsock2.h>
265 #endif
266 ]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
267 [AC_MSG_RESULT(yes)
268 ac_ntoh_defined=yes],
269 [AC_MSG_RESULT(no)])
270 if test $ac_ntoh_defined = no; then
271 AC_CHECK_HEADERS([arpa/inet.h], [have_arpa_inet_h=yes], [have_arpa_inet_h=no])
272 if test $have_arpa_inet_h = yes; then
273 AC_MSG_CHECKING([whether ntohs and ntohl are defined in <arpa/inet.h>])
274 AC_COMPILE_IFELSE(
275 [AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H
276 # include <sys/types.h>
277 #endif
278 #include <arpa/inet.h>
279 ]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])],
280 [AC_MSG_RESULT(yes)
281 AC_DEFINE(NEED_ARPA_INET_H, 1, [Define to 1 if you must include <arpa/inet.h> to get `ntohl'.])
282 ac_ntoh_defined=yes],
283 [AC_MSG_RESULT(no)])
284 fi
285 fi
286 if test $ac_ntoh_defined = no; then
287 AC_MSG_ERROR([
288 =========================================
289
290 Cannot find a definition for ntohs and/or ntohl!
291
292 =========================================])
293 fi
294 AC_LANG([C])
295 AC_SEARCH_LIBS([ntohs], [-lnet -lwinsock32])
296
297
298 dnl
299 dnl is va_list addressable?
300 dnl
301
302 AC_LANG([C++])
303 AC_CACHE_CHECK([for addressable va_list type],
304 ac_cv_va_list_addr,
305 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
306 void f(va_list *) {
307 }
308 void g(va_list val) {
309 f(&val);
310 }
311 void h(int a, ...) {
312 va_list val;
313 va_start(val, a);
314 g(val);
315 va_end(val);
316 }]], [[h(2, 3, 4);]])],[ac_cv_va_list_addr=yes],[ac_cv_va_list_addr=no])])
317 if test "x$ac_cv_va_list_addr" = xyes; then
318 AC_DEFINE(HAVE_ADDRESSABLE_VA_LIST, 1, [Define if the va_list type is addressable.])
319 fi
320
321
322 dnl
323 dnl select programs to be compiled and automatically run
324 dnl
325
326 m4_include([m4/lcdf-typetools.m4])
327
328 SELECTED_SUBDIRS=
329 m4_foreach_w([Kpse_Prog],kpse_lcdf_typetools_progs,[test "x$enable_[]Kpse_Prog" = xno || SELECTED_SUBDIRS="$SELECTED_SUBDIRS Kpse_Prog"
330 ])
331 AC_SUBST(SELECTED_SUBDIRS)
332
333 m4_foreach_w([Kpse_Opt],kpse_otftotfm_auto_opts,[AS_IF([test "x$enable_auto_]Kpse_Opt[" != xno],
334 [AC_DEFINE([HAVE_AUTO_]AS_TR_CPP(Kpse_Opt), 1,
335 [Define to run ]Kpse_Opt[ from otftotfm.])])
336 ])
337
338
339 dnl
340 dnl kpathsea
341 dnl
342
343 AC_ARG_WITH([kpathsea],
344 [AS_HELP_STRING([--with-kpathsea=PREFIX], [Kpathsea is installed (under PREFIX)])],
345 [kpathsea=$withval], [kpathsea=])
346
347 KPATHSEA_INCLUDES=
348 KPATHSEA_LIBS=
349 KPATHSEA_DEPEND=
350
351 if test "x$kpathsea" != xno; then
352 SAVE_CPPFLAGS="$CPPFLAGS"; SAVE_LDFLAGS="$LDFLAGS"
353 if test "x$kpathsea" != x -a "x$kpathsea" != xyes; then
354 KPATHSEA_INCLUDES="-I$kpathsea/include"
355 KPATHSEA_LIBS="-L$kpathsea/lib"
356 else
357 kpathsea=yes
358 fi
359
360 dnl check for kpathsea/kpathsea.h
361 if true; then
362 CPPFLAGS="$SAVE_CPPFLAGS $KPATHSEA_INCLUDES"
363 AC_CHECK_HEADER([kpathsea/kpathsea.h], [kpse_header=yes], [kpse_header=no])
364 fi
365
366 dnl if not found and kpathsea prefix not set, check /usr/local
367 if test "x$kpse_header" != xyes -a "x$kpathsea" = xyes -a -r /usr/local/include/kpathsea/tex-file.h; then
368 KPATHSEA_INCLUDES="-I/usr/local/include"
369 KPATHSEA_LIBS="-L/usr/local/lib"
370 CPPFLAGS="$SAVE_CPPFLAGS $KPATHSEA_INCLUDES"
371 AC_CHECK_HEADER([kpathsea/tex-file.h], [kpse_header=yes], [kpse_header=no])
372 fi
373
374 dnl check for -lkpathsea
375 if true; then
376 LDFLAGS="$SAVE_LDFLAGS $KPATHSEA_LIBS"
377 AC_CHECK_LIB([kpathsea], [kpse_set_program_name], [kpse_library=yes], [kpse_library=no])
378 fi
379
380 dnl bail out if not found
381 if test "x$kpse_header" != xyes -o "x$kpse_library" != xyes; then
382 AC_MSG_ERROR([
383 =========================================
384
385 I can't find the kpathsea library and/or header files. Tell me where to look
386 using the --with-kpathsea=PREFIX option (header files should be under
387 PREFIX/include/kpathsea, and library under PREFIX/lib), or disable support
388 using --without-kpathsea.
389
390 =========================================])
391 fi
392
393 dnl OK, found
394 AC_DEFINE(HAVE_KPATHSEA, 1, [Define if you want to use kpathsea.])
395 if true; then
396 KPATHSEA_LIBS="$KPATHSEA_LIBS -lkpathsea"
397 fi
398
399 dnl does it have opentype support?
400 if false; then
401 AC_DEFINE(HAVE_DECL_KPSE_OPENTYPE_FORMAT)
402 else
403 AC_CHECK_DECLS([kpse_opentype_format], [], [], [#include <kpathsea/kpathsea.h>])
404 fi
405
406 dnl does it have a separate format for encoding files?
407 AC_CHECK_DECLS([kpse_enc_format], [], [], [#include <kpathsea/kpathsea.h>])
408
409 CPPFLAGS="$SAVE_CPPFLAGS"; LDFLAGS="$SAVE_LDFLAGS"
410 fi
411
412 AM_CONDITIONAL([have_kpathsea], [test "x$with_kpathsea" != xno])
413 AC_SUBST([KPATHSEA_INCLUDES])
414 AC_SUBST([KPATHSEA_LIBS])
415 AC_SUBST([KPATHSEA_DEPEND])
416
417 AC_ARG_ENABLE([selfauto-set],
418 [AS_HELP_STRING([--disable-selfauto-set], [disable setting SELFAUTO variables from kpsewhich])],
419 [], [enable_selfauto_set=yes])
420
421 if test "x$enable_selfauto_set" = xyes -a "x$kpathsea" != xno; then
422 kpsewhich='kpsewhich'
423 test "x$kpathsea" != xyes -a -x "$kpathsea/bin/kpsewhich" && kpsewhich="$kpathsea/bin/kpsewhich"
424 SELFAUTOLOC="`$kpsewhich --expand-var='$SELFAUTOLOC' 2>/dev/null`"
425 SELFAUTODIR="`$kpsewhich --expand-var='$SELFAUTODIR' 2>/dev/null`"
426 SELFAUTOPARENT="`$kpsewhich --expand-var='$SELFAUTOPARENT' 2>/dev/null`"
427 SELFAUTOGRANDPARENT="`$kpsewhich --expand-var='$SELFAUTOGRANDPARENT' 2>/dev/null`"
428 if test -z "$SELFAUTODIR"; then
429 AC_MSG_WARN([
430 =========================================
431
432 Could not extract SELFAUTO variables from $kpsewhich.
433 Either supply the correct PREFIX to --with-kpathsea, or supply
434 --disable-selfauto-loc.
435
436 =========================================])
437 fi
438 AC_DEFINE_UNQUOTED([SELFAUTOLOC], "$SELFAUTOLOC", [kpsewhich's $SELFAUTOLOC variable])
439 AC_DEFINE_UNQUOTED([SELFAUTODIR], "$SELFAUTODIR", [kpsewhich's $SELFAUTODIR variable])
440 AC_DEFINE_UNQUOTED([SELFAUTOPARENT], "$SELFAUTOPARENT", [kpsewhich's $SELFAUTOPARENT variable])
441 if test -n "$SELFAUTOGRANDPARENT" -a "$SELFAUTOGRANDPARENT" != '$SELFAUTOGRANDPARENT'; then
442 AC_DEFINE_UNQUOTED([SELFAUTOGRANDPARENT], "$SELFAUTOGRANDPARENT", [kpsewhich's $SELFAUTOGRANDPARENT variable])
443 fi
444 fi
445
446
447 dnl
448 dnl glyphlist.txt and *.enc installation locations
449 dnl
450
451 AC_ARG_ENABLE([glyphlistdir],
452 [AS_HELP_STRING([--enable-glyphlistdir=DIR], [store glyphlist.txt files in DIR [pkgdatadir]])], [glyphlistdir="$enableval"], [glyphlistdir=NONE])
453 AC_ARG_ENABLE([encdir],
454 [AS_HELP_STRING([--enable-encdir=DIR], [store encoding files in DIR [pkgdatadir]])], [encdir="$enableval"], [encdir=NONE])
455
456 test "x$glyphlistdir" = xNONE -o "x$glyphlistdir" = xno \
457 -o "x$glyphlistdir" = x && glyphlistdir='${pkgdatadir}'
458 test "x$encdir" = xNONE -o "x$encdir" = xno \
459 -o "x$encdir" = x && encdir='${pkgdatadir}'
460
461 AC_SUBST([glyphlistdir])
462 AC_SUBST([encdir])
463
464
465 dnl
466 dnl TeX Live build stub
467 dnl
468
469 KPATHSEA_RULE=
470 AC_SUBST([KPATHSEA_RULE])
471
472
473 dnl
474 dnl verbatim portions of the header
475 dnl
476
477 AC_DEFINE(HAVE_PERMSTRING, 1, [Define if PermStrings are available.])
478 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.])
479 dnl PATHNAME_SEPARATOR?
480
481
482 dnl
483 dnl set path variables
484 dnl
485
486 shell_expand () {
487 val=`eval echo '$'"$1"`
488 while echo "x$val" | grep '\$' >/dev/null 2>&1; do val=`eval echo "$val"`; done
489 val=`echo "$val" | sed 's,//*,/,g'`
490 eval "$1='$val'"
491 }
492
493 dnl Preset $prefix and $exec_prefix.
494 test "x$prefix" = xNONE && prefix=$ac_default_prefix
495 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
496
497 pkgdatadir="${datadir}/$PACKAGE"
498 gdir="$glyphlistdir"
499 for i in data dataroot pkgdata g; do shell_expand ${i}dir; done
500 AC_DEFINE_UNQUOTED([GLYPHLISTDIR], ["$gdir"], [Directory for glyphlist.txt files.])
501
502
503 dnl
504 dnl Output
505 dnl
506
507 AC_CONFIG_FILES([Makefile liblcdf/Makefile libefont/Makefile cfftot1/Makefile mmafm/Makefile mmpfb/Makefile otfinfo/Makefile otftotfm/Makefile t1dotlessj/Makefile t1lint/Makefile t1rawafm/Makefile t1reencode/Makefile t1testpage/Makefile ttftotype42/Makefile])
508 AC_OUTPUT