dnl Process this file with autoconf to produce a configure script. dnl Adapted for TeX Live. AC_INIT([LCDF typetools], [2.75], [tex-k@tug.org]) AC_PREREQ([2.63]) AC_CONFIG_SRCDIR([NEWS]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) dnl Common code for all programs using libkpathsea. KPSE_COMMON([lcdf-typetools], [check-news]) AM_CONFIG_HEADER(config.h) AC_PROG_CXX AC_PROG_CXXCPP if test -n "$GCC" ; then CC="$CC -W -Wall" ; CXX="$CXX -W -Wall" ; fi AC_CXX_TEMPLATE_OBJS KPSE_CXX_HACK dnl dnl directory searching dnl AC_HEADER_DIRENT dnl dnl select programs to be compiled, otftotfm auto-options dnl m4_include([ac/lcdf-typetools.ac]) SELECTED_SUBDIRS='liblcdf libefont' 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 AC_ARG_ENABLE(tetex-build, [ --enable-tetex-build build as part of a teTeX installation], :, enable_tetex_build=no) dnl FIXME: test -d $srcdir/../kpathsea && enable_tetex_build=yes AC_ARG_WITH([kpathsea], [AS_HELP_STRING([--without-kpathsea], [build otftotfm without kpathsea])]) KPSE_KPATHSEA_FLAGS 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 ]], [[kpse_tfm_format;]])], [AC_MSG_RESULT([yes]) AC_CHECK_DECLS([kpse_opentype_format], , , [#include ])], [AC_MSG_RESULT([no]) with_kpathsea=no]) if test "x$with_kpathsea" = xno; then AC_MSG_ERROR([ ========================================= I can't find the kpathsea header and/or library files. Tell me where to look using the --with-kpathsea-includes=DIR option (header files under DIR/kpathsea) and --with-kpathsea-libdir=DIR option (library under DIR), or disable support using --without-kpathsea. =========================================]) fi fi AM_CONDITIONAL([have_kpathsea], [test "x$with_kpathsea" != xno]) KPSE_RESTORE_FLAGS AC_ARG_ENABLE(selfauto-set, [ --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_tetex_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 and/or dnl AC_LANG_CPLUSPLUS AC_CACHE_CHECK([whether works], ac_cv_good_new_hdr, [AC_TRY_LINK([#include ], [ 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 exists and works.]) fi AC_CHECK_HEADERS([new.h unistd.h]) dnl dnl functions such as strerror, working strtod, strtoul, time dnl headers such as unistd.h dnl AC_LANG_C AC_CHECK_FUNCS([strdup strerror]) AC_CACHE_CHECK(whether strtod works, ac_cv_working_strtod, [AC_TRY_RUN([#include #include int main(int c, char **v) { char s[] = "12 "; char *endp; double d = strtod(s, &endp); exit(*endp == 0 ? 1 : 0); }], ac_cv_working_strtod=yes, ac_cv_working_strtod=no, ac_cv_working_strtod=yes)]) if test $ac_cv_working_strtod = no; then AC_DEFINE(BROKEN_STRTOD, 1, [Define if strtod is broken.]) fi AC_CHECK_FUNCS(strtoul ctime mkstemp ftruncate sigaction waitpid) AC_CHECK_FUNC(floor, :, [AC_CHECK_LIB(m, floor)]) AC_CHECK_FUNC(fabs, :, [AC_CHECK_LIB(m, fabs)]) AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/wait.h) 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 or ! 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 #endif #if HAVE_SYS_TYPES_H # include #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 #endif #if HAVE_BYTEORDER_H # include #elif HAVE_NETINET_IN_H # include #elif HAVE_SYS_PARAM_H # include #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 ]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#if HAVE_SYS_TYPES_H # include #endif #include ]], [[(void) ntohs(0x0020), (void) ntohl(0x03040020);]])], [AC_MSG_RESULT(yes) AC_DEFINE(NEED_ARPA_INET_H, 1, [Define to 1 if you must include to get `ntohl'.]) ac_ntoh_defined=yes], [AC_MSG_RESULT(no)]) fi fi if test $ac_ntoh_defined = no; then AC_MSG_ERROR([ ========================================= Cannot find a definition for ntohs and/or ntohl! =========================================]) fi AC_LANG_C 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 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 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? AH_TOP([#ifndef LCDF_TYPETOOLS_CONFIG_H #define LCDF_TYPETOOLS_CONFIG_H]) AH_BOTTOM([/* Allow compilation on Windows (thanks, Fabrice Popineau). */ #ifdef WIN32 # include #else # define CDECL /* nothing */ #endif #ifdef __cplusplus extern "C" { #endif /* Prototype strerror if we don't have it. */ #if !HAVE_STRERROR char *strerror(int errno); #endif /* Prototype good_strtod if we need it. */ #if BROKEN_STRTOD double good_strtod(const char *nptr, char **endptr); #endif #ifdef __cplusplus } #endif #endif /* LCDF_TYPETOOLS_CONFIG_H */]) 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 AC_DEFINE_UNQUOTED(SHAREDIR, "$datadir/lcdf-typetools", [Data directory.]) dnl dnl Output dnl AC_CONFIG_FILES([Makefile liblcdf/Makefile libefont/Makefile]) AC_FOREACH([Kpse_Prog], kpse_lcdf_typetools_progs, [AC_CONFIG_FILES(Kpse_Prog[/Makefile])]) AC_OUTPUT