-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
268 lines (230 loc) · 9.32 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
dnl Configure template for OpenCReports
dnl Copyright (c) 2019-2025 Zoltán Böszörményi ([email protected])
dnl OpenCReports is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published by
dnl the Free Software Foundation; either version 3, or (at your option)
dnl any later version.
dnl OpenCReports is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU Lesser General Public License for more details.
AC_INIT([OpenCReports],m4_normalize(m4_include([VERSION])),[https://github.com/zboszor/OpenCReports])
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR(include/opencreport.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE()
AC_CONFIG_HEADERS(config.h)
AM_MAINTAINER_MODE
OCRPT_LT_CURRENT=1
OCRPT_LT_AGE=0
OCRPT_LT_REVISION=0
AC_SUBST(OCRPT_LT_CURRENT)
AC_SUBST(OCRPT_LT_REVISION)
AC_SUBST(OCRPT_LT_AGE)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LEX([noyywrap])
AX_PROG_FLEX
AX_PROG_BISON
LT_INIT([disable-static win32-dll])
AC_CHECK_FUNCS([localtime_r strfmon getrandom])
dnl Detect whether -D_BSD_SOURCE works
AC_MSG_CHECKING([whether -D_BSD_SOURCE provides strcasecmp])
old_CFLAGS="$CFLAGS"
CFLAGS="-Werror -D_BSD_SOURCE $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <string.h>]],[[return strcasecmp("a", "a");]])],
[_bsd_source_strcasecmp=yes],
[_bsd_source_strcasecmp=no])
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$_bsd_source_strcasecmp])
AC_MSG_CHECKING([whether -D_DEFAULT_SOURCE provides strcasecmp])
old_CFLAGS="$CFLAGS"
CFLAGS="-Werror -D_DEFAULT_SOURCE $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <string.h>]],[[return strcasecmp("a", "a");]])],
[_default_source_strcasecmp=yes],
[_default_source_strcasecmp=no])
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$_default_source_strcasecmp])
AC_MSG_CHECKING([whether -D_GNU_SOURCE provides strcasecmp])
old_CFLAGS="$CFLAGS"
CFLAGS="-Werror -D_GNU_SOURCE $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <string.h>]],[[return strcasecmp("a", "a");]])],
[_gnu_source_strcasecmp=yes],
[_gnu_source_strcasecmp=no])
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$_gnu_source_strcasecmp])
AS_IF(
[test x$_bsd_source_strcasecmp = xyes],
[COMPILE_SYMBOL=-D_BSD_SOURCE],
[test x$_default_source_strcasecmp = xyes],
[COMPILE_SYMBOL=-D_DEFAULT_SOURCE],
[test x$_gnu_source_strcasecmp = xyes],
[COMPILE_SYMBOL=-D_GNU_SOURCE],
[AC_MSG_WARN([Using strcasecmp may fail to compile!])])
AC_MSG_CHECKING([whether -D_DEFAULT_SOURCE provides reallocarray])
old_CFLAGS="$CFLAGS"
CFLAGS="-Werror -D_DEFAULT_SOURCE $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>]],
[[void *x = reallocarray(NULL, 2, 16); return x != NULL;]])],
[_default_source_reallocarray=yes],
[_default_source_reallocarray=no])
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$_default_source_reallocarray])
AC_MSG_CHECKING([whether -D_GNU_SOURCE provides reallocarray])
old_CFLAGS="$CFLAGS"
CFLAGS="-Werror -D_GNU_SOURCE $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>]],
[[void *x = reallocarray(NULL, 2, 16); return x != NULL;]])],
[_gnu_source_reallocarray=yes],
[_gnu_source_reallocarray=no])
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([$_gnu_source_reallocarray])
AS_IF(
[test x$_default_source_reallocarray = xyes],
[COMPILE_SYMBOL="$COMPILE_SYMBOL -D_DEFAULT_SOURCE"
AC_DEFINE(HAVE_REALLOCARRAY,[1],[Have reallocarray function])],
[test x$_gnu_source_reallocarray = xyes],
[COMPILE_SYMBOL="$COMPILE_SYMBOL -D_GNU_SOURCE"
AC_DEFINE(HAVE_REALLOCARRAY,[1],[Have reallocarray function])],
[AC_MSG_WARN([Using reallocarray may fail to compile!])])
AC_SUBST(COMPILE_SYMBOL)
AC_LIBTOOL_LINKER_OPTION([for linker support for -Wl,--export-dynamic],[ac_cv_Wl_dash_dash_export_dynamic],[-Wl,--export-dynamic],
[TEST_LINK_FLAG="-Wl,--export-dynamic"],
[AC_LIBTOOL_LINKER_OPTION([for linker support for -Wl,-export-dynamic],[ac_cv_Wl_dash_export_dynamic],[-Wl,-export-dynamic],
[TEST_LINK_FLAG="-Wl,-export-dynamic"],
[AC_LIBTOOL_LINKER_OPTION([for linker support for -rdynamic],[ac_cv_WL_rdynamic],[-rdynamic],
[TEST_LINK_FLAG="-rdynamic"],
[AC_MSG_ERROR([Working dynamic linker option not found])])])])
AC_SUBST(TEST_LINK_FLAG)
gl_VISIBILITY
AS_IF([test x$gl_cv_cc_visibility = xyes],
[AC_DEFINE(DLL_EXPORT_SYM,[__attribute__((visibility("default")))],[Explicitly export global symbols])],
[AC_DEFINE(DLL_EXPORT_SYM,[],[Explicitly export global symbols])]
)
PKG_INSTALLDIR()
dnl LibXML2 2.5.0 introduced the XmlTextReader API
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.5.0)
AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CFLAGS)
PKG_CHECK_MODULES(UTF8PROC, libutf8proc,,
[AC_CHECK_HEADER(utf8proc.h,
[AC_CHECK_LIB(utf8proc, utf8proc_iterate,
[UTF8PROC_LIBS="-lutf8proc"],
[AC_MSG_ERROR([utf8proc is not installed])])],
[AC_MSG_ERROR([utf8proc is not installed])])])
AC_SUBST(UTF8PROC_LIBS)
AC_SUBST(UTF8PROC_CFLAGS)
dnl GNU MP/MPFR detection
AC_CHECK_HEADERS(gmp.h mpfr.h mpf2mpfr.h,,[AC_MSG_ERROR([GNU MP and MPFR headers not found!])])
AC_CHECK_LIB(mpfr, mpfr_init2,[MPFR_LIBS="-lmpfr"],[AC_MSG_ERROR([GNU MPFR library not found!])])
AC_CHECK_LIB(gmp, __gmpf_init2,[MPFR_LIBS="$MPFR_LIBS -lgmp"],[AC_MSG_ERROR([GNU MP library not found!])])
AC_SUBST(MPFR_LIBS)
dnl libpaper detection
AC_CHECK_HEADERS(paper.h,,[AC_MSG_ERROR([libpaper header is not found])])
AC_CHECK_LIB(paper, paperinit,[PAPER_LIBS="-lpaper"],[AC_MSG_ERROR([libpaper library is not found])])
AC_SUBST(PAPER_LIBS)
AC_CHECK_HEADERS(csv.h,,[AC_MSG_ERROR([libcsv headers not found!])])
AC_CHECK_LIB(csv, csv_init,[CSV_LIBS=-lcsv],[AC_MSG_ERROR([libcsv library not found!])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <csv.h>]],
[[int i = CSV_APPEND_NULL]])],,
[AC_MSG_ERROR([libcsv 3.0.0 or newer is required!])])
AC_SUBST(CSV_LIBS)
PKG_CHECK_MODULES(YAJL, yajl)
AC_SUBST(YAJL_CFLAGS)
AC_SUBST(YAJL_LIBS)
PKG_CHECK_MODULES(PDFGEN, cairo >= 1.6 cairo-pdf pangocairo >= 1.10 librsvg-2.0 gdk-pixbuf-2.0)
AC_SUBST(PDFGEN_CFLAGS)
AC_SUBST(PDFGEN_LIBS)
enable_pgsql_tests=no
PKG_CHECK_MODULES(POSTGRESQL, libpq,
[enable_pgsql_tests=yes
AC_DEFINE(HAVE_POSTGRESQL,[1],[Have recent enough PostgreSQL])],
[AC_CHECK_HEADERS(libpq-fe.h,
[AC_CHECK_LIB(pq, PQdescribePortal,
[POSTGRESQL_LIBS="-lpq"
enable_pgsql_tests=yes
AC_DEFINE(HAVE_POSTGRESQL,[1],[Have recent enough PostgreSQL])],
[AC_MSG_NOTICE([PostgreSQL is not installed or older than 8.2.0])])],
[AC_MSG_NOTICE([PostgreSQL is not installed or older than 8.2.0])])])
AC_SUBST(POSTGRESQL_CFLAGS)
AC_SUBST(POSTGRESQL_LIBS)
AM_CONDITIONAL(ENABLE_PGSQL_TESTS, [test x$enable_pgsql_tests = xyes])
MYSQL_CLIENT([5.0.3],[thread-safe])
AC_ARG_WITH([odbcmanager],
[AS_HELP_STRING([--with-odbcmanager={unixodbc|iodbc}],
[specify ODBC manager library @<:@default=unixodbc@:>@])],
[odbcmanager=$with_odbcmanager],
[odbcmanager=unixodbc])
AS_IF(
[test x$odbcmanager = xunixodbc],
[PKG_CHECK_MODULES(ODBC, odbc,,
[AC_CHECK_HEADERS(sql.h sqlext.h sqltypes.h,
[AC_CHECK_LIB(odbc, SQLSetConnectAttr,
[ODBC_LIBS="-lodbc"],
[AC_MSG_ERROR([ODBC library is not installed])])],
[AC_MSG_ERROR([ODBC headers are not installed])])])],
[test x$odbcmanager = xiodbc],[PKG_CHECK_MODULES(ODBC, libiodbc)],
[AC_MSG_ERROR([Invalid ODBC manager type])])
AC_MSG_NOTICE([ODBC manager is $odbcmanager])
AC_SUBST(ODBC_CFLAGS)
AC_SUBST(ODBC_LIBS)
AC_MSG_CHECKING([whether tests are enabled])
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests],[enable unit tests])],
[],[enable_tests=no])
AC_MSG_RESULT([$enable_tests])
AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
AC_CHECK_PROG(MSGFMT,[msgfmt],[msgfmt],[false])
AM_CONDITIONAL(ENABLE_XLATE_TESTS, [test x$ac_cv_prog_MSGFMT = xmsgfmt])
AC_CHECK_PROG(GHOSTSCRIPT,[ghostscript],[ghostscript],[false])
AC_CHECK_PROG(IMCOMPARE,[compare],[compare],[false])
AM_CONDITIONAL(ENABLE_PDF_TESTS, [test x$ac_cv_prog_GHOSTSCRIPT = xghostscript -a x$ac_cv_prog_IMCOMPARE = xcompare])
AC_MSG_CHECKING([whether building documentation is enabled])
AC_ARG_ENABLE([documentation],
[AS_HELP_STRING([--enable-documentation],[enable building documentation])],
[],[enable_documentation=yes])
AC_MSG_RESULT([$enable_documentation])
AC_CHECK_PROG(XMLLINT,[xmllint],[xmllint],[false])
AC_CHECK_PROG(XSLTPROC,[xsltproc],[xsltproc],[false])
AC_CHECK_PROG(FOP,[fop],[fop],[false])
AC_MSG_CHECKING([whether building HTML documentation is possible])
AS_IF([test x$ac_cv_prog_XMLLINT = xxmllint -a x$ac_cv_prog_XSLTPROC = xxsltproc],
[enable_docs=yes],
[enable_docs=no])
AC_MSG_RESULT([$enable_docs])
AS_IF([test x$enable_documentation = xno],[enable_docs=no])
AM_CONDITIONAL(ENABLE_DOCS, [test x$enable_docs = xyes])
AC_MSG_CHECKING([whether building PDF documentation is possible])
AS_IF([test x$enable_docs = xyes -a x$ac_cv_prog_FOP = xfop],
[enable_pdf_docs=yes],
[enable_pdf_docs=no])
AC_MSG_RESULT([$enable_pdf_docs])
AS_IF([test x$enable_documentation = xno],[enable_pdf_docs=no])
AM_CONDITIONAL(ENABLE_PDF_DOCS, [test x$enable_pdf_docs = xyes])
AS_IF([test x$enable_maintainer_mode = xyes],[WERRORFLAG=],[WERRORFLAG="-Werror"])
AC_SUBST(WERRORFLAG)
AC_CONFIG_FILES([
Makefile
opencreports.pc
doc/Makefile
doc/OpenCReports.sgm
include/Makefile
libsrc/Makefile
tests/Makefile
])
AC_OUTPUT