summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/configure.ac
blob: 469d7f5df89f9f3b893ccc64dc43c21d1c16a264 (plain)
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
dnl Process this file with autoconf to produce a configure script.
dnl
dnl   Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl   This file is free software; the copyright holder
dnl   gives unlimited permission to copy and/or distribute it,
dnl   with or without modifications, as long as this notice is preserved.
dnl
dnl *********************************************************************
dnl
dnl  Adapted for TeX Live from dvisvgm-0.8.7/configure.ac
dnl  Copyright (C) 2005-2009 Martin Gieseking <martin.gieseking@uos.de>
dnl
dnl *********************************************************************
dnl
m4_include([version.ac])[] dnl define dvisvgm_version
AC_INIT([dvisvgm for TeX Live], dvisvgm_version, [tex-k@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([dvisvgm-]dvisvgm_version[/src/dvisvgm.cpp])
AC_CONFIG_AUX_DIR([../../build-aux])
AC_CONFIG_MACRO_DIR([../../m4])

# Common code for all programs using libkpathsea.
KPSE_COMMON([dvisvgm])

dnl Include additional code for dvisvgm.
m4_include([ac/dvisvgm.ac])

AC_CONFIG_HEADERS([config.h])

KPSE_COMPILER_VISIBILITY

AC_PROG_CXX
AC_PROG_CXXCPP
KPSE_CXX_HACK

AC_DEFINE_UNQUOTED([TARGET_SYSTEM], ["$host"],
                   [The machine triplet of the target system.])

AC_SEARCH_LIBS([sqrt], [m])

AC_CHECK_FUNCS([ftime gettimeofday])
AC_CHECK_HEADERS([sys/time.h sys/timeb.h])

KPSE_CHECK_WIN32
AM_CONDITIONAL([WIN32], [test "x$kpse_cv_have_win32" != xno])

KPSE_KPATHSEA_FLAGS
KPSE_ZLIB_FLAGS
KPSE_FREETYPE2_FLAGS
KPSE_POTRACE_FLAGS

KPSE_SAVE_FLAGS

if test "x$with_system_libgs" = xyes; then
  libgs_mode=link
  AS_CASE([$with_libgs_includes],
          ["" | yes | no], [LIBGS_INCLUDES=],
            [LIBGS_INCLUDES="-I$with_libgs_includes"])
  AS_CASE([$with_libgs_libdir],
          ["" | yes | no], [LIBGS_LIBS=-lgs],
            [LIBGS_LIBS="-L$with_libgs_libdir -lgs"])
  KPSE_ADD_FLAGS([libgs])
  AC_CHECK_HEADER([ghostscript/iapi.h])
  AC_CHECK_FUNC([gsapi_new_instance])
  if test "x$ac_cv_header_ghostscript_iapi_h:$ac_cv_func_gsapi_new_instance" != xyes:yes; then
    AC_MSG_ERROR([cannot find/use libgs])
  fi
  AC_CACHE_CHECK([for Ghostscript version 8.31 or later],
                 [kpse_cv_new_gsapi],
                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ghostscript/iapi.h>]],
                                                     [[gs_main_inst *inst;]])],
                                    [kpse_cv_new_gsapi=no],
                                    [kpse_cv_new_gsapi=yes])])
  if test "x$kpse_cv_new_gsapi" != xyes; then
    AC_MSG_ERROR([dvisvgm requires Ghostscript version 8.31 or later])
  fi
  AC_DEFINE([HAVE_LIBGS], 1,
            [Define to 1 if you have the `gs' library (-lgs).])
else
  libgs_mode=load
  LIBGS_INCLUDES=
  LIBGS_LIBS=
  # Windows (native or MinGW32) has neither <dlfcn.h> nor dlopen().
  if test "x$kpse_cv_have_win32" = xno; then
    # FreeBSD neither has nor requires libdl.
    AC_SEARCH_LIBS([dlopen], [dl])
    AS_CASE([$ac_cv_search_dlopen],
            [no | "none required"], [],
                [LIBGS_LIBS=$ac_cv_search_dlopen])
    AC_CHECK_HEADER([dlfcn.h])
    AC_CHECK_FUNC([dlopen])
    if test "x$ac_cv_header_dlfcn_h:$ac_cv_func_dlopen" != xyes:yes; then
      libgs_mode=no
      KPSE_RESTORE_FLAGS
      AC_DEFINE([DISABLE_GS], 1,
                [Set to 1 if PostScript support should be disabled.])
      LIBGS_LIBS=
    fi
  fi
fi
AC_SUBST([LIBGS_INCLUDES])
AC_SUBST([LIBGS_LIBS])
AM_CONDITIONAL([dlloader], [test "x$libgs_mode" = xload])

if test "x$enable_build" != xno || test -f config.force; then

# Checks for more libraries.
KPSE_ADD_FLAGS([zlib])
AC_CHECK_FUNC([gzopen],
              [AC_DEFINE([HAVE_LIBZ], 1,
                         [Define to 1 if you have the `z' library (-lz).])],
              [AC_MSG_ERROR([cannot find/use zlib])])

KPSE_ADD_FLAGS([freetype2])
AC_CHECK_FUNC([FT_Init_FreeType],
              [AC_DEFINE([HAVE_LIBFREETYPE], 1,
                         [Define to 1 if you have the `freetype2' library (-lfreetype).])],
              [AC_MSG_ERROR([cannot find/use libfreetype])])

KPSE_ADD_FLAGS([kpathsea])
AC_CHECK_FUNC([kpse_set_program_name],
              [AC_DEFINE([HAVE_LIBKPATHSEA], 1,
                         [Define to 1 if you have the `kpathsea' library (-lkpathsea).])],
              [AC_MSG_ERROR([cannot find/use libkpathsea])])

echo timestamp >config.force
fi

KPSE_RESTORE_FLAGS

AC_SUBST([DVISVGM_TREE], [dvisvgm-]dvisvgm_version)

AC_CONFIG_FILES([Makefile])

AC_OUTPUT