[AC21.5] Improve PostgreSQL autodetection
"Stephen J. Turnbull" <[email protected]> Mon, 04 May 2015 14:45:08 +0900
| Newsgroups | gmane.emacs.xemacs.patches |
|---|---|
| Message-ID | <[email protected]> |
APPROVE COMMIT 21.5 Many distributions (MacPorts, Debian GNU/Linux, Gentoo GNU/Linux at least) support multiple installations of PostgreSQL by version. This patch adds support for the most recent releases of PostgreSQL 8 and 9 in the subdirectories used by those distros, as well as an optional argument to --with-postgresql to specify the subdirectory. The optional argument doesn't currently work with a loadable module, but the variant subdirectories will be autodetected. The configure scripts have been regenerated and committed, but the diffs of the regenerated scripts are omitted here, since they include tens of thousands of lines due to differing autoconf versions. # HG changeset patch # Parent 23178aa71f8b985a32f9b80e5c6da660700a0315 Update Postgresql module for 2015 and MacPorts reality. diff -r 23178aa71f8b ChangeLog --- a/ChangeLog Mon Apr 20 15:09:11 2015 -0600 +++ b/ChangeLog Mon May 04 14:32:22 2015 +0900 @@ -1,3 +1,10 @@ +2015-05-04 Stephen J. Turnbull <[email protected]> + + * configure.ac (PostgreSQL): Allow specification of subdir. + Add most recent versioned directories for multiversion + installations (eg, MacPorts. + * configure: Regenerate. + 2015-04-09 Aidan Kehoe <[email protected]> * configure.ac: diff -r 23178aa71f8b configure.ac --- a/configure.ac Mon Apr 20 15:09:11 2015 -0600 +++ b/configure.ac Mon May 04 14:32:22 2015 +0900 @@ -885,7 +885,11 @@ AS_HELP_STRING([--with-ldap],[Support the LDAP protocol.]), [], []) XE_MERGED_ARG([postgresql], - AS_HELP_STRING([--with-postgresql],[Support the PostgreSQL RDBMS.]), + AS_HELP_STRING([--with-postgresql],[Support the PostgreSQL RDBMS. + Optional argument should be the basename of the + subdirectory containing `libpq-fe.h'. The first + subdirectory found on the -I path will be used. + Currently autodetect must be used --with-modules.]), [], []) dnl XE_HELP_SUBSECTION([Mail options]) @@ -3677,12 +3681,26 @@ AC_MSG_CHECKING([for PostgreSQL]) AC_MSG_RESULT() -dnl Look for these standard header file locations, known to be used on Linux - for header_dir in "" "pgsql/" "postgresql/"; do - AC_CHECK_HEADER(${header_dir}libpq-fe.h, - libpq_fe_h_file=${header_dir}libpq-fe.h; break) + case "$with_postgresql" in + "" | "yes" | "no" | "true" | "false" | "auto") + pg_header_dir="" ;; + *) + pg_header_dir="$with_postgresql" ;; + esac + + dnl Look in standard header file locations. + dnl These are known to be used on Linux or MacPorts. + dnl Assume that the most recent version available is the most likely to be + dnl found in an unversioned directory. + libpq_fe_h_file="" + for header_dir in $pg_header_dir "" "pgsql" "postgresql" "postgresql94" "postgresql-9.4" "postgresql/9.4" "postgresql84" "postgresql-8.4" "postgresql/8.4"; do + AC_CHECK_HEADER(${header_dir}/libpq-fe.h, + libpq_fe_h_file=${header_dir}/libpq-fe.h; break) done + if test -n "$pg_header_dir" -a "$header_dir" != "$pg_header_dir"; then + AC_WARN([--with-postgresql="$pg_header_dir" specified but not found; using "$libpq_fe_h_file"]) + pq_libs= extra_libs= if test -n "$libpq_fe_h_file"; then diff -r 23178aa71f8b modules/ChangeLog --- a/modules/ChangeLog Mon Apr 20 15:09:11 2015 -0600 +++ b/modules/ChangeLog Mon May 04 14:32:22 2015 +0900 @@ -1,3 +1,10 @@ +2015-05-04 Stephen J. Turnbull <[email protected]> + + * postgresql/configure.ac (PostgreSQL): Allow specification of subdir. + Add most recent versioned directories for multiversion + installations (eg, MacPorts. + * postgresql/configure: Regenerate. + 2014-08-11 Jerry James <[email protected]> * common/Makefile.common (CPPFLAGS): New variable. diff -r 23178aa71f8b modules/postgresql/configure.ac --- a/modules/postgresql/configure.ac Mon Apr 20 15:09:11 2015 -0600 +++ b/modules/postgresql/configure.ac Mon May 04 14:32:22 2015 +0900 @@ -32,10 +32,14 @@ dnl (such as the default /usr/local/pgsql when building from source), dnl then specify CPPFLAGS and LDFLAGS when configuring. dnl -dnl Look for these standard header file locations, known to be used on Linux -for header_dir in "" "pgsql/" "postgresql/"; do - AC_CHECK_HEADER([${header_dir}libpq-fe.h], - [libpq_fe_h_file=${header_dir}libpq-fe.h; break]) +dnl Look in standard header file locations. +dnl These are known to be used on Linux or MacPorts. +dnl Assume that the most recent version available is the most likely to be +dnl found in an unversioned directory. +libpq_fe_h_file="" + for header_dir in $pg_header_dir "" "pgsql" "postgresql" "postgresql94" "postgresql-9.4" "postgresql/9.4" "postgresql84" "postgresql-8.4" "postgresql/8.4"; do + AC_CHECK_HEADER(${header_dir}/libpq-fe.h, + libpq_fe_h_file=${header_dir}/libpq-fe.h; break) done test -z "$libpq_fe_h_file" &&