-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
executable file
·371 lines (309 loc) · 9.42 KB
/
configure.ac
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# -*-Shell-script-*-
#
# DjVuLibre-3.5
# Copyright (c) 2002 Leon Bottou and Yann Le Cun.
# Copyright (c) 2001 AT&T
#
# This software is subject to, and may be distributed under, the
# GNU General Public License, either Version 2 of the license,
# or (at your option) any later version. The license should have
# accompanied the software or you may obtain a copy of the license
# from the Free Software Foundation at http://www.fsf.org .
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
# distribued by Lizardtech Software.
#
# ----------------------------------------
# Initialization
# ----------------------------------------
m4_define([v_maj], [3])
m4_define([v_min], [5])
m4_define([v_mic], [27])
m4_define([v_ver], [v_maj.v_min.v_mic])
m4_define([lt_compat], [21])
m4_define([lt_cur], [v_mic])
m4_define([lt_rev], [0])
m4_define([lt_age], [m4_eval(v_mic - lt_compat)])
AC_PREREQ([2.65])
AC_INIT([djvulibre],[v_ver])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_CONFIG_SRCDIR(libdjvu/ddjvuapi.cpp)
AC_CONFIG_HEADER(config.h:config/config.h.in)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.6 subdir-objects dist-bzip2 dist-xz -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT([win32-dll disable-static])
# Library version
version_info="lt_cur:lt_rev:lt_age"
AC_SUBST([version_info])
# Additional libraries
AC_ARG_WITH(extra-includes,
AS_HELP_STRING([--with-extra-includes=DIR],[Define an additional directory for include files]),
[ if test -d "$withval" ; then
CPPFLAGS="$CPPFLAGS -I$withval"
else
AC_MSG_ERROR([Cannot stat directory $withval])
fi ] )
AC_ARG_WITH(extra-libraries,
AS_HELP_STRING([--with-extra-libraries=DIR],[Define an additional directory for library files]),
[ if test -d "$withval" ; then
LDFLAGS="$LDFLAGS -L$withval"
else
AC_MSG_ERROR([Cannot stat directory $withval])
fi ] )
# Always look into a "gnu" directory.
curwd=`pwd`
if test -d $curwd/gnu/include ; then
CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include"
fi
if test -d $curwd/gnu/lib ; then
LDFLAGS="$LDFLAGS -L$curwd/gnu/lib"
fi
# Special cases
AC_CHECK_DECL([_WIN32],[have_os_win32=yes],[have_os_win32=no])
AM_CONDITIONAL([HAVE_OS_WIN32], [test "x${have_os_win32}" = "xyes"])
AC_CHECK_DECL([__APPLE__],[have_os_apple=yes],[have_os_apple=no])
if test x$have_os_apple = xyes && test -d /opt/local ; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -L/opt/local/lib"
elif test x$have_os_apple = xyes && test -d /sw ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
fi
# ----------------------------------------
# Programs
# ----------------------------------------
# Does make set variable $(MAKE)
AC_PROG_MAKE_SET
# Programs
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
AC_PATH_PROG([TOUCH], [touch])
AC_PATH_PROG([RSVG], [rsvg-convert], [false])
AC_PATH_PROG([INKSCAPE], [inkscape], [false])
AC_PATH_PROG([CONVERT], [convert], [false])
conversion_tool=no
if test "x${RSVG}" != xfalse ; then
conversion_tool=rsvg
elif test "x${INKSCAPE}" != xfalse ; then
conversion_tool=inkscape
elif test "x${CONVERT}" != xfalse ; then
( ${CONVERT} --version 2>&1 | grep -q ImageMagick ) && conversion_tool=convert
fi
AM_CONDITIONAL([HAVE_CONVERSION_RSVG], [test x${conversion_tool} = xrsvg])
AM_CONDITIONAL([HAVE_CONVERSION_INKSCAPE], [test x${conversion_tool} = xinkscape])
AM_CONDITIONAL([HAVE_CONVERSION_CONVERT], [test x${conversion_tool} = xconvert])
AM_CONDITIONAL([HAVE_CONVERSION_TOOL], [test x${conversion_tool} != xno])
# tweak rm to make libtool happy
AC_PATH_PROG(RM, rm)
RM="$RM -f"
# Libtool & Compilers
AC_PROG_CC
AC_PROG_CXX
AC_OPTIMIZE
# C++
AC_LANG(C++)
AC_CXX_BOOL
AC_CXX_EXCEPTIONS
AC_CXX_TYPENAME
AC_CXX_STDINCLUDES
AC_CXX_NAMESPACES
AC_CXX_MEMBER_TEMPLATES
AC_CXX_INTEL_ATOMIC_BUILTINS
AC_CXX_GCCTLS
# ----------------------------------------
# Libraries
# ----------------------------------------
AC_CHECK_LIB(m,sqrt)
# AC_CHECK_LIB(iconv,libiconv_open) # not really used.
# ----------------------------------------
# Header Files
# ----------------------------------------
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(wchar.h wctype.h sys/mman.h iconv.h getopt.h)
AC_CHECK_HEADERS(langinfo.h sched.h new.h)
AC_CHECK_HEADERS(stdint.h inttypes.h sys/ipc.h sys/shm.h)
# ----------------------------------------
# Types
# ----------------------------------------
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_CHECK_TYPES(wchar_t)
AC_CHECK_TYPES(long long int)
AC_CHECK_TYPES(mbstate_t,,,[#include "wchar.h"])
AC_SYS_LARGEFILE
# ----------------------------------------
# Functions
# ----------------------------------------
AC_FUNC_MMAP
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(wcrtomb iswspace setenv nl_langinfo)
AC_CHECK_FUNCS(putc_unlocked strerror vsnprintf)
AC_CHECK_FUNCS(gethostname strftime getpwuid)
AC_CHECK_FUNCS(sigaction mkstemp sched_yield)
# iconv function might be defined as libiconv in iconv.h
AC_MSG_CHECKING([for iconv])
ac_has_iconv=no
AC_LANG_PUSH(C)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "iconv.h"]],
[[iconv((iconv_t)0, (char**)0, (size_t*)0, (char**)0, (size_t*)0);]])],
[ac_has_iconv=yes],[])
AC_MSG_RESULT($ac_has_iconv)
AC_LANG_POP(C)
if test x$ac_has_iconv = xyes ; then
AC_DEFINE(HAVE_ICONV,1,
[Define to 1 if you have the iconv function.])
fi
# ----------------------------------------
# Test auxilliary packages
# ----------------------------------------
# Search for PTHREADS (when not on windows)
have_pthread=no
AM_COND_IF([HAVE_OS_WIN32],,[AC_PATH_PTHREAD([have_pthread=yes])])
# Search JPEG library
AC_PATH_JPEG([have_jpeg="yes"], [have_jpeg="no"])
AC_MSG_CHECKING([for libjpeg])
AC_MSG_RESULT([${have_jpeg}])
# Search TIFF library
AC_PATH_TIFF([have_tiff="yes"], [have_tiff="no"])
AC_MSG_CHECKING([for libtiff])
AC_MSG_RESULT([${have_tiff}])
# ----------------------------------------
# What to compile
# ----------------------------------------
# Check compilation of xmltools
want_xmltools="yes"
AC_ARG_ENABLE([xmltools],
[AS_HELP_STRING([--disable-xmltools],
[Disable djvu xml tools. @<:@default=enabled@:>@])],
[want_xmltools=${enableval}])
AM_CONDITIONAL([WANT_XMLTOOLS], [test "x${want_xmltools}" = "xyes"])
# ----------------------------------------
# Desktop files
# ----------------------------------------
ac_desktopfiles="yes"
AC_ARG_ENABLE(desktopfiles,
AS_HELP_STRING([--disable-desktopfiles],
[Do not install icons and mime types. @<:@default=enabled@:>@]),
[ac_desktopfiles=$enableval])
AM_CONDITIONAL([WANT_DESKTOPFILES], [test "x${ac_desktopfiles}" = "xyes"])
# ----------------------------------------
# End
# ----------------------------------------
# Define installation path for .pc files
PKG_INSTALLDIR
# Define installation paths and version string
AC_DEFINE_UNQUOTED(DJVULIBRE_VERSION,["${PACKAGE_VERSION}"],[version string])
# Output files
AC_CONFIG_FILES([
Makefile
libdjvu/Makefile
tools/Makefile
xmltools/Makefile
share/Makefile
desktopfiles/Makefile
])
# Go
AC_OUTPUT
# Final message
echo
echo "$PACKAGE $VERSION"
echo
echo "Configuration Options Summary:"
echo
echo " OS.................: ${host_os}"
echo " Win32 support......: ${have_os_win32}"
echo " Pthread support....: ${have_pthread}"
echo " Iconv support......: ${ac_has_iconv}"
echo " JPEG support.......: ${have_jpeg}"
echo " TIFF support.......: ${have_tiff}"
echo " XML tools..........: ${want_xmltools}"
echo " Desktop files......: ${ac_desktopfiles}"
echo " Icon generation....: ${conversion_tool}"
echo
echo "Compilation..........: make (or gmake)"
echo " CPPFLAGS...........: $CPPFLAGS"
echo " CFLAGS.............: $CFLAGS"
echo " CXXFLAGS...........: $CXXFLAGS"
echo " LDFLAGS............: $LDFLAGS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"
echo
# ----------------------------------------
# Stuff added to config.h
# ----------------------------------------
# Fence
AH_TOP([
#ifndef CONFIG_H
#define CONFIG_H
/* config.h: begin */
])
# L18N Macros
AH_BOTTOM([
/* - Miscellaneous */
#define AUTOCONF 1
#if defined(__CYGWIN32__) || !defined(_WIN32)
# define UNIX 1
#endif
/* - BOOL */
#if !defined(HAVE_BOOL) && !defined(bool)
#define bool char
#define true 1
#define false 0
#endif
/* - WCHAR etc.*/
#if ! defined(HAVE_WCHAR_T)
#define HAS_WCHAR 0
#define HAS_WCTYPE 0
#define HAS_MBSTATE 0
#else
#define HAS_WCHAR 1
#if defined(HAVE_WCTYPE_H) && defined(HAVE_ISWSPACE)
#define HAS_WCTYPE 1
#endif
#if defined(HAVE_MBSTATE_T) && defined(HAVE_WCRTOMB)
#define HAS_MBSTATE 1
#endif
#endif
#if defined(HAVE_ICONV_H) && defined(HAVE_ICONV)
#define HAS_ICONV 1
#else
#define HAS_ICONV 0
#endif
/* - I18N MESSAGES HELL */
#define HAS_CTRL_C_IN_ERR_MSG 1
/* - CONTAINERS */
#ifndef HAVE_MEMBER_TEMPLATES
#define GCONTAINER_NO_MEMBER_TEMPLATES 1
#endif
#ifndef HAVE_TYPENAME
#define GCONTAINER_NO_TYPENAME 1
#endif
/* - JPEG */
#ifdef HAVE_JPEG
#define NEED_JPEG_DECODER 1
#endif
/* - MMAP */
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H)
#define HAS_MEMMAP 1
#else
#define HAS_MEMMAP 0
#endif
/* config.h: end */
#endif
])