forked from openlink/odbc-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
634 lines (546 loc) · 14.8 KB
/
configure.in
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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
AC_PREREQ(2.53)
AC_REVISION($Id$)
#
# configure.in
#
# odbc-bench - a TPC-A and TPC-C like benchmark program for databases
# Copyright (C) 2000-2018 OpenLink Software <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
##########################################################################
## ##
## Initialization ##
## ##
##########################################################################
AC_INIT([OpenLink ODBC Benchmark Utility],
[1.1],
[odbc-bench])
AC_CONFIG_SRCDIR([src/odbcbench.h])
AC_CONFIG_AUX_DIR(admin)
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME,AC_PACKAGE_VERSION)
AC_CANONICAL_HOST
AM_MAINTAINER_MODE
##########################################################################
## ##
## Check whether config.cache belongs to this machine ##
## ##
##########################################################################
AC_MSG_CHECKING(cached information)
hostcheck="$host"
AC_CACHE_VAL(ac_cv_hostcheck, [ ac_cv_hostcheck="$hostcheck" ])
if test "$ac_cv_hostcheck" != "$hostcheck"; then
AC_MSG_RESULT(changed)
AC_MSG_WARN([Running on a different architecture.])
AC_MSG_WARN([Can't use cached values.])
AC_MSG_ERROR([Please remove the invalid config.cache file, then try again.])
else
AC_MSG_RESULT(ok)
fi
##########################################################################
## ##
## Check for C compiler ##
## ##
##########################################################################
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_CC_STDC
AC_PROG_CPP
AC_LANG([C])
##########################################################################
## ##
## Check for standard programs ##
## ##
##########################################################################
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl AC_PROG_RANLIB
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
##########################################################################
## ##
## Check for standard header files ##
## ##
##########################################################################
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/poll.h)
##########################################################################
## ##
## Check for specific library functions ##
## ##
##########################################################################
AC_CHECK_FUNCS(strerror setenv usleep poll select)
##########################################################################
## ##
## Check for XML2 library functions ##
## ##
##########################################################################
AM_PATH_XML2(2.4.0)
##########################################################################
## ##
## Check for GTK library functions ##
## ##
##########################################################################
USE_GTK=false
AM_PATH_GTK(1.2.3, [], [], gthread )
if test x$no_gtk = x
then
USE_GTK=true
fi
##########################################################################
## ##
## Check if we want to build the GUI applications and libraries ##
## ##
##########################################################################
#
# Put separator between options
#
AC_ARG_ENABLE([],[
ODBC-Bench Specific Features:],[])
AC_ARG_ENABLE(gui, [dnl
AC_HELP_STRING([--enable-gui], [build GUI applications (default)])
AC_HELP_STRING([--disable-gui], [build GUI applications])dnl
], [
case "${enableval}" in
yes) USE_GUI=true ;;
no) USE_GUI=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gui) ;;
esac
],[USE_GUI=true])
##########################################################################
## ##
## Now make the final checks whether we can use GUI extentions ##
## ##
##########################################################################
if test x$USE_GTK = xfalse
then
USE_GUI=false
fi
if test x$USE_GUI = xfalse
then
USE_GTK=false
fi
if test x$USE_GUI = xtrue
then
AC_DEFINE(GUI, 1, [Define if we detected a GUI library we can use])
fi
AM_CONDITIONAL(GUI, [test x$USE_GUI = xtrue])
AM_CONDITIONAL(GTK, [test x$USE_GTK = xtrue])
##########################################################################
## ##
## Check for dynamic load module ##
## ##
##########################################################################
AC_CHECK_HEADERS(dlfcn.h dl.h dld.h)
LIBADD_DL=
AC_CHECK_LIB(dl, dlopen,
[
AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the -ldl library])
LIBADD_DL="-ldl"
],
[
AC_CHECK_FUNCS(dlopen _dlopen,
[
AC_DEFINE(HAVE_LIBDL, 1,[Define if you have the -ldl library])
])
])
AC_CHECK_FUNC(shl_load,
[
AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if you have the shl_load function])
],
[
AC_CHECK_LIB(dld, shl_load,
[
AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if you have the shl_load function])
LIBADD_DL="$LIBADD_DL -ldld"
])
])
AC_CHECK_LIB(dld, dld_link,
[
AC_DEFINE(HAVE_DLD, 1, [Define if you have the -ldld library])
test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"
])
AC_CHECK_FUNC(NSCreateObjectFileImageFromFile,
[
AC_DEFINE(HAVE_DYLD, 1, [Define if you have the DYLD library])
])
AC_SUBST(LIBADD_DL)
##########################################################################
## ##
## Checkout pthread situation ##
## ##
##########################################################################
AC_MSG_CHECKING(for thread model)
AC_ARG_ENABLE(pthreads, [dnl
AC_HELP_STRING([--enable-pthreads], [build threaded applications (default)])
AC_HELP_STRING([--disable-pthreads], [build non-threaded applications])dnl
], [
case "${enableval}" in
yes) USE_PTHREADS=true ;;
no) USE_PTHREADS=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-pthreads) ;;
esac
],[USE_PTHREADS=true])
if test x$USE_PTHREADS = xtrue
then
AC_MSG_RESULT(enabled pthread support)
CPPFLAGS="$CPPFLAGS -DWITH_PTHREADS -D_REENTRANT"
found_lib=false
AC_MSG_CHECKING(for OS dependent thread flags)
case $host in
*-aix*)
CC=cc_r7
AC_MSG_RESULT([use cc_r7 for AIX])
;;
*UnixWare*)
CFLAGS="$CFLAGS -Kthread"
AC_MSG_RESULT([use -Kthread for UnixWare])
;;
i[3456]86-dg-dgux*)
CFLAGS="$CFLAGS -D_POSIX4A_DRAFT6_SOURCE"
LIBS="$LIBS -lthread"
AC_MSG_RESULT([use -lthread for DG/UX])
;;
*-freebsd*)
CFLAGS="$CFLAGS -pthread"
AC_MSG_RESULT([use -pthread for FreeBSD])
;;
*)
AC_MSG_RESULT([none])
;;
esac
#
# Check headers
#
AC_CHECK_HEADER(pthread.h)
#
# If mutex functions are in C library, we should not need to link
# with -lpthread
#
AC_CHECK_FUNC(pthread_create, [found_lib=true])
#
# Check out the various libraries
#
if test x$found_lib = xfalse
then
IODBC_CHECK_PTHREAD_LIB(pthreads, pthread_create,
[
if test "$host_os" = "osf3.2"
then
CPPFLAGS="$CPPFLAGS -DOLD_PTHREADS"
LIBS="$LIBS -lpthreads -lmach -lc_r"
else
LIBS="$LIBS -lpthreads"
fi
found_lib=true
])
fi
if test x$found_lib = xfalse
then
IODBC_CHECK_PTHREAD_LIB(pthread, pthread_create,
[
LIBS="$LIBS -lpthread"
found_lib=true
])
fi
else
AC_MSG_RESULT(no thread support)
fi
##########################################################################
## ##
## Checkout ODBC situation ##
## ##
##########################################################################
#
# Put separator between options
#
AC_ARG_WITH([],[
ODBC configuration:],[])
#
# Initialize variables
#
found_odbc=no
ODBC_CFLAGS=
ODBC_LIBS=
#
# Check for iODBC support
#
if test "$found_odbc" = "no"
then
AC_ARG_WITH(iodbc, [dnl
AC_HELP_STRING([--with-iodbc(=DIR)], [Select iODBC support])
AC_HELP_STRING([], [DIR is the iODBC base install directory])
AC_HELP_STRING([], [(default=/usr/local)])
] , [
if test "$withval" = "yes"
then
withval=/usr/local
fi
PATH_IODBC="$withval/bin:$PATH"
AC_PATH_PROG(IODBC_CONFIG, iodbc-config, no, [$PATH_IODBC])
AC_MSG_CHECKING([for iODBC support])
if test -f "$withval/lib/libiodbc.dylib"
then
found_odbc=iODBC # Mac OS X
ODBC_CFLAGS="-I$withval/include"
ODBC_LIBS="-L$withval/lib -liodbc -liodbcinst"
AC_MSG_RESULT(yes)
elif test -x "$IODBC_CONFIG"
then
found_odbc=iODBC
ODBC_CFLAGS=`$IODBC_CONFIG --cflags`
ODBC_LIBS=`$IODBC_CONFIG --static-libs`
AC_MSG_RESULT(yes)
elif test -f "$withval/lib/libiodbc.a"
then
found_odbc=iODBC
ODBC_CFLAGS="-I$withval/include"
ODBC_LIBS="$withval/lib/libiodbc.a $withval/lib/libiodbcinst.a"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
fi
#
# Check for OpenLink odbcsdk support
#
if test "$found_odbc" = "no"
then
AC_ARG_WITH(odbcsdk, [dnl
AC_HELP_STRING([--with-odbcsdk(=DIR)], [Select OpenLink odbcsdk support])
AC_HELP_STRING([], [DIR is the odbcsdk base install directory])
AC_HELP_STRING([], [(default=/usr/local)])
], [
if test "$withval" = "yes"
then
withval=/usr/local
fi
AC_MSG_CHECKING([for OpenLink odbcsdk support])
if test -f "$withval/lib/libiodbc.a"
then
found_odbc=odbcsdk
ODBC_CFLAGS="-I$withval/include"
ODBC_LIBS="$withval/lib/libiodbc.a"
if test -f "$withval/lib/libiodbcinst.a"
then
ODBC_LIBS="$ODBC_LIBS $withval/lib/libiodbcinst.a"
fi
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
fi
#
# Check for UnixODBC support
#
if test "$found_odbc" = "no"
then
AC_ARG_WITH(unixodbc, [dnl
AC_HELP_STRING([--with-unixodbc(=DIR)], [Select UnixODBC support])
AC_HELP_STRING([], [DIR is the UnixODBC base install directory])
AC_HELP_STRING([], [(default=/usr/local)])
], [
if test "$withval" = "yes"
then
withval=/usr/local
fi
AC_MSG_CHECKING([for UnixODBC support])
if test -f "$withval/lib/libodbc.a"
then
found_odbc=unixODBC
ODBC_CFLAGS="-I$withval/include"
ODBC_LIBS="-L$withval/lib -lodbc"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
fi
#
# Check for DataDirect support
#
if test "$found_odbc" = "no"
then
AC_ARG_WITH(datadirect, [dnl
AC_HELP_STRING([--with-datadirect(=DIR)], [Select DataDirect support])
AC_HELP_STRING([], [DIR is the DataDirect base install directory])
AC_HELP_STRING([], [(default=/usr/local)])
], [
if test "$withval" = "yes"
then
withval=/usr/local
fi
AC_MSG_CHECKING([for DataDirect support])
if test -f "$withval/lib/libodbc.a"
then
found_odbc=DataDirect
ODBC_CFLAGS="-I$withval/include"
ODBC_LIBS="-L$withval/lib -lodbc"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
fi
#
# Check for custom ODBC support
#
if test "$found_odbc" = "no"
then
AC_ARG_WITH(odbc-include, [dnl
AC_HELP_STRING([--with-odbc-inc=DIR], [Specify custom ODBC include directory])
AC_HELP_STRING([], [(default=/usr/local/include)])
], [
if test "$withval" = "yes"
then
withval=/usr/local/include
fi
AC_MSG_CHECKING([for sql.h])
if test -f "$withval/sql.h"
then
ODBC_CFLAGS="-I$withval"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
AC_ARG_WITH(odbc-lib, [dnl
AC_HELP_STRING([--with-odbc-lib=DIR], [Specify custom ODBC lib directory])
AC_HELP_STRING([], [(default=/usr/local/lib)])dnl
], [
if test "$withval" = "yes"
then
withval=/usr/local/lib
fi
ac_save_LDFLAGS=$LDFLAGS
test -n "$withval" && LDFLAGS="$LDFLAGS -L$withval"
AC_CHECK_LIB(iodbc, SQLConnect,
[
ODBC_LIBS="-L$withval -liodbc"; found_odbc=iODBC
],
[
AC_CHECK_LIB(odbc, SQLConnect,
[
ODBC_LIBS="-L$withval -lodbc"; found_odbc=ODBC
])
])
LDFLAGS=$ac_save_LDFLAGS
])
fi
#
# Maybe the libraries are in some default directory
#
if test "$found_odbc" = "no"
then
AC_PATH_PROG(IODBC_CONFIG, iodbc-config, no)
AC_MSG_CHECKING([for iODBC support])
if test -x "$IODBC_CONFIG"
then
found_odbc=iODBC
ODBC_CFLAGS=`$IODBC_CONFIG --cflags`
ODBC_LIBS=`$IODBC_CONFIG --static-libs`
AC_MSG_RESULT(yes)
fi
fi
#
# Maybe the libraries are in some default directory
#
if test "$found_odbc" = "no"
then
AC_CHECK_LIB(iodbc, SQLConnect,
[
ODBC_LIBS="-liodbc"; found_odbc=iODBC
],
[
AC_CHECK_LIB(odbc, SQLConnect,
[
ODBC_LIBS="-lodbc"; found_odbc=ODBC
])
])
fi
#
# Do not continue unless we found a valid ODBC implementation
#
if test "$found_odbc" = "no"
then
AC_MSG_ERROR([could not find ODBC header files or libraries])
fi
#
# Expand our compile flags
#
AC_SUBST(ODBC_CFLAGS)
AC_SUBST(ODBC_LIBS)
#
# Check if SQLLEN, SQLULEN, SQLBIGINT, SQLUBIGINT are defined
#
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
AC_CHECK_TYPE(SQLLEN, ,
AC_DEFINE(SQLLEN, SQLINTEGER,
[define to SQLINTEGER if not defined in the ODBC headers])
AC_DEFINE(SQLULEN, SQLUINTEGER,
[define to SQLUINTEGER if not defined in the ODBC headers]),
[
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
])
##########################################################################
## ##
## Generate Makefiles etc. ##
## ##
##########################################################################
AC_CONFIG_FILES([
Makefile
lib/Makefile
src/Makefile
src/gtk/Makefile
scripts/Makefile
contrib/Makefile
contrib/RedHat/odbc-bench.spec
docs/Makefile
])
AC_CONFIG_COMMANDS([default], [])
AC_OUTPUT
##########################################################################
## ##
## Display configuration information ##
## ##
##########################################################################
echo ""
echo ""
echo "${PACKAGE_STRING} configuration summary"
echo "${PACKAGE_STRING} configuration summary" | sed 's/./=/g'
echo ""
echo "Installation variables"
echo "AC_HELP_STRING(prefix, [${prefix}])"
echo "AC_HELP_STRING(exec_prefix, [${exec_prefix}])"
echo ""
echo "Installation paths"
echo "AC_HELP_STRING(programs, [${bindir}])"
echo "AC_HELP_STRING(include files, [${includedir}])"
echo "AC_HELP_STRING(libraries, [${libdir}])"
echo "AC_HELP_STRING(manual pages, [${mandir}])"
echo ""
echo "Extensions"
echo "AC_HELP_STRING(Driver Manager, [${found_odbc}])"
echo "AC_HELP_STRING(GUI Extensions, [${USE_GUI}])"
echo "AC_HELP_STRING(ThreadSafe, [${USE_PTHREADS}])"
echo ""