-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
242 lines (215 loc) · 7.12 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT([Gawk Extension Libraries], 0.4.1, gawkextlib-users@lists.sourceforge.net, gawkextlib)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
INSTALL="$ac_aux_dir/install-sh -c"
export INSTALL
AM_INIT_AUTOMAKE([-Wall])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18.1])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl We need AC_SYS_LARGEFILE because gawk uses it, and there can otherwise
dnl be a discrepancy in the struct stat layout in IOBUF_PUBLIC
AC_SYS_LARGEFILE
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST([pkgextensiondir], ['${libdir}/gawk'])
AC_SUBST([pkgdatadir], ['${datadir}/awk'])
if test "$GCC" = yes
then
CFLAGS="$CFLAGS -Wall -Wextra"
fi
AC_SUBST([GAWKPROG],"gawk${EXEEXT}")
AC_ARG_WITH(gawk,
[AS_HELP_STRING([--with-gawk=PATH],[Use gawk in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
if test -x "$withval/gawk${EXEEXT}"; then
AC_SUBST([GAWKPROG],"$withval/gawk${EXEEXT}")
elif test -x "$withval/bin/gawk${EXEEXT}"; then
AC_SUBST([GAWKPROG],"$withval/bin/gawk${EXEEXT}")
elif test -x "$withval/usr/bin/gawk${EXEEXT}"; then
AC_SUBST([GAWKPROG],"$withval/usr/bin/gawk${EXEEXT}")
fi
]
)
AC_ARG_WITH(expat,
[AS_HELP_STRING([--with-expat=PATH],[Use expat in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
]
)
AC_ARG_WITH(libpq,
[AS_HELP_STRING([--with-libpq=PATH],[Use PostgreSQL libpq in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
LIBPQ_PATH="${withval}"
]
)
AC_ARG_WITH(libpq-conninfo,
[AS_HELP_STRING([--with-libpq-conninfo=CONNINFO],[Use CONNINFO to connect to PostgreSQL server for pgsql tests])],
[PQCONNINFO="$withval"],
[PQCONNINFO=""]
)
AC_SUBST([PQCONNINFO])
AC_ARG_WITH(mpfr,
[AS_HELP_STRING([--with-mpfr=PATH],[Use MPFR libmpfr in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
]
)
AC_ARG_WITH(gmp,
[AS_HELP_STRING([--with-gmp=PATH],[Use GMP libgmp in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
]
)
AC_ARG_WITH(gd,
[AS_HELP_STRING([--with-gd=PATH],[Use GD in PATH])],
[
if test -d "$withval/lib"; then
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
else
LDFLAGS="-L${withval} ${LDFLAGS}"
fi
if test -d "$withval/include"; then
CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
else
CPPFLAGS="-I${withval} ${CPPFLAGS}"
fi
]
)
AC_ARG_ENABLE(xml,
AC_HELP_STRING([--disable-xml],[Do not build XML extension @<:@default=build if <expat.h> is present@:>@]))
if test x"$enable_xml" != x"no" ; then
AC_CHECK_HEADER(expat.h)
if test x"$enable_xml" = x"yes" -a x"$ac_cv_header_expat_h" = x"no" ; then
AC_MSG_ERROR([Configured with --enable-xml, but C compiler cannot find expat.h])
fi
fi
AM_CONDITIONAL(BUILD_XML, test x"$ac_cv_header_expat_h" = x"yes")
AC_ARG_ENABLE(pgsql,
AC_HELP_STRING([--disable-pgsql],[Do not build pgsql extension @<:@default=build if <libpq-fe.h> is present@:>@]))
if test x"$enable_pgsql" != x"no" ; then
AC_CHECK_HEADER(libpq-fe.h)
if test x"$enable_pgsql" = x"yes" -a x"$ac_cv_header_libpq_fe_h" = x"no" ; then
AC_MSG_ERROR([Configured with --enable-pgsql, but C compiler cannot find libpq-fe.h])
fi
fi
AM_CONDITIONAL(BUILD_PGSQL, test x"$ac_cv_header_libpq_fe_h" = x"yes")
# test if we can connect to a PostgreSQL server to run tests
if test x"$ac_cv_header_libpq_fe_h" = x"yes" ; then
AS_ECHO_N(["checking for ability to connect to a PostgreSQL server... "])
if test x"$LIBPQ_PATH" = x ; then
pqpath="$PATH"
else
pqpath="$LIBPQ_PATH/bin:$PATH"
fi
# sadly, newer psql gets confused by -d ""
if test x"$PQCONNINFO" = x ; then
pgres=`PATH="$pqpath" psql -At -c "SELECT 1"`
else
pgres=`PATH="$pqpath" psql -At -c "SELECT 1" -d "$PQCONNINFO"`
fi
if test x"$pgres" = x"1" ; then
AS_ECHO(["yes"])
got_pgconn=1
else
AS_ECHO(["no"])
got_pgconn=0
test x"$PQCONNINFO" = x || AC_MSG_ERROR([Configured with --with-libpq-conninfo, but unable to connect to PostgreSQL server])
fi
else
got_pgconn=0
fi
AM_CONDITIONAL(TEST_PGSQL, test x"$got_pgconn" = x"1")
AC_ARG_ENABLE(mpfr,
AC_HELP_STRING([--disable-mpfr],[Do not build MPFR extension @<:@default=build if libmpfr has function mpfr_free_str@:>@]))
dnl Recognition of MPFR could be done by recognizing the header file mpfr.h.
dnl This led to trouble because GMP comes with an incompatible version of mpfr.h
dnl So, after detecting presence of the GMP lib, the only test that will be done
dnl is recognition of the function mpfr_free_str which is expected to reside in
dnl libmpfr since version 2.1 of MPFR.
if test x"$enable_mpfr" != x"no" ; then
AC_CHECK_LIB(gmp, __gmpz_init, [true])
if test x"$ac_cv_lib_gmp___gmpz_init" = x"yes" ; then
# Since libmpfr is typically static, it may not pull in
# libgmp automatically, so we specify it explicitly to be safe.
AC_CHECK_LIB(mpfr, mpfr_free_str, [true], [true], -lgmp)
if test x"$ac_cv_lib_mpfr_mpfr_free_str" = x"no" ; then
AC_MSG_WARN([Configured with --enable-mpfr, but MPFR was not found or does not have required features of MPFR 2.2. Go install MPFR 2.2 or later from http://www.mpfr.org/mpfr-current and try again.])
fi
else
AC_MSG_WARN([Configured with --enable-mpfr, but GMP was not found. Go install GMP 4.1.4 or later from http://www.swox.com/gmp and try again.])
fi
fi
AM_CONDITIONAL(BUILD_MPFR, test x"$ac_cv_lib_mpfr_mpfr_free_str" = x"yes")
AC_ARG_ENABLE(gd,
AC_HELP_STRING([--disable-gd],[Do not build GD graphics extension @<:@default=build if <gd.h> is present@:>@]))
if test x"$enable_gd" != x"no" ; then
AC_CHECK_HEADER(gd.h)
if test x"$enable_gd" = x"yes" -a x"$ac_cv_header_gd_h" = x"no" ; then
AC_MSG_ERROR([Configured with --enable-gd, but C compiler cannot find gd.h])
fi
fi
AM_CONDITIONAL(BUILD_GD, test x"$ac_cv_header_gd_h" = x"yes")
AC_CHECK_HEADERS(gawkapi.h unistd.h stdlib.h string.h libintl.h)
if test x"$ac_cv_header_gawkapi_h" = x"no" ; then
AC_MSG_ERROR([Cannot find gawkapi.h. Please use --with-gawk to supply a location for your gawk build.])
fi
AC_C_INLINE
AC_CONFIG_HEADERS([config.h:configh.in])
AC_CONFIG_FILES(Makefile
awklib/Makefile
doc/Makefile
extension/Makefile
packaging/Makefile
packaging/gawkextlib.spec
po/Makefile.in
test/Makefile)
AC_OUTPUT