File: configure.in

package info (click to toggle)
ocamlodbc 2.10-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 412 kB
  • ctags: 273
  • sloc: ansic: 865; ml: 784; makefile: 375; sh: 101
file content (384 lines) | stat: -rw-r--r-- 12,335 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
#################################################################################
#                OCamlODBC                                                         #
#                                                                               #
#    Copyright (C) 2004 Institut National de Recherche en Informatique et       #
#    en Automatique. All rights reserved.                                       #
#                                                                               #
#    This program is free software; you can redistribute it and/or modify       #
#    it under the terms of the GNU Lesser General Public License as published   #
#    by the Free Software Foundation; either version 2.1 of the License, or     #
#    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 Lesser General Public License for more details.                        #
#                                                                               #
#    You should have received a copy of the GNU Lesser 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                                                            #
#                                                                               #
#    Contact: Maxence.Guesdon@inria.fr                                          #
#################################################################################

# autoconf input based on sample by Jean-Christophe Filli<E2>tre


# check for one particular file of the sources 
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl

AC_INIT(ocaml_odbc.ml)

# Check for Ocaml compilers

# we first look for ocamlc in the path; if not present, we fail
AC_CHECK_PROG(OCAMLC,ocamlc,`which ocamlc`,no)
if test "$OCAMLC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlc.)
fi

# we look for the directory of ocamlc in $OCAMLC
OCAMLBIN=`dirname $OCAMLC`

# we extract Ocaml version number and library path
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "`
echo "ocaml library path is $OCAMLLIB"

# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLOPT,ocamlopt,`which ocamlopt`,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
	AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
	AC_MSG_CHECKING(ocamlopt version)
	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
	    OCAMLOPT=no
	else
	    AC_MSG_RESULT(ok)
	    OCAMLBEST=opt
	fi
fi

# Now we need ocamlmklib
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLMKLIB,ocamlmklib,`which ocamlmklib`,no)
if test "$OCAMLMKLIB" = no ; then
	AC_MSG_ERROR(Cannot find ocamlmklib)
fi

# checking for ocamlc.opt
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,`which ocamlc.opt`,no)
if test "$OCAMLCDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLC=$OCAMLCDOTOPT
	fi
fi

# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
    AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,`which ocamlopt.opt`,no)
    if test "$OCAMLOPTDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
	TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
	if test "$TMPVER" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLOPT=$OCAMLOPTDOTOPT
	fi
    fi
fi

# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_CHECK_PROG(OCAMLDEP,ocamldep,`which ocamldep`,no)
if test "$OCAMLDEP" = no ; then
	AC_MSG_ERROR(Cannot find ocamldep.)
fi

AC_CHECK_PROG(OCAMLLEX,ocamllex,`which ocamllex`,no)
if test "$OCAMLLEX" = no ; then
	AC_MSG_ERROR(Cannot find ocamllex.)
fi

AC_CHECK_PROG(OCAMLYACC,ocamlyacc,`which ocamlyacc`,no)
if test "$OCAMLYACC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlyacc.)
fi

AC_CHECK_PROG(OCAMLDOC,ocamldoc,`which ocamldoc`,no)


# Check for databases
############ POSTGRES ##################
POSTGRES=yes
POSTGRES_LIBS=
AC_MSG_RESULT(======== configure PostgreSQL ========)
AC_ARG_WITH(pg_incs, [  --with-pg-incs=INCLUDES (-I options to find PostgreSQL ODBC headers)],
    if test "$withval" != "no" ; then  
	POSTGRES_INCS="$withval"
    else
        POSTGRES_INCS=""
    fi)
AC_ARG_WITH(pg_libs, [  --with-pg-libs=DIRS (-L options to find PostgreSQL ODBC libs)],
    if test "$withval" != "no" ; then  
	POSTGRES_LIBDIRS="$withval"
    else
        POSTGRES_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $POSTGRES_INCS $POSTGRES_LIBDIRS"

AC_CHECK_HEADERS(iodbc.h,,[POSTGRES=no])
AC_CHECK_HEADERS(isql.h,,[POSTGRES=no])
AC_CHECK_HEADERS(isqlext.h,,[POSTGRES=no])
if test "$POSTGRES" = "no"; then
  AC_MSG_RESULT(PostgreSQL ODBC headers not found)
else
  AC_MSG_RESULT(PostgreSQL ODBC headers found)
  dnl Checking for PostgreSQL ODBC lib -lpsqlodbc
  AC_CHECK_LIB(psqlodbc,SQLAllocEnv,POSTGRES_LIBS=-lpsqlodbc)
fi
if test "$POSTGRES_LIBS" = "no"; then
  AC_MSG_RESULT(No PostgreSQL ODBC support)
else
  AC_MSG_RESULT(PostgreSQL ODBC support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"

############ MYSQL ##################
MYSQL=yes
MYSQL_LIBS=no
AC_MSG_RESULT(======== configure MySQL ========)
AC_ARG_WITH(mysql_incs, [  --with-mysql-incs=INCLUDES (-I options to find MySQL ODBC headers)],
    if test "$withval" != "no" ; then  
	MYSQL_INCS="$withval"
    else
        MYSQL_INCS=""
    fi)
AC_ARG_WITH(mysql_libs, [  --with-mysql-libs=DIRS (-L options to find MySQL ODBC libs)],
    if test "$withval" != "no" ; then  
	MYSQL_LIBDIRS="$withval"
    else
        MYSQL_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MYSQL_INCS $MYSQL_LIBDIRS"

AC_CHECK_HEADERS(iodbc.h,,[MYSQL=no])
AC_CHECK_HEADERS(isql.h,,[MYSQL=no])
AC_CHECK_HEADERS(isqlext.h,,[MYSQL=no])
if test "$MYSQL" = "no"; then
  AC_MSG_RESULT(MySQL ODBC headers not found)
else
  AC_MSG_RESULT(MySQL ODBC headers found)
  dnl Checking for MySQL ODBC lib -lmyodbc_mysql
  AC_CHECK_LIB(myodbc_mysql,SQLAllocEnv,MYSQL_LIBS=-lmyodbc_mysql)
fi
if test "$MYSQL_LIBS" = "no"; then
  AC_MSG_RESULT(No MySQL ODBC support)
else
  AC_MSG_RESULT(MySQL ODBC support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"

############ UNIXODBC ##################
UNIXODBC=yes
UNIXODBC_LIBS=no
AC_MSG_RESULT(======== configure unixODBC ========)
AC_ARG_WITH(unixodbc_incs, [  --with-unixodbc-incs=INCLUDES (-I options to find unixODBC headers)],
    if test "$withval" != "no" ; then  
	UNIXODBC_INCS="$withval"
    else
        UNIXODBC_INCS=""
    fi)
AC_ARG_WITH(unixodbc_libs, [  --with-unixodbc-libs=DIRS (-L options to find unixODBC libs)],
    if test "$withval" != "no" ; then  
	UNIXODBC_LIBDIRS="$withval"
    else
        UNIXODBC_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $UNIXODBC_INCS $UNIXODBC_LIBDIRS"

AC_CHECK_HEADERS(odbcinst.h,,[UNIXODBC=no])
AC_CHECK_HEADERS(sql.h,,[UNIXODBC=no])
AC_CHECK_HEADERS(sqlext.h,,[UNIXODBC=no])
if test "$UNIXODBC" = "no"; then
  AC_MSG_RESULT(unixODBC headers not found)
else
  AC_MSG_RESULT(unixODBC headers found)
  dnl Checking for unixODBC lib -lodbc
  AC_CHECK_LIB(odbc,SQLAllocEnv,UNIXODBC_LIBS=-lodbc)
fi
if test "$UNIXODBC_LIBS" = "no"; then
  AC_MSG_RESULT(No unixODBC support)
else
  AC_MSG_RESULT(unixODBC support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"

############ DB2 ##################
DB2=yes
DB2_LIBS=no
AC_MSG_RESULT(======== configure DB2 ========)
AC_ARG_WITH(db2_incs, [  --with-db2-incs=INCLUDES (-I options to find DB2 headers)],
    if test "$withval" != "no" ; then  
	DB2_INCS="$withval"
    else
        DB2_INCS=""
    fi)
AC_ARG_WITH(db2_libs, [  --with-db2-libs=DIRS (-L options to find DB2 libs)],
    if test "$withval" != "no" ; then  
	DB2_LIBDIRS="$withval"
    else
        DB2_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $DB2_INCS $DB2_LIBDIRS"

AC_CHECK_HEADERS(sqlcli1.h,,[DB2=no])
if test "$DB2" = "no"; then
  AC_MSG_RESULT(DB2 headers not found)
else
  AC_MSG_RESULT(DB2 headers found)
  dnl Checking for DB2 lib -ldb2
  AC_CHECK_LIB(db2,SQLAllocEnv,DB2_LIBS=-ldb2)
fi
if test "$DB2_LIBS" = "no"; then
  AC_MSG_RESULT(No DB2 support)
else
  AC_MSG_RESULT(DB2 support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"

############ OPENINGRES ##################
OPENINGRES=yes
OPENINGRES_LIBS=no
AC_MSG_RESULT(======== configure OPENINGRES ========)
AC_ARG_WITH(db2_incs, [  --with-ingres-incs=INCLUDES (-I options to find OPENINGRES headers)],
    if test "$withval" != "no" ; then  
	OPENINGRES_INCS="$withval"
    else
        OPENINGRES_INCS=""
    fi)
AC_ARG_WITH(db2_libs, [  --with-ingres-libs=DIRS (-L options to find OPENINGRES libs)],
    if test "$withval" != "no" ; then  
	OPENINGRES_LIBDIRS="$withval"
    else
        OPENINGRES_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $OPENINGRES_INCS $OPENINGRES_LIBDIRS"

AC_CHECK_HEADERS(sqlext.h,,[OPENINGRES=no])
if test "$OPENINGRES" = "no"; then
  AC_MSG_RESULT(OPENINGRES headers not found)
else
  AC_MSG_RESULT(OPENINGRES headers found)
  dnl Checking for OPENINGRES lib -lodbc
  AC_CHECK_LIB(odbc,SQLAllocEnv,OPENINGRES_LIBS=-lodbc)
fi
if test "$OPENINGRES_LIBS" = "no"; then
  AC_MSG_RESULT(No OPENINGRES support)
else
  AC_MSG_RESULT(OPENINGRES support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"

############ ORACLE through DataDirect "Connect for ODBC" driver  ##################
ORACLECFO=yes
ORACLECFO_LIBS=no
AC_MSG_RESULT(======== configure ORACLE through DataDirect "Connect for ODBC" driver ========)
AC_ARG_WITH(oraclecfo_incs, [  --with-oraclecfo-incs=INCLUDES (-I options to find Connect for ODBC headers)],
    if test "$withval" != "no" ; then  
	ORACLECFO_INCS="$withval"
    else
        ORACLECFO_INCS=""
    fi)
AC_ARG_WITH(oraclecfo_libs, [  --with-oraclecfo-libs=DIRS (-L options to find Connect for ODBC libs)],
    if test "$withval" != "no" ; then  
	ORACLECFO_LIBDIRS="$withval"
    else
        ORACLECFO_LIBDIRS=""
    fi)
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ORACLECFO_INCS $ORACLECFO_LIBDIRS"

AC_CHECK_HEADERS(odbcinst.h,,[ORACLECFO=no])
AC_CHECK_HEADERS(sql.h,,[ORACLECFO=no])
AC_CHECK_HEADERS(sqlext.h,,[ORACLECFO=no])
if test "ORACLECFO" = "no"; then
  AC_MSG_RESULT(ORACLECFO headers not found)
else
  AC_MSG_RESULT(ORACLECFO headers found)
  dnl Checking for ORACLECFO lib -lodbc
  AC_CHECK_LIB(odbc,SQLAllocEnv,ORACLECFO_LIBS=-lodbc)
fi
if test "ORACLECFO_LIBS" = "no"; then
  AC_MSG_RESULT(No Oracle through DataDirect "Connect for ODBC" driver support)
else
  AC_MSG_RESULT(Oracle through DataDirect "Connect for ODBC" driver support)
fi

CPP_FLAGS="$OLD_CPPFLAGS"



# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLBIN)

AC_SUBST(POSTGRES_INCS)
AC_SUBST(POSTGRES_LIBDIRS)
AC_SUBST(POSTGRES_LIBS)

AC_SUBST(MYSQL_INCS)
AC_SUBST(MYSQL_LIBDIRS)
AC_SUBST(MYSQL_LIBS)

AC_SUBST(UNIXODBC_INCS)
AC_SUBST(UNIXODBC_LIBDIRS)
AC_SUBST(UNIXODBC_LIBS)

AC_SUBST(DB2_INCS)
AC_SUBST(DB2_LIBDIRS)
AC_SUBST(DB2_LIBS)

AC_SUBST(OPENINGRES_INCS)
AC_SUBST(OPENINGRES_LIBDIRS)
AC_SUBST(OPENINGRES_LIBS)

AC_SUBST(ORACLECFO_INCS)
AC_SUBST(ORACLECFO_LIBDIRS)
AC_SUBST(ORACLECFO_LIBS)

# Finally create the master.Makefile from master.Makefile.in
AC_OUTPUT(master.Makefile)
chmod a-w master.Makefile