| 1 |
# Configure paths for libunixodbc |
| 2 |
# Yoshihiro OKUMURA 05-03-10 |
| 3 |
# Adapted from: |
| 4 |
# Configure paths for GLIB |
| 5 |
# Owen Taylor 97-11-3 |
| 6 |
|
| 7 |
dnl AM_PATH_UNIXODBC([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 8 |
dnl Test for UNIXODBC, and define UNIXODBC_CFLAGS and UNIXODBC_LIBS |
| 9 |
dnl |
| 10 |
AC_DEFUN([AM_PATH_UNIXODBC],[ |
| 11 |
AC_ARG_WITH([unixodbc-prefix], |
| 12 |
[ --with-unixodbc-prefix=PFX |
| 13 |
Prefix where libunixodbc is installed (optional)], |
| 14 |
unixodbc_config_prefix="$withval", unixodbc_config_prefix="") |
| 15 |
AC_ARG_WITH([unixodbc-exec-prefix], |
| 16 |
[ --with-unixodbc-exec-prefix=PFX |
| 17 |
Exec prefix where libunixodbc is installed (optional)], |
| 18 |
unixodbc_config_exec_prefix="$withval", unixodbc_config_exec_prefix="") |
| 19 |
if test x$unixodbc_config_exec_prefix != x ; then |
| 20 |
unixodbc_config_args="$unixodbc_config_args" |
| 21 |
if test x${UNIXODBC_CONFIG+set} != xset ; then |
| 22 |
UNIXODBC_CONFIG=$unixodbc_config_exec_prefix/bin/odbc_config |
| 23 |
fi |
| 24 |
fi |
| 25 |
if test x$unixodbc_config_prefix != x ; then |
| 26 |
unixodbc_config_args="$unixodbc_config_args --prefix=$unixodbc_config_prefix" |
| 27 |
if test x${UNIXODBC_CONFIG+set} != xset ; then |
| 28 |
UNIXODBC_CONFIG=$unixodbc_config_prefix/bin/odbc_config |
| 29 |
fi |
| 30 |
fi |
| 31 |
|
| 32 |
AC_PATH_PROG(UNIXODBC_CONFIG, odbc_config, no) |
| 33 |
min_unixodbc_version=ifelse([$1], ,2.2.0,[$1]) |
| 34 |
require_major_version=`echo $min_unixodbc_version | \ |
| 35 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 36 |
require_minor_version=`echo $min_unixodbc_version | \ |
| 37 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 38 |
require_micro_version=`echo $min_unixodbc_version | \ |
| 39 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 40 |
|
| 41 |
AC_MSG_CHECKING(for libunixodbc - version >= $min_unixodbc_version) |
| 42 |
no_unixodbc="" |
| 43 |
if test "$UNIXODBC_CONFIG" = "no" ; then |
| 44 |
no_unixodbc=yes |
| 45 |
else |
| 46 |
UNIXODBC_CFLAGS=`$UNIXODBC_CONFIG $unixodbc_config_args --cflags` |
| 47 |
UNIXODBC_LIBS=`$UNIXODBC_CONFIG $unixodbc_config_args --libs` |
| 48 |
UNIXODBC_STATIC_LIBS=`$UNIXODBC_CONFIG $unixodbc_config_args --static-libs` |
| 49 |
UNIXODBC_LIBTOOL_LIBS=`$UNIXODBC_CONFIG $unixodbc_config_args --libtool-libs` |
| 50 |
UNIXODBC_ODBCVERSION=`$UNIXODBC_CONFIG $unixodbc_config_args --odbcversion` |
| 51 |
UNIXODBC_ODBCINI=`$UNIXODBC_CONFIG $unixodbc_config_args --odbcini` |
| 52 |
UNIXODBC_ODBCINSTINI=`$UNIXODBC_CONFIG $unixodbc_config_args --odbcinstini` |
| 53 |
UNIXODBC_VERSION=`$UNIXODBC_CONFIG $unixodbc_config_args --version` |
| 54 |
unixodbc_config_major_version=`$UNIXODBC_CONFIG $unixodbc_config_args --version | \ |
| 55 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 56 |
unixodbc_config_minor_version=`$UNIXODBC_CONFIG $unixodbc_config_args --version | \ |
| 57 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 58 |
unixodbc_config_micro_version=`$UNIXODBC_CONFIG $unixodbc_config_args --version | \ |
| 59 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 60 |
if test $unixodbc_config_major_version -gt $require_major_version || \ |
| 61 |
(test $unixodbc_config_major_version -eq $require_major_version && \ |
| 62 |
test $unixodbc_config_minor_version -gt $require_minor_version) || \ |
| 63 |
(test $unixodbc_config_major_version -eq $require_major_version && \ |
| 64 |
test $unixodbc_config_minor_version -eq $require_minor_version && \ |
| 65 |
test $unixodbc_config_micro_version -ge $require_micro_version); then |
| 66 |
version_check="yes" |
| 67 |
else |
| 68 |
version_check="no" |
| 69 |
fi |
| 70 |
fi |
| 71 |
|
| 72 |
if test "x$no_unixodbc" = x ; then |
| 73 |
if test "x$version_check" = "xyes" ; then |
| 74 |
AC_MSG_RESULT(yes (version $unixodbc_config_major_version.$unixodbc_config_minor_version.$unixodbc_config_micro_version)) |
| 75 |
ifelse([$2], , :, [$2]) |
| 76 |
else |
| 77 |
AC_MSG_RESULT(no (version $unixodbc_config_major_version.$unixodbc_config_minor_version.$unixodbc_config_micro_version)) |
| 78 |
echo "*** An old version of unixodbc $UNIXODBC_VERSION was found." |
| 79 |
echo "*** You need a version of unixodbc newer than $min_unixodbc_version." |
| 80 |
UNIXODBC_CFLAGS="" |
| 81 |
UNIXODBC_LIBS="" |
| 82 |
UNIXODBC_STATIC_LIBS="" |
| 83 |
UNIXODBC_LIBTOOL_LIBS="" |
| 84 |
UNIXODBC_ODBCVERSION="" |
| 85 |
UNIXODBC_ODBCINI="" |
| 86 |
UNIXODBC_ODBCINSTINI="" |
| 87 |
UNIXODBC_VERSION="" |
| 88 |
ifelse([$3], , :, [$3]) |
| 89 |
fi |
| 90 |
else |
| 91 |
AC_MSG_RESULT(no) |
| 92 |
if test "$UNIXODBC_CONFIG" = "no" ; then |
| 93 |
echo "*** The odbc_config script installed by unixODBC could not be found" |
| 94 |
echo "*** If unixODBC was installed in PREFIX, make sure PREFIX/bin is in" |
| 95 |
echo "*** your path, or set the UNIXODBC_CONFIG environment variable to the" |
| 96 |
echo "*** full path to odbc_config." |
| 97 |
fi |
| 98 |
UNIXODBC_CFLAGS="" |
| 99 |
UNIXODBC_LIBS="" |
| 100 |
UNIXODBC_STATIC_LIBS="" |
| 101 |
UNIXODBC_LIBTOOL_LIBS="" |
| 102 |
UNIXODBC_ODBCVERSION="" |
| 103 |
UNIXODBC_ODBCINI="" |
| 104 |
UNIXODBC_ODBCINSTINI="" |
| 105 |
UNIXODBC_VERSION="" |
| 106 |
ifelse([$3], , :, [$3]) |
| 107 |
fi |
| 108 |
AC_SUBST(UNIXODBC_CFLAGS) |
| 109 |
AC_SUBST(UNIXODBC_LIBS) |
| 110 |
AC_SUBST(UNIXODBC_STATIC_LIBS) |
| 111 |
AC_SUBST(UNIXODBC_LIBTOOL_LIBS) |
| 112 |
AC_SUBST(UNIXODBC_ODBCVERSION) |
| 113 |
AC_SUBST(UNIXODBC_ODBCINI) |
| 114 |
AC_SUBST(UNIXODBC_ODBCINSTINI) |
| 115 |
AC_SUBST(UNIXODBC_VERSION) |
| 116 |
]) |