From 2c58ba09a435b2460c6f3a9d9675965ada781c59 Mon Sep 17 00:00:00 2001 From: bdermold Date: Thu, 19 Nov 2015 23:54:05 +0000 Subject: [PATCH] Updated to use ax_path_generic m4 macro to check for libcurl. --- libdbconn/Makefile.in | 6 +- libdbconn/configure | 450 ++++++++++++++++++++++++++++- libdbconn/configure.ac | 6 +- libdbconn/m4/ax_compare_version.m4 | 178 ++++++++++++ libdbconn/m4/ax_path_generic.m4 | 165 +++++++++++ libdbconn/src/Makefile.am | 2 +- libdbconn/src/Makefile.in | 8 +- 7 files changed, 794 insertions(+), 21 deletions(-) create mode 100644 libdbconn/m4/ax_compare_version.m4 create mode 100644 libdbconn/m4/ax_path_generic.m4 diff --git a/libdbconn/Makefile.in b/libdbconn/Makefile.in index e56a1e9..2bc40c3 100644 --- a/libdbconn/Makefile.in +++ b/libdbconn/Makefile.in @@ -41,7 +41,8 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ build-aux/ltmain.sh build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_postgresql.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_path_generic.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -122,6 +123,9 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ diff --git a/libdbconn/configure b/libdbconn/configure index 5e44eac..ee5a065 100755 --- a/libdbconn/configure +++ b/libdbconn/configure @@ -793,6 +793,9 @@ am__EXEEXT_TRUE LTLIBOBJS POW_LIB LIBOBJS +CURL_LIBS +CURL_CFLAGS +CURL_CONFIG POSTGRESQL_LDFLAGS POSTGRESQL_CFLAGS POSTGRESQL_VERSION @@ -915,6 +918,8 @@ enable_fast_install with_gnu_ld enable_libtool_lock with_postgresql +with_curl_prefix +with_curl_exec_prefix ' ac_precious_vars='build_alias host_alias @@ -924,7 +929,10 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -CPP' +CPP +CURL_CONFIG +CURL_CFLAGS +CURL_LIBS' # Initialize some variables set by options. @@ -1574,6 +1582,10 @@ Optional Packages: --with-postgresql=@<:@ARG@:>@ use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config + --with-curl-prefix=PREFIX + Prefix where curl is installed (optional) + --with-curl-exec-prefix=EPREFIX + Exec prefix where curl is installed (optional) Some influential environment variables: CC C compiler command @@ -1584,6 +1596,9 @@ Some influential environment variables: CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CURL_CONFIG config script used for curl + CURL_CFLAGS CFLAGS used for curl + CURL_LIBS LIBS used for curl Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4402,13 +4417,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4405: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4420: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4408: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4423: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4411: output\"" >&5) + (eval echo "\"\$as_me:4426: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5614,7 +5629,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5617 "configure"' > conftest.$ac_ext + echo '#line 5632 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7467,11 +7482,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7470: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7485: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7474: \$? = $ac_status" >&5 + echo "$as_me:7489: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7806,11 +7821,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7809: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7824: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7813: \$? = $ac_status" >&5 + echo "$as_me:7828: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7911,11 +7926,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7914: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7929: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7918: \$? = $ac_status" >&5 + echo "$as_me:7933: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7966,11 +7981,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7969: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7984: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7973: \$? = $ac_status" >&5 + echo "$as_me:7988: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10769,7 +10784,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10772 "configure" +#line 10787 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10865,7 +10880,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10868 "configure" +#line 10883 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11195,7 +11210,7 @@ $as_echo "no" >&6; } - postgresql_version_req=8.4 + postgresql_version_req= if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then @@ -11239,6 +11254,409 @@ $as_echo "no" >&6; } +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# This macro compares two version strings. Due to the various number of +# minor-version numbers that can exist, and the fact that string +# comparisons are not compatible with numeric comparisons, this is not +# necessarily trivial to do in a autoconf script. This macro makes doing +# these comparisons easy. +# +# The six basic comparisons are available, as well as checking equality +# limited to a certain number of minor-version levels. +# +# The operator OP determines what type of comparison to do, and can be one +# of: +# +# eq - equal (test A == B) +# ne - not equal (test A != B) +# le - less than or equal (test A <= B) +# ge - greater than or equal (test A >= B) +# lt - less than (test A < B) +# gt - greater than (test A > B) +# +# Additionally, the eq and ne operator can have a number after it to limit +# the test to that number of minor versions. +# +# eq0 - equal up to the length of the shorter version +# ne0 - not equal up to the length of the shorter version +# eqN - equal up to N sub-version levels +# neN - not equal up to N sub-version levels +# +# When the condition is true, shell commands ACTION-IF-TRUE are run, +# otherwise shell commands ACTION-IF-FALSE are run. The environment +# variable 'ax_compare_version' is always set to either 'true' or 'false' +# as well. +# +# Examples: +# +# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) +# +# would both be true. +# +# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) +# +# would both be false. +# +# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) +# +# would be true because it is only comparing two minor versions. +# +# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) +# +# would be true because it is only comparing the lesser number of minor +# versions of the two values. +# +# Note: The characters that separate the version numbers do not matter. An +# empty string is the same as version 0. OP is evaluated by autoconf, not +# configure, so must be a string, not a variable. +# +# The author would like to acknowledge Guido Draheim whose advice about +# the m4_case and m4_ifvaln functions make this macro only include the +# portions necessary to perform the specific comparison specified by the +# OP argument in the final configure script. +# +# LICENSE +# +# Copyright (c) 2008 Tim Toolan +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + + + +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_path_generic.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG]) +# +# DESCRIPTION +# +# Runs the LIBRARY-config script and defines LIBRARY_CFLAGS and +# LIBRARY_LIBS unless the user had predefined them in the environment. +# +# The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION +# is specified, the script must also support the `--version' arg. If the +# `--with-library-[exec-]prefix' arguments to ./configure are given, it +# must also support `--prefix' and `--exec-prefix'. Prefereable use +# CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and +# LIBS-ARG instead of `--libs`, if given. +# +# The SED-EXPR-EXTRACTOR parameter representes the expression used in sed +# to extract the version number. Use it if your 'foo-config --version' +# dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'. +# +# The macro respects LIBRARY_CONFIG, LIBRARY_CFLAGS and LIBRARY_LIBS +# variables. If the first one is defined, it specifies the name of the +# config script to use. If the latter two are defined, the script is not +# ran at all and their values are used instead (if only one of them is +# defined, the empty value of the remaining one is still used). +# +# Example: +# +# AX_PATH_GENERIC(Foo, 1.0.0) +# +# would run `foo-config --version' and check that it is at least 1.0.0, if +# successful the following variables would be defined and substituted: +# +# FOO_CFLAGS to `foo-config --cflags` +# FOO_LIBS to `foo-config --libs` +# +# Example: +# +# AX_PATH_GENERIC([Bar],,,[ +# AC_MSG_ERROR([Cannot find Bar library]) +# ]) +# +# would check for bar-config program, defining and substituting the +# following variables: +# +# BAR_CFLAGS to `bar-config --cflags` +# BAR_LIBS to `bar-config --libs` +# +# Example: +# +# ./configure BAZ_LIBS=/usr/lib/libbaz.a +# +# would link with a static version of baz library even if `baz-config +# --libs` returns just "-lbaz" that would normally result in using the +# shared library. +# +# This macro is a rearranged version of AC_PATH_GENERIC from Angus Lees. +# +# LICENSE +# +# Copyright (c) 2009 Francesco Salvestrini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 13 + +# This is what autoupdate's m4 run will expand. It fires +# the warning (with _au_warn_XXX), outputs it into the +# updated configure.ac (with AC_DIAGNOSE), and then outputs +# the replacement expansion. + + +# This is an auxiliary macro that is also run when +# autoupdate runs m4. It simply calls m4_warning, but +# we need a wrapper so that each warning is emitted only +# once. We break the quoting in m4_warning's argument in +# order to expand this macro's arguments, not AU_DEFUN's. + + +# Finally, this is the expansion that is picked up by +# autoconf. It tells the user to run autoupdate, and +# then outputs the replacement expansion. We do not care +# about autoupdate's warning because that contains +# information on what to do *after* running autoupdate. + + + + + + + + + +# Check whether --with-curl-prefix was given. +if test "${with_curl_prefix+set}" = set; then + withval=$with_curl_prefix; curl_config_prefix="$withval" +else + curl_config_prefix="" +fi + + +# Check whether --with-curl-exec-prefix was given. +if test "${with_curl_exec_prefix+set}" = set; then + withval=$with_curl_exec_prefix; curl_config_exec_prefix="$withval" +else + curl_config_exec_prefix="" +fi + + + + + + + if test x"$CURL_CFLAGS" != x -o x"$CURL_LIBS" != x; then + + + + : + + +else + + if test x$curl_config_exec_prefix != x; then + + curl_config_args="$curl_config_args --exec-prefix=$curl_config_exec_prefix" + if test x${CURL_CONFIG+set} != xset; then + + CURL_CONFIG=$curl_config_exec_prefix/bin/curl-config + +fi + + +fi + + if test x$curl_config_prefix != x; then + + curl_config_args="$curl_config_args --prefix=$curl_config_prefix" + if test x${CURL_CONFIG+set} != xset; then + + CURL_CONFIG=$curl_config_prefix/bin/curl-config + +fi + + +fi + + + for ac_prog in curl-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_CURL_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $CURL_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_CURL_CONFIG="$CURL_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +CURL_CONFIG=$ac_cv_path_CURL_CONFIG +if test -n "$CURL_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5 +$as_echo "$CURL_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CURL_CONFIG" && break +done +test -n "$CURL_CONFIG" || CURL_CONFIG="no" + + if test "$CURL_CONFIG" = "no"; then + + : + + +else + + if test x"" = x; then + + CURL_CFLAGS="`$CURL_CONFIG $curl_config_args --cflags`" + +else + + CURL_CFLAGS="`$CURL_CONFIG $curl_config_args `" + +fi + + + if test x"" = x; then + + CURL_LIBS="`$CURL_CONFIG $curl_config_args --libs`" + +else + + CURL_LIBS="`$CURL_CONFIG $curl_config_args `" + +fi + + + if test x"" != x; then + + if test x"{ { $as_echo "$as_me:$LINENO: error: LIBCURL Not Found" >&5 +$as_echo "$as_me: error: LIBCURL Not Found" >&2;} + { (exit 1); exit 1; }; }" != x; then + + curl_version="`$CURL_CONFIG $curl_config_args --version | $SED -e { { $as_echo "$as_me:$LINENO: error: LIBCURL Not Found" >&5 +$as_echo "$as_me: error: LIBCURL Not Found" >&2;} + { (exit 1); exit 1; }; }`" + +else + + curl_version="`$CURL_CONFIG $curl_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" + +fi + + + { $as_echo "$as_me:$LINENO: checking for curl ($curl_version) >= " >&5 +$as_echo_n "checking for curl ($curl_version) >= ... " >&6; } + + + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + + ax_compare_version_A=`echo "$curl_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version_B=`echo "" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version=`echo "x$ax_compare_version_A +x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` + + + + if test "$ax_compare_version" = "true" ; then + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + + + : + + + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + : + + + fi + + +else + + + + : + + +fi + + +fi + + +fi + + + + + + # Checks for header files. diff --git a/libdbconn/configure.ac b/libdbconn/configure.ac index e3e47f1..648f773 100644 --- a/libdbconn/configure.ac +++ b/libdbconn/configure.ac @@ -19,7 +19,11 @@ AC_PROG_LIBTOOL # Checks for libraries. m4_include([m4/ax_lib_postgresql.m4]) -AX_LIB_POSTGRESQL([8.4]) +AX_LIB_POSTGRESQL() + +m4_include([m4/ax_compare_version.m4]) +m4_include([m4/ax_path_generic.m4]) +AX_PATH_GENERIC([curl],,[AC_MSG_ERROR([LIBCURL Not Found])]) # Checks for header files. AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h sys/time.h unistd.h utime.h]) diff --git a/libdbconn/m4/ax_compare_version.m4 b/libdbconn/m4/ax_compare_version.m4 new file mode 100644 index 0000000..21524dc --- /dev/null +++ b/libdbconn/m4/ax_compare_version.m4 @@ -0,0 +1,178 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# This macro compares two version strings. Due to the various number of +# minor-version numbers that can exist, and the fact that string +# comparisons are not compatible with numeric comparisons, this is not +# necessarily trivial to do in a autoconf script. This macro makes doing +# these comparisons easy. +# +# The six basic comparisons are available, as well as checking equality +# limited to a certain number of minor-version levels. +# +# The operator OP determines what type of comparison to do, and can be one +# of: +# +# eq - equal (test A == B) +# ne - not equal (test A != B) +# le - less than or equal (test A <= B) +# ge - greater than or equal (test A >= B) +# lt - less than (test A < B) +# gt - greater than (test A > B) +# +# Additionally, the eq and ne operator can have a number after it to limit +# the test to that number of minor versions. +# +# eq0 - equal up to the length of the shorter version +# ne0 - not equal up to the length of the shorter version +# eqN - equal up to N sub-version levels +# neN - not equal up to N sub-version levels +# +# When the condition is true, shell commands ACTION-IF-TRUE are run, +# otherwise shell commands ACTION-IF-FALSE are run. The environment +# variable 'ax_compare_version' is always set to either 'true' or 'false' +# as well. +# +# Examples: +# +# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) +# +# would both be true. +# +# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) +# +# would both be false. +# +# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) +# +# would be true because it is only comparing two minor versions. +# +# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) +# +# would be true because it is only comparing the lesser number of minor +# versions of the two values. +# +# Note: The characters that separate the version numbers do not matter. An +# empty string is the same as version 0. OP is evaluated by autoconf, not +# configure, so must be a string, not a variable. +# +# The author would like to acknowledge Guido Draheim whose advice about +# the m4_case and m4_ifvaln functions make this macro only include the +# portions necessary to perform the specific comparison specified by the +# OP argument in the final configure script. +# +# LICENSE +# +# Copyright (c) 2008 Tim Toolan +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +dnl ######################################################################### +AC_DEFUN([AX_COMPARE_VERSION], [ + AC_REQUIRE([AC_PROG_AWK]) + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + AS_VAR_PUSHDEF([A],[ax_compare_version_A]) + A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + AS_VAR_PUSHDEF([B],[ax_compare_version_B]) + B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary + dnl # then the first line is used to determine if the condition is true. + dnl # The sed right after the echo is to remove any indented white space. + m4_case(m4_tolower($2), + [lt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [gt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [le],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ], + [ge],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ],[ + dnl Split the operator from the subversion count if present. + m4_bmatch(m4_substr($2,2), + [0],[ + # A count of zero means use the length of the shorter version. + # Determine the number of characters in A and B. + ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` + ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` + + # Set A to no more than B's length and B to no more than A's length. + A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` + B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` + ], + [[0-9]+],[ + # A count greater than zero means use only that many subversions + A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + ], + [.+],[ + AC_WARNING( + [illegal OP numeric parameter: $2]) + ],[]) + + # Pad zeros at end of numbers to make same length. + ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" + B="$B`echo $A | sed 's/./0/g'`" + A="$ax_compare_version_tmp_A" + + # Check for equality or inequality as necessary. + m4_case(m4_tolower(m4_substr($2,0,2)), + [eq],[ + test "x$A" = "x$B" && ax_compare_version=true + ], + [ne],[ + test "x$A" != "x$B" && ax_compare_version=true + ],[ + AC_WARNING([illegal OP parameter: $2]) + ]) + ]) + + AS_VAR_POPDEF([A])dnl + AS_VAR_POPDEF([B])dnl + + dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. + if test "$ax_compare_version" = "true" ; then + m4_ifvaln([$4],[$4],[:])dnl + m4_ifvaln([$5],[else $5])dnl + fi +]) dnl AX_COMPARE_VERSION + diff --git a/libdbconn/m4/ax_path_generic.m4 b/libdbconn/m4/ax_path_generic.m4 new file mode 100644 index 0000000..a4db88f --- /dev/null +++ b/libdbconn/m4/ax_path_generic.m4 @@ -0,0 +1,165 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_path_generic.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG]) +# +# DESCRIPTION +# +# Runs the LIBRARY-config script and defines LIBRARY_CFLAGS and +# LIBRARY_LIBS unless the user had predefined them in the environment. +# +# The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION +# is specified, the script must also support the `--version' arg. If the +# `--with-library-[exec-]prefix' arguments to ./configure are given, it +# must also support `--prefix' and `--exec-prefix'. Prefereable use +# CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and +# LIBS-ARG instead of `--libs`, if given. +# +# The SED-EXPR-EXTRACTOR parameter representes the expression used in sed +# to extract the version number. Use it if your 'foo-config --version' +# dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'. +# +# The macro respects LIBRARY_CONFIG, LIBRARY_CFLAGS and LIBRARY_LIBS +# variables. If the first one is defined, it specifies the name of the +# config script to use. If the latter two are defined, the script is not +# ran at all and their values are used instead (if only one of them is +# defined, the empty value of the remaining one is still used). +# +# Example: +# +# AX_PATH_GENERIC(Foo, 1.0.0) +# +# would run `foo-config --version' and check that it is at least 1.0.0, if +# successful the following variables would be defined and substituted: +# +# FOO_CFLAGS to `foo-config --cflags` +# FOO_LIBS to `foo-config --libs` +# +# Example: +# +# AX_PATH_GENERIC([Bar],,,[ +# AC_MSG_ERROR([Cannot find Bar library]) +# ]) +# +# would check for bar-config program, defining and substituting the +# following variables: +# +# BAR_CFLAGS to `bar-config --cflags` +# BAR_LIBS to `bar-config --libs` +# +# Example: +# +# ./configure BAZ_LIBS=/usr/lib/libbaz.a +# +# would link with a static version of baz library even if `baz-config +# --libs` returns just "-lbaz" that would normally result in using the +# shared library. +# +# This macro is a rearranged version of AC_PATH_GENERIC from Angus Lees. +# +# LICENSE +# +# Copyright (c) 2009 Francesco Salvestrini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 13 + +AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC]) +AC_DEFUN([AX_PATH_GENERIC],[ + AC_REQUIRE([AC_PROG_SED]) + + dnl we're going to need uppercase and lowercase versions of the + dnl string `LIBRARY' + pushdef([UP], translit([$1], [a-z], [A-Z]))dnl + pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl + + AC_ARG_WITH(DOWN-prefix,[AS_HELP_STRING([--with-]DOWN[-prefix=PREFIX], [Prefix where $1 is installed (optional)])], + DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") + AC_ARG_WITH(DOWN-exec-prefix,[AS_HELP_STRING([--with-]DOWN[-exec-prefix=EPREFIX], [Exec prefix where $1 is installed (optional)])], + DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") + + AC_ARG_VAR(UP[]_CONFIG, [config script used for $1]) + AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1]) + AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1]) + + AS_IF([test x"$UP[]_CFLAGS" != x -o x"$UP[]_LIBS" != x],[ + dnl Don't run config script at all, use user-provided values instead. + AC_SUBST(UP[]_CFLAGS) + AC_SUBST(UP[]_LIBS) + : + $4 + ],[ + AS_IF([test x$DOWN[]_config_exec_prefix != x],[ + DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" + AS_IF([test x${UP[]_CONFIG+set} != xset],[ + UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config + ]) + ]) + AS_IF([test x$DOWN[]_config_prefix != x],[ + DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" + AS_IF([test x${UP[]_CONFIG+set} != xset],[ + UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config + ]) + ]) + + AC_PATH_PROGS(UP[]_CONFIG,[$6 DOWN-config],[no]) + AS_IF([test "$UP[]_CONFIG" = "no"],[ + : + $5 + ],[ + dnl Get the CFLAGS from LIBRARY-config script + AS_IF([test x"$7" = x],[ + UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" + ],[ + UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args $7`" + ]) + + dnl Get the LIBS from LIBRARY-config script + AS_IF([test x"$8" = x],[ + UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" + ],[ + UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args $8`" + ]) + + AS_IF([test x"$2" != x],[ + dnl Check for provided library version + AS_IF([test x"$3" != x],[ + dnl Use provided sed expression + DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e $3`" + ],[ + DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" + ]) + + AC_MSG_CHECKING([for $1 ($DOWN[]_version) >= $2]) + AX_COMPARE_VERSION($DOWN[]_version,[ge],[$2],[ + AC_MSG_RESULT([yes]) + + AC_SUBST(UP[]_CFLAGS) + AC_SUBST(UP[]_LIBS) + : + $4 + ],[ + AC_MSG_RESULT([no]) + : + $5 + ]) + ],[ + AC_SUBST(UP[]_CFLAGS) + AC_SUBST(UP[]_LIBS) + : + $4 + ]) + ]) + ]) + + popdef([UP]) + popdef([DOWN]) +]) + diff --git a/libdbconn/src/Makefile.am b/libdbconn/src/Makefile.am index 0e4b402..4fba915 100644 --- a/libdbconn/src/Makefile.am +++ b/libdbconn/src/Makefile.am @@ -3,7 +3,7 @@ lib_LTLIBRARIES = libdbconn.la include_HEADERS = dbconn.h libdbconn_la_SOURCES = dbconn.c dbconn_pgsql.c dbconn_pgsql.h dbconn_private.h dbconn_sqlite.c dbconn_sqlite.h dbconn_version.c dbconn_wspc.c dbconn_wspc.h sqlite3.c sqlite3.h -libdbconn_la_CFLAGS = $(POSTGRESQL_CFLAGS) -I${includedir} -Wall -Wextra +libdbconn_la_CFLAGS = $(POSTGRESQL_CFLAGS) $(CURL_CFLAGS) -I${includedir} -Wall -Wextra libdbconn_la_LDFLAGS = -no-undefined -avoid-version $(POSTGRESQL_LDFLAGS) $(CURL_LIBS) -L${libdir} -lmsngr pkgconfigdir = $(libdir)/pkgconfig diff --git a/libdbconn/src/Makefile.in b/libdbconn/src/Makefile.in index ccadeaf..cc96842 100644 --- a/libdbconn/src/Makefile.in +++ b/libdbconn/src/Makefile.in @@ -41,7 +41,8 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/dbconn.pc.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_postgresql.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_path_generic.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -130,6 +131,9 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -236,7 +240,7 @@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libdbconn.la include_HEADERS = dbconn.h libdbconn_la_SOURCES = dbconn.c dbconn_pgsql.c dbconn_pgsql.h dbconn_private.h dbconn_sqlite.c dbconn_sqlite.h dbconn_version.c dbconn_wspc.c dbconn_wspc.h sqlite3.c sqlite3.h -libdbconn_la_CFLAGS = $(POSTGRESQL_CFLAGS) -I${includedir} -Wall -Wextra +libdbconn_la_CFLAGS = $(POSTGRESQL_CFLAGS) $(CURL_CFLAGS) -I${includedir} -Wall -Wextra libdbconn_la_LDFLAGS = -no-undefined -avoid-version $(POSTGRESQL_LDFLAGS) $(CURL_LIBS) -L${libdir} -lmsngr pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = dbconn.pc