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