File: configure.in

package info (click to toggle)
myodbc 3.51.09-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,400 kB
  • ctags: 1,596
  • sloc: ansic: 29,806; sh: 10,765; cpp: 627; makefile: 610
file content (761 lines) | stat: -rw-r--r-- 23,905 bytes parent folder | download
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
##########################################################################
# Copyright (C) 1995-2004 MySQL AB, www.mysql.com                        #
#                                                                        #
# 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          #
##########################################################################

##########################################################################
#                                                                        #
# configure.in                                                           #
#                                                                        #
# @description: This is the MyODBC 3.51 driver configure.in              #
#                                                                        #
# @author     : MySQL AB (monty@mysql.com, venu@mysql.com)               #
# @date       : 2001-Aug-15                                              #
# @product    : myodbc3                                                  #
#                                                                        #
##########################################################################

###################################################################
#                                                                 #
# Initializations                                                 #
#                                                                 #
###################################################################

AC_INIT(driver/myodbc3.c)
#AC_PREREQ(2.53)
#AC_INIT([MySQL ODBC 3.51 Driver],[3.51.05],[myodbc@lists.mysql.com],[libmyodbc3])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(MyODBC,3.51.09)

myodbc_version=$VERSION
###################################################################
#                                                                 #
# See the libtool docs for information on how to do shared lib    #
# versions.                                                       #
#                                                                 #
###################################################################

SHARED_LIB_VERSION=1:0:0
AM_CONFIG_HEADER(driver/myconf.h)
AC_SUBST(myodbc_version)

# Canonicalize the configuration name.
SYSTEM_TYPE="$host_vendor-$host_os"
MACHINE_TYPE="$host_cpu"
AC_SUBST(SYSTEM_TYPE)
# AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", [Define SYSTEM_TYPE])
AC_SUBST(MACHINE_TYPE)
# AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$MACHINE_TYPE", [Define MACHINE_TYPE])

# Detect intel x86 like processor
BASE_MACHINE_TYPE=$MACHINE_TYPE
case $MACHINE_TYPE in
  i?86) BASE_MACHINE_TYPE=i386 ;;
esac

# Save some variables and the command line options for mysqlbug
SAVE_CFLAGS="$CFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
CONF_COMMAND="$0 $ac_configure_args"
AC_SUBST(CONF_COMMAND)
AC_SUBST(SAVE_CFLAGS)
AC_SUBST(SAVE_LDFLAGS)

AC_PREREQ(2.12)dnl    Minimum Autoconf version required.

# This is need before AC_PROG_CC
#

if test "x${CFLAGS-}" = x ; then
  cflags_is_set=no
else
  cflags_is_set=yes
fi

if test "x${LDFLAGS-}" = x ; then
  ldflags_is_set=no
else
  ldflags_is_set=yes
fi

# The following hack should ensure that configure doesn't add optimizing
# or debugging flags to CFLAGS or CXXFLAGS
CFLAGS="$CFLAGS "

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP

# Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc"
then
  ac_cv_prog_gcc="no"
fi

if test "$ac_cv_prog_gcc" = "yes"
then
  AS="$CC -c"
  AC_SUBST(AS)
else
  AC_PATH_PROG(AS, as, as)
fi

AM_ENABLE_SHARED
AM_DISABLE_STATIC

# define _UNIX_
AC_DEFINE(_UNIX_,1,[Define if we are using unix build environment (always true)])

AM_PROG_LIBTOOL
AC_CHECK_LIB(z,compress)


# option, cache_name, variable,
# code to execute if yes, code to exectute if fail
AC_DEFUN(AC_SYS_COMPILER_FLAG,
[
  AC_MSG_CHECKING($1)
  OLD_CFLAGS="[$]CFLAGS"
  AC_CACHE_VAL(mysql_cv_option_$2,
  [
    CFLAGS="[$]OLD_CFLAGS $1"
    AC_TRY_RUN([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no)
  ])
  CFLAGS="[$]OLD_CFLAGS"
  if test x"[$]mysql_cv_option_$2" = "xyes" ; then
    $3="[$]$3 $1"
    AC_MSG_RESULT(yes)
    $5
  else
    AC_MSG_RESULT(no)
    $4
  fi
])

# arch, option, cache_name, variable
AC_DEFUN(AC_SYS_CPU_COMPILER_FLAG,
[
  if test "`uname -m 2>/dev/null`" = "$1" ; then
    AC_SYS_COMPILER_FLAG($2,$3,$4)
  fi
])

# os, option, cache_name, variable
AC_DEFUN(AC_SYS_OS_COMPILER_FLAG,
[
  if test "x$mysql_cv_sys_os" = "x$1" ; then
    AC_SYS_COMPILER_FLAG($2,$3,$4)
  fi
])

# We need some special hacks when running solaris
AC_PATH_PROG(uname_prog, uname, no)

# We should go through this and put all the explictly system dependent
# stuff in one place
AC_MSG_CHECKING(operating system)
AC_CACHE_VAL(mysql_cv_sys_os,
[
  if test "$uname_prog" != "no"; then
    mysql_cv_sys_os="`uname`"
  else
    mysql_cv_sys_os="Not Solaris"
  fi
])
AC_MSG_RESULT($mysql_cv_sys_os)

# This should be rewritten to use $target_os
case "$target_os" in
 sco3.2v5*) 
     CFLAGS="$CFLAGS -DSCO"
     LD='$(CC) $(CFLAGS)'
     case "$CFLAGS" in
       *-belf*) 
         AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
         case "$LDFLAGS" in
           *-belf*) ;;
           *) echo "Adding -belf option to ldflags."
              LDFLAGS="$LDFLAGS -belf"
           ;;
         esac
         ])
       ;;
       *)
         AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
         case "$LDFLAGS" in
           *-belf*) ;;
           *)
	     echo "Adding -belf option to ldflags."
             LDFLAGS="$LDFLAGS -belf"
           ;;
         esac
         ])
       ;;
     esac
  ;;
  sysv5UnixWare*) 
    if test "$GCC" != "yes"; then
      # We are using built-in inline function
      CFLAGS="$CFLAGS -Kalloca"
    fi
  ;;
  sysv5OpenUNIX8*) 
    if test "$GCC" != "yes"; then
      # We are using built-in inline function
      CFLAGS="$CFLAGS -Kalloca"
    fi
  ;;
esac

AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(LD)
AC_SUBST(INSTALL_SCRIPT)

export CC CFLAGS LD LDFLAGS

#
# Some system specific hacks
#
MAX_C_OPTIMIZE="-O3"
case $SYSTEM_TYPE in
  *darwin*)
    if test "$ac_cv_prog_gcc" = "yes"
    then
      MAX_C_OPTIMIZE="-O"
    fi
    ;;
esac

# To avoid configure to fail when used with gcc 3.x along with
# iodbc/unixodbc search path in system directories; add -isystem
# to CFLAGS

using_gcc_3x=no
if test "$CC" = "gcc" 
then
  AC_MSG_CHECKING([if we are using gcc >= 3.x])
  gcc_version=`${CC} --version | head -n 1`
  case "$gcc_version" in
      "gcc (GCC) 3."*)
    using_gcc_3x=yes;
  esac  

  if test "$using_gcc_3x" = "yes" 
  then
    AC_MSG_RESULT([yes (${gcc_version})])
  else 
    AC_MSG_RESULT([no (${gcc_version})])
  fi
fi


###################################################################
#                                                                 #
# Check if localtime_r exists in libc or not                      #
#                                                                 #
###################################################################

AC_CHECK_LIB(c, localtime_r, 
             [AC_DEFINE(HAVE_LOCALTIME_R, 1, 
                        [Define if we detected a localtime_r])
             ]
            )
###################################################################
#                                                                 #
# Perl existance (For Docs)                                       #
#                                                                 #
###################################################################
AC_PATH_PROG(PERL, perl, no)
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
then
  PERL5=$PERL
else
  AC_PATH_PROG(PERL5, perl5, no)
  if test "$PERL5" != no
  then
    PERL=$PERL5
    ac_cv_path_PERL=$ac_cv_path_PERL5
  fi
fi

AC_SUBST(PERL)
AC_SUBST(PERL5)

###################################################################
#                                                                 #
# Check if we want to link with thread safe client libraries      #
#                                                                 #
###################################################################

echo ""
echo "MySQL CONFIGURATION - CLIENT LIBS AND HEADERS"
thread_safe=no

AC_MSG_CHECKING([if building of thread safe library is enabled])
AC_ARG_ENABLE(thread_safe,
[  --enable-thread-safe    Build the thread safe library default=yes],
[ case "${enableval}" in
   yes) thread_safe=yes ;;
   no)  thread_safe=no ;;
   *) AC_MSG_ERROR(bad value '${enableval}' for --enable-thread-safe);;
  esac
],[thread_safe=yes])
AC_MSG_RESULT([$thread_safe])

if test "$thread_safe" = "yes"
then
  myodbc_thread_dir="driver_r"
  myodbc_test_linklib="../driver_r/libmyodbc3_r.la"
  AC_SUBST(myodbc_thread_dir)
else
  myodbc_test_linklib="../driver/libmyodbc3.la"
fi

###################################################################
#                                                                 #
# Check for the client libraries and compile options              #
# Options are taken from the output of mysql_config		  #
#                                                                 #
###################################################################

AC_ARG_WITH(mysql-path,
[  --with-mysql-path=DIR   Path where MySQL is installed],
mysql_path=$withval,mysql_path="")

mysql_config=""
if test "$mysql_path" != ""
then
  mysql_config="$mysql_path/bin/mysql_config"
  if test ! -x $mysql_config
  then
    AC_MSG_ERROR([File $mysql_config doesn't exists or isn't executable.  Please specify with --with-mysql-path where bin/mysql_config can be found]);
  fi
else
  # Search where mysql_config is installed
  TEST_PATHS="/usr/local/mysql /usr"
  for i in $TEST_PATHS
  do
    mysql_config="$i/bin/mysql_config"
    if test -x $mysql_config
    then
      break;
    fi   
    mysql_config=""
  done

  if test "$mysql_config" = ""
  then
    AC_MSG_ERROR([Can't find mysql_config in $TEST_PATHS]);
  fi
fi

OPT=`$mysql_config --cflags`
if test $? != "0"
then
  AC_MSG_ERROR([Could not execute $mysql_config. Please check your installation])
fi
# We have to remove any ' around paths as this confuses configure
OPT=`echo $OPT | sed -e "s;';;g"`
CFLAGS="$CFLAGS $OPT"

MYSQL_LIB=`$mysql_config --libs | sed -e "s;';;g"`
OPT=`$mysql_config --libs_r`
if test $? != "0"
then
  # mysql_config that is before 4.0.17
  # In this case assume we can use the same compile options for the
  # thread safe library as for the normal
  OPT=`echo $MYSQL_LIB | sed -e 's;lmysqlclient;lmysqlclient_r;'`
else
  OPT=`echo $OPT | sed -e "s;';;g"`
fi
MYSQL_THREADSAFE_LIB="$OPT"

AC_SUBST(MYSQL_LIB)
AC_SUBST(MYSQL_THREADSAFE_LIB)

SAVE_LIBS=$LIBS
LIBS="$LIBS $MYSQL_LIB"
AC_CHECK_FUNC(mysql_real_query,[],
[ AC_MSG_ERROR([Could not find compile MySQL single user test program. Please check config.log for errors]) ])

if test "x$thread_safe" = "xyes"
then
  LIBS="$LIBS $MYSQL_THREADSAFE_LIB"
  AC_CHECK_FUNC(mysql_real_query,[],
  [ AC_MSG_ERROR([Could not find compile MySQL single user test program. Please check config.log for errors]) ])
fi
LIBS=$SAVE_LIBS

echo "END OF MYSQL CONFIGURATION"
echo ""
echo "ODBC DRIVER MANAGER CONFIGURATION - LIBRARIES AND HEADERS"
###################################################################
#                                                                 #
# Check if we want to include iODBC header files                  #
#                                                                 #
###################################################################

use_iODBC=no
AC_ARG_WITH(iODBC,
[  --with-iODBC[=DIR]     Use iODBC located in DIR],
[use_iODBC=yes;iODBC="$withval"],use_iODBC=no)

if test "x$use_iODBC" = "xyes"
then

myodbc_link_dmlib="-liodbc"

AC_ARG_WITH(iodbc-includes,
[  --with-iodbc-includes=DIR Find iODBC headers in DIR],
iodbc_includes="$withval",iodbc_includes="$iodbc/include")

AC_ARG_WITH(iodbc-libs,
[  --with-iodbc-libs=DIR   Find iODBC libraries in DIR],
iodbc_libs="$withval",iodbc_libs="$iodbc/lib")


# if gcc 3.x used, and system search paths specified for 
# unixodbc / iodbc, then overcum the gcc error by specifying
# -isystem

if test "$using_gcc_3x" = "yes"
then
  if test "x$iodbc" = "x/usr" ||
     test "x$iodbc" = "x/usr/" ||
     test "x$iodbc" = "x/usr/local" ||
     test "x$iodbc" = "x/usr/local/"
   then
     ODBC_FLAGS="-isystem"
  fi
fi

# add iodbc version
AC_PATH_PROG(iodbc_conf,iodbc-config,no)
if test "$iodbc_conf" != "no"
then
  iodbc_version=`$iodbc_conf --version`
else
  iodbc_version="unknown"
fi
AC_MSG_CHECKING([for iodbc version])
AC_MSG_RESULT([$iodbc_version])

AC_CHECK_IODBC($iodbc_includes,$iodbc_libs)

AC_ARG_WITH(odbc-ini,
[  --with-odbc-ini=PATH    Location of system odbc.ini [IODBCDIR/etc/odbc.ini]],
odbc_ini="$withval",odbc_ini="$iodbc/etc/odbc.ini")

if test "x$have_iodbcinst" != "xyes"
then
  AC_DEFINE_UNQUOTED(SYSTEM_ODBC_INI,"$odbc_ini",
                     [Define path to system wide odbc.ini file])
fi
ODBC_DM_PATH="--with-iodbc=$iodbc"
AC_SUBST(ODBC_DM_PATH)

else

###################################################################
#                                                                 #
# Check if we want to include unixODBC header files               #
#                                                                 #
###################################################################

AC_ARG_WITH(unixODBC,
[  --with-unixODBC[=DIR]     Use unixODBC located in DIR],
unixODBC="$withval",unixODBC="/usr/local/")

myodbc_link_dmlib="-lodbc"
# add unixodbc version
AC_PATH_PROG(isql,isql,no)
if test "$isql" != "no"
then
  unixodbc_version=`$isql --version`
else
  unixodbc_version="unknown"
fi
AC_MSG_CHECKING([for unixODBC version])
AC_MSG_RESULT([$unixodbc_version])

# Default to /usr if not specified
if test "x$unixODBC" = "x"
then
	unixODBC="/usr";
fi

# if gcc 3.x used, and system search paths specified for 
# unixodbc / iodbc, then overcum the gcc error by specifying
# -isystem

if test "$using_gcc_3x" = "yes"
then
  if test "x$unixODBC" = "x/usr" ||
     test "x$unixODBC" = "x/usr/" ||
     test "x$unixODBC" = "x/usr/local" ||
     test "x$unixODBC" = "x/usr/local/"
   then
     ODBC_FLAGS="-isystem"
  fi
fi

AC_ARG_WITH(unixODBC-includes,
[  --with-unixODBC-includes=DIR Find unixODBC headers in DIR],
unixODBC_includes="$withval",unixODBC_includes="$unixODBC/include")

AC_ARG_WITH(unixODBC-libs,
[  --with-unixODBC-libs=DIR Find unixODBC libraries in DIR],
unixODBC_libs="$withval",unixODBC_libs="$unixODBC/lib")

AC_CHECK_UNIXODBC($unixODBC_includes,$unixODBC_libs)

AC_ARG_WITH(odbc-ini,
[  --with-odbc-ini=PATH    Location of system odbc.ini [UnixODBCDIR/etc/odbc.ini]],
odbc_ini="$withval",odbc_ini="$unixODBC/etc/odbc.ini")

if test "x$have_odbcinst" != "xyes"
then
  AC_DEFINE_UNQUOTED(SYSTEM_ODBC_INI,"$odbc_ini",
                     [Define path to system wide odbc.ini file])
fi
ODBC_DM_PATH="--with-unixODBC=$unixODBC"
AC_SUBST(ODBC_DM_PATH)

fi

###################################################################
# if we're working in an older odbc environment,                  #
# we don't have the SQL* types, so we need to fall                #
# back to the old versions                                        #
###################################################################

AC_CHECK_ODBC_TYPE(SQLHENV,HENV)
AC_CHECK_ODBC_TYPE(SQLHDBC,HDBC)
AC_CHECK_ODBC_TYPE(SQLHSTMT,HSTMT)

AC_CHECK_ODBC_TYPE(SQLINTEGER,SDWORD)
AC_CHECK_ODBC_TYPE(SQLUINTEGER,UDWORD)
AC_CHECK_ODBC_TYPE(SQLSMALLINT,SWORD)
AC_CHECK_ODBC_TYPE(SQLUSMALLINT,UWORD)

AC_CHECK_ODBC_TYPE(SQLPOINTER,PTR)
AC_CHECK_ODBC_TYPE(SQLHWND,HWND)

AC_CHECK_ODBC_TYPE(SQLRETURN,RETCODE)

AC_CHECK_ODBC_TYPE(SQLCHAR,UCHAR)

###################################################################
#                                                                 #
# Check and validate for odbc.ini                                 #
#                                                                 #
###################################################################

if test "x$iodbc_ok" = "xyes" && test "x$have_iodbcinst" != "xyes"
then
cat <<EOF
----------------------------------------------------------------
Warning: using iODBC but libiodbcinst library not found.
Enabling workaround, which will search for mysql datasource
configuration as follows:

1. \$ODBCINI, and if not found - \$HOME/.odbc.ini (User data sources)
2. $odbc_ini (System data sources)

If you want to change (2), re-run configure using the
   --with-odbc-ini=/some/other/path/odbc.ini
option.
----------------------------------------------------------------
EOF
fi

echo "END OF DRIVER MANAGER CONFIGURATION"
echo

###################################################################
#                                                                 #
# Build optimized or debug version ?                              #
#                                                                 #
###################################################################
if test "$ac_cv_prog_gcc" = "yes"
then
  DEBUG_CFLAGS="-g"
  DEBUG_OPTIMIZE_CC="-O"
  OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
else
  DEBUG_CFLAGS="-g"
  DEBUG_OPTIMIZE_CC=""
  OPTIMIZE_CFLAGS="-O"
fi

AC_MSG_CHECKING([if debug mode is enabled])
AC_ARG_WITH(debug,
    [  --with-debug            Build the debug version default=no],
    [with_debug=$withval],
    [with_debug=no])
AC_MSG_RESULT([$with_debug])

if test "$with_debug" = "yes" || test "$with_debug" = "full"
then
 CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON $CFLAGS"
else
  # Optimized version. No debug
  CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
fi
AC_SUBST(CFLAGS)


###################################################################
#                                                                 #
# Build Docs ?                                                    #
#                                                                 #
###################################################################
myodbc_docs_dir=""
AC_MSG_CHECKING([if building of documentation is enabled])
AC_ARG_WITH(docs,
            [  --with-docs             Build the documentation default=no],
            [with_docs=$withval],
            [with_docs=no]
           )
AC_MSG_RESULT([$with_docs])

if test "$with_docs" = "yes"
then
  myodbc_docs_dir="Docs"
fi
AC_SUBST(myodbc_docs_dir)

###################################################################
#                                                                 #
# Build Samples ?                                                 #
#                                                                 #
###################################################################

myodbc_samples_dir="samples"
AC_MSG_CHECKING([if building of samples is enabled])
AC_ARG_WITH(samples,
            [  --with-samples          Build the samples default=yes],
            [with_samples=$withval],
            [with_samples=yes]
           )
AC_MSG_RESULT([$with_samples])

if test "$with_samples" = "no"
then
  myodbc_samples_dir=""
fi
AC_SUBST(myodbc_samples_dir)

###################################################################
#                                                                 #
# Add some extra LDFLAGS to the linking of the shared library     #
#                                                                 #
###################################################################

AC_ARG_WITH(ldflags,
    [  --with-ldflags=option   Extra arguments for linking. Normally -lmysqlclient],
    EXTRA_LDFLAGS="$withval",EXTRA_LDFLAGS="")
AC_SUBST(EXTRA_LDFLAGS)
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"

###################################################################
#                                                                 #
# Build test library ?                                            #
#                                                                 #
###################################################################

AC_MSG_CHECKING([if building of test is enabled])
AC_ARG_ENABLE(test,
[AC_HELP_STRING([--enable-test],
                [Enable building of test library default=yes])],
 [ case "${enableval}" in
     yes) enable_test=yes ;;
     no)  enable_test=no ;;
     *) AC_MSG_ERROR(bad value '${enableval}' for --enable-test);;
     esac
 ],[enable_test=yes])
 AC_MSG_RESULT([$enable_test])

if test "x$enable_test" = "xyes"
then
  myodbc_test_dir="test"
fi
AC_SUBST(myodbc_test_dir)

###################################################################
#                                                                 #
# Link test library againt Driver Manager supplied ?              #
#                                                                 #
###################################################################


AC_MSG_CHECKING([if linking of test library is specified])
AC_ARG_ENABLE(dmlink,
[AC_HELP_STRING([--enable-dmlink],
                [Enable linking of test library againt supplied driver manager default=no])],
 [ case "${enableval}" in
     yes) enable_dmlink=yes ;;
     no)  enable_dmlink=no ;;
     *) AC_MSG_ERROR(bad value '${enableval}' for --enable-dmlink);;
     esac
 ],[enable_dmlink=no])
 AC_MSG_RESULT([$enable_dmlink])

if test "x$enable_dmlink" = "xyes"
then
  myodbc_test_linklib="$myodbc_link_dmlib"
fi
AC_SUBST(myodbc_test_linklib)


echo
###################################################################
#                                                                 #
# Generate Makefiles                                              #
#                                                                 #
###################################################################

AC_OUTPUT([
  Makefile 
  driver/Makefile
  driver_r/Makefile
  samples/Makefile
  test/Makefile
  scripts/Makefile
	Docs/Makefile
])

echo
echo "Success!!"
echo " -------------------------------------------------------------------- "
echo "| Remember to check the MyODBC FAQ for detailed installation and     |"
echo "| setup instructions from:                                           |"
echo "| http://www.mysql.com/products/myodbc/faq_toc.html                  |"
echo "|                                                                    |"
echo "| MyODBC Home page:                                                  |"
echo "| http://www.mysql.com/products/myodbc/                              |" 
echo "|                                                                    |"
echo "| MySQL/MyODBC Mail archive:                                         |"
echo "| http://lists.mysql.com/                                            |" 
echo "|                                                                    |"
echo "| If you have any questions or improvements to driver, then send a   |"
echo "| detailed mail to 'myodbc@lists.mysql.com'                          |" 
echo " -------------------------------------------------------------------- "
echo