1
dnl The configure script is generated by autogen.sh from configure.base
2
dnl and the various configure.add files in the source tree. Edit
3
dnl configure.base and reprocess rather than modifying ./configure.
5
dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement?
8
AC_INIT(configure.base)
15
dnl Kill caching --- this ought to be the default
16
define([AC_CACHE_LOAD], )dnl
17
define([AC_CACHE_SAVE], )dnl
19
dnl uncomment to put support files in another directory
20
dnl AC_CONFIG_AUX_DIR(admin)
22
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
26
dnl need to find admin files, so keep track of the top dir.
30
dnl if mkoctfile doesn't work, then we need the following:
34
dnl Need C compiler regardless so define it in a way that
35
dnl makes autoconf happy and we can override whatever we
36
dnl need with mkoctfile -p.
37
dnl XXX FIXME XXX should use mkoctfile to get CC and CFLAGS
40
dnl XXX FIXME XXX need tests for -p -c -s in mkoctfile.
42
dnl *******************************************************************
43
dnl Sort out mkoctfile version number and install paths
45
dnl XXX FIXME XXX latest octave has octave-config so we don't
46
dnl need to discover things here. Doesn't have --exe-site-dir
47
dnl but defines --oct-site-dir and --m-site-dir
49
dnl Check for mkoctfile
50
AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile)
51
test -z "$MKOCTFILE" && AC_MSG_WARN([no mkoctfile found on path])
63
[ --with-path install path prefix],
66
[ --with-mpath override path for m-files],
69
[ --with-opath override path for oct-files],
72
[ --with-xpath override path for executables],
75
[ --with-altpath alternative functions install path prefix],
78
[ --with-altmpath override path for alternative m-files],
81
[ --with-altopath override path for alternative oct-files],
84
if test -n "$path" ; then
85
test -z "$mpath" && mpath=$path
86
test -z "$opath" && opath=$path/oct
87
test -z "$xpath" && xpath=$path/bin
88
test -z "$altpath" && altpath=$path-alternatives
91
if test -n "$altpath" ; then
92
test -z "$altmpath" && altmpath=$altpath
93
test -z "$altopath" && altopath=$altpath/oct
96
dnl Don't query if path/ver are given in the configure environment
97
#if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then
98
if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then
99
dnl Construct program to get mkoctfile version and local install paths
100
cat > conftest.cc <<EOF
101
#include <octave/config.h>
102
#include <octave/version.h>
103
#include <octave/defaults.h>
105
#define INFOV "\nINFOV=" OCTAVE_VERSION "\n"
107
#define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n"
109
#ifdef OCTAVE_LOCALVERFCNFILEDIR
110
# define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n"
112
# define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n"
115
#ifdef OCTAVE_LOCALVEROCTFILEDIR
116
# define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n"
118
# define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH "\n"
121
#ifdef OCTAVE_LOCALVERARCHLIBDIR
122
# define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR "\n"
124
# define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR "\n"
127
const char *infom = INFOM;
128
const char *infoo = INFOO;
129
const char *infox = INFOX;
130
const char *infoh = INFOH;
131
const char *infov = INFOV;
134
dnl Compile program perhaps with a special version of mkoctfile
135
$MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE)
137
dnl Strip the config info from the compiled file
138
eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"`
141
dnl set the appropriate variables if they are not already set
142
ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"`
143
subver=`echo $INFOV | sed -e "[s/^[^.]*[.][^.]*[.]//]"`
144
alt_mbase=`echo $INFOM | sed -e "[s,\/[^\/]*$,,]"`
145
alt_obase=`echo $INFOO | sed -e "[s,/site.*$,/site,]"`
146
test -z "$mpath" && mpath=$INFOM/octave-forge
147
test -z "$opath" && opath=$INFOO/octave-forge
148
test -z "$xpath" && xpath=$INFOX
149
test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m
150
test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH
153
dnl *******************************************************************
155
dnl XXX FIXME XXX Should we allow the user to override these?
156
dnl Do we even need them? The individual makefiles can call mkoctfile -p
157
dnl themselves, so the only reason to keep them is for configure, and
158
dnl for those things which are not built using mkoctfile (e.g., aurecord)
159
dnl but it is not clear we should be using octave compile flags for those.
161
dnl C compiler and flags
162
AC_MSG_RESULT([retrieving compile and link flags from $MKOCTFILE])
163
CC=`$MKOCTFILE -p CC`
164
CFLAGS=`$MKOCTFILE -p CFLAGS`
165
CPPFLAGS=`$MKOCTFILE -p CPPFLAGS`
166
CPICFLAG=`$MKOCTFILE -p CPICFLAG`
167
LDFLAGS=`$MKOCTFILE -p LDFLAGS`
168
LIBS=`$MKOCTFILE -p LIBS`
174
dnl Fortran compiler and flags
175
F77=`$MKOCTFILE -p F77`
176
FFLAGS=`$MKOCTFILE -p FFLAGS`
177
FPICFLAG=`$MKOCTFILE -p FPICFLAG`
182
dnl C++ compiler and flags
183
CXX=`$MKOCTFILE -p CXX`
184
CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
185
CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
190
dnl *******************************************************************
192
dnl Check for features of your version of mkoctfile.
193
dnl All checks should be designed so that the default
194
dnl action if the tests are not performed is to do whatever
195
dnl is appropriate for the most recent version of Octave.
197
dnl Define the following macro:
198
dnl OF_CHECK_LIB(lib,fn,true,false,helpers)
199
dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS
200
AC_DEFUN(OF_CHECK_LIB,
202
AC_CHECK_LIB($1,$2,$3,$4,$5)
206
dnl Define the following macro:
207
dnl TRY_MKOCTFILE(msg,program,action_if_true,action_if_false)
209
AC_DEFUN(TRY_MKOCTFILE,
211
cat > conftest.cc << EOF
212
#include <octave/config.h>
215
ac_try="$MKOCTFILE -c conftest.cc"
216
if AC_TRY_EVAL(ac_try) ; then
226
dnl Check if F77_FUNC works with MKOCTFILE
228
TRY_MKOCTFILE([for F77_FUNC],
229
[int F77_FUNC (hello, HELLO) (const int &n);],,
230
[MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"])
232
dnl **********************************************************
234
dnl Evaluate an expression in octave
236
dnl OCTAVE_EVAL(expr,var) -> var=expr
238
AC_DEFUN(OCTAVE_EVAL,
239
[AC_MSG_CHECKING([for $1 in Octave])
240
$2=`echo "disp($1)" | $OCTAVE -qf`
245
dnl Check status of an octave variable
247
dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false)
249
AC_DEFUN(OCTAVE_CHECK_EXIST,
250
[AC_MSG_CHECKING([for $1 in Octave])
251
if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then
260
dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version
261
AC_CHECK_PROG(OCTAVE,octave,octave)
262
OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
264
dnl grab canonical host type so we can write system specific install stuff
265
OCTAVE_EVAL(octave_config_info('canonical_host_type'),canonical_host_type)
267
dnl grab SHLEXT from octave config
268
OCTAVE_EVAL(octave_config_info('SHLEXT'),SHLEXT)
274
dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files.
276
case "$canonical_host_type" in
283
dnl Use $(STRIP) in the makefile to strip executables. If not found,
284
dnl STRIP expands to ':', which in the makefile does nothing.
285
dnl Don't need this for .oct files since mkoctfile handles them directly
287
AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:)
289
dnl Strip on windows, don't strip on Mac OS/X or IRIX
290
dnl For the rest, you can force strip using MKOCTFILE="mkoctfile -s"
291
dnl or avoid strip using STRIP=: before ./configure
292
case "$canonical_host_type" in
293
powerpc-apple-darwin*|*-sgi-*)
296
*-cygwin-*|*-mingw-*)
297
MKOCTFILE="$MKOCTFILE -s"
302
AC_SUBST(HAVE_LIB_TERMCAP)
304
AC_CHECK_FUNCS(fork, [have_fork=yes], [have_fork=])
307
dnl In modern autoconf, we should be able to replace this with something
308
dnl the CHECK_TYPE macro
309
AC_DEFUN([TYPE_SOCKLEN_T],
310
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
313
[#include <sys/types.h>
314
#include <sys/socket.h>],
315
[socklen_t len = 42; return 0;],
316
ac_cv_type_socklen_t=yes,
317
ac_cv_type_socklen_t=no)
319
if test $ac_cv_type_socklen_t != yes; then
320
MISCDEFS="$MISCDEFS -Dsocklen_t=int"
324
dnl Check for socklen_t
327
dnl Check if octave_function(void) fails
328
TRY_MKOCTFILE([for octave_function(void)],
329
[#include <octave/ov-fcn.h>
330
class myfun:octave_function {myfun():octave_function(){}};],
331
[],[MISCDEFS="$MISCDEFS -DOCTAVE_FUNCTION_VOID_FAILS"])
334
case "$canonical_host_type" in
340
AC_CHECK_HEADER(term.h, have_term=yes, have_term=no)
341
AC_CHECK_HEADER(termcap.h, have_termcap=yes, have_termcap=no)
345
if test $have_termcap = yes; then
346
MISCDEFS="$MISCDEFS -DUSE_TERM -DHAVE_TERMCAP_H"
347
OF_CHECK_LIB(termcap, tgetnum, HAVE_LIB_TERMCAP=yes)
349
elif test $have_term = yes; then
350
MISCDEFS="$MISCDEFS -DUSE_TERM -DHAVE_TERM_H"
352
OF_CHECK_LIB(termcap, tgetnum, HAVE_LIB_TERMCAP=yes)
357
CONFIGURE_OUTPUTS="Makeconf"
359
octave commands will install into the following directories:
367
shell commands will install into the following directories:
373
octave-forge is configured with
374
octave: $OCTAVE (version $OCTAVE_VERSION)
375
mkoctfile: $MKOCTFILE for Octave $subver
376
have term.h or termcap.h: $TERMSTATUS"