1
dnl -------------------------------------------------------- -*- autoconf -*-
2
dnl Licensed to the Apache Software Foundation (ASF) under one or more
3
dnl contributor license agreements. See the NOTICE file distributed with
4
dnl this work for additional information regarding copyright ownership.
5
dnl The ASF licenses this file to You under the Apache License, Version 2.0
6
dnl (the "License"); you may not use this file except in compliance with
7
dnl the License. You may obtain a copy of the License at
9
dnl http://www.apache.org/licenses/LICENSE-2.0
11
dnl Unless required by applicable law or agreed to in writing, software
12
dnl distributed under the License is distributed on an "AS IS" BASIS,
13
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
dnl See the License for the specific language governing permissions and
15
dnl limitations under the License.
18
dnl dbd.m4: Trafficserver's DBD autoconf macros
22
dnl TS_CHECK_SQLITE3: look for sqlite3 libraries and headers
24
AC_DEFUN([TS_CHECK_SQLITE3], [
26
AC_ARG_WITH(sqlite3, [AC_HELP_STRING([--with-sqlite3=DIR],[use a specific sqlite3 library])],
28
if test "x$withval" != "xyes" && test "x$withval" != "x"; then
29
sqlite3_base_dir="$withval"
30
if test "$withval" != "no"; then
34
sqlite3_include="`echo $withval |sed -e 's/:.*$//'`"
35
sqlite3_ldflags="`echo $withval |sed -e 's/^.*://'`"
36
AC_MSG_CHECKING(checking for sqlite3 includes in $sqlite3_include libs in $sqlite3_ldflags )
39
sqlite3_include="$withval/include"
40
sqlite3_ldflags="$withval/lib"
41
AC_MSG_CHECKING(checking for sqlite3 includes in $withval)
48
if test "x$sqlite3_base_dir" = "x"; then
49
AC_MSG_CHECKING([for sqlite3 location])
50
AC_CACHE_VAL(ats_cv_sqlite3_dir,[
51
for dir in /usr/local /usr ; do
52
if test -d $dir && test -f $dir/include/sqlite3.h; then
53
ats_cv_sqlite3_dir=$dir
58
sqlite3_base_dir=$ats_cv_sqlite3_dir
59
if test "x$sqlite3_base_dir" = "x"; then
61
AC_MSG_RESULT([not found])
64
sqlite3_include="$sqlite3_base_dir/include"
65
sqlite3_ldflags="$sqlite3_base_dir/lib"
66
AC_MSG_RESULT([$sqlite3_base_dir])
69
if test -d $sqlite3_include && test -d $sqlite3_ldflags && test -f $sqlite3_include/sqlite3.h; then
72
AC_MSG_RESULT([not found])
76
if test "$enable_sqlite3" != "no"; then
77
saved_ldflags=$LDFLAGS
78
saved_cppflags=$CPPFLAGS
79
sqlite3_have_headers=0
81
if test "$sqlite3_base_dir" != "/usr"; then
82
TS_ADDTO(CPPFLAGS, [-I${sqlite3_include}])
83
TS_ADDTO(LDFLAGS, [-L${sqlite3_ldflags}])
86
TS_ADDTO(LDFLAGS, [-R${sqlite3_ldflags}])
90
AC_CHECK_LIB(sqlite3, sqlite3_open_v2, [sqlite3_have_libs=1])
91
if test "$sqlite3_have_libs" != "0"; then
92
TS_FLAG_HEADERS(sqlite3.h, [sqlite3_have_headers=1])
94
if test "$sqlite3_have_headers" != "0"; then
95
AC_DEFINE(HAVE_SQLITE3,1,[Compiling with Sqlite3 support])
96
AC_SUBST([LIBSQLITE3], ["-lsqlite3"])
99
CPPFLAGS=$saved_cppflags
100
LDFLAGS=$saved_ldflags
106
dnl TS_CHECK_BDB: look for Berkeley-DB libraries and headers
108
AC_DEFUN([TS_CHECK_BDB], [
110
AC_ARG_WITH(bdb, [AC_HELP_STRING([--with-libdb=DIR],[use a specific Berkeley-DB library])],
112
if test "x$withval" != "xyes" && test "x$withval" != "x"; then
113
libdb_base_dir="$withval"
114
if test "$withval" != "no"; then
118
libdb_include="`echo $withval |sed -e 's/:.*$//'`"
119
libdb_ldflags="`echo $withval |sed -e 's/^.*://'`"
120
AC_MSG_CHECKING(checking for libdb includes in $libdb_include libs in $libdb_ldflags )
123
libdb_include="$withval/include"
124
libdb_ldflags="$withval/lib"
125
AC_MSG_CHECKING(checking for libdb includes in $withval)
132
if test "x$libdb_base_dir" = "x"; then
133
AC_MSG_CHECKING([for libdb location])
134
AC_CACHE_VAL(ats_cv_libdb_dir,[
135
for dir in /usr/local /usr ; do
136
if test -d $dir && test -f $dir/include/db.h; then
137
ats_cv_libdb_dir=$dir
142
libdb_base_dir=$ats_cv_libdb_dir
143
if test "x$libdb_base_dir" = "x"; then
145
AC_MSG_RESULT([not found])
148
libdb_include="$libdb_base_dir/include"
149
libdb_ldflags="$libdb_base_dir/lib"
150
AC_MSG_RESULT([$libdb_base_dir])
153
if test -d $libdb_include && test -d $libdb_ldflags && test -f $libdb_include/db.h; then
156
AC_MSG_RESULT([not found])
160
if test "$enable_libdb" != "no"; then
161
saved_ldflags=$LDFLAGS
162
saved_cppflags=$CPPFLAGS
165
if test "$libdb_base_dir" != "/usr"; then
166
TS_ADDTO(CPPFLAGS, [-I${libdb_include}])
167
TS_ADDTO(LDFLAGS, [-L${libdb_ldflags}])
170
TS_ADDTO(LDFLAGS, [-R${libdb_ldflags}])
174
AC_CHECK_LIB(db, __db_open, [libdb_have_libs=1])
175
AC_CHECK_LIB(db, __db185_open, [libdb_have_libs=1])
176
if test "$libdb_have_libs" != "0"; then
177
TS_FLAG_HEADERS(db_185.h db.h, [libdb_have_headers=1])
179
if test "$libdb_have_headers" != "0"; then
180
AC_SUBST([LIBDB], ["-ldb"])
183
CPPFLAGS=$saved_cppflags
184
LDFLAGS=$saved_ldflags