summaryrefslogtreecommitdiffstats
path: root/m4/sqlora8.m4
blob: a3e7dc4450a1560adf99876fd097f05e0da8762a (plain)
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
# LIBSQLORA8_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
#    Eugene Grigorjev <eugene@zabbix.com>   Feb-02-2007
#
# Checks for Sqlora8.  DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-sqlora8 or --without-sqlora8
# or --with-oracle or --without-oracle. If not supplied, DEFAULT-ACTION is no.
#
# This macro #defines HAVE_SQLORA8 if a required header files is
# found, and sets @SQLORA8_LDFLAGS@ and @SQLORA8_CPPFLAGS@ to the necessary
# values.
#
# Users may override the detected values by doing something like:
# SQLORA8_LDFLAGS="-lsqlora8" SQLORA8_CPPFLAGS="-I/usr/myinclude" ./configure
#
# This macro 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.

AC_DEFUN([LIBSQLORA8_CHECK_CONFIG],
[
  AC_ARG_WITH(oracle,
    [
What DBMS do you want to use (please select only one):
AC_HELP_STRING([--with-oracle@<:@=ARG@:>@],
		[use Sqlora8 library @<:@default=no@:>@, default is to search through a number of common places for the Sqlora8 files.])],[ if test "$withval" = "no"; then
            want_sqlora8="no"
            _libsqlora8_with="no"
        elif test "$withval" = "yes"; then
            want_sqlora8="yes"
            _libsqlora8_with="yes"
        else
            want_sqlora8="yes"
            _libsqlora8_with=$withval
        fi
     ],[_libsqlora8_with=ifelse([$1],,[no],[$1])])

  if test "x$want_sqlora8" = "x" ; then
	  AC_ARG_WITH(sqlora8,
	    [AC_HELP_STRING([--with-sqlora8@<:@=ARG@:>@],
			[use Sqlora8 library @<:@default=no@:>@, same as --with-oracle.])],[ if test "$withval" = "no"; then
		    want_sqlora8="no"
		    _libsqlora8_with="no"
		elif test "$withval" = "yes"; then
		    want_sqlora8="yes"
		    _libsqlora8_with="yes"
		else
		    want_sqlora8="yes"
		    _libsqlora8_with=$withval
		fi
	     ],[_libsqlora8_with=ifelse([$1],,[no],[$1])])
  fi

  if test "x$_libsqlora8_with" != x"no"; then
	AC_MSG_CHECKING([for Oracle support])

	if test "$_libsqlora8_with" = "yes"; then
		if test -f /usr/include/sqlora.h; then
			SQLORA8_INCDIR=/usr
			SQLORA8_LIBDIR=/usr/lib
		elif test -f /usr/lib/libsqlora8/include/sqlora.h; then
			SQLORA8_INCDIR=/usr/lib/libsqlora8
			SQLORA8_LIBDIR=/usr/lib
		elif test -f $SQLORA8_HOME/lib/sqlora8/include/sqlora.h; then
			SQLORA8_INCDIR=$SQLORA8_HOME/lib/sqlora8
			SQLORA8_LIBDIR=$SQLORA8_HOME/lib
		elif test -f $SQLORA8_HOME/include/sqlora.h; then
			SQLORA8_INCDIR=${SQLORA8_HOME}
			SQLORA8_LIBDIR=${SQLORA8_HOME}/lib
		else
			found_sqlora8="no"
			AC_MSG_RESULT([no])
		fi
	else
		if test -f $_libsqlora8_with/include/sqlora.h; then
			SQLORA8_INCDIR=$_libsqlora8_with
			SQLORA8_LIBDIR=$_libsqlora8_with/lib
		elif test -f $_libsqlora8_with/lib/libsqlora8/include/sqlora.h; then
			SQLORA8_INCDIR=$_libsqlora8_with/lib/libsqlora8
			SQLORA8_LIBDIR=$_libsqlora8_with/lib
		elif test -f $_libsqlora8_with/libsqlora8/include/sqlora.h; then
			SQLORA8_INCDIR=$_libsqlora8_with/libsqlora8
			SQLORA8_LIBDIR=$_libsqlora8_with
		else
			found_sqlora8="no"
			AC_MSG_RESULT([no])
		fi
	fi

	if test "x$found_sqlora8" != "xno" ; then
		found_sqlora8="yes"
		AC_MSG_RESULT([yes])

		SQLORA8_CPPFLAGS="-I$SQLORA8_INCDIR/include -I$SQLORA8_INCDIR/lib/libsqlora8/include"
		SQLORA8_LDFLAGS="-L$SQLORA8_LIBDIR -lsqlora8"

		AC_DEFINE(HAVE_SQLORA8,1,[Define to 1 if SQLORA8 library should be enabled.])
	fi
  fi

  AC_SUBST(SQLORA8_CPPFLAGS)
  AC_SUBST(SQLORA8_LDFLAGS)

  unset _libsqlora8_with
])dnl