summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvipdfmx/configure.in
blob: 8ed5e6adfd706740cbd36118463bbfee9981be3f (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
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/dvipdfmx.c)
AM_INIT_AUTOMAKE(xdvipdfmx, 0.4)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

# Timezone tests written by MAW for pdfdoc.c.
#
AC_DEFUN([AC_EXT_TIMEZONE],
[AC_MSG_CHECKING([whether time.h defines timezone as an external variable])
AC_TRY_LINK([#include <time.h>], [ -timezone; ],
	[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMEZONE)], [AC_MSG_RESULT(no)])])
AC_DEFUN([AC_TZ_HAS_TM_GMTOFF],
[AC_MSG_CHECKING([whether struct tz has tm_gmtoff as a member])
AC_TRY_COMPILE([#include <time.h>], [struct tm *tp; tp->tm_gmtoff],
	[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TM_GMTOFF)], [AC_MSG_RESULT(no)])])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

# Building inside teTeX or TeX Live?
AC_ARG_ENABLE(tetex-build, [  --enable-tetex-build    build as part of a teTeX installation])


dnl Check for kpathsea library. (required)
if test "x$enable_tetex_build" = xyes; then
  # In teTeX and TeX Live, LDFLAGS is passed by texk/Makefile and
  # reserved for the user.  Therefore we need another variable for the
  # loader flags to find the local kpathsea.  We use xdvipdfmx_LDFLAGS
  # since Automake already sets that up in the link command.
  xdvipdfmx_LDFLAGS=
  AC_SUBST(xdvipdfmx_LDFLAGS)

  if test ! -d $srcdir/../../texk/kpathsea; then
    AC_MSG_ERROR([
=========================================

You specified --enable-tetex-build, but I can't find the kpathsea
directory.  I expected it to be in $srcdir/../../texk/kpathsea.

=========================================])
  fi
  CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/../../texk -I\$(top_srcdir)/../../texk"
  xdvipdfmx_LDFLAGS="-L\$(top_builddir)/../../texk/kpathsea/.libs"

  AM_CONDITIONAL(TDS_VERSION_11, true)
  AC_DEFINE([__TDS_VERSION__], 0x200406L)
else
  dnl Don't bother going further if we don't have kpse installed.
  AC_ARG_WITH(kpathsea,
  [  --with-kpathsea=DIR     use kpathsea include/library files from DIR], [
    if test -d "$withval"; then
      CPPFLAGS="$CPPFLAGS -I$withval/include"
      LDFLAGS="$LDFLAGS -L$withval/lib"
    fi
  ], [
    if test -d "$prefix"; then
      CPPFLAGS="$CPPFLAGS -I$prefix/include"
      LDFLAGS="$LDFLAGS -L$prefix/lib"
    else
      CPPFLAGS="$CPPFLAGS -I$ac_default_prefix/include"
      LDFLAGS="$LDFLAGS -L$ac_default_prefix/lib"
    fi
  ])

  AC_CHECK_LIB(kpathsea, kpse_find_file, [LIBS="-lkpathsea $LIBS"],
    AC_MSG_ERROR([kpathsea library not found
This version of xdvipdfmx requires the kpathsea library and its headers. If
you know where it is you might try setting the LDFLAGS environment variable
with -L pointing to the directory containing libkpathsea.a.
    ])
  )

  dnl Check kpathsea support for required formats and funcs.
  AC_CHECK_KPSE_SUPPORT

  dnl Check for TDS version kpathsea library supports.
  AC_CHECK_KPSE_TDS_VERSION

  dnl Check for libfreetype, required for xdvipdfmx features
  AC_CHECK_LIBFREETYPE
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(stdint.h inttypes.h sys/types.h)

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(open close system getenv mkstemp basename)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_EXT_TIMEZONE
AC_TZ_HAS_TM_GMTOFF

AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_C_BIGENDIAN

AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)


dnl Check for additonal libraries.

AC_HAS_LIBFONTCONFIG
AC_HAS_APP_SERVICES

if test "x$enable_tetex_build" = xyes; then
  # Get these common libraries from the sources, too.
  # Seems like it would be simpler to treat kpathsea this way too, but
  # we're just starting from what lcdf-typetools did.
  sinclude(../../libs/libpng/withenable.ac)
  sinclude(../../libs/libpng/libpng.ac)

  sinclude(../../libs/zlib/withenable.ac)
  sinclude(../../libs/zlib/zlib.ac)

  sinclude(../../libs/freetype2/withenable.ac)
  sinclude(../../libs/freetype2/freetype2.ac)

  # yes, we have zlib and png.
  AC_DEFINE(HAVE_ZLIB)
  AC_DEFINE(HAVE_LIBPNG)
  AC_DEFINE(HAVE_FREETYPE2)

  # You must define HAVE_ZLIB_COMPRESS2 to enable '-z' option for controlling
  # zlib compression level, but zlib.ac included above does not do this test.
  # We assume zlib always has compress2() here although that's not always true.
  AC_DEFINE(HAVE_ZLIB_COMPRESS2, 1, [Define if your zlib has the compress2 function])

  # tetex/tex live build; this always has kpathsea, xbasename, etc.,
  # as we're building from current sources.  Do this stuff at the end so
  # other configure tests don't try to link with kpathsea (which doesn't
  # exist at configure time).
  LIBS="-lkpathsea -lm $LIBS"
  xdvipdfmx_LDFLAGS="$xdvipdfmx_LDFLAGS $FONTCONFIGLDFLAGS"
  AC_SUBST(xdvipdfmx_LDFLAGS)
  AC_MSG_NOTICE([tetex build enabled, LIBS now: $LIBS])
else
  AC_HAS_LIBPAPER
  AC_HAS_ZLIB
  AC_HAS_LIBPNG

dnl these variables are defined in the tetex case and used in src/Makefile.am.
dnl just let them be empty.
  AC_SUBST(LIBPNGCPPFLAGS)
  AC_SUBST(LDLIBPNG)
  AC_SUBST(LIBPNGDEP)
  AC_SUBST(ZLIBCPPFLAGS)
  AC_SUBST(LDZLIB)
  AC_SUBST(ZLIBDEP)
  AC_SUBST(FT2CPPFLAGS)
  AC_SUBST(LDFT2)
  AC_SUBST(FT2DEP)
  AC_SUBST(dvipdfmx_LDFLAGS)
  AC_SUBST(xdvipdfmx_LDFLAGS)
fi

AC_OUTPUT(Makefile data/Makefile src/Makefile)