dbd.m4 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. dnl -------------------------------------------------------- -*- autoconf -*-
  2. dnl Copyright 2005 The Apache Software Foundation or its licensors, as
  3. dnl applicable.
  4. dnl
  5. dnl Licensed under the Apache License, Version 2.0 (the "License");
  6. dnl you may not use this file except in compliance with the License.
  7. dnl 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. dnl
  17. dnl DBD module
  18. dnl
  19. dnl
  20. dnl APU_CHECK_DBD: compile backends for apr_dbd.
  21. dnl
  22. AC_DEFUN([APU_CHECK_DBD], [
  23. apu_have_pgsql=0
  24. AC_ARG_WITH([pgsql], [
  25. --with-pgsql=DIR specify PostgreSQL location
  26. ], [
  27. apu_have_pgsql=0
  28. if test "$withval" = "yes"; then
  29. AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
  30. if test "$apu_have_pgsql" = "0"; then
  31. AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
  32. fi
  33. elif test "$withval" = "no"; then
  34. apu_have_pgsql=0
  35. else
  36. old_cppflags="$CPPFLAGS"
  37. old_ldflags="$LDFLAGS"
  38. pgsql_CPPFLAGS="-I$withval/include"
  39. pgsql_LDFLAGS="-L$withval/lib "
  40. APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
  41. APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
  42. AC_MSG_NOTICE(checking for pgsql in $withval)
  43. AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
  44. if test "$apu_have_pgsql" != "0"; then
  45. APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
  46. APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
  47. fi
  48. if test "$apu_have_pgsql" != "1"; then
  49. AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
  50. if test "$apu_have_pgsql" != "0"; then
  51. APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql])
  52. APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
  53. fi
  54. fi
  55. CPPFLAGS="$old_cppflags"
  56. LDFLAGS="$old_ldflags"
  57. fi
  58. ], [
  59. apu_have_pgsql=0
  60. AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
  61. ])
  62. AC_SUBST(apu_have_pgsql)
  63. dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
  64. dnl we know the library is there.
  65. if test "$apu_have_pgsql" = "1"; then
  66. APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lpq])
  67. APR_ADDTO(APRUTIL_LIBS,[-lpq])
  68. fi
  69. ])
  70. dnl
  71. AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  72. apu_have_mysql=0
  73. AC_CHECK_FILES([dbd/apr_dbd_mysql.c],[
  74. AC_ARG_WITH([mysql], [
  75. --with-mysql=DIR **** SEE INSTALL.MySQL ****
  76. ], [
  77. apu_have_mysql=0
  78. if test "$withval" = "yes"; then
  79. old_cppflags="$CPPFLAGS"
  80. old_ldflags="$LDFLAGS"
  81. AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
  82. if test "x$MYSQL_CONFIG" != 'x'; then
  83. mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  84. mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
  85. APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
  86. APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
  87. fi
  88. AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
  89. if test "$apu_have_mysql" = "0"; then
  90. AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
  91. else
  92. if test "x$MYSQL_CONFIG" != 'x'; then
  93. APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
  94. APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
  95. fi
  96. fi
  97. CPPFLAGS="$old_cppflags"
  98. LDFLAGS="$old_ldflags"
  99. elif test "$withval" = "no"; then
  100. apu_have_mysql=0
  101. else
  102. old_cppflags="$CPPFLAGS"
  103. old_ldflags="$LDFLAGS"
  104. AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
  105. if test "x$MYSQL_CONFIG" != 'x'; then
  106. mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  107. mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
  108. else
  109. mysql_CPPFLAGS="-I$withval/include"
  110. mysql_LDFLAGS="-L$withval/lib "
  111. fi
  112. APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
  113. APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
  114. AC_MSG_NOTICE(checking for mysql in $withval)
  115. AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
  116. if test "$apu_have_mysql" != "0"; then
  117. APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
  118. APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
  119. fi
  120. if test "$apu_have_mysql" != "1"; then
  121. AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
  122. if test "$apu_have_mysql" != "0"; then
  123. APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
  124. APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
  125. fi
  126. fi
  127. CPPFLAGS="$old_cppflags"
  128. LDFLAGS="$old_ldflags"
  129. fi
  130. ], [
  131. apu_have_mysql=0
  132. old_cppflags="$CPPFLAGS"
  133. old_ldflags="$LDFLAGS"
  134. AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
  135. if test "x$MYSQL_CONFIG" != 'x'; then
  136. mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
  137. mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
  138. APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
  139. APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
  140. fi
  141. AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
  142. if test "$apu_have_mysql" != "0"; then
  143. if test "x$MYSQL_CONFIG" != 'x'; then
  144. APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
  145. APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
  146. fi
  147. fi
  148. CPPFLAGS="$old_cppflags"
  149. LDFLAGS="$old_ldflags"
  150. ])
  151. ])
  152. AC_SUBST(apu_have_mysql)
  153. dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
  154. dnl we know the library is there.
  155. if test "$apu_have_mysql" = "1"; then
  156. APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lmysqlclient_r])
  157. APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r])
  158. fi
  159. ])
  160. dnl
  161. AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
  162. apu_have_sqlite3=0
  163. AC_ARG_WITH([sqlite3], [
  164. --with-sqlite3=DIR
  165. ], [
  166. apu_have_sqlite3=0
  167. if test "$withval" = "yes"; then
  168. AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
  169. elif test "$withval" = "no"; then
  170. apu_have_sqlite3=0
  171. else
  172. old_cppflags="$CPPFLAGS"
  173. old_ldflags="$LDFLAGS"
  174. sqlite3_CPPFLAGS="-I$withval/include"
  175. sqlite3_LDFLAGS="-L$withval/lib "
  176. APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
  177. APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])
  178. AC_MSG_NOTICE(checking for sqlite3 in $withval)
  179. AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
  180. if test "$apu_have_sqlite3" != "0"; then
  181. APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
  182. APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
  183. fi
  184. CPPFLAGS="$old_cppflags"
  185. LDFLAGS="$old_ldflags"
  186. fi
  187. ], [
  188. apu_have_sqlite3=0
  189. AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
  190. ])
  191. AC_SUBST(apu_have_sqlite3)
  192. dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
  193. dnl we know the library is there.
  194. if test "$apu_have_sqlite3" = "1"; then
  195. APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite3])
  196. APR_ADDTO(APRUTIL_LIBS,[-lsqlite3])
  197. fi
  198. ])
  199. dnl
  200. AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
  201. apu_have_sqlite2=0
  202. AC_ARG_WITH([sqlite2], [
  203. --with-sqlite2=DIR
  204. ], [
  205. apu_have_sqlite2=0
  206. if test "$withval" = "yes"; then
  207. AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
  208. elif test "$withval" = "no"; then
  209. apu_have_sqlite2=0
  210. else
  211. old_cppflags="$CPPFLAGS"
  212. old_ldflags="$LDFLAGS"
  213. sqlite2_CPPFLAGS="-I$withval/include"
  214. sqlite2_LDFLAGS="-L$withval/lib "
  215. APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
  216. APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])
  217. AC_MSG_NOTICE(checking for sqlite2 in $withval)
  218. AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
  219. if test "$apu_have_sqlite2" != "0"; then
  220. APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
  221. APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
  222. fi
  223. CPPFLAGS="$old_cppflags"
  224. LDFLAGS="$old_ldflags"
  225. fi
  226. ], [
  227. apu_have_sqlite2=0
  228. AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
  229. ])
  230. AC_SUBST(apu_have_sqlite2)
  231. dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
  232. dnl we know the library is there.
  233. if test "$apu_have_sqlite2" = "1"; then
  234. APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite])
  235. APR_ADDTO(APRUTIL_LIBS,[-lsqlite])
  236. fi
  237. ])
  238. dnl