This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
/
acinclude.m4
461 lines (448 loc) · 14.8 KB
/
acinclude.m4
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
#######################################################################
#
# pgAdmin III - PostgreSQL Tools
# Copyright (C) 2002 - 2004, The pgAdmin Development Team
# This software is released under the Artistic Licence
#
# acinclude.m4 - Build system scripts.
#
#######################################################################
#############################
# Override wx-config binary #
#############################
AC_DEFUN([CHECK_WX_CONFIG_BINARY],
[AC_MSG_CHECKING(for wx-config binary)
AC_ARG_WITH(wx-config,
[ --with-wx-config=FILE name of wx-config binary],
[if test "$withval" != no; then
AC_MSG_RESULT(yes)
wx_config_binary="$withval"
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([you must specify a filename when using --with-wx-config=FILE])
fi])
AC_MSG_RESULT(yes)
])
#########################################
# Override PostgreSQL include directory #
#########################################
AC_DEFUN([CHECK_PGSQL_INCLUDE],
[AC_MSG_CHECKING(for pgsql include files)
AC_ARG_WITH(pgsql-include,
[ --with-pgsql-include=DIR location of PostgreSQL include files],
[if test "$withval" != no; then
AC_MSG_RESULT(yes)
pgsql_include="$withval"
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([you must specify a directory when using --with-pgsql-include=DIR])
fi])
AC_MSG_RESULT(yes)
])
###########################
# Debug build of pgAdmin3 #
###########################
AC_DEFUN([ENABLE_DEBUG],
[AC_ARG_ENABLE(debug,
[ --enable-debug build a debug version of pgAdmin3],
[pg_debug_build=yes
CFLAGS="-Wall -g -O0"
CXXFLAGS="-Wall -g -O0"],
[pg_debug_build=no])
])
############################
# Static build of pgAdmin3 #
############################
AC_DEFUN([ENABLE_STATIC],
[AC_ARG_ENABLE(static,
[ --enable-static build a static version of pgAdmin3],
[pg_static_build=yes],
[pg_static_build=no])
])
########################################
# Check for PostgreSQL library (libpq) #
########################################
AC_DEFUN([CHECK_PGSQL],
[AC_MSG_CHECKING(for pgsql)
AC_ARG_WITH(pgsql,
[ --with-pgsql=DIR directory to look for pgsql libraries and headers],
[if test "$withval" != no
then
AC_MSG_RESULT(yes)
LIBPQ_HOME="$withval"
else
AC_MSG_RESULT(no)
fi], [
AC_MSG_RESULT(yes)
LIBPQ_HOME="/usr/local/pgsql"
# Check for headers
if test "$pgsql_include" = ""
then
if test ! -f "${LIBPQ_HOME}/include/libpq-fe.h"
then
LIBPQ_HOME=/usr/local
if test ! -f "${LIBPQ_HOME}/include/libpq-fe.h"
then
LIBPQ_HOME=/usr
fi
fi
if test -f "/usr/include/libpq-fe.h"
then
pgsql_include="/usr/include"
else
if test -f "/usr/include/pgsql/libpq-fe.h"
then
pgsql_include="/usr/include/pgsql"
fi
fi
fi
])
#
# Check for libpq libraries and headers
#
if test -n "${LIBPQ_HOME}"
then
PGSQL_OLD_LDFLAGS="$LDFLAGS"
PGSQL_OLD_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS -L${LIBPQ_HOME}/lib"
if test "$pgsql_include" != ""
then
CPPFLAGS="$CPPFLAGS -I${pgsql_include}"
else
CPPFLAGS="$CPPFLAGS -I${LIBPQ_HOME}/include"
fi
if test "$pg_static_build" = "yes"
then
LIBS="${LIBPQ_HOME}/lib/libpq.a -lcrypt $LIBS -lssl -lcrypto"
else
LIBS="$LIBS -lssl -lcrypto -lpq"
fi
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB(pq, PQexec, [pgsql_cv_libpq=yes], [pgsql_cv_libpq=no])
AC_CHECK_LIB(pq, SSL_connect, [pgsql_ssl_libpq=yes], [pgsql_ssl_libpq=np])
AC_CHECK_HEADER(libpq-fe.h, [pgsql_cv_libpqfe_h=yes], [pgsql_cv_libpqfe_h=no])
AC_LANG_RESTORE
if test "$pgsql_cv_libpq" = "yes" -a "$pgsql_cv_libpqfe_h" = "yes"
then
AC_MSG_CHECKING(pgsql in ${LIBPQ_HOME})
AC_MSG_RESULT(ok)
else
AC_MSG_CHECKING(pgsql in ${LIBPQ_HOME})
AC_MSG_RESULT(failed)
LDFLAGS="$PGSQL_OLD_LDFLAGS"
CPPFLAGS="$PGSQL_OLD_CPPFLAGS"
AC_MSG_ERROR([you must specify a valid pgsql installation with --with-pgsql=DIR])
fi
if test "$pgsql_ssl_libpq" = "yes"
then
CPPFLAGS="$CPPFLAGS -DSSL"
fi
fi
])
#####################################################################
# WxWindows linking checks #
# This check should be specified last in configure.ac, since all of #
# the above checks affect this test in some way or another. #
#####################################################################
AC_DEFUN([CHECK_WXWINDOWS],
[AC_MSG_CHECKING(for wxWindows)
AC_ARG_WITH(wx,
[ --with-wx=DIR root directory for wxWindows installation],
[if test "$withval" != no
then
AC_MSG_RESULT(yes)
WX_HOME="$withval"
else
AC_MSG_RESULT(no)
fi], [
AC_MSG_RESULT(yes)
WX_HOME=/usr/local/wx2
if test ! -f "${WX_HOME}/include/wx-2.5/wx/wx.h"
then
WX_HOME=/usr/local
if test ! -f "${WX_HOME}/include/wx-2.5/wx/wx.h"
then
WX_HOME=/usr
fi
fi
])
if test -n "${WX_HOME}"
then
# Check for wx-config binary
if test "$wx_config_binary" != ""
then
if test ! -f "${WX_HOME}/bin/${wx_config_binary}"
then
if test ! -f "${WX_HOME}/${wx_config_binary}"
then
AC_MSG_ERROR([Could not find ${wx_config_binary}])
else
WX_CONFIG="${WX_HOME}/${wx_config_binary}"
fi
else
WX_CONFIG="${WX_HOME}/bin/${wx_config_binary}"
fi
else
if test ! -f "${WX_HOME}/bin/wx-config"
then
if test ! -f "${WX_HOME}/wx-config"
then
AC_MSG_ERROR([Could not find wx-config in ${WX_HOME}])
else
WX_CONFIG="${WX_HOME}/wx-config"
fi
else
WX_CONFIG="${WX_HOME}/bin/wx-config"
fi
fi
LDFLAGS="$LDFLAGS -L${WX_HOME}/lib"
WX_OLD_LDFLAGS="$LDFLAGS"
WX_OLD_CPPFLAGS="$CPPFLAGS"
if test "$pg_static_build" = "yes"
then
WX_NEW_LDFLAGS=`${WX_CONFIG} --static --libs`
else
WX_NEW_LDFLAGS=`${WX_CONFIG} --libs`
fi
# Which version of wxWindows is this?
WX_VERSION=`${WX_CONFIG} --version`
case "${WX_VERSION}" in
2.5*)
WX_VERSION="2.5"
;;
2.4*)
WX_VERSION="2.4"
;;
*)
;;
esac
# Here we go!!
if test "$pg_static_build" = "yes"
then
case "${WX_NEW_LDFLAGS}" in
*libwx_mswud-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_mswud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_mswu-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_mswu_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_mswd-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_mswd_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_msw-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_msw_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_macud-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_macud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_macud_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_macud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_macd-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_macd_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_macd_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_macd_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_mac-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_mac_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_mac_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_mac_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2ud-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2ud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2ud_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2ud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2d-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2d_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2d_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2d_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2u-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2u_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk2u_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk2u_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtkud-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtkud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtkud_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtkud_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtkd-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtkd_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtkd_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtkd_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk-*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*libwx_gtk_core*)
LIBS="$LIBS ${WX_HOME}/lib/libwx_gtk_stc-${WX_VERSION}.a"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*)
;;
esac
else
case "${WX_NEW_LDFLAGS}" in
*libwx_mswud-*)
LIBS="$LIBS -lwx_mswud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_mswu-*)
LIBS="$LIBS -lwx_mswu_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_mswd-*)
LIBS="$LIBS -lwx_mswd_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*libwx_msw-*)
LIBS="$LIBS -lwx_msw_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
LDFLAGS="$LDFLAGS -mwindows -Wl,--subsystem,windows"
;;
*wx_macud-*)
LIBS="$LIBS -lwx_macud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_macud_core*)
LIBS="$LIBS -lwx_macud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_macd-*)
LIBS="$LIBS -lwx_macd_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_macd_core*)
LIBS="$LIBS -lwx_macd_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_mac-*)
LIBS="$LIBS -lwx_mac_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_mac_core*)
LIBS="$LIBS -lwx_mac_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2ud-*)
LIBS="$LIBS -lwx_gtk2ud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2ud_core*)
LIBS="$LIBS -lwx_gtk2ud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2d-*)
LIBS="$LIBS -lwx_gtk2d_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2d_core*)
LIBS="$LIBS -lwx_gtk2d_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2u-*)
LIBS="$LIBS -lwx_gtk2u_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk2u_core*)
LIBS="$LIBS -lwx_gtk2u_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtkud-*)
LIBS="$LIBS -lwx_gtkud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtkud_core*)
LIBS="$LIBS -lwx_gtkud_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtkd-*)
LIBS="$LIBS -lwx_gtkd_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtkd_core*)
LIBS="$LIBS -lwx_gtkd_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk-*)
LIBS="$LIBS -lwx_gtk_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*wx_gtk_core*)
LIBS="$LIBS -lwx_gtk_stc-${WX_VERSION}"
LIBS="$LIBS $WX_NEW_LDFLAGS"
;;
*)
;;
esac
fi
WX_NEW_CPPFLAGS=`${WX_CONFIG} --cxxflags`
CPPFLAGS="$CPPFLAGS $WX_NEW_CPPFLAGS -I${WX_HOME}/include/wx-2.5"
case "${host}" in
*-apple-darwin*)
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -fno-rtti"
;;
*)
;;
esac
wx_wx_h="yes"
if test ! -f "${WX_HOME}/include/wx-2.5/wx/version.h"
then
wx_wx_h="no"
fi
if test ! -f "${WX_HOME}/include/wx-2.5/wx/stc/stc.h"
then
AC_MSG_ERROR([you need to install the stc package from wxWindows/contrib/src/stc])
wx_wx_h="no"
fi
if test "$wx_wx_h" = "yes"
then
AC_MSG_CHECKING([wxWindows in ${WX_HOME}])
AC_MSG_RESULT(ok)
else
AC_MSG_CHECKING([wxWindows in ${WX_HOME}])
LDFLAGS="$WX_OLD_LDFLAGS"
CPPFLAGS="$WX_OLD_CPPFLAGS"
AC_MSG_RESULT(failed)
AC_MSG_ERROR([you must specify a valid wxWindows installation with --with-wx=DIR])
fi
fi
])