Debian Codegraph @

texk/xdvik/configure.ac

raw
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Copyright (C) 2009-2014 Peter Breitenlohner <[email protected]>
4 dnl
5 dnl This file is free software; the copyright holder
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
8 dnl
9 m4_define([xdvik_version], [22.87.06])
10 AC_INIT([xdvik], xdvik_version, [[email protected]])
11 AC_PREREQ([2.65])
12 AC_CONFIG_SRCDIR([xdvi.c])
13 AC_CONFIG_AUX_DIR([../../build-aux])
14 AC_CONFIG_MACRO_DIRS([../../m4 m4])
15
16 dnl Common code for all programs using libkpathsea.
17 KPSE_COMMON([xdvik])
18 KPSE_CANONICAL_HOST
19
20 dnl Include additional code for xdvik.
21 m4_include([ac/xdvik.ac])
22
23 # Reduce compiler warnings, there are just too many.
24 WARNING_CFLAGS=`echo $WARNING_CFLAGS | sed -e 's/ -Wcast-qual/ /' -e 's/ -Wwrite-strings/ /'`
25
26 AC_SEARCH_LIBS([pow], [m])
27
28 AC_ARG_WITH([ps],
29 AS_HELP_STRING([--with-ps=PS],
30 [Use PostScript (PS=no/yes/gs/dps/news, default gs)]))
31 AS_CASE([$with_ps],
32 ["" | yes | gs], [PS_DEF=-DPS_GS],
33 [no], [PS_DEF=],
34 [dps], [PS_DEF=-DPS_DPS],
35 [news], [PS_DEF=-DPS_NEWS],
36 [AC_MSG_WARN([unknown--with-ps argument `$with_ps'; using gs.])
37 PS_DEF=-DPS_GS])
38 AC_SUBST([PS_DEF])
39
40 dnl Required, not optional.
41 dnl AC_ARG_ENABLE([grey],
42 dnl AS_HELP_STRING([--disable-grey],
43 dnl [Disable greyscale anti-aliasing for shrunken bitmaps]))
44 AC_DEFINE([GREY], 1, [Define to enable greyscale anti-aliasing for shrunken bitmaps.])
45
46 dnl Required, not optional.
47 dnl AC_ARG_ENABLE([color],
48 dnl AS_HELP_STRING([--disable-color],
49 dnl [Disable support for color specials]))
50 AC_DEFINE([COLOR], 1, [Define to enable support for color specials.])
51
52 dnl Required, not optional.
53 dnl AC_ARG_ENABLE([freetype],
54 dnl AS_HELP_STRING([--disable-freetype],
55 dnl [Do not use FreeType2 (direct rendering of Type1 fonts)]))
56 AC_DEFINE([FREETYPE], 1, [Define to compile in the FreeType2 library.])
57
58 dnl OBSOLETE AC_ARG_ENABLE([gf],
59 dnl OBSOLETE AS_HELP_STRING([--enable-gf],
60 dnl OBSOLETE [Enable gf format pixel files (in addition to pk)]))
61 dnl OBSOLETE AC_DEFINE([USE_GF], 1, [Define to enable gf format files (in addition to pk format).])
62
63 AC_ARG_ENABLE([a4],
64 AS_HELP_STRING([--disable-a4],
65 [Set default paper size to letter and default unit to inch]))
66 AS_IF([test "x$enable_a4" = xno],
67 [AC_MSG_NOTICE([Disabled a4/cm, using letter/in instead])],
68 [AC_DEFINE([A4], 1, [Define to use A4 as the default paper size.])])
69
70 AC_CONFIG_HEADERS([c-auto.h:c-auto.in])
71
72 AC_FUNC_FORK
73 AC_FUNC_VPRINTF
74 XDVI_FUNC_WORKING_VSNPRINTF
75 XDVI_FUNC_MEMICMP
76 AC_FUNC_ALLOCA
77 AC_C_STRINGIZE
78 AC_FUNC_MEMCMP
79 AC_HEADER_SYS_WAIT
80 AC_TYPE_SIGNAL
81 AC_C_BIGENDIAN
82 AC_PATH_XTRA
83
84 dnl XDVI checks by Paul Vojta
85 XDVI_FUNC_SETSID_IN_VFORK
86 XDVI_C_BITMAP_TYPE
87 XDVI_SYS_STREAMS
88 XDVI_SYS_OLD_LINUX
89 XDVI_FUNC_POLL
90 XDVI_FUNC_XKB_BELL
91 XDVI_XINPUT_2_1
92
93 dnl #######
94
95 dnl COMPILER_WARNINGS
96
97 dnl #######
98
99 # Check for `--allow-multiple-definition' linker flag
100 XDVI_LINKER_MULTIPLE_DEFNS
101
102 AC_CHECK_HEADERS([stdint.h inttypes.h])
103 AC_TYPE_UINT32_T
104 AC_CHECK_TYPE([ptrdiff_t], [],
105 [AC_DEFINE_UNQUOTED([ptrdiff_t], [long],
106 [Define to `long' if <sys/types.h> does not define.])])
107
108 AC_CHECK_FUNCS([mkstemp memcpy strerror waitpid sigaction strchr setenv \
109 fchdir getcwd getpwnam getuid getpwuid \
110 lstat ftruncate snprintf vsnprintf realpath])
111
112 # <sys/bsdtypes.h> is for ISC 4.0, to define fd_set in psgs.c.
113 # regex.h is needed for regexp support in DVI search.
114 AC_CHECK_HEADERS([netdb.h sys/bsdtypes.h sys/param.h unistd.h sys/fcntl.h regex.h])
115
116 # Checks for iconv
117 XDVI_CHECK_ICONV
118
119 # Checks for langinfo
120 XDVI_CHECK_LANGINFO
121
122 # Check X11 headers.
123 # X11/IntrinsicI.h is needed for LateBindings (to roll our own translations)
124 xdvi_save_CPPFLAGS=$CPPFLAGS
125 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
126 AC_CHECK_HEADERS([X11/Intrinsic.h X11/IntrinsicI.h X11/Xosdefs.h X11/xpm.h \
127 Xm/XpmP.h])
128 # For editres, we need to check both the header and define a linker option.
129 AC_CHECK_HEADERS([X11/Xmu/Editres.h X11/Xmu/Xmu.h],
130 [x_xmu_lib=-lXmu],
131 [x_xmu_lib=],
132 [#ifdef HAVE_X11_INTRINSIC_H
133 # include <X11/Intrinsic.h>
134 #endif])
135 AC_SUBST([x_xmu_lib])
136 CPPFLAGS=$xdvi_save_CPPFLAGS
137
138 AC_ARG_ENABLE([magick],
139 AS_HELP_STRING([--enable-magick],
140 [Use ImageMagick to load/render image files.
141 EXPERIMENTAL - DO NOT USE!]))
142 if test "x$enable_magick" = xyes; then
143 AC_MSG_CHECKING([for ImageMagick version])
144 if MAGICK_VER=`Magick-config --version 2>/dev/null`; then
145 AC_MSG_RESULT([$MAGICK_VER])
146 set dummy `echo $MAGICK_VER | sed -e 's/\./ /g'`
147 MAGICK_VER_MAJOR=$2
148 MAGICK_VER_MINOR=$3
149 if expr $MAGICK_VER_MAJOR \> 4 >/dev/null && \
150 (expr $MAGICK_VER_MAJOR \> 5 >/dev/null || \
151 expr $MAGICK_VER_MINOR \> 2 >/dev/null); then
152 MAGICK_CPP="-DMAGICK_VER_MAJOR=$MAGICK_VER_MAJOR -DMAGICK_VER_MINOR=$MAGICK_VER_MINOR `Magick-config --cppflags`"
153 MAGICK_LD="`Magick-config --libs` `Magick-config --ldflags`"
154 AC_MSG_NOTICE([ImageMagick support enabled])
155 X_CFLAGS="$X_CFLAGS $MAGICK_CPP"
156 X_EXTRA_LIBS="$X_EXTRA_LIBS $MAGICK_LD"
157 AC_DEFINE([MAGICK], 1, [Define to use ImageMagick])
158 else
159 AC_MSG_NOTICE([ImageMagick version too old - disabled])
160 fi
161 else
162 AC_MSG_RESULT([cannot run 'Magick-config' - ImageMagick support disabled])
163 fi
164 fi
165
166 # Check whether -lXpm can be used
167 XDVI_FIND_XPM
168
169 # Check for libXext.
170 AS_IF([test -n "$x_libraries"],
171 [XLFLAG="-L$x_libraries"],
172 [XLFLAG=])
173 if test -z "$x_ext_lib"; then # allow envvar override
174 AC_CHECK_LIB([Xext], [XextCreateExtension],
175 [x_ext_lib='-lXext'], [],
176 [-lX11 $X_EXTRA_LIBS $XLFLAG])
177 fi
178 AC_SUBST([x_ext_lib])
179
180 # Check for libXp.
181 # Although libXp is now defunct (no longer part of XOrg), older versions
182 # of libXm may need to link with libXp; same for the equally defunct libXaw8.
183 # We certainly don't want to include libXp unless necessary, since this might
184 # only perpetuate the need to keep libXp.so around.
185 # Moreover for ELF shared libraries a requirement for libXp.so is probably
186 # encoded into libXm.so and/or libXaw.so and need not be specified explicitly.
187 AC_CHECK_LIB([Xp], [XpQueryVersion],
188 [x_xp_lib='-lXp'], [],
189 [$x_ext_lib -lX11 $X_EXTRA_LIBS $XLFLAG])
190
191 if test "x$enable_build" != xno || test -f config.force; then
192
193 # Check which toolkit was specified
194 AS_CASE([$with_xdvi_x_toolkit],
195 [next | nextaw | neXtaw], [val=neXtaw],
196 [xaw3d], [val=xaw3d],
197 ["" | x | xa | xaw], [val=xaw],
198 [y | ye | yes], [val=yes],
199 [m | mo | mot | moti | motif], [val=motif],
200 [AC_MSG_WARN([unknown --with-xdvi-x-toolkit argument
201 `$with_xdvi_x_toolkit'; using xaw.])
202 val=xaw])
203 with_xdvi_x_toolkit=$val
204
205 if test "x$with_xdvi_x_toolkit" = xxaw3d; then
206 prog_extension="xaw3d"
207 x_tool_libs="-lXaw3d"
208 elif test "x$with_xdvi_x_toolkit" = xneXtaw; then
209 prog_extension="nextaw"
210 x_tool_libs="-lneXtaw"
211 else
212 # Check for Xaw headers and library version
213 XDVI_CHECK_XAW_HEADERS
214 if test "x$with_xdvi_x_toolkit" != xxaw; then
215 if test "x$with_xdvi_x_toolkit" = xmotif; then
216 # Requested motiv
217 default_toolkit=none
218 else
219 # Requested motiv with Xaw as fallback
220 default_toolkit=Xaw
221 fi
222 XDVI_FIND_MOTIF
223 fi
224 if test "x$with_xdvi_x_toolkit" = xxaw; then
225 # Requested or fallback to Xaw, check for library
226 XDVI_CHECK_XAW_LIBRARY
227 fi
228 fi
229 AC_SUBST([x_tool_libs])
230 final_exec_name="xdvi-$prog_extension"
231 program_transform_name="'s,xdvi-bin,$final_exec_name,'"
232 AC_SUBST([final_exec_name])
233
234 dnl #######
235
236 dnl $program_transform_name replacement
237
238 dnl #######
239
240 # If we're on Solaris and we want DPS, then add the extra compilation stuff
241 # to get it.
242 if echo "$PS_DEF" | grep PS_DPS >/dev/null; then
243 if test "`(uname) 2>/dev/null`" = SunOS \
244 && uname -r | grep '^5' >/dev/null; then
245 AC_MSG_NOTICE([adding DPS includes and libraries for Solaris])
246 X_CFLAGS="$X_CFLAGS -I/usr/openwin/include/X11"
247 X_LIBS="$X_LIBS -R/usr/openwin/lib /usr/openwin/lib/libdps.so $ac_sunmath"
248 AC_CHECK_LIB([sunmath], [isinf],
249 [X_LIBS="$X_LIBS -lsunmath"])
250 dnl We only need isinf and ieeefp.h to work around a Solaris bug in
251 dnl -ldps; see psdps.c. isinf is in -lsunmath.
252 AC_CHECK_FUNCS([isinf])
253 AC_CHECK_HEADERS([ieeefp.h])
254 else
255 dnl SunOS 4.x is simpler.
256 AC_MSG_NOTICE([adding DPS libraries for SunOS 4.x])
257 X_LIBS="$X_LIBS -ldps"
258 fi
259 elif echo "$PS_DEF" | grep PS_NEWS >/dev/null; then
260 AC_MSG_NOTICE([adding NeWS libraries])
261 X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps"
262 fi
263
264 KPSE_KPATHSEA_FLAGS
265 KPSE_FREETYPE2_FLAGS
266
267 XDVI_GS_LIB_PATH
268
269 KPSE_ADD_FLAGS([kpathsea])
270
271 KPSE_CHECK_KPSE_FORMAT([enc], [],
272 [AC_MSG_ERROR([your kpathsea has no kpse_enc_format.])])
273 AC_CHECK_HEADER([kpathsea/version.h], [],
274 [AC_MSG_ERROR([Sorry, kpathsea too old])])
275
276 KPSE_RESTORE_FLAGS
277
278 echo timestamp >config.force
279 fi
280
281 AC_ARG_WITH([default-dvips-path],
282 AS_HELP_STRING([--with-default-dvips-path=CMD],
283 [Use CMD as default DVI to PS converter]), ,
284 [with_default_dvips_path="dvips"])
285 AC_DEFINE_UNQUOTED([DEFAULT_DVIPS_PATH], ["$with_default_dvips_path"],
286 [Define to point to the default command to use for printing (optional).])
287
288 AC_ARG_WITH([default-ps2pdf-path],
289 AS_HELP_STRING([--with-default-ps2pdf-path=CMD],
290 [Use CMD as default PS to PDF converter]), ,
291 [with_default_ps2pdf_path="ps2pdf"])
292 AC_DEFINE_UNQUOTED([DEFAULT_PS2PDF_PATH], ["$with_default_ps2pdf_path"],
293 [Define to point to the default command to use for printing (optional).])
294
295 XDVIK_VERSION=xdvik_version
296 AC_SUBST([XDVIK_VERSION])
297
298 AC_CONFIG_FILES([Makefile tests/Makefile])
299
300 AC_CONFIG_FILES([xdvi:xdvi-sh.in], [chmod +x xdvi])
301
302 dnl The subdirectory squeeze must be configured for the build system.
303 KPSE_NATIVE_SUBDIRS([squeeze])
304
305 AC_OUTPUT