1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3# 4### Copyright (C) 2015-2019 Olaf Till <i7tiol@t-online.de> 5### 6### This program is free software; you can redistribute it and/or 7### modify it under the terms of the GNU General Public License as 8### published by the Free Software Foundation; either version 3 of the 9### License, or (at your option) any later version. 10### 11### This program is distributed in the hope that it will be useful, 12### but WITHOUT ANY WARRANTY; without even the implied warranty of 13### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14### General Public License for more details. 15### 16### You should have received a copy of the GNU General Public License 17### along with this program; if not, see 18### <http://www.gnu.org/licenses/>. 19 20AC_PREREQ([2.67]) 21AC_INIT([database], [2.4.4], [i7tiol@t-online.de]) 22AC_CONFIG_SRCDIR([__pq_connect__.cc]) 23AC_CONFIG_HEADERS([config.h]) 24 25# Avoid warnings for redefining AH-generated preprocessor symbols of 26# Octave. 27AH_TOP([#include "undef-ah-octave.h"]) 28 29AC_CONFIG_MACRO_DIRS([m4]) 30 31# Checks for programs. 32AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile) 33if test -z "$MKOCTFILE"; then 34AC_MSG_ERROR([mkoctfile not found], 1); 35fi 36AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config) 37if test -z "$OCTAVE_CONFIG"; then 38AC_MSG_ERROR([octave-config not found], 1); 39fi 40AC_CHECK_PROG(PG_CONFIG, pg_config, pg_config) 41if test -z "$PG_CONFIG"; then 42AC_MSG_ERROR([pg_config not found], 1); 43fi 44AC_PROG_AWK 45if test -z "$ac_cv_prog_AWK"; then 46AC_MSG_ERROR([AWK not found], 1); 47fi 48 49AC_PROG_SED 50 51# The same value of CXX as Octave was compiled with is supposed to be used. 52CXX=${CXX:-`${MKOCTFILE} -p CXX`} 53AC_PROG_CXX 54 55AC_PROG_CXXCPP 56 57# Checks for libraries. 58AC_CHECK_LIB([pq], [PQconnectdb], [], [ 59 AC_MSG_ERROR([unable to find the PQconnectdb() function in pq]) 60]) 61 62# Checks for typedefs, structures, and compiler characteristics. 63 64# Checks for library functions. 65AC_FUNC_ERROR_AT_LINE 66 67# Check for PostgreSQL version. 68AC_MSG_CHECKING([whether PostgreSQL version >= 8.3]) 69if `$PG_CONFIG --version | awk 'NR==1 { print $(NF); };' | awk -F '.' ' { if ( $1 > 8 || $1 == 8 && $2 >= 3 ) exit 1; else exit 0}'`; then 70 AC_MSG_RESULT(no) 71 AC_MSG_ERROR([package "database" does not work with PostgreSQL version < 8.3], 1); 72else 73 AC_MSG_RESULT(yes) 74fi 75 76# Start of checks for Octave features, preparations for checks. 77OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`} 78## We need Octaves include path both with and without '/octave' 79## appended. The path without '/octave' is needed to selectively test 80## for Octave headers, like octave/....h. The path with '/octave' is 81## needed since some Octave headers contain include directives for 82## other Octave headers with <> instead of "". 83OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`} 84AC_LANG_PUSH([C++]) 85TCXXFLAGS=$CXXFLAGS 86TLDFLAGS=$LDFLAGS 87TLIBS=$LIBS 88TCPPFLAGS=$CPPFLAGS 89LDFLAGS="-L$OCTLIBDIR $LDFLAGS" 90LIBS="-loctinterp $LIBS" 91# CXXFLAGS= 92CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS" 93 94## Presence of 'error_state' -- does _not_ indicate no exceptions are 95## used. 96AC_LINK_IFELSE( 97 [AC_LANG_PROGRAM([[#include <octave/oct.h>] 98 [#include <stdio.h>]], 99 [[printf ("%i", error_state);]])], 100 [AC_DEFINE([HAVE_OCTAVE_ERROR_STATE], 1, 101 [Define as 1 if liboctinterp is old enough to provide error_state.])]) 102 103## Presence of 'verror (octave(_|::)execution_exception&, const char *, 104## va_list)' 105AC_COMPILE_IFELSE( 106 [AC_LANG_PROGRAM([[#include <octave/oct.h>]], 107 [[octave_execution_exception e;] 108 [va_list args;] 109 [verror (e, "test", args);]])], 110 [AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1, 111 [Define as 1 if liboctinterp has 'verror (octave(_|::)execution_exception&, const char *, va_list)'.])], 112 [AC_COMPILE_IFELSE( 113 [AC_LANG_PROGRAM([[#include <octave/oct.h>]], 114 [[octave::execution_exception e;] 115 [va_list args;] 116 [verror (e, "test", args);]])], 117 [AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1, 118 [Define as 1 if liboctinterp has 'verror (octave(_|::)execution_exception&, const char *, va_list)'.])])]) 119 120AC_CHECK_HEADERS([octave/interpreter.h]) 121 122## Simple symbol alternatives of different Octave versions. 123OF_OCTAVE_LIST_ALT_SYMS([ 124[dnl 125 [oct_mach_info], 126 [octave::mach_info], 127 [[octave::mach_info::flt_fmt_unknown;]], 128 [OCTAVE__MACH_INFO], 129 [], 130 [] 131], 132 133[dnl 134 [is_cell], 135 [iscell], 136 [[octave_value ().iscell ();]], 137 [OV_ISCELL], 138 [], 139 [] 140], 141 142[dnl 143 [is_empty], 144 [isempty], 145 [[octave_value ().isempty ();]], 146 [OV_ISEMPTY], 147 [], 148 [] 149], 150 151[dnl 152 [is_float_type], 153 [isfloat], 154 [[octave_value ().isfloat ();]], 155 [OV_ISFLOAT], 156 [], 157 [] 158], 159 160[dnl 161 [is_integer_type], 162 [isinteger], 163 [[octave_value ().isinteger ();]], 164 [OV_ISINTEGER], 165 [], 166 [] 167], 168 169[dnl 170 [is_real_type], 171 [isreal], 172 [[octave_value ().isreal ();]], 173 [OV_ISREAL], 174 [], 175 [] 176], 177 178[dnl 179 [feval], 180 [octave::feval], 181 [[octave::feval ("date");]], 182 [OCTAVE__FEVAL], 183 [[#include <octave/parse.h>]], 184 [[#include <octave/parse.h>]] 185], 186 187[dnl 188 [octave_execution_exception], 189 [octave::execution_exception], 190 [[octave::execution_exception ();]], 191 [OCTAVE__EXECUTION_EXCEPTION], 192 [], 193 [] 194], 195 196[dnl 197 [octave_vformat], 198 [octave::vformat], 199 [[std::ostringstream obuf;] 200 [va_list args;] 201 [octave::vformat (obuf, "dummy", args);]], 202 [OCTAVE__VFORMAT], 203 [], 204 [] 205] 206 207], 208 [oct-alt-includes.h]) 209 210LIBS=$TLIBS 211LDFLAGS=$TLDFLAGS 212CXXFLAGS=$TCXXFLAGS 213CPPFLAGS=$TCPPFLAGS 214AC_LANG_POP([C++]) 215# End of checks for Octave features. 216 217AC_CONFIG_FILES([Makefile]) 218AC_OUTPUT 219