Made it 2.0.0, and removed the changes that are in 1.1.x, as
[freeradius.git] / src / modules / rlm_sql / drivers / rlm_sql_oracle / configure.in
1 AC_INIT(sql_oracle.c)
2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql_oracle])
4
5
6 if test x$with_[]modname != xno; then
7
8         AC_PROG_CC
9         AC_PROG_CPP
10
11         targetname=modname   # we might change this later.
12
13         AC_SUBST(ORACLE_LIBS)
14         AC_SUBST(ORACLE_INCLUDE)
15
16         AC_MSG_CHECKING([for oci.h])
17
18         dnl #
19         dnl # See if the user passed in the oracle_home_dir option and
20         dnl # use that first.  If not, use $ORACLE_HOME.  If that's
21         dnl # not defined, give up.  There's no point in blindly
22         dnl # hunting around for Oracle - there's no standard place
23         dnl # for it.  Any sane Oracle user/developer should have $ORACLE_HOME
24         dnl # defined anyways.
25         dnl #
26
27         AC_TRY_COMPILE([#include <oci.h>],
28                 [ int a = 1;],
29                 ORACLE_INCLUDE=" ",
30                 ORACLE_INCLUDE=
31         )
32
33         # Look for Oracle10g "Instant Client" installed from RPM
34         if test "x$ORACLE_INCLUDE" = "x"; then
35                 old_CFLAGS="$CFLAGS"
36
37         AC_MSG_WARN([PETER XXXXXXXXXXXXXXXX1.])
38                 FR_LOCATE_DIR(oracle_include_dir,oci.h)
39
40                 for try in /usr/include/oracle/10.1.0.3/client $oracle_include_dir; do
41                         CFLAGS="$old_CFLAGS -I$try"
42                         AC_TRY_COMPILE([#include <oci.h>],
43                                 [ int a = 1; ],
44                                 ORACLE_INCLUDE="-I$try",
45                                 ORACLE_INCLUDE=
46                         )
47                         if test "x$ORACLE_INCLUDE" != "x"; then
48                                 ORACLE_LIBS="-L$/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lm"
49                                 break;
50                         fi
51                 done
52                 CFLAGS="$old_CFLAGS"
53         fi
54         # Finish Looking for Oracle10g includes installed from RPM
55
56         # Look for Oracle8i.
57         if test "x$ORACLE_INCLUDE" = "x"; then
58                 old_CFLAGS="$CFLAGS"
59
60                 FR_LOCATE_DIR(oracle_home_dir,oci.h)
61
62                 for try in $oracle_home_dir $oracle_include_dir; do
63                         CFLAGS="$old_CFLAGS -I${try}/rdbms/demo -I${try}/rdbms/public -I${try}/plsql/public -I${try}/network/public -I${try}/oci/include"
64                         AC_TRY_COMPILE([#include <oci.h>],
65                                 [ int a = 1; ],
66                                 OHOME=$try,
67                                 OHOME=
68                         )
69                         if test "x$OHOME" != "x"; then
70                                 break;
71                         fi
72                 done
73
74                 if test "x$OHOME" = "x" -a "x$ORACLE_HOME" != "x"; then
75                         CFLAGS="$old_CFLAGS -I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${ORACLE_HOME}/network/public -I${ORACLE_HOME}/oci/include"
76                         AC_TRY_COMPILE([#include <oci.h>],
77                                 [ int a = 1; ],
78                                 OHOME=$ORACLE_HOME,
79                                 OHOME=
80                         )
81                 fi
82
83                 CFLAGS="$old_CFLAGS"
84
85                 if test "x$OHOME" != "x"; then
86                         ORACLE_HOME=$OHOME
87                         ORACLE_INCLUDE="-I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/plsql/public -I${ORACLE_HOME}/network/public -I${ORACLE_HOME}/oci/include"
88                 fi
89         fi     ##  this section sets $ORACLE_HOME, if found.
90
91         # not Oracle8i, try older.
92         if test "x$ORACLE_INCLUDE" = "x"; then
93                 old_CFLAGS="$CFLAGS"
94
95                 FR_LOCATE_DIR(oracle_include_dir,oci.h)
96
97                 for try in /usr/local/include/oracle /usr/local/oracle/include $oracle_include_dir; do
98                         CFLAGS="$old_CFLAGS -I$try"
99                         AC_TRY_COMPILE([#include <oci.h>],
100                                 [ int a = 1; ],
101                                 ORACLE_INCLUDE="-I$try",
102                                 ORACLE_INCLUDE=
103                         )
104                         if test "x$ORACLE_INCLUDE" != "x"; then
105                                 break;
106                         fi
107                 done
108                 CFLAGS="$old_CFLAGS"
109         fi
110
111         if test "x$ORACLE_INCLUDE" = "x"; then
112                 AC_MSG_RESULT(no)
113                 AC_MSG_WARN([oracle headers not found.  Use --with-oracle-home-dir=<path>.])
114                 targetname=   # disabled module
115         else
116                 sql_oracle_cflags="${sql_oracle_cflags} ${ORACLE_INCLUDE}"
117                 AC_MSG_RESULT(yes)
118
119
120                 ## is this set, from above?
121                 if test "x$ORACLE_HOME" != "x"; then
122                         ## we must have an Oracle8i tree
123
124                         # FIXME: we might do some checking, just to be nice
125                         ORACLE_LIBS="-L$ORACLE_HOME/lib -lclntsh -lm"
126
127                 else
128                         AC_MSG_CHECKING([for oracle_init in -loracleclient])
129
130                         dnl #
131                         dnl #  Look for it in a number of directories.
132                         dnl #
133                         old_LIBS="$LIBS"
134
135                         FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.so])
136                         FR_LOCATE_DIR(oracle_lib_dir,[oracleclient.a])
137
138                         for try in /usr/lib/oracle /usr/local/lib/oracle /usr/local/oracle/lib $oracle_lib_dir; do
139                                 LIBS="$old_LIBS -L$try -loracleclient"
140                                 AC_TRY_LINK([extern char oracle_init();],
141                                         [ oracle_init()],
142                                         ORACLE_LIBS="-L$try -loracleclient",
143                                         ORACLE_LIBS=
144                                 )
145                                 if test "x$ORACLE_LIBS" != "x"; then
146                                         break;
147                                 fi
148                         done
149                         LIBS="$old_LIBS"
150
151                         dnl #
152                         dnl #  If one or the other isn't found, disable
153                         dnl #  them both..
154                         dnl #  If both are found, enable them both.
155                         dnl #
156                         if test "x$ORACLE_LIBS" = "x"; then
157                                 AC_MSG_RESULT(no)
158                                 ORACLE_INCLUDE=
159                         fi
160                 fi
161
162                 if test "x$ORACLE_LIBS" = "x"; then
163                         AC_MSG_WARN([oracle libraries not found.  Use --with-oracle-lib-dir=<path>.])
164                         targetname=   # disabled module
165                 else
166                         sql_oracle_ldflags="$sql_oracle_ldflags $ORACLE_LIBS"
167                         AC_MSG_RESULT(yes)
168                 fi
169         fi
170
171         if test "x$targetname" = "x"; then
172                 AC_MSG_WARN([sql submodule 'oracle' disabled])
173         fi
174
175 else
176         targetname=
177         echo \*\*\* module modname is disabled.
178 fi
179
180 AC_SUBST(sql_oracle_ldflags)
181 AC_SUBST(sql_oracle_cflags)
182 AC_SUBST(targetname)
183 AC_OUTPUT(Makefile)