File: configure.base

package info (click to toggle)
octave2.1-forge 2006.03.17%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 16,672 kB
  • ctags: 6,047
  • sloc: cpp: 49,610; ansic: 14,035; perl: 2,789; sh: 2,087; makefile: 1,560; lex: 1,219; tcl: 799; fortran: 422; objc: 202
file content (520 lines) | stat: -rw-r--r-- 14,766 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
dnl The configure script is generated by autogen.sh from configure.base 
dnl and the various configure.add files in the source tree.  Edit 
dnl configure.base and reprocess rather than modifying ./configure.

dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement?
AC_PREREQ(2.2)

AC_INIT(configure.base)

PACKAGE=octave-forge
MAJOR_VERSION=0
MINOR_VERSION=1
PATCH_LEVEL=0

dnl Kill caching --- this ought to be the default
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl

dnl uncomment to put support files in another directory
dnl AC_CONFIG_AUX_DIR(admin)

VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

dnl need to find admin files, so keep track of the top dir.
TOPDIR=`pwd`
AC_SUBST(TOPDIR)

dnl if mkoctfile doesn't work, then we need the following:
dnl AC_PROG_CXX
dnl AC_PROG_F77

dnl Need C compiler regardless so define it in a way that
dnl makes autoconf happy and we can override whatever we
dnl need with mkoctfile -p.
dnl XXX FIXME XXX should use mkoctfile to get CC and CFLAGS
AC_PROG_CC

dnl XXX FIXME XXX need tests for -p -c -s in mkoctfile.

dnl *******************************************************************
dnl Sort out mkoctfile version number and install paths

dnl XXX FIXME XXX latest octave has octave-config so we don't
dnl need to discover things here.  Doesn't have --exe-site-dir
dnl but defines --oct-site-dir and --m-site-dir

dnl Check for mkoctfile
AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile)
test -z "$MKOCTFILE" &&	AC_MSG_WARN([no mkoctfile found on path])

AC_SUBST(ver)
AC_SUBST(subver)
AC_SUBST(mpath)
AC_SUBST(opath)
AC_SUBST(xpath)
AC_SUBST(altpath)
AC_SUBST(altmpath)
AC_SUBST(altopath)

AC_ARG_WITH(path, 
	[  --with-path             install path prefix],
	[ path=$withval ])
AC_ARG_WITH(mpath,
	[  --with-mpath            override path for m-files],
	[mpath=$withval])
AC_ARG_WITH(opath,
	[  --with-opath            override path for oct-files],
	[opath=$withval])
AC_ARG_WITH(xpath,
	[  --with-xpath            override path for executables],
	[xpath=$withval])
AC_ARG_WITH(altpath, 
	[  --with-altpath          alternative functions install path prefix],
	[ altpath=$withval ])
AC_ARG_WITH(altmpath,
	[  --with-altmpath         override path for alternative m-files],
	[altmpath=$withval])
AC_ARG_WITH(altopath,
	[  --with-altopath         override path for alternative oct-files],
	[altopath=$withval])	

if test -n "$path" ; then
   test -z "$mpath" && mpath=$path 
   test -z "$opath" && opath=$path/oct 
   test -z "$xpath" && xpath=$path/bin
   test -z "$altpath" && altpath=$path-alternatives
fi

if test -n "$altpath" ; then
   test -z "$altmpath" && altmpath=$altpath 
   test -z "$altopath" && altopath=$altpath/oct 
fi

dnl Don't query if path/ver are given in the configure environment
#if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then
if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then
   dnl Construct program to get mkoctfile version and local install paths
   cat > conftest.cc <<EOF
#include <octave/config.h>
#include <octave/version.h>
#include <octave/defaults.h>

#define INFOV "\nINFOV=" OCTAVE_VERSION "\n"

#define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n"

#ifdef OCTAVE_LOCALVERFCNFILEDIR
# define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n"
#else
# define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n"
#endif

#ifdef OCTAVE_LOCALVEROCTFILEDIR
# define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n"
#else
# define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH  "\n"
#endif

#ifdef OCTAVE_LOCALVERARCHLIBDIR
# define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR  "\n"
#else
# define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR  "\n"
#endif

const char *infom = INFOM;
const char *infoo = INFOO;
const char *infox = INFOX;
const char *infoh = INFOH;
const char *infov = INFOV;
EOF

   dnl Compile program perhaps with a special version of mkoctfile
   $MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE)

   dnl Strip the config info from the compiled file
   eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"`
   rm -rf conftest*

   dnl set the appropriate variables if they are not already set
   ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"`
   subver=`echo $INFOV | sed -e "[s/^[^.]*[.][^.]*[.]//]"`
   alt_mbase=`echo $INFOM | sed -e "[s,\/[^\/]*$,,]"`
   alt_obase=`echo $INFOO | sed -e "[s,/site.*$,/site,]"`
   test -z "$mpath" && mpath=$INFOM/octave-forge
   test -z "$opath" && opath=$INFOO/octave-forge
   test -z "$xpath" && xpath=$INFOX
   test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m
   test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH
fi

dnl *******************************************************************

dnl XXX FIXME XXX Should we allow the user to override these?
dnl Do we even need them?  The individual makefiles can call mkoctfile -p
dnl themselves, so the only reason to keep them is for configure, and
dnl for those things which are not built using mkoctfile (e.g., aurecord)
dnl but it is not clear we should be using octave compile flags for those.

dnl C compiler and flags
AC_MSG_RESULT([retrieving compile and link flags from $MKOCTFILE])
CC=`$MKOCTFILE -p CC`
CFLAGS=`$MKOCTFILE -p CFLAGS`
CPPFLAGS=`$MKOCTFILE -p CPPFLAGS`
CPICFLAG=`$MKOCTFILE -p CPICFLAG`
LDFLAGS=`$MKOCTFILE -p LDFLAGS`
LIBS=`$MKOCTFILE -p LIBS`
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CPICFLAG)

dnl Fortran compiler and flags
F77=`$MKOCTFILE -p F77`
FFLAGS=`$MKOCTFILE -p FFLAGS`
FPICFLAG=`$MKOCTFILE -p FPICFLAG`
AC_SUBST(F77)
AC_SUBST(FFLAGS)
AC_SUBST(FPICFLAG)

dnl C++ compiler and flags
CXX=`$MKOCTFILE -p CXX`
CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
AC_SUBST(CXXPICFLAG)

dnl *******************************************************************

dnl Check for features of your version of mkoctfile.
dnl All checks should be designed so that the default
dnl action if the tests are not performed is to do whatever
dnl is appropriate for the most recent version of Octave.

dnl Define the following macro:
dnl    OF_CHECK_LIB(lib,fn,true,false,helpers)
dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS
AC_DEFUN(OF_CHECK_LIB,
[save_LIBS="$LIBS"
AC_CHECK_LIB($1,$2,$3,$4,$5)
LIBS="$save_LIBS"
])

dnl Define the following macro:
dnl    TRY_MKOCTFILE(msg,program,action_if_true,action_if_false)
dnl
AC_DEFUN(TRY_MKOCTFILE,
[AC_MSG_CHECKING($1)
cat > conftest.cc << EOF
#include <octave/config.h>
$2
EOF
ac_try="$MKOCTFILE -c conftest.cc"
if AC_TRY_EVAL(ac_try) ; then
   AC_MSG_RESULT(yes)
   $3
else
   AC_MSG_RESULT(no)
   $4
fi
])

dnl
dnl Check if F77_FUNC works with MKOCTFILE
dnl
TRY_MKOCTFILE([for F77_FUNC],
[int F77_FUNC (hello, HELLO) (const int &n);],,
[MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"])

dnl
dnl Check if octave still uses SLList.h
dnl
TRY_MKOCTFILE([for SLList.h],[#include <octave/SLList.h>],
[MKOCTFILE="$MKOCTFILE -DHAVE_SLLIST_H"],)

dnl
dnl Check if octave has lo_ieee_nan_value
dnl
TRY_MKOCTFILE([for lo_ieee_nan_value],
[ #include <octave/lo-ieee.h>
int test(void) { lo_ieee_nan_value(); }],,
[MKOCTFILE="$MKOCTFILE -DUSE_OCTAVE_NAN"])

dnl
dnl Check if octave is needs octave_idx_type
dnl
TRY_MKOCTFILE([for octave_idx_type],
[#include <octave/oct-types.h>
octave_idx_type test(void) { octave_idx_type idx = 1; return idx; }],,
[MKOCTFILE="$MKOCTFILE -Doctave_idx_type=int"])

dnl
dnl Check if octave uses quit.h
dnl
TRY_MKOCTFILE([for quit.h],[#include <octave/quit.h>],,
[MKOCTFILE="$MKOCTFILE -DNEED_OCTAVE_QUIT"])

dnl **********************************************************

dnl Evaluate an expression in octave
dnl
dnl OCTAVE_EVAL(expr,var) -> var=expr
dnl
AC_DEFUN(OCTAVE_EVAL,
[AC_MSG_CHECKING([for $1 in Octave])
$2=`echo "disp($1)" | $OCTAVE -qf`
AC_MSG_RESULT($$2)
AC_SUBST($2)
])

dnl Check status of an octave variable
dnl
dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false)
dnl
AC_DEFUN(OCTAVE_CHECK_EXIST,
[AC_MSG_CHECKING([for $1 in Octave])
if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then
   AC_MSG_RESULT(yes)
   $2
else
   AC_MSG_RESULT(no)
   $3
fi
])

dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version
AC_CHECK_PROG(OCTAVE,octave,octave)
OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)

dnl grab canonical host type so we can write system specific install stuff
OCTAVE_EVAL(octave_config_info('canonical_host_type'),canonical_host_type)

dnl grab SHLEXT from octave config
OCTAVE_EVAL(octave_config_info('SHLEXT'),SHLEXT)

AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_RANLIB

dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files.
COPY_FLAGS="-Rfp"
case "$canonical_host_type" in
    *-*-linux*)
        COPY_FLAGS="-fdp"
    ;;
esac
AC_SUBST(COPY_FLAGS)

dnl Use $(STRIP) in the makefile to strip executables.  If not found, 
dnl STRIP expands to ':', which in the makefile does nothing.
dnl Don't need this for .oct files since mkoctfile handles them directly
STRIP=${STRIP-strip}
AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:)

dnl Strip on windows, don't strip on Mac OS/X or IRIX
dnl For the rest, you can force strip using MKOCTFILE="mkoctfile -s"
dnl or avoid strip using STRIP=: before ./configure
case "$canonical_host_type" in
    powerpc-apple-darwin*|*-sgi-*)
	STRIP=:
    ;;
    *-cygwin-*|*-mingw-*) 
	MKOCTFILE="$MKOCTFILE -s" 
    ;;
esac

dnl Things needed to link to X11 programs
dnl defines X_CFLAGS, X_LIBS
AC_SUBST(DEFHAVE_X)
AC_SUBST(X_LIBS)
AC_SUBST(X_CFLAGS)
AC_PATH_XTRA
if test "$no_x" = yes ; then
	DEFHAVE_X=
	XSTATUS="no (plot/g{input,text,zoom,rab} will not work)"
else
	DEFHAVE_X="HAVE_X=1"
	X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
	XSTATUS="yes"
fi

OCTAVE_CHECK_EXIST(autoload,[
	HAVE_AUTOLOAD="yes"
	OCTLINK=.octlink
	MKOCTLINK=$TOPDIR/admin/octlink.sh
],[
	HAVE_AUTOLOAD="no"
	OCTLINK=.oct
	MKOCTLINK=$LN_S
])
AC_SUBST(HAVE_AUTOLOAD)
AC_SUBST(OCTLINK)
AC_SUBST(MKOCTLINK)

OCTAVE_CHECK_EXIST(do_fortran_indexing,
	[HAVE_DO_FORTRAN_INDEXING="-DHAVE_DO_FORTRAN_INDEXING"],)
AC_SUBST(HAVE_DO_FORTRAN_INDEXING)

OCTAVE_CHECK_EXIST(propagate_empty_matrices,
	[PROPAGATE_EMPTY_MATRICES="-DHAVE_PROPAGATE_EMPTY_MATRICES"],)
AC_SUBST(HAVE_PROPAGATE_EMPTY_MATRICES)

OCTAVE_CHECK_EXIST(ok_to_lose_imaginary_part,
  [HAVE_OK_TO_LOSE_IMAGINARY_PART="-DHAVE_OK_TO_LOSE_IMAGINARY_PART"],)
AC_SUBST(HAVE_OK_TO_LOSE_IMAGINARY_PART)

dnl Test for N-dimensional Arrays
TRY_MKOCTFILE([for N-dim arrays],
[#include <octave/dim-vector.h>],
[HAVE_ND_ARRAYS="-DHAVE_ND_ARRAYS"],)
AC_SUBST(HAVE_ND_ARRAYS)

OCTAVE_CHECK_EXIST(class,[TYPEID_HAS_CLASS="-DTYPEID_HAS_CLASS"],)
AC_SUBST(TYPEID_HAS_CLASS)

dnl Test for load/save functions in class
TRY_MKOCTFILE([for load/save functions in class],
[#include <octave/ov-scalar.h>
int main (void) { octave_scalar a; a.load_ascii(std::cin); }],
[CLASS_HAS_LOAD_SAVE="-DCLASS_HAS_LOAD_SAVE"],)
AC_SUBST(CLASS_HAS_LOAD_SAVE)

TRY_MKOCTFILE([for Octave_map indexing],
[#include <octave/oct-map.h>
int main(void) { Octave_map a; a[["key"]]; }],
[HAVE_OCTAVE_MAP_INDEX="-DHAVE_OCTAVE_MAP_INDEX"],)
AC_SUBST(HAVE_OCTAVE_MAP_INDEX)

TRY_MKOCTFILE([for old Octave concatenation],
[#include <octave/dNDArray.h>
int main(void) { NDArray a(dim_vector(1,1)); Array<int> idx(2,0); a=concat(a,a,idx); }],
[HAVE_OCTAVE_CONCAT="-DHAVE_OLD_OCTAVE_CONCAT"],)

TRY_MKOCTFILE([for Octave concatenation],
[#include <octave/dNDArray.h>
int main(void) { NDArray a(dim_vector(1,1)); Array<int> idx(2,0); a=a.concat(a,idx); }],
[HAVE_OCTAVE_CONCAT="-DHAVE_OCTAVE_CONCAT"],)
AC_SUBST(HAVE_OCTAVE_CONCAT)

TRY_MKOCTFILE([for swap_8_bytes],
[#include <sys/types.h>
#include <octave/config.h>
#include <octave/byte-swap.h>
int main(void) {long long a = 1; swap_8_bytes (&a,1);}],,
[HAVE_SWAP_BYTES="-DHAVE_SWAP_BYTES"])
AC_SUBST(HAVE_SWAP_BYTES)

TRY_MKOCTFILE([for op_uplus],
[#include <octave/config.h>
#include <octave/ov.h>
int main(void) {int i = octave_value::op_uplus;}],
[HAVE_OCTAVE_UPLUS="-DHAVE_OCTAVE_UPLUS"],)
AC_SUBST(HAVE_OCTAVE_UPLUS)

dnl Test for the makeinfo program
AC_CHECK_PROG(MAKEINFO,makeinfo,makeinfo)
if [ test -n "$MAKEINFO" ]; then
	dnl Check whether the makeinfo command accepts the 
	dnl "--no-split" option
	touch conftest.texi
	AC_MSG_CHECKING([for makeinfo --no-split])
	ac_try="$MAKEINFO --no-split conftest.texi"
	if AC_TRY_EVAL(ac_try) ; then
		MAKEINFO="$MAKEINFO --no-split"
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
	fi
	rm -f conftest.*
fi

dnl Test for the texi2dvi program
AC_CHECK_PROG(TEXI2DVI,texi2dvi,texi2dvi)
if [ test -n "$TEXI2DVI" ]; then
	dnl Check whether the texi2dvi command accepts the 
	dnl "--clean" option
	cat > conftest.texi <<EOF
\input texinfo
@bye
EOF
	AC_MSG_CHECKING([that texi2dvi runs])
	ac_try="$TEXI2DVI conftest.texi > /dev/null"
	if AC_TRY_EVAL(ac_try) ; then
	    AC_MSG_RESULT(yes)
	    AC_MSG_CHECKING([for texi2dvi --clean])
	    ac_try="$TEXI2DVI --clean conftest.texi > /dev/null"
	    if AC_TRY_EVAL(ac_try) ; then
		TEXI2DVI="$TEXI2DVI --clean"
		AC_MSG_RESULT(yes)
	    else
		AC_MSG_RESULT(no)
	    fi
	else
	    TEXI2DVI=""
	    AC_MSG_RESULT(no)
	fi
	rm -f conftest.*
fi

dnl Test for the texi2html program
AC_CHECK_PROG(TEXI2HTML,texi2html,texi2html)
if [ test -n "$TEXI2HTML" ]; then
	STATUS="yes"
	dnl Check whether the texi2html command accepts the 
	dnl "-split_chapter -number" option
	touch conftest.texi
	AC_MSG_CHECKING([for texi2html --clean])
	ac_try="$TEXI2HTML -split_chapter -number conftest.texi"
	if AC_TRY_EVAL(ac_try) ; then
		TEXI2HTML="$TEXI2HTML -split_chapter -number"
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
	fi
	rm -f conftest.*
        dnl TeTex 3.0 on Suse is leaving a conftest directory
	rm -rf conftest
fi

dnl Test for the dvipdf program
AC_CHECK_PROG(DVIPDF,dvipdf,dvipdf)

dnl Test for the dvips program
AC_CHECK_PROG(DVIPS,dvips,dvips)

MKDOC=$TOPDIR/admin/mkdoc
AC_SUBST(MKDOC)

MKTEXI=$TOPDIR/admin/mktexi
AC_SUBST(MKTEXI)

CONFIGURE_OUTPUTS="Makeconf octinst.sh"
STATUS_MSG="
octave commands will install into the following directories:
   m-files:   $mpath
   oct-files: $opath
   binaries:  $xpath
alternatives:
   m-files:   $altmpath
   oct-files: $altopath

shell commands will install into the following directories:
   binaries:  $bindir
   man pages: $mandir
   libraries: $libdir
   headers:   $includedir

octave-forge is configured with
   octave:      $OCTAVE (version $OCTAVE_VERSION)
   mkoctfile:	$MKOCTFILE for Octave $subver
   X11 support:	$XSTATUS
   makeinfo:    $MAKEINFO
   texi2dvi:    $TEXI2DVI
   texi2html:   $TEXI2HTML
   mkdoc:       $MKDOC
   mktexi:      $MKTEXI
   dvips:       $DVIPS
   dvipdf:      $DVIPDF"