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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# Thomas Esser, for teTeX. All settings here are my fault, don't blame
# the dvipng maintainers for it.
# Process this file with autoconf to produce a configure script.
AC_INIT([dvipng], [1.10], [dvipng@nongnu.org])
AC_CONFIG_SRCDIR([dvipng.c])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--disable-debug],[Compile without debug (-d) option]),
[ if test "$enableval" = yes ; then
AC_DEFINE(DEBUG, 1, [Define as 1 to get the debug (-d) option.])
fi ],
[ enable_debug="yes";
AC_DEFINE(DEBUG, 1, [Define as 1 to get the debug (-d) option.])])
AC_ARG_ENABLE(timing,
AC_HELP_STRING([--enable-timing],[Output execution time of dvipng]),
[ if test "$enableval" = yes ; then
AC_DEFINE(TIMING, 1, [Define as 1 to get execution time output.])
fi ])
# Checks for programs.
AC_SET_MAKE
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_ARG_WITH(gs,
AC_HELP_STRING([--with-gs=/PATH/TO/gs],[Hard-wire the location of GhostScript]),
[if test "x$withval" = xno ; then
GS=no
else
AC_PATH_PROG(GS,["$withval"])
dnl --skip, karl GS_CHECK_DEVICES
fi],
[AC_CHECK_PROG(GS,gs,gs)
if test -n "$GS"; then
true
dnl --skip, karl GS_CHECK_DEVICES
else
GS="gs"
AC_MSG_WARN([Cannot find GhostScript in your PATH])
fi
])
AC_DEFINE_UNQUOTED(GS_PATH, "$GS", [Define as the path to GhostScript.])
dnl Check devices for GS
dnl AC_GS_HAS_DEVICE(DEVICE,ACTION-IF-FAILED)
dnl
AC_DEFUN([AC_GS_HAS_DEVICE],
[AC_MSG_CHECKING([whether $GS has the $1 device])
if $GS -h | grep $1 >/dev/null; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
$2
fi
])
ac_cv_lib_t1_T1_InitLib=yes
PSFONTS_O=""
if test "$ac_cv_lib_t1_T1_InitLib" = yes; then
PSFONTS_O="t1.o"
fi
AC_SUBST(PSFONTS_O)
ac_have_freetype2="yes" # we have ft2
if test "$ac_have_freetype2" = yes; then
# Have to set compiler and linker flags in Makefile.in, it seems.
PSFONTS_O="$PSFONTS_O sfd.o ft.o"
AC_DEFINE(HAVE_FT2, 1, [Define to 1 if you have freetype2])
AC_DEFINE(HAVE_FT_LIBRARY_VERSION)
fi
if test -n "$PSFONTS_O"; then
PSFONTS_O="$PSFONTS_O enc.o fontmap.o tfm.o"
fi
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS([inttypes.h fcntl.h sys/time.h stdbool.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
#if test "$ac_cv_header_inttypes_h" = yes; then
# Sometimes we want to use gcc -ansi -pedantic as a portability test
# The typedef of int64_t is not in the system header file in that
# case. Then, #define int64_t as "long long", which is non-ansi, but
# is present in most modern compilers. Using a #define rather than a
# typedef can be a problem, but in dvipng int64_t only is used as
# typecast, and there are no problems.
# MY_CHECK_TYPE(int64_t, long long)
# MY_CHECK_TYPE(uint64_t, unsigned long long)
#fi
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([dup2 memset munmap pow putenv strchr strrchr strtol strstr])
if test "$enable_timing" = "yes"; then
AC_CHECK_FUNCS([ftime gettimeofday])
fi
AC_SEARCH_LIBS([pow], [m])
AC_SEARCH_LIBS([basename], [gen])
# let's skip dvigif for the moment.
INSTALL_BIN_TARGET="install-dvipng"
AC_SUBST(INSTALL_BIN_TARGET)
dnl
dnl MAKEINFO_CHECK_MACRO( MACRO, [ACTION-IF-FOUND
dnl [, ACTION-IF-NOT-FOUND]])
dnl
AC_DEFUN([MAKEINFO_CHECK_MACRO],
[if test -n "$MAKEINFO" -a "$makeinfo" != ":"; then
AC_MSG_CHECKING([if $MAKEINFO understands @$1{}])
echo \\\\input texinfo > conftest.texi
echo @$1{test} >> conftest.texi
if $MAKEINFO conftest.texi > /dev/null 2> /dev/null; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
rm -f conftest.texi conftest.info
fi
])
dnl
dnl MAKEINFO_CHECK_MACROS( MACRO ... [, ACTION-IF-FOUND
dnl [, ACTION-IF-NOT-FOUND]])
dnl
AC_DEFUN([MAKEINFO_CHECK_MACROS],
[for ac_macro in $1; do
MAKEINFO_CHECK_MACRO($ac_macro, $2,
[MAKEINFO_MACROS="-D no-$ac_macro $MAKEINFO_MACROS"
$3])dnl
done
AC_SUBST(MAKEINFO_MACROS)
])
# Documentation-related checks
AC_PATH_PROG(MAKEINFO, makeinfo, :)
MAKEINFO_CHECK_MACROS(acronym env option)
AC_PATH_PROG(INSTALL_INFO, install-info, :, $PATH /usr/sbin /sbin)
sinclude(../../libs/zlib/withenable.ac)
sinclude(../../libs/zlib/zlib.ac)
sinclude(../../libs/libpng/withenable.ac)
sinclude(../../libs/libpng/libpng.ac)
sinclude(../../libs/t1lib/withenable.ac)
sinclude(../../libs/t1lib/t1lib.ac)
sinclude(../../libs/freetype2/withenable.ac)
sinclude(../../libs/freetype2/freetype2.ac)
sinclude(../../libs/gd/withenable.ac)
sinclude(../../libs/gd/gd.ac)
sinclude(../kpathsea/withenable.ac)
if test "$with_system_freetype2" = yes; then
OLD_LIBS=$LIBS
LIBS="$LDFREETYPE2 $LIBS"
AC_CHECK_FUNCS([FT_Library_Version])
LIBS=$OLD_LIBS
else
AC_DEFINE([HAVE_FT_LIBRARY_VERSION])
fi
if test "$with_system_gd" = yes; then
OLD_LIBS=$LIBS
LIBS="$LDGD $LIBS"
AC_CHECK_FUNCS([gdImageCreateTrueColor gdImageCreateFromJpeg gdImagePngEx gdImageCreateFromPngPtr gdImageGif FT_Library_Version])
LIBS=$OLD_LIBS
else
AC_DEFINE([HAVE_GDIMAGECREATETRUECOLOR])
AC_DEFINE([HAVE_GDIMAGEPNGEX])
AC_DEFINE([HAVE_GDIMAGEGIF])
fi
AC_DEFINE([HAVE_GD_H])
AC_DEFINE([HAVE_LIBGD])
AC_DEFINE([HAVE_T1LIB_H], 1,
[Define to 1 if you have the <t1lib.h> header file.])
AC_DEFINE([HAVE_LIBT1], 1,
[Define to 1 if you have the `t1' library (-lt1).])
AC_DEFINE([HAVE_PNG_H], 1,
[Define to 1 if you have the <png.h> header file.])
AC_DEFINE([HAVE_LIBPNG], 1,
[Define to 1 if you have the `png' library (-lpng).])
AC_DEFINE([HAVE_LIBZ])
# Allow shared or static libkpathsea
LIBS="-L../kpathsea/.libs -lkpathsea $LIBS"
AC_DEFINE([HAVE_KPATHSEA_KPATHSEA_H], 1,
[Define to 1 if you have the <kpathsea/kpathsea.h> header file.])
AC_DEFINE([HAVE_KPSE_ENC_FORMATS], 1,
[Define to 1 if your kpathsea has kpse_enc_format.])
AC_DEFINE([HAVE_LIBKPATHSEA], 1,
[Define to 1 if you have the `kpathsea' library (-lkpathsea).])
#
# Check for ApplicationServices framework (Mac OS X)
#
AC_DEFUN([AC_HAS_APP_SERVICES], [
_cppflags=$CPPFLAGS _ldflags=$LDFLAGS
AC_MSG_CHECKING([for Mac OS X ApplicationServices framework])
AC_TRY_COMPILE(
[
#include <ApplicationServices/ApplicationServices.h>
], [
ATSFontRef fontRef;
],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_APP_SERVICES, 1, [Define if you have ApplicationServices (Mac OS X)])
LIBS="$LIBS -framework ApplicationServices"
],
[ AC_MSG_RESULT(no) ]
)
])
AC_HAS_APP_SERVICES
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
|