~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to build/dbd.m4

  • Committer: Bazaar Package Importer
  • Author(s): Arno Toell
  • Date: 2011-01-13 11:49:18 UTC
  • Revision ID: james.westby@ubuntu.com-20110113114918-vu422h8dknrgkj15
Tags: upstream-2.1.5-unstable
ImportĀ upstreamĀ versionĀ 2.1.5-unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
8
dnl
 
9
dnl     http://www.apache.org/licenses/LICENSE-2.0
 
10
dnl
 
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.
 
16
 
 
17
dnl
 
18
dnl dbd.m4: Trafficserver's DBD autoconf macros
 
19
dnl
 
20
 
 
21
dnl
 
22
dnl TS_CHECK_SQLITE3: look for sqlite3 libraries and headers
 
23
dnl
 
24
AC_DEFUN([TS_CHECK_SQLITE3], [
 
25
enable_sqlite3=no
 
26
AC_ARG_WITH(sqlite3, [AC_HELP_STRING([--with-sqlite3=DIR],[use a specific sqlite3 library])],
 
27
[
 
28
  if test "x$withval" != "xyes" && test "x$withval" != "x"; then
 
29
    sqlite3_base_dir="$withval"
 
30
    if test "$withval" != "no"; then
 
31
      enable_sqlite3=yes
 
32
      case "$withval" in
 
33
      *":"*)
 
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 )
 
37
        ;;
 
38
      *)
 
39
        sqlite3_include="$withval/include"
 
40
        sqlite3_ldflags="$withval/lib"
 
41
        AC_MSG_CHECKING(checking for sqlite3 includes in $withval)
 
42
        ;;
 
43
      esac
 
44
    fi
 
45
  fi
 
46
])
 
47
 
 
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
 
54
      break
 
55
    fi
 
56
  done
 
57
  ])
 
58
  sqlite3_base_dir=$ats_cv_sqlite3_dir
 
59
  if test "x$sqlite3_base_dir" = "x"; then
 
60
    enable_sqlite3=no
 
61
    AC_MSG_RESULT([not found])
 
62
  else
 
63
    enable_sqlite3=yes
 
64
    sqlite3_include="$sqlite3_base_dir/include"
 
65
    sqlite3_ldflags="$sqlite3_base_dir/lib"
 
66
    AC_MSG_RESULT([$sqlite3_base_dir])
 
67
  fi
 
68
else
 
69
  if test -d $sqlite3_include && test -d $sqlite3_ldflags && test -f $sqlite3_include/sqlite3.h; then
 
70
    AC_MSG_RESULT([ok])
 
71
  else
 
72
    AC_MSG_RESULT([not found])
 
73
  fi
 
74
fi
 
75
 
 
76
if test "$enable_sqlite3" != "no"; then
 
77
  saved_ldflags=$LDFLAGS
 
78
  saved_cppflags=$CPPFLAGS
 
79
  sqlite3_have_headers=0
 
80
  sqlite3_have_libs=0
 
81
  if test "$sqlite3_base_dir" != "/usr"; then
 
82
    TS_ADDTO(CPPFLAGS, [-I${sqlite3_include}])
 
83
    TS_ADDTO(LDFLAGS, [-L${sqlite3_ldflags}])
 
84
    case $host_os in
 
85
      solaris*)
 
86
        TS_ADDTO(LDFLAGS, [-R${sqlite3_ldflags}])
 
87
        ;;
 
88
    esac
 
89
  fi
 
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])
 
93
  fi
 
94
  if test "$sqlite3_have_headers" != "0"; then
 
95
    AC_DEFINE(HAVE_SQLITE3,1,[Compiling with Sqlite3 support])
 
96
    AC_SUBST([LIBSQLITE3], ["-lsqlite3"])
 
97
  else
 
98
    enable_sqlite3=no
 
99
    CPPFLAGS=$saved_cppflags
 
100
    LDFLAGS=$saved_ldflags
 
101
  fi
 
102
fi
 
103
])
 
104
 
 
105
dnl
 
106
dnl TS_CHECK_BDB: look for Berkeley-DB libraries and headers
 
107
dnl
 
108
AC_DEFUN([TS_CHECK_BDB], [
 
109
enable_libdb=no
 
110
AC_ARG_WITH(bdb, [AC_HELP_STRING([--with-libdb=DIR],[use a specific Berkeley-DB library])],
 
111
[
 
112
  if test "x$withval" != "xyes" && test "x$withval" != "x"; then
 
113
    libdb_base_dir="$withval"
 
114
    if test "$withval" != "no"; then
 
115
      enable_libdb=yes
 
116
      case "$withval" in
 
117
      *":"*)
 
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 )
 
121
        ;;
 
122
      *)
 
123
        libdb_include="$withval/include"
 
124
        libdb_ldflags="$withval/lib"
 
125
        AC_MSG_CHECKING(checking for libdb includes in $withval)
 
126
        ;;
 
127
      esac
 
128
    fi
 
129
  fi
 
130
])
 
131
 
 
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
 
138
      break
 
139
    fi
 
140
  done
 
141
  ])
 
142
  libdb_base_dir=$ats_cv_libdb_dir
 
143
  if test "x$libdb_base_dir" = "x"; then
 
144
    enable_libdb=no
 
145
    AC_MSG_RESULT([not found])
 
146
  else
 
147
    enable_libdb=yes
 
148
    libdb_include="$libdb_base_dir/include"
 
149
    libdb_ldflags="$libdb_base_dir/lib"
 
150
    AC_MSG_RESULT([$libdb_base_dir])
 
151
  fi
 
152
else
 
153
  if test -d $libdb_include && test -d $libdb_ldflags && test -f $libdb_include/db.h; then
 
154
    AC_MSG_RESULT([ok])
 
155
  else
 
156
    AC_MSG_RESULT([not found])
 
157
  fi
 
158
fi
 
159
 
 
160
if test "$enable_libdb" != "no"; then
 
161
  saved_ldflags=$LDFLAGS
 
162
  saved_cppflags=$CPPFLAGS
 
163
  libdb_have_headers=0
 
164
  libdb_have_libs=0
 
165
  if test "$libdb_base_dir" != "/usr"; then
 
166
    TS_ADDTO(CPPFLAGS, [-I${libdb_include}])
 
167
    TS_ADDTO(LDFLAGS, [-L${libdb_ldflags}])
 
168
    case $host_os in
 
169
      solaris*)
 
170
        TS_ADDTO(LDFLAGS, [-R${libdb_ldflags}])
 
171
        ;;
 
172
    esac
 
173
  fi
 
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])
 
178
  fi
 
179
  if test "$libdb_have_headers" != "0"; then
 
180
    AC_SUBST([LIBDB], ["-ldb"])
 
181
  else
 
182
    enable_libdb=no
 
183
    CPPFLAGS=$saved_cppflags
 
184
    LDFLAGS=$saved_ldflags
 
185
  fi
 
186
fi
 
187
])