| 1 | # |
|---|
| 2 | # CAUTION: THE configure.ac FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT IT. |
|---|
| 3 | # |
|---|
| 4 | # If you want to make changes to configure.ac, edit configure.ac.in instead. |
|---|
| 5 | # |
|---|
| 6 | # Process configure.ac.in with autoconf to produce a configure script. |
|---|
| 7 | |
|---|
| 8 | # All text in libpqxx is pure ASCII, so we can afford the "C" locale which is |
|---|
| 9 | # likely to be faster than any other. This may also work around bugs in some |
|---|
| 10 | # environments, esp. with UTF-8 locales. |
|---|
| 11 | LC_ALL=C |
|---|
| 12 | |
|---|
| 13 | AC_PREREQ(2.59) |
|---|
| 14 | AC_INIT(libpqxx, 3.2, [Jeroen T. Vermeulen <jtv@xs4all.nl>]) |
|---|
| 15 | AC_LANG(C++) |
|---|
| 16 | AC_CONFIG_AUX_DIR(config) |
|---|
| 17 | AC_CONFIG_MACRO_DIR([config/m4]) |
|---|
| 18 | AM_INIT_AUTOMAKE(libpqxx, 3.2) |
|---|
| 19 | |
|---|
| 20 | PQXXVERSION=3.2 |
|---|
| 21 | PQXX_ABI=3.2 |
|---|
| 22 | PQXX_MAJOR=3 |
|---|
| 23 | PQXX_MINOR=2 |
|---|
| 24 | AC_SUBST(PQXXVERSION) |
|---|
| 25 | AC_SUBST(PQXX_ABI) |
|---|
| 26 | AC_SUBST(PQXX_MAJOR) |
|---|
| 27 | AC_SUBST(PQXX_MINOR) |
|---|
| 28 | |
|---|
| 29 | AC_CONFIG_SRCDIR([src/connection.cxx]) |
|---|
| 30 | AC_CONFIG_HEADER([include/pqxx/config.h]) |
|---|
| 31 | |
|---|
| 32 | # default prefix for installs |
|---|
| 33 | AC_PREFIX_DEFAULT(/usr/local) |
|---|
| 34 | |
|---|
| 35 | # Checks for programs. |
|---|
| 36 | AC_PROG_CXX |
|---|
| 37 | AC_PROG_CC |
|---|
| 38 | AC_PROG_INSTALL |
|---|
| 39 | AC_DISABLE_SHARED |
|---|
| 40 | AC_PROG_LIBTOOL |
|---|
| 41 | AC_PROG_MAKE_SET |
|---|
| 42 | AC_PATH_PROG([MKDIR], [mkdir]) |
|---|
| 43 | AC_PATH_PROG([DOXYGEN], [doxygen]) |
|---|
| 44 | AM_CONDITIONAL([BUILD_REFERENCE], [test -n "$DOXYGEN"]) |
|---|
| 45 | AC_CHECK_PROG(HAVE_DOT, dot, YES, NO) |
|---|
| 46 | AC_PATH_PROG([XMLTO], [xmlto]) |
|---|
| 47 | AC_PATH_PROG([PKG_CONFIG], [pkg-config]) |
|---|
| 48 | AM_CONDITIONAL([BUILD_TUTORIAL], [test -n "$XMLTO"]) |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | AM_MAINTAINER_MODE |
|---|
| 52 | |
|---|
| 53 | # see if we want verbose compiler warnings |
|---|
| 54 | AC_MSG_CHECKING([maintainer mode]) |
|---|
| 55 | AC_ARG_ENABLE(maintainer-mode) |
|---|
| 56 | AC_MSG_RESULT(${enable_maintainer_mode}) |
|---|
| 57 | |
|---|
| 58 | AC_ARG_ENABLE(shared) |
|---|
| 59 | if test "${shared}" = "yes" ; then |
|---|
| 60 | CPPFLAGS="$CPPFLAGS -DPQXX_SHARED" |
|---|
| 61 | fi |
|---|
| 62 | |
|---|
| 63 | # Add options to compiler command line, if compiler accepts it |
|---|
| 64 | add_compiler_opts() { |
|---|
| 65 | for option in $* ; do |
|---|
| 66 | ACO_SAVE_CXXFLAGS="$CXXFLAGS" |
|---|
| 67 | CXXFLAGS="$CXXFLAGS $option" |
|---|
| 68 | AC_MSG_CHECKING([whether $CXX accepts $option]) |
|---|
| 69 | AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) |
|---|
| 70 | AC_MSG_RESULT($has_option) |
|---|
| 71 | if test "$has_option" = "no" ; then |
|---|
| 72 | CXXFLAGS="$ACO_SAVE_CXXFLAGS" |
|---|
| 73 | fi |
|---|
| 74 | done |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | # Let's try to get the compiler to be helpful |
|---|
| 79 | # (Omit options -Weffc++ and -Wabi because they currently yield too many |
|---|
| 80 | # warnings in gcc's standard headers; omit -Wunreachable-code because it isn't |
|---|
| 81 | # always right) |
|---|
| 82 | if test "$GCC" = "yes" ; then |
|---|
| 83 | # In maintainer mode, enable all the warning options we can |
|---|
| 84 | if test "$enable_maintainer_mode" = "yes"; then |
|---|
| 85 | add_compiler_opts \ |
|---|
| 86 | -Werror \ |
|---|
| 87 | -Wno-div-by-zero \ |
|---|
| 88 | -ffor-scope \ |
|---|
| 89 | -fstrict-aliasing \ |
|---|
| 90 | -Wstrict-aliasing \ |
|---|
| 91 | -funit-at-a-time \ |
|---|
| 92 | -pedantic \ |
|---|
| 93 | -fno-nonansi-builtins \ |
|---|
| 94 | -Wall \ |
|---|
| 95 | -Wmultichar \ |
|---|
| 96 | -W \ |
|---|
| 97 | -Wextra \ |
|---|
| 98 | -Wfloat-equal \ |
|---|
| 99 | -Wundef \ |
|---|
| 100 | -Wshadow \ |
|---|
| 101 | -Wpointer-arith \ |
|---|
| 102 | -Wcast-qual \ |
|---|
| 103 | -Wcast-align \ |
|---|
| 104 | -Wconversion \ |
|---|
| 105 | -Wctor-dtor-privacy \ |
|---|
| 106 | -Wc++-compat \ |
|---|
| 107 | -Wendif-labels \ |
|---|
| 108 | -Wlogical-op \ |
|---|
| 109 | -Woverlength-strings \ |
|---|
| 110 | -Wpointer-sign \ |
|---|
| 111 | -Wredundant-decls \ |
|---|
| 112 | -Wsign-compare \ |
|---|
| 113 | -Wwrite-strings \ |
|---|
| 114 | -Wnon-virtual-dtor \ |
|---|
| 115 | -Wreorder \ |
|---|
| 116 | -Wold-style-cast \ |
|---|
| 117 | -Woverloaded-virtual \ |
|---|
| 118 | -Wsign-promo \ |
|---|
| 119 | -Wstrict-null-sentinel \ |
|---|
| 120 | -Wformat-security \ |
|---|
| 121 | -Wnonnull \ |
|---|
| 122 | -Winit-self \ |
|---|
| 123 | -Wswitch \ |
|---|
| 124 | -Wmissing-field-initializers \ |
|---|
| 125 | -Wmissing-include-dirs \ |
|---|
| 126 | -Wunused \ |
|---|
| 127 | -funit-at-a-time |
|---|
| 128 | fi |
|---|
| 129 | |
|---|
| 130 | if test "$enable_long_long" = "yes" ; then |
|---|
| 131 | add_compiler_opts -Wno-long-long |
|---|
| 132 | fi |
|---|
| 133 | |
|---|
| 134 | AC_MSG_CHECKING([g++ visibility attribute]) |
|---|
| 135 | gcc_visibility=yes |
|---|
| 136 | SAVE_CXXFLAGS="$CXXFLAGS" |
|---|
| 137 | CXXFLAGS="$CXXFLAGS -Werror" |
|---|
| 138 | AC_TRY_COMPILE([ |
|---|
| 139 | struct __attribute__ ((visibility("hidden"))) d { d() {} void f() {} }; |
|---|
| 140 | ], |
|---|
| 141 | [d D;D.f()], |
|---|
| 142 | AC_DEFINE([PQXX_HAVE_GCC_VISIBILITY],1, |
|---|
| 143 | [Define if g++ supports visibility attribute, as in g++ 4.0]), |
|---|
| 144 | gcc_visibility=no) |
|---|
| 145 | AC_MSG_RESULT($gcc_visibility) |
|---|
| 146 | if test "$gcc_visibility" = "yes" ; then |
|---|
| 147 | # Setting default symbol visibility to "hidden" vastly reduces |
|---|
| 148 | # library size with g++ 4.0, but unfortunately this will require |
|---|
| 149 | # some more work in the libpqxx setup. Instead, we make only |
|---|
| 150 | # inline functions hidden. |
|---|
| 151 | add_compiler_opts -fvisibility-inlines-hidden |
|---|
| 152 | #add_compiler_opts -fvisibility=hidden |
|---|
| 153 | fi |
|---|
| 154 | CXXFLAGS="$SAVE_CXXFLAGS" |
|---|
| 155 | |
|---|
| 156 | AC_MSG_CHECKING([g++ deprecation attribute]) |
|---|
| 157 | gcc_deprecated=yes |
|---|
| 158 | AC_TRY_COMPILE([void f() __attribute__ ((deprecated));], |
|---|
| 159 | [], |
|---|
| 160 | AC_DEFINE([PQXX_HAVE_GCC_DEPRECATED],1, |
|---|
| 161 | [Define if g++ supports deprecated attribute, as in g++ 4.0]), |
|---|
| 162 | gcc_deprecated=no) |
|---|
| 163 | AC_MSG_RESULT($gcc_deprecated) |
|---|
| 164 | |
|---|
| 165 | fi |
|---|
| 166 | |
|---|
| 167 | # Determine name of standard namespace. PGSTD will be set to this name. The |
|---|
| 168 | # --with-std= option takes precedence if given; otherwise, several alternatives |
|---|
| 169 | # are tried. |
|---|
| 170 | # As a special case, if the argument to the --with-std option is "yes" (as would |
|---|
| 171 | # be the case if the user specified the option but no argument for it), the |
|---|
| 172 | # guessing logic is enabled as if the option had not been used. |
|---|
| 173 | AH_TEMPLATE(PGSTD,[name of standard library namespace (normally "std")]) |
|---|
| 174 | AC_MSG_CHECKING([name of standard library namespace (normally "std")]) |
|---|
| 175 | guessstd=no |
|---|
| 176 | AC_ARG_WITH(std, |
|---|
| 177 | AC_HELP_STRING( |
|---|
| 178 | [--with-std], |
|---|
| 179 | [name of standard library namespace (normally "std")]), |
|---|
| 180 | [std=${withval};], |
|---|
| 181 | [guessstd=yes]) |
|---|
| 182 | |
|---|
| 183 | if test "${guessstd}" = "yes" -o "${withval}" = "yes"; then |
|---|
| 184 | # No explicit std namespace given. Check for alternative "standard" |
|---|
| 185 | # namespaces, in order of preference. |
|---|
| 186 | for ns in std _STL stlp_std "" ; do |
|---|
| 187 | AC_COMPILE_IFELSE([#include <string> |
|---|
| 188 | ${ns}::string justastring;], |
|---|
| 189 | [std="${ns}"; break]) |
|---|
| 190 | done |
|---|
| 191 | fi |
|---|
| 192 | AC_DEFINE_UNQUOTED( |
|---|
| 193 | PGSTD, |
|---|
| 194 | [$std], |
|---|
| 195 | [name of standard library namespace (normally "std")]) |
|---|
| 196 | if ! test -z "${std}" ; then |
|---|
| 197 | AC_MSG_RESULT([::${std}]) |
|---|
| 198 | usestd="using namespace ${std};" |
|---|
| 199 | else |
|---|
| 200 | AC_MSG_RESULT([::]) |
|---|
| 201 | fi |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | boost_smart_ptr=yes |
|---|
| 205 | AC_CHECK_HEADER(boost/smart_ptr.hpp, AC_DEFINE(PQXX_HAVE_BOOST_SMART_PTR, 1, |
|---|
| 206 | [Define if you have the <boost/smart_ptr.hpp> header]), |
|---|
| 207 | boost_smart_ptr=no) |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | AC_MSG_CHECKING([whether TR1 headers live in tr1 directory]) |
|---|
| 211 | tr1headers=yes |
|---|
| 212 | AC_TRY_COMPILE( |
|---|
| 213 | [#include <tr1/memory>], |
|---|
| 214 | [], |
|---|
| 215 | AC_DEFINE( |
|---|
| 216 | [PQXX_TR1_HEADERS], |
|---|
| 217 | 1, |
|---|
| 218 | [Define if headers for TR1 extension to standard live in tr1/]), |
|---|
| 219 | tr1headers=no) |
|---|
| 220 | AC_MSG_RESULT($tr1headers) |
|---|
| 221 | |
|---|
| 222 | if test "${tr1headers}" = "yes" ; then |
|---|
| 223 | tr1dir="tr1/" |
|---|
| 224 | else |
|---|
| 225 | tr1dir="" |
|---|
| 226 | fi |
|---|
| 227 | |
|---|
| 228 | AH_TEMPLATE(PQXXTR1, [namespace of TR1 extension to the C++ standard]) |
|---|
| 229 | AC_MSG_CHECKING([namespace of TR1 extension to the C++ standard]) |
|---|
| 230 | guesstr1=no |
|---|
| 231 | AC_ARG_WITH( |
|---|
| 232 | tr1, |
|---|
| 233 | AC_HELP_STRING( |
|---|
| 234 | [--with-tr1], |
|---|
| 235 | [namespace of TR1 extension to the C++ standard]), |
|---|
| 236 | [tr1=${withval};], |
|---|
| 237 | [guesstr1=yes]) |
|---|
| 238 | |
|---|
| 239 | if test "${guesstr1}" = "yes" ; then |
|---|
| 240 | # No explicit TR1 namespace given. Try PGSTD::tr1. If that doesn't |
|---|
| 241 | # work, assume PGSTD as our best bet. |
|---|
| 242 | tr1="${std}::tr1" |
|---|
| 243 | AC_TRY_COMPILE( |
|---|
| 244 | [#include <${tr1dir}memory>], |
|---|
| 245 | [using namespace ${tr1}], |
|---|
| 246 | [], |
|---|
| 247 | [tr1=${std}]) |
|---|
| 248 | fi |
|---|
| 249 | AC_DEFINE_UNQUOTED( |
|---|
| 250 | PQXXTR1, |
|---|
| 251 | [$tr1], |
|---|
| 252 | [namespace of TR1 standard extensions (e.g. "std" or "std::tr1")]) |
|---|
| 253 | AC_MSG_RESULT([$tr1]) |
|---|
| 254 | |
|---|
| 255 | ioshdr=yes |
|---|
| 256 | AC_CHECK_HEADER(ios,AC_DEFINE(PQXX_HAVE_IOS,1, |
|---|
| 257 | [Define if you have the <ios> header]), |
|---|
| 258 | ioshdr=no) |
|---|
| 259 | |
|---|
| 260 | streambuf=yes |
|---|
| 261 | AC_CHECK_HEADER(streambuf,AC_DEFINE(PQXX_HAVE_STREAMBUF,1, |
|---|
| 262 | [Define if you have the <streambuf> header; if not, <streambuf.h> is used]), |
|---|
| 263 | streambuf=no) |
|---|
| 264 | |
|---|
| 265 | localehdr=yes |
|---|
| 266 | AC_CHECK_HEADER(locale,AC_DEFINE(PQXX_HAVE_LOCALE,1, |
|---|
| 267 | [Define if you have the <locale> header]), |
|---|
| 268 | localehdr=no) |
|---|
| 269 | |
|---|
| 270 | imbue=yes |
|---|
| 271 | AC_MSG_CHECKING([locale function and stringstream::imbue]) |
|---|
| 272 | AC_TRY_COMPILE([#include <sstream> |
|---|
| 273 | #ifdef PQXX_HAVE_LOCALE |
|---|
| 274 | #include <locale> |
|---|
| 275 | #endif |
|---|
| 276 | ${usestd}], |
|---|
| 277 | [stringstream S; S.imbue(locale("C"))], |
|---|
| 278 | [AC_DEFINE(PQXX_HAVE_IMBUE, 1, [Define if stringstream::imbue works])], |
|---|
| 279 | [imbue=no]) |
|---|
| 280 | AC_MSG_RESULT($imbue) |
|---|
| 281 | |
|---|
| 282 | AC_MSG_CHECKING([char_traits template]) |
|---|
| 283 | char_traits=yes |
|---|
| 284 | AC_TRY_COMPILE([#include <string> |
|---|
| 285 | ${usestd}], |
|---|
| 286 | [char_traits<char>::eof()], |
|---|
| 287 | AC_DEFINE(PQXX_HAVE_CHAR_TRAITS, 1, |
|---|
| 288 | [Define if std provides the char_traits template and <char> specialization]), |
|---|
| 289 | char_traits=no) |
|---|
| 290 | AC_MSG_RESULT($char_traits) |
|---|
| 291 | |
|---|
| 292 | AC_MSG_CHECKING(["warning" preprocessor directive]) |
|---|
| 293 | cpp_warning=yes |
|---|
| 294 | AC_TRY_COMPILE([#warning cpp supports warning directive], [], AC_DEFINE(PQXX_HAVE_CPP_WARNING, 1, |
|---|
| 295 | [Define if preprocessor supports nonstandard "warning" directive]), |
|---|
| 296 | cpp_warning=no) |
|---|
| 297 | AC_MSG_RESULT($cpp_warning) |
|---|
| 298 | |
|---|
| 299 | AC_MSG_CHECKING(["message" preprocessor pragma]) |
|---|
| 300 | cpp_pragma_message=yes |
|---|
| 301 | AC_TRY_COMPILE([#pragma message("cpp supports message pragma")], [], AC_DEFINE(PQXX_HAVE_CPP_PRAGMA_MESSAGE, 1, |
|---|
| 302 | [Define if preprocessor supports pragma "message"]), |
|---|
| 303 | cpp_pragma_message=no) |
|---|
| 304 | AC_MSG_RESULT($cpp_pragma_message) |
|---|
| 305 | |
|---|
| 306 | # Find PostgreSQL includes and libraries |
|---|
| 307 | AC_PATH_PROGS(PG_CONFIG, pg_config) |
|---|
| 308 | if test -z "$PG_CONFIG" || test ! -r "$PG_CONFIG"; then |
|---|
| 309 | AC_MSG_ERROR([ |
|---|
| 310 | PostgreSQL configuration script pg_config not found. Make sure this is in your |
|---|
| 311 | command path before configuring. Without it, the configure script has no way to |
|---|
| 312 | find the right location for the libpq library and its headers. |
|---|
| 313 | ]) |
|---|
| 314 | fi |
|---|
| 315 | with_postgres_include=`$PG_CONFIG --includedir` |
|---|
| 316 | AC_MSG_NOTICE([using PostgreSQL headers at $with_postgres_include]) |
|---|
| 317 | with_postgres_lib=`$PG_CONFIG --libdir` |
|---|
| 318 | AC_MSG_NOTICE([using PostgreSQL libraries at $with_postgres_lib]) |
|---|
| 319 | |
|---|
| 320 | AC_SUBST(with_postgres_lib) |
|---|
| 321 | AC_SUBST(with_postgres_include) |
|---|
| 322 | #POSTGRES_LIB="-R${with_postgres_lib}" |
|---|
| 323 | AC_SUBST(POSTGRES_LIB) |
|---|
| 324 | POSTGRES_INCLUDE="-I${with_postgres_include}" |
|---|
| 325 | AC_SUBST(POSTGRES_INCLUDE) |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | AC_HEADER_STDC |
|---|
| 329 | |
|---|
| 330 | AC_MSG_CHECKING([ability to compile programs using the standard C library]) |
|---|
| 331 | AC_TRY_COMPILE([#include <string.h> |
|---|
| 332 | ${usestd} |
|---|
| 333 | extern void f(size_t);], |
|---|
| 334 | [f(strlen(""))],[], |
|---|
| 335 | [AC_MSG_ERROR([ |
|---|
| 336 | Could not build even a tiny test program using the standard C library. |
|---|
| 337 | |
|---|
| 338 | Something very basic has gone wrong; try reading config.log to find out what. |
|---|
| 339 | You'll probably want to go straight to the end of that file and read backwards |
|---|
| 340 | until you find an error message. Then identify the problem, try to fix it, and |
|---|
| 341 | run this script again. |
|---|
| 342 | |
|---|
| 343 | The configure script's --help option may provide useful tips on how to influence |
|---|
| 344 | what compiler and command line options are used, what additional libraries are |
|---|
| 345 | linked in, and so on. |
|---|
| 346 | ])]) |
|---|
| 347 | AC_MSG_RESULT(yes) |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | # After this check, we should be able to link socket-based programs. |
|---|
| 351 | socklibok=no |
|---|
| 352 | AC_SEARCH_LIBS(select, socket nsl ws2_32 wsock32 winsock, [socklibok=yes]) |
|---|
| 353 | |
|---|
| 354 | # Microsoft proprietary libraries do not work with code that is generated with |
|---|
| 355 | # autoconf's SEARCH_LIBS macro, so we need to check manually and just use the |
|---|
| 356 | # first socket library available. |
|---|
| 357 | # We only do this if select() is not available by other means, to avoid picking |
|---|
| 358 | # up an unnecessary Windows compatibility library on a non-Windows system. |
|---|
| 359 | for l in ws2_32 wsock32 winsock ; do |
|---|
| 360 | if test "${socklibok}" != "yes" ; then |
|---|
| 361 | AC_CHECK_LIB($l,main,LIBS="$LIBS -l$l";[socklibok=yes]) |
|---|
| 362 | fi |
|---|
| 363 | done |
|---|
| 364 | |
|---|
| 365 | if test "${socklibok}" != "yes" ; then |
|---|
| 366 | AC_MSG_ERROR([ |
|---|
| 367 | Could not figure out how to link a simple sockets-based program. Please read |
|---|
| 368 | the config.log file for more clues as to why this failed. |
|---|
| 369 | ]) |
|---|
| 370 | fi |
|---|
| 371 | |
|---|
| 372 | |
|---|
| 373 | AC_CHECK_HEADER([${with_postgres_include}/libpq-fe.h],[],[AC_MSG_ERROR([ |
|---|
| 374 | Can't find libpq-fe.h in ${with_postgres_include}. Are you sure the libpq |
|---|
| 375 | headers are installed correctly? They should be in the directory returned by |
|---|
| 376 | "pg_config --includedir". |
|---|
| 377 | |
|---|
| 378 | If you do have libpq (the C-language client library for PostgreSQL) installed, |
|---|
| 379 | make sure you have the related development materials--mainly its header files-- |
|---|
| 380 | as well as the library binary. Some system distributions keep the two in |
|---|
| 381 | seperate packages with names like "alibrary" and "alibrary-dev", respectively. |
|---|
| 382 | In that case, make sure you have the latter installed as well. |
|---|
| 383 | ])]) |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | AC_MSG_CHECKING([for ability to compile source files using libpq]) |
|---|
| 387 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>],[PQexec(0,"")], |
|---|
| 388 | [], |
|---|
| 389 | [AC_MSG_ERROR([ |
|---|
| 390 | Could not compile a call to a basic libpq function. There must be something |
|---|
| 391 | seriously wrong with the headers that "pg_config --includedir" pointed to; the |
|---|
| 392 | contents of config.log may give you a clue about the nature of the failure. |
|---|
| 393 | Source including the libpq header libpq-fe.h can be compiled, but a call to the |
|---|
| 394 | most basic libpq function PQexec() failed to compile successfully. This is the |
|---|
| 395 | litmus test for a working libpq. |
|---|
| 396 | ])]) |
|---|
| 397 | AC_MSG_RESULT(yes) |
|---|
| 398 | |
|---|
| 399 | # Perform this check in C; autoconf's AC_HAVE_LIBRARY breaks in C++ because it |
|---|
| 400 | # tries to call main() |
|---|
| 401 | AC_LANG_PUSH(C) |
|---|
| 402 | |
|---|
| 403 | LDFLAGS="$LDFLAGS -L${with_postgres_lib}" |
|---|
| 404 | |
|---|
| 405 | AC_HAVE_LIBRARY(pq, [], [AC_MSG_ERROR([ |
|---|
| 406 | Could not link to libpq. Make sure you have the PostgreSQL client library |
|---|
| 407 | installed, and that the library binary can be found in the location returned by |
|---|
| 408 | "pg_config --libdir". |
|---|
| 409 | ])], -L${with_postgres_lib}) |
|---|
| 410 | |
|---|
| 411 | AC_CHECK_LIB([pq], [PQexec],[], [AC_MSG_ERROR([ |
|---|
| 412 | Did not find the PQexec() function in libpq. This is the litmus test for a |
|---|
| 413 | working libpq installation. |
|---|
| 414 | |
|---|
| 415 | A source file using the PQexec() function did compile without problems, and the |
|---|
| 416 | libpq library is available for linking, but for some reason a call to PQexec() |
|---|
| 417 | failed to link properly to the libpq library. This may be because the libpq |
|---|
| 418 | library file is damaged, or in some incorrect format. or if your libpq is much |
|---|
| 419 | more recent than libpqxx version 3.2, perhaps libpq has undergone a |
|---|
| 420 | radical ABI change. |
|---|
| 421 | |
|---|
| 422 | The last parts of config.log may give you a clue as to what really went wrong, |
|---|
| 423 | but be warned that this is no easy reading. Look for the last error message |
|---|
| 424 | occurring in the file. |
|---|
| 425 | ])], -L${with_postgres_lib}) |
|---|
| 426 | |
|---|
| 427 | # Remove redundant occurrances of -lpq |
|---|
| 428 | LIBS="`echo "$LIBS" | sed -e 's/-lpq[[:space:]]*[[:space:]]-lpq\>/-lpq/g'`" |
|---|
| 429 | |
|---|
| 430 | AC_LANG_POP(C) |
|---|
| 431 | |
|---|
| 432 | AC_MSG_CHECKING([for correct C++ linkage of basic libpq functions]) |
|---|
| 433 | if test "$enable_maintainer_mode" = "yes"; then |
|---|
| 434 | AC_LINK_IFELSE([ |
|---|
| 435 | #include <${with_postgres_include}/libpq-fe.h> |
|---|
| 436 | int main(){return !PQexec(0,0);}], |
|---|
| 437 | [], |
|---|
| 438 | [AC_MSG_ERROR([ |
|---|
| 439 | Linking a call to libpq failed in C++, even though it succeeded in C. If your |
|---|
| 440 | C and C++ compilers are very different beasts, this may mean that we do not have |
|---|
| 441 | the right options for linking with it after all. Alternatively, this may be |
|---|
| 442 | caused by a bug in autoconf or automake. |
|---|
| 443 | |
|---|
| 444 | Since you are configuring libpqxx using the --enable-maintainer-mode option, any |
|---|
| 445 | compiler warnings for autoconf test programs will be treated as errors. The |
|---|
| 446 | problem may just go away if you run the configure script again but with the |
|---|
| 447 | maintainer mode option omitted. Please report such cases (including the |
|---|
| 448 | config.log produced by the failed attempt) so future versions can attempt to |
|---|
| 449 | work around the problem. |
|---|
| 450 | |
|---|
| 451 | Should this error occur even while not in maintainer mode, read the config.log |
|---|
| 452 | file for more detailed information. Look for the last error message, which may |
|---|
| 453 | be several pages up from the end of the file. |
|---|
| 454 | ])]) |
|---|
| 455 | else |
|---|
| 456 | AC_LINK_IFELSE([ |
|---|
| 457 | #include <${with_postgres_include}/libpq-fe.h> |
|---|
| 458 | int main(){return !PQexec(0,0);}], |
|---|
| 459 | [], |
|---|
| 460 | [AC_MSG_ERROR([ |
|---|
| 461 | Linking a call to libpq failed in C++, even though it succeeded in C. If your |
|---|
| 462 | C and C++ compilers are very different beasts, this may mean that we do not have |
|---|
| 463 | the right options for linking with it after all. |
|---|
| 464 | |
|---|
| 465 | Read the config.log file for more detailed information. Look for the last error |
|---|
| 466 | message, which may be several pages up from the end of the file. |
|---|
| 467 | ])]) |
|---|
| 468 | fi |
|---|
| 469 | AC_MSG_RESULT(yes) |
|---|
| 470 | |
|---|
| 471 | |
|---|
| 472 | AC_MSG_CHECKING([that type of libpq's Oid is as expected]) |
|---|
| 473 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h> |
|---|
| 474 | #include"${srcdir}/include/pqxx/libpq-forward.hxx" |
|---|
| 475 | extern void f(pqxx::oid&);], |
|---|
| 476 | [Oid o;f(o)], |
|---|
| 477 | [], |
|---|
| 478 | [AC_MSG_ERROR([ |
|---|
| 479 | The Oid typedef in libpq has changed. Please notify the libpqxx authors of the |
|---|
| 480 | change! |
|---|
| 481 | ])]) |
|---|
| 482 | AC_MSG_RESULT(yes) |
|---|
| 483 | |
|---|
| 484 | AC_MSG_CHECKING([lo_tell()]) |
|---|
| 485 | lotell=yes |
|---|
| 486 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h> |
|---|
| 487 | void f(PGconn *c) { lo_tell(c,2); }], |
|---|
| 488 | [], |
|---|
| 489 | AC_DEFINE(PQXX_HAVE_LO_TELL, 1, |
|---|
| 490 | [Define if libpq has lo_tell()]), |
|---|
| 491 | [lotell=no] |
|---|
| 492 | ) |
|---|
| 493 | AC_MSG_RESULT($lotell) |
|---|
| 494 | |
|---|
| 495 | |
|---|
| 496 | AC_MSG_CHECKING([for strerror_r]) |
|---|
| 497 | strerror_r=yes |
|---|
| 498 | AC_TRY_COMPILE( |
|---|
| 499 | [#include <cstring> |
|---|
| 500 | ${usestd} |
|---|
| 501 | bool f(char x[]) { return strerror_r(0,x,10) != 0; }], |
|---|
| 502 | [], |
|---|
| 503 | [AC_DEFINE(PQXX_HAVE_STRERROR_R,1,[Define if strerror_r exists])], |
|---|
| 504 | [strerror_r=no]) |
|---|
| 505 | AC_MSG_RESULT($strerror_r) |
|---|
| 506 | if test "$strerror_r" != "yes" ; then |
|---|
| 507 | AC_MSG_WARN([ |
|---|
| 508 | No definition of strerror_r, the thread-safe version of strerror(), was found in |
|---|
| 509 | your <cstring> header. |
|---|
| 510 | |
|---|
| 511 | This may be because your implementation strerror() is threadsafe, in which case |
|---|
| 512 | there is nothing to worry about. |
|---|
| 513 | ]) |
|---|
| 514 | fi # strerror_r |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | AC_MSG_CHECKING([for strnlen]) |
|---|
| 518 | strnlen=yes |
|---|
| 519 | AC_TRY_COMPILE( |
|---|
| 520 | [#include <cstring> |
|---|
| 521 | ${usestd}], |
|---|
| 522 | [return strnlen("",1)], |
|---|
| 523 | [AC_DEFINE(PQXX_HAVE_STRNLEN,1,[Define if strnlen exists])], |
|---|
| 524 | strnlen=no) |
|---|
| 525 | AC_MSG_RESULT($strnlen) |
|---|
| 526 | |
|---|
| 527 | AC_MSG_CHECKING([for strlcpy]) |
|---|
| 528 | strlcpy=yes |
|---|
| 529 | AC_TRY_COMPILE( |
|---|
| 530 | [#include <cstring> |
|---|
| 531 | ${usestd}], |
|---|
| 532 | [char buf[2];return strlcpy(buf,"",1)], |
|---|
| 533 | [AC_DEFINE(PQXX_HAVE_STRLCPY,1,[Define if strlcpy exists])], |
|---|
| 534 | strlcpy=no) |
|---|
| 535 | AC_MSG_RESULT($strlcpy) |
|---|
| 536 | |
|---|
| 537 | AC_MSG_CHECKING([for long long]) |
|---|
| 538 | long_long=yes |
|---|
| 539 | AC_TRY_COMPILE(,[long long l=0LL; return int(l)], |
|---|
| 540 | AC_DEFINE(PQXX_HAVE_LONG_LONG,1, |
|---|
| 541 | [Define if the compiler supports "long long" types]), |
|---|
| 542 | long_long=no) |
|---|
| 543 | AC_MSG_RESULT($long_long) |
|---|
| 544 | |
|---|
| 545 | AC_MSG_CHECKING([for long double]) |
|---|
| 546 | long_double=yes |
|---|
| 547 | AC_TRY_COMPILE(,[long double x=0;return int(x)], |
|---|
| 548 | AC_DEFINE(PQXX_HAVE_LONG_DOUBLE,1, |
|---|
| 549 | [Define if the compiler supports the standard "long double" type]), |
|---|
| 550 | long_double=no) |
|---|
| 551 | AC_MSG_RESULT($long_double) |
|---|
| 552 | |
|---|
| 553 | AC_MSG_CHECKING([for working <sys/select.h>]) |
|---|
| 554 | select_h=yes |
|---|
| 555 | AC_TRY_COMPILE( |
|---|
| 556 | [#include <cstring> |
|---|
| 557 | #include <sys/select.h> |
|---|
| 558 | ${usestd}] |
|---|
| 559 | , [select(0,0,0,0,0)] |
|---|
| 560 | , AC_DEFINE(PQXX_HAVE_SYS_SELECT_H,1, |
|---|
| 561 | [Define if the sys/select.h header defines a working select() and friends, as per POSIX 1003.1-2001]) |
|---|
| 562 | ,select_h=no |
|---|
| 563 | ) |
|---|
| 564 | AC_MSG_RESULT($select_h) |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | AC_MSG_CHECKING([for poll()]) |
|---|
| 568 | poll=yes |
|---|
| 569 | AC_TRY_COMPILE( |
|---|
| 570 | [#include <poll.h> |
|---|
| 571 | ${usestd}], |
|---|
| 572 | [pollfd p = { 0,0,0 }; poll(&p,1,0)], |
|---|
| 573 | AC_DEFINE(PQXX_HAVE_POLL,1, |
|---|
| 574 | [Define if the system has the poll() function (mainly GNU/Linux)]), |
|---|
| 575 | poll=no |
|---|
| 576 | ) |
|---|
| 577 | AC_MSG_RESULT($poll) |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | # Long-standing annoyance in glibc: the definition for FD_SET includes an |
|---|
| 581 | # unnecessary C-style cast that the compiler may warn for. If the compiler is |
|---|
| 582 | # configured to treat warnings as errors, that may be a problem for us. |
|---|
| 583 | AC_MSG_CHECKING([for working fd_set]) |
|---|
| 584 | if test "$enable_maintainer_mode" = "yes"; then |
|---|
| 585 | AC_TRY_COMPILE( |
|---|
| 586 | [#include <cstring> |
|---|
| 587 | #ifdef PQXX_HAVE_SYS_SELECT_H |
|---|
| 588 | #include <sys/select.h> |
|---|
| 589 | #else |
|---|
| 590 | #include <ctime> |
|---|
| 591 | #include <sys/types.h> |
|---|
| 592 | #endif |
|---|
| 593 | #ifdef HAVE_UNISTD_H |
|---|
| 594 | #include <unistd.h> |
|---|
| 595 | #endif |
|---|
| 596 | #ifdef _WIN32 |
|---|
| 597 | #include <winsock2.h> |
|---|
| 598 | #endif |
|---|
| 599 | ${usestd} |
|---|
| 600 | extern "C" void f() { fd_set s; FD_ZERO(&s); FD_SET(1, &s); }], |
|---|
| 601 | [], |
|---|
| 602 | [], |
|---|
| 603 | [AC_MSG_ERROR([ |
|---|
| 604 | Could not compile code using fd_set. This may be a known problem with GNU libc |
|---|
| 605 | and the extremely strict compiler options used in libpqxx's maintainer mode; try |
|---|
| 606 | configuring again, this time omitting the --enable-maintainer-mode option. |
|---|
| 607 | ])]) |
|---|
| 608 | else |
|---|
| 609 | AC_TRY_COMPILE( |
|---|
| 610 | [#include <cstring> |
|---|
| 611 | #ifdef PQXX_HAVE_SYS_SELECT_H |
|---|
| 612 | #include <sys/select.h> |
|---|
| 613 | #else |
|---|
| 614 | #include <ctime> |
|---|
| 615 | #include <sys/types.h> |
|---|
| 616 | #endif |
|---|
| 617 | #ifdef HAVE_UNISTD_H |
|---|
| 618 | #include <unistd.h> |
|---|
| 619 | #endif |
|---|
| 620 | #ifdef _WIN32 |
|---|
| 621 | #include <winsock2.h> |
|---|
| 622 | #endif |
|---|
| 623 | ${usestd}], |
|---|
| 624 | [fd_set s;FD_ZERO(&s);FD_SET(1,&s)], |
|---|
| 625 | [], |
|---|
| 626 | [AC_MSG_ERROR([ |
|---|
| 627 | Could not compile code using fd_set. There is something seriously wrong, or |
|---|
| 628 | maybe your warning options are too strict. If you are using GNU libc (as will |
|---|
| 629 | be the case on a GNU/Linux system) and are telling the compiler to treat |
|---|
| 630 | warnings as errors, the cause may be an old-style cast in the definition of |
|---|
| 631 | FD_SET that triggers a compiler warning. |
|---|
| 632 | |
|---|
| 633 | See config.log for more details; look for the last error message in the file. |
|---|
| 634 | ])]) |
|---|
| 635 | fi |
|---|
| 636 | AC_MSG_RESULT(yes) |
|---|
| 637 | |
|---|
| 638 | |
|---|
| 639 | AC_MSG_CHECKING([if select() accepts NULL fdsets]) |
|---|
| 640 | select_accepts_null=yes |
|---|
| 641 | AC_RUN_IFELSE( |
|---|
| 642 | [#ifdef PQXX_HAVE_SYS_SELECT_H |
|---|
| 643 | #include <sys/select.h> |
|---|
| 644 | #else |
|---|
| 645 | #include <ctime> |
|---|
| 646 | #include <sys/types.h> |
|---|
| 647 | #endif |
|---|
| 648 | #ifdef HAVE_UNISTD_H |
|---|
| 649 | #include <unistd.h> |
|---|
| 650 | #endif |
|---|
| 651 | #ifdef _WIN32 |
|---|
| 652 | #include <winsock2.h> |
|---|
| 653 | #endif |
|---|
| 654 | ${usestd} |
|---|
| 655 | extern "C" int foo(){fd_set f; FD_SET(1,&f); return select(2,0,&f,&f,0)<0;} |
|---|
| 656 | int main() { return foo(); }], |
|---|
| 657 | AC_DEFINE(PQXX_SELECT_ACCEPTS_NULL,1, |
|---|
| 658 | [Define if select() accepts NULL fd_set arguments]), |
|---|
| 659 | select_accepts_null=no, |
|---|
| 660 | select_accepts_null=no |
|---|
| 661 | ) |
|---|
| 662 | AC_MSG_RESULT($select_accepts_null) |
|---|
| 663 | |
|---|
| 664 | |
|---|
| 665 | AC_MSG_CHECKING([sleep()]) |
|---|
| 666 | sleep=yes |
|---|
| 667 | AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H |
|---|
| 668 | #include <unistd.h> |
|---|
| 669 | #endif |
|---|
| 670 | ${usestd}],[sleep(0x01)], |
|---|
| 671 | AC_DEFINE(PQXX_HAVE_SLEEP, 1, [Define if POSIX sleep() exists]), |
|---|
| 672 | [sleep=no] |
|---|
| 673 | ) |
|---|
| 674 | AC_MSG_RESULT($sleep) |
|---|
| 675 | |
|---|
| 676 | AC_MSG_CHECKING([PQisthreadsafe()]) |
|---|
| 677 | pqisthreadsafe=yes |
|---|
| 678 | AC_TRY_COMPILE( |
|---|
| 679 | [#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 680 | [PQisthreadsafe()], |
|---|
| 681 | AC_DEFINE( |
|---|
| 682 | PQXX_HAVE_PQISTHREADSAFE, |
|---|
| 683 | 1, |
|---|
| 684 | [Define if libpq has PQisthreadsafe()]), |
|---|
| 685 | [pqisthreadsafe=no]) |
|---|
| 686 | AC_MSG_RESULT($pqisthreadsafe) |
|---|
| 687 | |
|---|
| 688 | AC_MSG_CHECKING([PQserverVersion()]) |
|---|
| 689 | pqserverversion=yes |
|---|
| 690 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 691 | [PQserverVersion(0)], |
|---|
| 692 | AC_DEFINE(PQXX_HAVE_PQSERVERVERSION, 1, |
|---|
| 693 | [Define if libpq has PQserverVersion()]), |
|---|
| 694 | [pqserverversion=no] |
|---|
| 695 | ) |
|---|
| 696 | AC_MSG_RESULT($pqserverversion) |
|---|
| 697 | |
|---|
| 698 | AC_MSG_CHECKING([PQprotocolVersion()]) |
|---|
| 699 | pqprotocolversion=yes |
|---|
| 700 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 701 | [PQprotocolVersion(0)], |
|---|
| 702 | AC_DEFINE(PQXX_HAVE_PQPROTOCOLVERSION, 1, |
|---|
| 703 | [Define if libpq has PQprotocolVersion()]), |
|---|
| 704 | [pqprotocolversion=no] |
|---|
| 705 | ) |
|---|
| 706 | AC_MSG_RESULT($pqprotocolversion) |
|---|
| 707 | |
|---|
| 708 | |
|---|
| 709 | AC_MSG_CHECKING([PQescapeString()]) |
|---|
| 710 | pqescapestring=yes |
|---|
| 711 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 712 | [char c[1];PQescapeString(c,"",0x01)], |
|---|
| 713 | AC_DEFINE(PQXX_HAVE_PQESCAPESTRING, 1, |
|---|
| 714 | [Define if libpq has PQescapeString()]), |
|---|
| 715 | [pqescapestring=no] |
|---|
| 716 | ) |
|---|
| 717 | AC_MSG_RESULT($pqescapestring) |
|---|
| 718 | if test "$pqescapestring" != yes ; then |
|---|
| 719 | AC_MSG_WARN([ |
|---|
| 720 | You appear to be building with a very old libpq version that does not have |
|---|
| 721 | PQescapeString(). This can cause serious problems when non-ASCII data is used |
|---|
| 722 | in SQL strings. |
|---|
| 723 | Please consider upgrading to at least the libpq that came with PostgreSQL 7.2 |
|---|
| 724 | before going any further! |
|---|
| 725 | ]) |
|---|
| 726 | fi |
|---|
| 727 | |
|---|
| 728 | AC_MSG_CHECKING([PQescapeStringConn()]) |
|---|
| 729 | pqescapestringconn=yes |
|---|
| 730 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 731 | [char b[1];PQescapeStringConn(0,b,b,sizeof(b),0)], |
|---|
| 732 | AC_DEFINE(PQXX_HAVE_PQESCAPESTRINGCONN, 1, |
|---|
| 733 | [Define if libpq has PQescapeStringConn()]), |
|---|
| 734 | [pqescapestringconn=no] |
|---|
| 735 | ) |
|---|
| 736 | AC_MSG_RESULT($pqescapestringconn) |
|---|
| 737 | |
|---|
| 738 | AC_MSG_CHECKING([PQescapeBytea()]) |
|---|
| 739 | pqescapebytea=yes |
|---|
| 740 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h> |
|---|
| 741 | #include<cstddef> |
|---|
| 742 | ${usestd}], |
|---|
| 743 | [size_t l=0;const unsigned char c[]="";PQescapeBytea(c,1,&l)], |
|---|
| 744 | AC_DEFINE(PQXX_HAVE_PQESCAPEBYTEA,1,[Define if libpq has PQescapeBytea()]), |
|---|
| 745 | [pqescapebytea=no] |
|---|
| 746 | ) |
|---|
| 747 | AC_MSG_RESULT($pqescapebytea) |
|---|
| 748 | |
|---|
| 749 | AC_MSG_CHECKING([PQescapeByteaConn()]) |
|---|
| 750 | pqescapebyteaconn=yes |
|---|
| 751 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h> |
|---|
| 752 | #include<cstddef> |
|---|
| 753 | ${usestd}], |
|---|
| 754 | [unsigned char b[1];size_t c;PQescapeByteaConn(0,b,sizeof(b),&c)], |
|---|
| 755 | AC_DEFINE(PQXX_HAVE_PQESCAPEBYTEACONN,1,[Define if libpq has PQescapeByteaConn()]), |
|---|
| 756 | [pqescapebyteaconn=no] |
|---|
| 757 | ) |
|---|
| 758 | AC_MSG_RESULT($pqescapebyteaconn) |
|---|
| 759 | |
|---|
| 760 | AC_MSG_CHECKING([PQunescapeBytea()]) |
|---|
| 761 | pqunescapebytea=yes |
|---|
| 762 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h> |
|---|
| 763 | ${usestd}], |
|---|
| 764 | [size_t l=0;const unsigned char c[]="";PQunescapeBytea(c,&l)], |
|---|
| 765 | AC_DEFINE(PQXX_HAVE_PQUNESCAPEBYTEA,1,[Define if libpq has PQunescapeBytea()]), |
|---|
| 766 | [pqunescapebytea=no] |
|---|
| 767 | ) |
|---|
| 768 | AC_MSG_RESULT($pqunescapebytea) |
|---|
| 769 | |
|---|
| 770 | AC_MSG_CHECKING([PQfreemem()]) |
|---|
| 771 | pqfreemem=yes |
|---|
| 772 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 773 | [char c='x';PQfreemem(&c)], |
|---|
| 774 | AC_DEFINE(PQXX_HAVE_PQFREEMEM,1,[Define if libpq has PQfreemem()]), |
|---|
| 775 | [pqfreemem=no] |
|---|
| 776 | ) |
|---|
| 777 | AC_MSG_RESULT($pqfreemem) |
|---|
| 778 | |
|---|
| 779 | AC_MSG_CHECKING([PQfreeNotify()]) |
|---|
| 780 | pqfreenotify=yes |
|---|
| 781 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 782 | [char c='x';PQfreeNotify(&c)], |
|---|
| 783 | AC_DEFINE(PQXX_HAVE_PQFREENOTIFY,1,[Define if libpq has PQfreeNotify()]), |
|---|
| 784 | [pqfreenotify=no] |
|---|
| 785 | ) |
|---|
| 786 | AC_MSG_RESULT($pqfreenotify) |
|---|
| 787 | |
|---|
| 788 | AC_MSG_CHECKING([PQftable()]) |
|---|
| 789 | pqftable=yes |
|---|
| 790 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 791 | [PGresult*r=0;PQftable(r,0)], |
|---|
| 792 | AC_DEFINE(PQXX_HAVE_PQFTABLE,1,[Define if libpq has PQftable()]), |
|---|
| 793 | [pqftable=no] |
|---|
| 794 | ) |
|---|
| 795 | AC_MSG_RESULT($pqftable) |
|---|
| 796 | |
|---|
| 797 | AC_MSG_CHECKING([PQftablecol()]) |
|---|
| 798 | pqftablecol=yes |
|---|
| 799 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 800 | [PGresult*r=0;PQftablecol(r,0)], |
|---|
| 801 | AC_DEFINE(PQXX_HAVE_PQFTABLECOL,1,[Define if libpq has PQftablecol()]), |
|---|
| 802 | [pqftablecol=no] |
|---|
| 803 | ) |
|---|
| 804 | AC_MSG_RESULT($pqftablecol) |
|---|
| 805 | |
|---|
| 806 | AC_MSG_CHECKING([for new COPY functions]) |
|---|
| 807 | pqputcopy=yes |
|---|
| 808 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 809 | [PGconn*c=0;PQputCopyData(c,"",0)], |
|---|
| 810 | AC_DEFINE(PQXX_HAVE_PQPUTCOPY,1,[Define if libpq has PQputCopyData() and related functions]), |
|---|
| 811 | [pqputcopy=no] |
|---|
| 812 | ) |
|---|
| 813 | AC_MSG_RESULT($pqputcopy) |
|---|
| 814 | |
|---|
| 815 | AC_MSG_CHECKING([PQprepare()]) |
|---|
| 816 | pqprepare=yes |
|---|
| 817 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 818 | [extern PGconn*c;Oid o;PQprepare(c,"","",0,&o)], |
|---|
| 819 | AC_DEFINE(PQXX_HAVE_PQPREPARE,1,[Define if libpq has PQprepare()]), |
|---|
| 820 | [pqprepare=no] |
|---|
| 821 | ) |
|---|
| 822 | AC_MSG_RESULT($pqprepare) |
|---|
| 823 | |
|---|
| 824 | AC_MSG_CHECKING([PQexecPrepared()]) |
|---|
| 825 | pqexecprepared=yes |
|---|
| 826 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 827 | [PGconn*c=0;const char*p[1]={0};const int i=0;PQexecPrepared(c,"",i,p,&i,&i,i)], |
|---|
| 828 | AC_DEFINE(PQXX_HAVE_PQEXECPREPARED,1,[Define if libpq has PQexecPrepared()]), |
|---|
| 829 | [pqexecprepared=no] |
|---|
| 830 | ) |
|---|
| 831 | AC_MSG_RESULT($pqexecprepared) |
|---|
| 832 | |
|---|
| 833 | AC_MSG_CHECKING([PQexecParams()]) |
|---|
| 834 | pqexecparams=yes |
|---|
| 835 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 836 | [PQexecParams(0, "", 0, 0, 0, 0, 0, 0)], |
|---|
| 837 | AC_DEFINE(PQXX_HAVE_PQEXECPARAMS,1,[Define if libpq has PQexecParams()]), |
|---|
| 838 | [pqexecparams=no] |
|---|
| 839 | ) |
|---|
| 840 | AC_MSG_RESULT($pqexecparams) |
|---|
| 841 | |
|---|
| 842 | AC_MSG_CHECKING([PQresultErrorField()]) |
|---|
| 843 | pqresulterrorfield=yes |
|---|
| 844 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 845 | [PGresult*r=0;PQresultErrorField(r,PG_DIAG_STATEMENT_POSITION)], |
|---|
| 846 | AC_DEFINE(PQXX_HAVE_PQRESULTERRORFIELD,1,[Define if libpq has PQresultErrorField() and PG_DIAG_STATEMENT_POSITION]), |
|---|
| 847 | [pqresulterrorfield=no] |
|---|
| 848 | ) |
|---|
| 849 | AC_MSG_RESULT($pqresulterrorfield) |
|---|
| 850 | |
|---|
| 851 | AC_MSG_CHECKING([PQencryptPassword()]) |
|---|
| 852 | pqencryptpassword=yes |
|---|
| 853 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 854 | [PQencryptPassword("x","y")], |
|---|
| 855 | AC_DEFINE(PQXX_HAVE_PQENCRYPTPASSWORD,1,[Define if libpq has PQencryptPassword()]), |
|---|
| 856 | [pqencryptpassword=no] |
|---|
| 857 | ) |
|---|
| 858 | AC_MSG_RESULT($pqencryptpassword) |
|---|
| 859 | |
|---|
| 860 | |
|---|
| 861 | AC_MSG_CHECKING([PQclientEncoding()]) |
|---|
| 862 | pqclientencoding=yes |
|---|
| 863 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 864 | [return PQclientEncoding(NULL)], |
|---|
| 865 | AC_DEFINE(PQXX_HAVE_PQCLIENTENCODING,1,[Define if libpq has PQclientEncoding()]), |
|---|
| 866 | [pqclientencoding=no] |
|---|
| 867 | ) |
|---|
| 868 | AC_MSG_RESULT($pqclientencoding) |
|---|
| 869 | |
|---|
| 870 | |
|---|
| 871 | AC_MSG_CHECKING([PQmblen()]) |
|---|
| 872 | pqmblen=yes |
|---|
| 873 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 874 | [return PQmblen(NULL,1)], |
|---|
| 875 | AC_DEFINE(PQXX_HAVE_PQMBLEN,1,[Define if libpq has PQmblen()]), |
|---|
| 876 | [pqmblen=no] |
|---|
| 877 | ) |
|---|
| 878 | AC_MSG_RESULT($pqmblen) |
|---|
| 879 | |
|---|
| 880 | |
|---|
| 881 | AC_MSG_CHECKING([PQdescribePortal()]) |
|---|
| 882 | pqdescribeportal=yes |
|---|
| 883 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 884 | [return PQdescribePortal(NULL, "foo")!=0;], |
|---|
| 885 | AC_DEFINE(PQXX_HAVE_PQDESCRIBEPORTAL,1,[Define if libpq has PQdescribePortal()]), |
|---|
| 886 | [pqdescribeportal=no] |
|---|
| 887 | ) |
|---|
| 888 | AC_MSG_RESULT($pqdescribeportal) |
|---|
| 889 | |
|---|
| 890 | |
|---|
| 891 | AC_MSG_CHECKING([PQcancel()]) |
|---|
| 892 | pqcancel=yes |
|---|
| 893 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 894 | [PQcancel(NULL, NULL, 0)], |
|---|
| 895 | AC_DEFINE(PQXX_HAVE_PQCANCEL, 1, |
|---|
| 896 | [Define if libpq has PQcancel() and friends]), |
|---|
| 897 | [pqcancel=no] |
|---|
| 898 | ) |
|---|
| 899 | AC_MSG_RESULT($pqcancel) |
|---|
| 900 | |
|---|
| 901 | AC_MSG_CHECKING([PQsetErrorVerbosity()]) |
|---|
| 902 | pqverbosity=yes |
|---|
| 903 | AC_TRY_COMPILE([#include<${with_postgres_include}/libpq-fe.h>], |
|---|
| 904 | [PGconn*c=0;PGVerbosity verb=PQERRORS_DEFAULT;PQsetErrorVerbosity(c, verb)], |
|---|
| 905 | AC_DEFINE(PQXX_HAVE_PQSETERRORVERBOSITY,1,[Define if libpq has PQsetErrorVerbosity()]), |
|---|
| 906 | [pqverbosity=no] |
|---|
| 907 | ) |
|---|
| 908 | AC_MSG_RESULT($pqverbosity) |
|---|
| 909 | |
|---|
| 910 | AC_CHECK_HEADER(limits, |
|---|
| 911 | [AC_DEFINE(PQXX_HAVE_LIMITS, 1, [Define if <limits> exists])]) |
|---|
| 912 | |
|---|
| 913 | AC_MSG_CHECKING([for C99 isnan()]) |
|---|
| 914 | c_isnan=yes |
|---|
| 915 | AC_TRY_COMPILE([#include <cmath> |
|---|
| 916 | extern double f(); |
|---|
| 917 | ${usestd}], |
|---|
| 918 | [if(isnan(f())f()], |
|---|
| 919 | AC_DEFINE(PQXX_HAVE_C_ISNAN,1,[Define if math.h defines C99 isnan()]), |
|---|
| 920 | [c_isnan=no] |
|---|
| 921 | ) |
|---|
| 922 | AC_MSG_RESULT($c_isnan) |
|---|
| 923 | |
|---|
| 924 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
|---|
| 925 | quiet_nan=yes |
|---|
| 926 | AC_TRY_COMPILE([#include <limits> |
|---|
| 927 | extern void f(double); |
|---|
| 928 | ${usestd}], |
|---|
| 929 | [f(numeric_limits<double>::quiet_NaN())], |
|---|
| 930 | [AC_DEFINE(PQXX_HAVE_QUIET_NAN,1, |
|---|
| 931 | [Define if std::numeric_limits has quiet_NaN()])], |
|---|
| 932 | [quiet_nan=no]) |
|---|
| 933 | AC_MSG_RESULT($quiet_nan) |
|---|
| 934 | |
|---|
| 935 | AC_MSG_CHECKING([for C NAN macro]) |
|---|
| 936 | c_nan=yes |
|---|
| 937 | AC_TRY_COMPILE([#include <cmath> |
|---|
| 938 | extern void f(double); |
|---|
| 939 | ${usestd}], |
|---|
| 940 | [f(NAN)], |
|---|
| 941 | [AC_DEFINE(PQXX_HAVE_C_NAN,1, |
|---|
| 942 | [Define if C math header defines NAN])], |
|---|
| 943 | [c_nan=no]) |
|---|
| 944 | AC_MSG_RESULT($c_nan) |
|---|
| 945 | |
|---|
| 946 | AC_MSG_CHECKING([for C99 nan() family]) |
|---|
| 947 | nan=yes |
|---|
| 948 | AC_TRY_COMPILE([#include <cmath> |
|---|
| 949 | ${usestd} |
|---|
| 950 | extern void f(double);], |
|---|
| 951 | [f(nan(""))], |
|---|
| 952 | [AC_DEFINE(PQXX_HAVE_NAN,1, |
|---|
| 953 | [Define if C99 fnan()/nan()/lnan() are available])], |
|---|
| 954 | [nan=no]) |
|---|
| 955 | AC_MSG_RESULT($nan) |
|---|
| 956 | |
|---|
| 957 | AC_MSG_CHECKING([for C99 isinf()]) |
|---|
| 958 | c_isnan=yes |
|---|
| 959 | AC_TRY_COMPILE([#include <cmath> |
|---|
| 960 | extern double f(); |
|---|
| 961 | ${usestd}], |
|---|
| 962 | [if(isinf(f())f()], |
|---|
| 963 | AC_DEFINE(PQXX_HAVE_C_ISINF,1,[Define if math.h defines C99 isinf()]), |
|---|
| 964 | [c_isinf=no] |
|---|
| 965 | ) |
|---|
| 966 | AC_MSG_RESULT($c_isinf) |
|---|
| 967 | |
|---|
| 968 | AC_MSG_CHECKING([whether std::string has a clear() function]) |
|---|
| 969 | string_clear=yes |
|---|
| 970 | AC_TRY_COMPILE([#include <string> |
|---|
| 971 | ${usestd}], |
|---|
| 972 | [string i;i.clear()], |
|---|
| 973 | [AC_DEFINE(PQXX_HAVE_STRING_CLEAR, |
|---|
| 974 | 1, |
|---|
| 975 | [Define if string class has the clear() function])], |
|---|
| 976 | [string_clear=no]) |
|---|
| 977 | AC_MSG_RESULT($string_clear) |
|---|
| 978 | |
|---|
| 979 | AC_MSG_CHECKING([for standard distance()]) |
|---|
| 980 | distance=yes |
|---|
| 981 | AC_TRY_COMPILE([#include <iterator> |
|---|
| 982 | ${usestd}], |
|---|
| 983 | [int i[1]; return distance(i, i+1)], |
|---|
| 984 | [AC_DEFINE(PQXX_HAVE_DISTANCE, |
|---|
| 985 | 1, |
|---|
| 986 | [Define if distance() works according to the standard])], |
|---|
| 987 | [distance='no']) |
|---|
| 988 | AC_MSG_RESULT($distance) |
|---|
| 989 | |
|---|
| 990 | AC_MSG_CHECKING([if count_if() works as expected]) |
|---|
| 991 | count_if='yes' |
|---|
| 992 | AC_TRY_COMPILE([#include <algorithm> |
|---|
| 993 | #include <functional> |
|---|
| 994 | ${usestd} |
|---|
| 995 | struct P{P(){}bool operator()(const int&)const{return false;}}p;], |
|---|
| 996 | [int v;return int(count_if(&v,&v,p))], |
|---|
| 997 | [AC_DEFINE(PQXX_HAVE_COUNT_IF, |
|---|
| 998 | 1, |
|---|
| 999 | [Define if count_if() works according to the standard])], |
|---|
| 1000 | [count_if='no']) |
|---|
| 1001 | AC_MSG_RESULT($count_if) |
|---|
| 1002 | |
|---|
| 1003 | AC_MSG_CHECKING([whether <iterator> defines a usable iterator template]) |
|---|
| 1004 | AC_TRY_COMPILE([#include <iterator> |
|---|
| 1005 | ${usestd}], |
|---|
| 1006 | [struct I:iterator<random_access_iterator_tag,int>{}], |
|---|
| 1007 | [it='yes'], |
|---|
| 1008 | [AC_DEFINE(PQXX_BROKEN_ITERATOR, |
|---|
| 1009 | 1, |
|---|
| 1010 | [Define if <iterator> lacks an iterator template definition]) |
|---|
| 1011 | it='no']) |
|---|
| 1012 | AC_MSG_RESULT($it) |
|---|
| 1013 | |
|---|
| 1014 | AC_MSG_CHECKING([for reverse_iterator template]) |
|---|
| 1015 | reverseit='yes' |
|---|
| 1016 | AC_TRY_COMPILE([#include <iterator> |
|---|
| 1017 | ${usestd} struct I:iterator<random_access_iterator_tag,int>{};], |
|---|
| 1018 | [reverse_iterator<I> rit], |
|---|
| 1019 | [AC_DEFINE(PQXX_HAVE_REVERSE_ITERATOR, |
|---|
| 1020 | 1, |
|---|
| 1021 | [Define if reverse_iterator template works as expected])], |
|---|
| 1022 | [reverseit='no']) |
|---|
| 1023 | AC_MSG_RESULT($reverseit) |
|---|
| 1024 | |
|---|
| 1025 | AC_MSG_CHECKING([for tr1::shared_ptr]) |
|---|
| 1026 | sharedptr='yes' |
|---|
| 1027 | AC_TRY_COMPILE([#include <${tr1dir}memory>], |
|---|
| 1028 | [${tr1}::shared_ptr<int> i(new int(1)); return *i;], |
|---|
| 1029 | [AC_DEFINE(PQXX_HAVE_SHARED_PTR, |
|---|
| 1030 | 1, |
|---|
| 1031 | [Define if compiler has shared_ptr])], |
|---|
| 1032 | [sharedptr='no']) |
|---|
| 1033 | AC_MSG_RESULT($sharedptr) |
|---|
| 1034 | |
|---|
| 1035 | AC_MSG_CHECKING([whether overloaded using-declarations work]) |
|---|
| 1036 | AC_TRY_COMPILE([ |
|---|
| 1037 | struct A {A(){} void f(int){}}; |
|---|
| 1038 | struct B:A {B(){} using A::f; void f(int,bool){}};], |
|---|
| 1039 | [B b;b.f(1,true);], |
|---|
| 1040 | [usingdecl='yes'], |
|---|
| 1041 | [AC_DEFINE(PQXX_BROKEN_USING_DECL, |
|---|
| 1042 | 1, |
|---|
| 1043 | [Define if function overloading using "using" breaks]) |
|---|
| 1044 | usingdecl='no']) |
|---|
| 1045 | AC_MSG_RESULT($usingdecl) |
|---|
| 1046 | |
|---|
| 1047 | |
|---|
| 1048 | AC_PROG_MAKE_SET |
|---|
| 1049 | |
|---|
| 1050 | AC_CONFIG_FILES([Makefile config/Makefile debian/Makefile doc/Makefile |
|---|
| 1051 | doc/Doxyfile src/Makefile test/Makefile test/unit/Makefile tools/Makefile |
|---|
| 1052 | win32/Makefile include/Makefile include/pqxx/Makefile libpqxx.pc pqxx-config |
|---|
| 1053 | libpqxx.spec]) |
|---|
| 1054 | |
|---|
| 1055 | |
|---|
| 1056 | AC_CONFIG_COMMANDS([configitems], ["${srcdir}/tools/splitconfig" "${srcdir}"]) |
|---|
| 1057 | |
|---|
| 1058 | AC_OUTPUT |
|---|
| 1059 | |
|---|