annotate main/database/src/configure.ac @ 12718:1af86934c14e octave-forge

Make compatible with Octaves new exception-based error handling. Retain compatibility with Octaves old error handling based on error_state. * src/error_helpers.[h,cc]: Added. * src/Makefile.in: Integrate error-helpers.[h,cc]. * src/config.h.in: Added. * configure.ac, src/config.h.in: Test presence of 'error_state' and presence of 'verror (octave_execution_exception&, const char *, va_list)'. * src/__pq_connect__.cc, src/command.cc, src/command.h, src/converters.cc, src/converters_arr_comp.cc, src/pq_connection.cc, src/pq_conninfo.cc, src/pq_exec.cc, src/pq_lo.cc, src/pq_update_types.cc: If necessary, include error-helpers.h, replace error() with c_verror(), set and check a different error indicator than error_state, use CHECK_ERROR or SET_ERR, explicitely check for errors instead of relying on Octave checking error_state when returning to the prompt.
author i7tiol
date Sat, 27 Feb 2016 11:11:04 +0000
parents c73c23bbe9ce
children 65172e6662d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
1 # -*- Autoconf -*-
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
2 # Process this file with autoconf to produce a configure script.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
3
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
4 AC_PREREQ([2.67])
11716
6ef2f5b6a9e5 Prepare for release 2.2.0.
i7tiol
parents: 11646
diff changeset
5 AC_INIT([database], [2.2.0], [i7tiol@t-online.de])
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
6 AC_CONFIG_SRCDIR([__pq_connect__.cc])
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
7 AC_CONFIG_HEADERS([config.h])
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
8
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
9 # Checks for programs.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
10 AC_PROG_CXX
11646
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
11 if test "$GXX" != yes; then
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
12 AC_MSG_ERROR([This package needs the GNU C++ compiler, which wasn't found.], 1);
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
13 fi
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
14
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
15 AC_CHECK_PROG(OCTAVE, octave, octave)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
16 AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
17 AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config)
11553
35e9e4b6ab34 Fix configuration of postgresql include directories.
i7tiol
parents: 11550
diff changeset
18 AC_CHECK_PROG(PG_CONFIG, pg_config, pg_config)
11646
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
19 if test -z "$PG_CONFIG"; then
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
20 AC_MSG_ERROR([pg_config not found], 1);
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11632
diff changeset
21 fi
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
22
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
23 # Checks for libraries.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
24 AC_CHECK_LIB([pq], [PQconnectdb])
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
25
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
26 # Checks for typedefs, structures, and compiler characteristics.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
27
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
28 # Checks for library functions.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
29 AC_FUNC_ERROR_AT_LINE
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
30
12564
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
31 # Check for PostgreSQL version. (Octave is 'abused' here for string
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
32 # and version handling, only because I'm more familiar with it than
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
33 # with other tools. Should not interfer with cross-compiling as long
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
34 # as you have any Octave installed locally.)
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
35 AC_MSG_CHECKING([whether PostgreSQL version is >= 8.3])
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
36 if $OCTAVE -q --eval ["[~, vs] = system ('$PG_CONFIG --version'); if (compare_versions (regexp (vs, '(\\d+\\.\\d+\\.\\d+)', 'tokens'){1}{:}, '8.3', '>=')) exit (1); else exit (0); endif"]; then
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
37 AC_MSG_RESULT(no)
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
38 AC_MSG_ERROR([package \"database\" does not work with PostgreSQL version < 8.3], 1);
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
39 else
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
40 AC_MSG_RESULT(yes)
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
41 fi
c73c23bbe9ce Check postgresql version at configure time. Fixes bug #44345.
i7tiol
parents: 11716
diff changeset
42
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
43 # Start of checks for Octave features, preparations for checks.
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
44 OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`}
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
45 OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$OCTAVE_CONFIG -p OCTINCLUDEDIR`}
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
46 AC_LANG_PUSH([C++])
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
47 TCXXFLAGS=$CXXFLAGS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
48 TLDFLAGS=$LDFLAGS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
49 TLIBS=$LIBS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
50 LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
51 LIBS="-loctinterp $LIBS"
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
52 CXXFLAGS="-I$OCTINCLUDEDIR $CXXFLAGS"
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
53
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
54 ## Presence of 'error_state' -- does _not_ indicate no exceptions are
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
55 ## used.
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
56 AC_LINK_IFELSE(
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
57 [AC_LANG_PROGRAM([[#include <oct.h>]
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
58 [#include <stdio.h>]],
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
59 [[printf ("%i", error_state);]])],
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
60 [AC_DEFINE([HAVE_OCTAVE_ERROR_STATE], 1)])
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
61
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
62 ## Presence of 'verror (octave_execution_exception&, const char *,
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
63 ## va_list)'
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
64 AC_LINK_IFELSE(
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
65 [AC_LANG_PROGRAM([[#include <oct.h>]],
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
66 [[octave_execution_exception e;]
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
67 [va_list args;]
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
68 [verror (e, "test", args);]])],
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
69 [AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1)])
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
70
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
71 LIBS=$TLIBS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
72 LDFLAGS=$TLDFLAGS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
73 CXXFLAGS=$TCXXFLAGS
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
74 AC_LANG_POP([C++])
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
75 # End of checks for Octave features.
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12564
diff changeset
76
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
77 AC_CONFIG_FILES([Makefile])
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
78 AC_OUTPUT