~ubuntu-branches/ubuntu/wily/octave-miscellaneous/wily

« back to all changes in this revision

Viewing changes to src/configure.base

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Rafael Laboissiere, Sébastien Villemot
  • Date: 2012-10-17 13:40:55 UTC
  • mfrom: (1.2.1) (12 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: package-import@ubuntu.com-20121017134055-vatltexghy77fnv7
Tags: 1.2.0-1
[ Rafael Laboissiere ]
* Imported Upstream version 1.2.0
* Bump Standards-Version to 3.9.4 (no changes needed)
* Refresh for new upstream release
* Use Sébastien Villemot's @debian.org email address
* Remove obsolete DM-Upload-Allowed flag
* Add patch autoload-yes.patch
* Add copyright info for file lauchli.m (included in a Debian patch)
* Add patch partcnt-test-succeeds.patch
* Build-depends on octave-pkg-dev >= 1.0.3

[ Sébastien Villemot ]
* debian/control: fix versioned dependency on debhelper
* Add lintian override for false positive on hardening (fortify)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
4
 
 
5
 
dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement?
6
 
AC_PREREQ(2.2)
7
 
 
8
 
AC_INIT(configure.base)
9
 
 
10
 
PACKAGE=octave-forge
11
 
MAJOR_VERSION=0
12
 
MINOR_VERSION=1
13
 
PATCH_LEVEL=0
14
 
 
15
 
dnl Kill caching --- this ought to be the default
16
 
define([AC_CACHE_LOAD], )dnl
17
 
define([AC_CACHE_SAVE], )dnl
18
 
 
19
 
dnl uncomment to put support files in another directory
20
 
dnl AC_CONFIG_AUX_DIR(admin)
21
 
 
22
 
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
23
 
AC_SUBST(PACKAGE)
24
 
AC_SUBST(VERSION)
25
 
 
26
 
dnl need to find admin files, so keep track of the top dir.
27
 
TOPDIR=`pwd`
28
 
AC_SUBST(TOPDIR)
29
 
 
30
 
dnl if mkoctfile doesn't work, then we need the following:
31
 
dnl AC_PROG_CXX
32
 
dnl AC_PROG_F77
33
 
 
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
38
 
AC_PROG_CC
39
 
 
40
 
dnl XXX FIXME XXX need tests for -p -c -s in mkoctfile.
41
 
 
42
 
dnl *******************************************************************
43
 
dnl Sort out mkoctfile version number and install paths
44
 
 
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
48
 
 
49
 
dnl Check for mkoctfile
50
 
AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile)
51
 
test -z "$MKOCTFILE" && AC_MSG_WARN([no mkoctfile found on path])
52
 
 
53
 
AC_SUBST(ver)
54
 
AC_SUBST(subver)
55
 
AC_SUBST(mpath)
56
 
AC_SUBST(opath)
57
 
AC_SUBST(xpath)
58
 
AC_SUBST(altpath)
59
 
AC_SUBST(altmpath)
60
 
AC_SUBST(altopath)
61
 
 
62
 
AC_ARG_WITH(path, 
63
 
        [  --with-path             install path prefix],
64
 
        [ path=$withval ])
65
 
AC_ARG_WITH(mpath,
66
 
        [  --with-mpath            override path for m-files],
67
 
        [mpath=$withval])
68
 
AC_ARG_WITH(opath,
69
 
        [  --with-opath            override path for oct-files],
70
 
        [opath=$withval])
71
 
AC_ARG_WITH(xpath,
72
 
        [  --with-xpath            override path for executables],
73
 
        [xpath=$withval])
74
 
AC_ARG_WITH(altpath, 
75
 
        [  --with-altpath          alternative functions install path prefix],
76
 
        [ altpath=$withval ])
77
 
AC_ARG_WITH(altmpath,
78
 
        [  --with-altmpath         override path for alternative m-files],
79
 
        [altmpath=$withval])
80
 
AC_ARG_WITH(altopath,
81
 
        [  --with-altopath         override path for alternative oct-files],
82
 
        [altopath=$withval])    
83
 
 
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
89
 
fi
90
 
 
91
 
if test -n "$altpath" ; then
92
 
   test -z "$altmpath" && altmpath=$altpath 
93
 
   test -z "$altopath" && altopath=$altpath/oct 
94
 
fi
95
 
 
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>
104
 
 
105
 
#define INFOV "\nINFOV=" OCTAVE_VERSION "\n"
106
 
 
107
 
#define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n"
108
 
 
109
 
#ifdef OCTAVE_LOCALVERFCNFILEDIR
110
 
# define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n"
111
 
#else
112
 
# define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n"
113
 
#endif
114
 
 
115
 
#ifdef OCTAVE_LOCALVEROCTFILEDIR
116
 
# define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n"
117
 
#else
118
 
# define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH  "\n"
119
 
#endif
120
 
 
121
 
#ifdef OCTAVE_LOCALVERARCHLIBDIR
122
 
# define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR  "\n"
123
 
#else
124
 
# define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR  "\n"
125
 
#endif
126
 
 
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;
132
 
EOF
133
 
 
134
 
   dnl Compile program perhaps with a special version of mkoctfile
135
 
   $MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE)
136
 
 
137
 
   dnl Strip the config info from the compiled file
138
 
   eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"`
139
 
   rm -rf conftest*
140
 
 
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
151
 
fi
152
 
 
153
 
dnl *******************************************************************
154
 
 
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.
160
 
 
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`
169
 
AC_SUBST(CC)
170
 
AC_SUBST(CFLAGS)
171
 
AC_SUBST(CPPFLAGS)
172
 
AC_SUBST(CPICFLAG)
173
 
 
174
 
dnl Fortran compiler and flags
175
 
F77=`$MKOCTFILE -p F77`
176
 
FFLAGS=`$MKOCTFILE -p FFLAGS`
177
 
FPICFLAG=`$MKOCTFILE -p FPICFLAG`
178
 
AC_SUBST(F77)
179
 
AC_SUBST(FFLAGS)
180
 
AC_SUBST(FPICFLAG)
181
 
 
182
 
dnl C++ compiler and flags
183
 
CXX=`$MKOCTFILE -p CXX`
184
 
CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
185
 
CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
186
 
AC_SUBST(CXX)
187
 
AC_SUBST(CXXFLAGS)
188
 
AC_SUBST(CXXPICFLAG)
189
 
 
190
 
dnl *******************************************************************
191
 
 
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.
196
 
 
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,
201
 
[save_LIBS="$LIBS"
202
 
AC_CHECK_LIB($1,$2,$3,$4,$5)
203
 
LIBS="$save_LIBS"
204
 
])
205
 
 
206
 
dnl Define the following macro:
207
 
dnl    TRY_MKOCTFILE(msg,program,action_if_true,action_if_false)
208
 
dnl
209
 
AC_DEFUN(TRY_MKOCTFILE,
210
 
[AC_MSG_CHECKING($1)
211
 
cat > conftest.cc << EOF
212
 
#include <octave/config.h>
213
 
$2
214
 
EOF
215
 
ac_try="$MKOCTFILE -c conftest.cc"
216
 
if AC_TRY_EVAL(ac_try) ; then
217
 
   AC_MSG_RESULT(yes)
218
 
   $3
219
 
else
220
 
   AC_MSG_RESULT(no)
221
 
   $4
222
 
fi
223
 
])
224
 
 
225
 
dnl
226
 
dnl Check if F77_FUNC works with MKOCTFILE
227
 
dnl
228
 
TRY_MKOCTFILE([for F77_FUNC],
229
 
[int F77_FUNC (hello, HELLO) (const int &n);],,
230
 
[MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"])
231
 
 
232
 
dnl **********************************************************
233
 
 
234
 
dnl Evaluate an expression in octave
235
 
dnl
236
 
dnl OCTAVE_EVAL(expr,var) -> var=expr
237
 
dnl
238
 
AC_DEFUN(OCTAVE_EVAL,
239
 
[AC_MSG_CHECKING([for $1 in Octave])
240
 
$2=`echo "disp($1)" | $OCTAVE -qf`
241
 
AC_MSG_RESULT($$2)
242
 
AC_SUBST($2)
243
 
])
244
 
 
245
 
dnl Check status of an octave variable
246
 
dnl
247
 
dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false)
248
 
dnl
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
252
 
   AC_MSG_RESULT(yes)
253
 
   $2
254
 
else
255
 
   AC_MSG_RESULT(no)
256
 
   $3
257
 
fi
258
 
])
259
 
 
260
 
dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version
261
 
AC_CHECK_PROG(OCTAVE,octave,octave)
262
 
OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
263
 
 
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)
266
 
 
267
 
dnl grab SHLEXT from octave config
268
 
OCTAVE_EVAL(octave_config_info('SHLEXT'),SHLEXT)
269
 
 
270
 
AC_PROG_LN_S
271
 
 
272
 
AC_PROG_RANLIB
273
 
 
274
 
dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files.
275
 
COPY_FLAGS="-Rfp"
276
 
case "$canonical_host_type" in
277
 
    *-*-linux*)
278
 
        COPY_FLAGS="-fdp"
279
 
    ;;
280
 
esac
281
 
AC_SUBST(COPY_FLAGS)
282
 
 
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
286
 
STRIP=${STRIP-strip}
287
 
AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:)
288
 
 
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-*)
294
 
        STRIP=:
295
 
    ;;
296
 
    *-cygwin-*|*-mingw-*) 
297
 
        MKOCTFILE="$MKOCTFILE -s" 
298
 
    ;;
299
 
esac
300
 
 
301
 
AC_SUBST(MISCDEFS)
302
 
AC_SUBST(HAVE_LIB_TERMCAP)
303
 
 
304
 
AC_CHECK_FUNCS(fork, [have_fork=yes], [have_fork=])
305
 
AC_SUBST(have_fork)
306
 
 
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,
311
 
[
312
 
    AC_TRY_COMPILE(
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)
318
 
])
319
 
    if test $ac_cv_type_socklen_t != yes; then
320
 
       MISCDEFS="$MISCDEFS -Dsocklen_t=int"
321
 
    fi
322
 
])
323
 
 
324
 
dnl Check for socklen_t
325
 
TYPE_SOCKLEN_T
326
 
 
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"])
332
 
 
333
 
dnl Check for term.h
334
 
case "$canonical_host_type" in
335
 
    *-sgi-*)
336
 
        have_term=no
337
 
        have_termcap=no
338
 
    ;;
339
 
    *)
340
 
        AC_CHECK_HEADER(term.h, have_term=yes, have_term=no)
341
 
        AC_CHECK_HEADER(termcap.h, have_termcap=yes, have_termcap=no)
342
 
    ;;
343
 
esac
344
 
 
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)
348
 
    TERMSTATUS=yes 
349
 
elif test $have_term = yes; then
350
 
    MISCDEFS="$MISCDEFS -DUSE_TERM -DHAVE_TERM_H"
351
 
    TERMSTATUS=yes
352
 
    OF_CHECK_LIB(termcap, tgetnum, HAVE_LIB_TERMCAP=yes)
353
 
else
354
 
    TERMSTATUS=no
355
 
fi
356
 
 
357
 
CONFIGURE_OUTPUTS="Makeconf"
358
 
STATUS_MSG="
359
 
octave commands will install into the following directories:
360
 
   m-files:   $mpath
361
 
   oct-files: $opath
362
 
   binaries:  $xpath
363
 
alternatives:
364
 
   m-files:   $altmpath
365
 
   oct-files: $altopath
366
 
 
367
 
shell commands will install into the following directories:
368
 
   binaries:  $bindir
369
 
   man pages: $mandir
370
 
   libraries: $libdir
371
 
   headers:   $includedir
372
 
 
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"