1dnl Process this file with autoconf to produce a configure script. 2dnl 3dnl Copyright (C) 2009-2014 Peter Breitenlohner <tex-live@tug.org> 4dnl 5dnl This file is free software; the copyright holder 6dnl gives unlimited permission to copy and/or distribute it, 7dnl with or without modifications, as long as this notice is preserved. 8dnl 9dnl ********************************************************************* 10dnl 11dnl Adapted for TeX Live from dvisvgm-0.8.7/configure.ac 12dnl Copyright (C) 2005-2009 Martin Gieseking <martin.gieseking@uos.de> 13dnl 14dnl ********************************************************************* 15dnl 16m4_include([version.ac])[] dnl define dvisvgm_version 17AC_INIT([dvisvgm (TeX Live)], dvisvgm_version, [tex-k@tug.org]) 18AC_PREREQ([2.65]) 19AC_CONFIG_SRCDIR([dvisvgm-]dvisvgm_version[/src/dvisvgm.cpp]) 20AC_CONFIG_AUX_DIR([../../build-aux]) 21AC_CONFIG_MACRO_DIR([../../m4]) 22 23# Common code for all programs using libkpathsea. 24KPSE_COMMON([dvisvgm]) 25 26dnl Include additional code for dvisvgm. 27m4_include([ac/dvisvgm.ac]) 28 29AC_CONFIG_HEADERS([config.h]) 30 31AC_PROG_CXX 32AC_PROG_CXXCPP 33KPSE_CXX_HACK 34 35AC_DEFINE_UNQUOTED([TARGET_SYSTEM], ["$host"], 36 [The machine triplet of the target system.]) 37 38AC_SEARCH_LIBS([sqrt], [m]) 39 40AC_CHECK_FUNCS([ftime gettimeofday]) 41AC_CHECK_HEADERS([sys/time.h sys/timeb.h]) 42 43KPSE_COND_WIN32 44 45KPSE_KPATHSEA_FLAGS 46KPSE_ZLIB_FLAGS 47KPSE_FREETYPE2_FLAGS 48KPSE_POTRACE_FLAGS 49 50KPSE_SAVE_FLAGS 51 52AS_IF([test "x$with_libgs" = xno], [libgs_mode=no], 53 [dnl 54if test "x$with_system_libgs" = xyes; then 55 libgs_mode=link 56 AS_CASE([$with_libgs_includes], 57 ["" | yes | no], [LIBGS_INCLUDES=], 58 [LIBGS_INCLUDES="-I$with_libgs_includes"]) 59 AS_CASE([$with_libgs_libdir], 60 ["" | yes | no], [LIBGS_LIBS=-lgs], 61 [LIBGS_LIBS="-L$with_libgs_libdir -lgs"]) 62 KPSE_ADD_FLAGS([libgs]) 63 AC_CHECK_HEADER([ghostscript/iapi.h]) 64 AC_CHECK_FUNC([gsapi_new_instance]) 65 if test "x$ac_cv_header_ghostscript_iapi_h:$ac_cv_func_gsapi_new_instance" != xyes:yes; then 66 AC_MSG_ERROR([cannot find/use libgs]) 67 fi 68 AC_CACHE_CHECK([for Ghostscript version 8.31 or later], 69 [kpse_cv_new_gsapi], 70 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ghostscript/iapi.h>]], 71 [[gs_main_inst *inst;]])], 72 [kpse_cv_new_gsapi=no], 73 [kpse_cv_new_gsapi=yes])]) 74 if test "x$kpse_cv_new_gsapi" != xyes; then 75 AC_MSG_ERROR([dvisvgm requires Ghostscript version 8.31 or later]) 76 fi 77 AC_DEFINE([HAVE_LIBGS], 1, 78 [Define to 1 if you have the `gs' library (-lgs).]) 79else 80 libgs_mode=load 81 LIBGS_INCLUDES= 82 LIBGS_LIBS= 83 # Windows (native or MinGW32) has neither <dlfcn.h> nor dlopen(). 84 if test "x$kpse_cv_have_win32" = xno; then 85 # FreeBSD neither has nor requires libdl. 86 AC_SEARCH_LIBS([dlopen], [dl]) 87 AS_CASE([$ac_cv_search_dlopen], 88 [no | "none required"], [], 89 [LIBGS_LIBS=$ac_cv_search_dlopen]) 90 AC_CHECK_HEADER([dlfcn.h]) 91 AC_CHECK_FUNC([dlopen]) 92 if test "x$ac_cv_header_dlfcn_h:$ac_cv_func_dlopen" != xyes:yes; then 93 libgs_mode=no 94 KPSE_RESTORE_FLAGS 95 LIBGS_LIBS= 96 fi 97 fi 98fi]) 99if test "x$libgs_mode" = xno; then 100 AC_DEFINE([DISABLE_GS], 1, 101 [Set to 1 if PostScript support should be disabled.]) 102fi 103AC_SUBST([LIBGS_INCLUDES]) 104AC_SUBST([LIBGS_LIBS]) 105AM_CONDITIONAL([dlloader], [test "x$libgs_mode" = xload]) 106 107KPSE_SAVE_FLAGS 108 109if test "x$enable_build" != xno || test -f config.force; then 110 111# Checks for more libraries. 112KPSE_ADD_FLAGS([zlib]) 113AC_CHECK_FUNC([gzopen], [], 114 [AC_MSG_ERROR([cannot find/use zlib])]) 115 116KPSE_ADD_FLAGS([freetype2]) 117AC_CHECK_FUNC([FT_Init_FreeType], [], 118 [AC_MSG_ERROR([cannot find/use libfreetype])]) 119 120KPSE_ADD_FLAGS([kpathsea]) 121AC_CHECK_FUNC([kpse_set_program_name], [], 122 [AC_MSG_ERROR([cannot find/use libkpathsea])]) 123 124# Check if the kpathsea headers are C++ safe. 125AC_LANG_PUSH([C++]) 126AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <kpathsea/kpathsea.h>]], 127 [[printf("%s\n", concat("one", "two"))]])], 128 [], 129 [AC_MSG_ERROR([Sorry, your kpathsea headers are too old]) 130 AC_DEFINE([KPSE_CXX_UNSAFE], 1, 131 [Define to 1 if the kpathsea headers are not C++ safe.])]) 132AC_LANG_POP([C++]) 133 134echo timestamp >config.force 135fi 136 137KPSE_RESTORE_FLAGS 138 139AC_DEFINE([HAVE_LIBZ], 1, [Define to 1 if you have the `z' library (-lz).]) 140AC_DEFINE([HAVE_LIBFREETYPE], 1, [Define to 1 if you have the `freetype2' library (-lfreetype).]) 141AC_DEFINE([HAVE_LIBKPATHSEA], 1, [Define to 1 if you have the `kpathsea' library (-lkpathsea).]) 142if false; then 143 AC_DEFINE([KPSE_CXX_UNSAFE], 1, [Define to 1 if the kpathsea headers are not C++ safe.]) 144fi 145 146AC_SUBST([DVISVGM_TREE], [dvisvgm-]dvisvgm_version) 147 148AC_CONFIG_FILES([Makefile]) 149 150AC_OUTPUT 151