changeset 288:cd358128ebe2 octave-forge

Use F77_FUNC instead of F77_FCN (at least for newer versions of octave)
author pkienzle
date Fri, 12 Apr 2002 20:16:12 +0000
parents 2a718fe6b884
children 4a7e214aa62a
files FIXES/CmplxQR.cc FIXES/CmplxQRP.cc FIXES/dbleQR.cc FIXES/dbleQRP.cc configure.base extra/mex/mex.cc main/splines/trisolve.cc
diffstat 7 files changed, 101 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/FIXES/CmplxQR.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/FIXES/CmplxQR.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -34,11 +34,11 @@
 
 extern "C"
 {
-  int F77_FCN (zgeqrf, ZGEQRF) (const int&, const int&, Complex*,
+  int F77_FUNC (zgeqrf, ZGEQRF) (const int&, const int&, Complex*,
 				const int&, Complex*, Complex*,
 				const int&, int&); 
 
-  int F77_FCN (zungqr, ZUNGQR) (const int&, const int&, const int&,
+  int F77_FUNC (zungqr, ZUNGQR) (const int&, const int&, const int&,
 				Complex*, const int&, Complex*,
 				Complex*, const int&, int&);
 }
--- a/FIXES/CmplxQRP.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/FIXES/CmplxQRP.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -36,11 +36,11 @@
 
 extern "C"
 {
-  int F77_FCN (zgeqpf, ZGEQPF) (const int&, const int&, Complex*,
+  int F77_FUNC (zgeqpf, ZGEQPF) (const int&, const int&, Complex*,
 				const int&, int*, Complex*, Complex*,
 				double*, int&);
 
-  int F77_FCN (zungqr, ZUNGQR) (const int&, const int&, const int&,
+  int F77_FUNC (zungqr, ZUNGQR) (const int&, const int&, const int&,
 				Complex*, const int&, Complex*,
 				Complex*, const int&, int&);
 }
--- a/FIXES/dbleQR.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/FIXES/dbleQR.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -34,11 +34,11 @@
 
 extern "C"
 {
-  int F77_FCN (dgeqrf, DGEQRF) (const int&, const int&, double*,
+  int F77_FUNC (dgeqrf, DGEQRF) (const int&, const int&, double*,
 				const int&, double*, double*,
 				const int&, int&); 
 
-  int F77_FCN (dorgqr, DORGQR) (const int&, const int&, const int&,
+  int F77_FUNC (dorgqr, DORGQR) (const int&, const int&, const int&,
 				double*, const int&, double*, double*,
 				const int&, int&);
 }
--- a/FIXES/dbleQRP.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/FIXES/dbleQRP.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -36,11 +36,11 @@
 
 extern "C"
 {
-  int F77_FCN (dgeqpf, DGEQPF) (const int&, const int&, double*,
+  int F77_FUNC (dgeqpf, DGEQPF) (const int&, const int&, double*,
 				const int&, int*, double*, double*,
 				int&);
 
-  int F77_FCN (dorgqr, DORGQR) (const int&, const int&, const int&,
+  int F77_FUNC (dorgqr, DORGQR) (const int&, const int&, const int&,
 				double*, const int&, double*, double*,
 				const int&, int&); 
 }
--- a/configure.base	Fri Apr 12 16:32:18 2002 +0000
+++ b/configure.base	Fri Apr 12 20:16:12 2002 +0000
@@ -20,14 +20,31 @@
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
+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.
+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)
@@ -94,7 +111,7 @@
 
    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/^[^.]*.[^.]*.//"`
+   subver=`echo $INFOV | sed -e "s/^[^.]*[.][^.]*[.]//"`
    test -z $mpath && mpath=$INFOM/octave-forge
    test -z $opath && opath=$INFOO/octave-forge
    test -z $xpath && xpath=$INFOX
@@ -102,7 +119,9 @@
 
 dnl *******************************************************************
 
+dnl XXX FIXME XXX should we allow the user to override these?
 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`
@@ -123,15 +142,31 @@
 dnl C++ compiler and flags
 CXX=`$MKOCTFILE -p CXX`
 CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
-CXXPICFLAGS=`$MKOCTFLIE -p CXXPICFLAGS`
+CXXPICFLAGS=`$MKOCTFILE -p CXXPICFLAGS`
 AC_SUBST(CXX)
 AC_SUBST(CXXFLAGS)
 AC_SUBST(CXXPICFLAGS)
 
-dnl if mkoctfile -p doesn't work, then use the following:
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_F77
+dnl *******************************************************************
+
+dnl Check if F77_FUNC works with MKOCTFILE
+AC_MSG_CHECKING([for F77_FUNC])
+cat > conftest.cc << EOF
+#include <octave/config.h>
+
+int F77_FUNC (hello, HELLO) (const int &n);
+
+EOF
+ac_try="$MKOCTFILE -c conftest.cc"
+if AC_TRY_EVAL(ac_try) ; then
+   AC_MSG_RESULT(yes)
+else
+   dnl "-DHAVE_OCTAVE_2x -s -v" is in Makeconf.base
+   AC_MSG_RESULT(no)
+   MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"
+fi
+
+dnl **********************************************************
 
 AC_PROG_LN_S
 AC_PROG_INSTALL
@@ -139,7 +174,8 @@
 
 dnl Use $(STRIP) in the makefile to strip executables.  If not found, 
 dnl STRIP expands to ':', which in the makefile does nothing.
-if test -z "$STRIP"; then STRIP=strip; fi
+dnl Don't need this for .oct files since mkoctfile handles them directly
+STRIP=${STRIP-strip}
 AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:)
 
 dnl Things needed to link to X11 programs
@@ -160,16 +196,17 @@
 STATUS_MSG="
 
 octave commands will install into the following directories:
-   m-files:     $mpath
-   oct-files:   $opath
-   executables: $xpath
+   m-files:   $mpath
+   oct-files: $opath
+   binaries:  $xpath
 
 shell commands will install into the following directories:
-   shell commands: $bindir
-   man pages:      $mandir
-   libraries:      $libdir
-   include files:  $includedir
+   binaries:  $bindir
+   man pages: $mandir
+   libraries: $libdir
+   headers:   $includedir
 
 octave-forge is configured with
-   mkoctfile: $MKOCTFILE
-   X11 support: $XSTATUS"
+   mkoctfile:	$MKOCTFILE for Octave $subver
+   X11 support:	$XSTATUS"
+
--- a/extra/mex/mex.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/extra/mex/mex.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -460,7 +460,7 @@
 mex* __mex = NULL;
 
 extern "C" {
-  void F77_FCN(mexfunction,MEXFUNCTION)
+  void F77_FUNC(mexfunction,MEXFUNCTION)
     (const int& nargout, mxArray *plhs[], 
      const int& nargin,  mxArray *prhs[]);
   void mexFunction(const int nargout, mxArray *plhs[],
@@ -513,7 +513,7 @@
     {
       __mex = &context;
       if (cs == use_fortran)
-	F77_FCN(mexfunction,MEXFUNCTION)(nargout, argout, nargin, argin);
+	F77_FUNC(mexfunction,MEXFUNCTION)(nargout, argout, nargin, argin);
       else
 	mexFunction(nargout, argout, nargin, argin);
     }
@@ -818,7 +818,7 @@
 // fixed.  It costs and extra function call, but is easier to maintain.
 extern "C" {
 
-  void F77_FCN(mexerrmsgtxt, MEXERRMSGTXT)
+  void F77_FUNC(mexerrmsgtxt, MEXERRMSGTXT)
     (const char *s, const int slen)
     {
       if (slen > 1 || (slen == 1 && s[0] != ' ') ) 
@@ -827,134 +827,134 @@
       __mex->abort();
     }
 
-  void F77_FCN(mexprintf,MEXPRINTF)
+  void F77_FUNC(mexprintf,MEXPRINTF)
     (const char *s, const int slen)
     {
       mexPrintf("%.*s\n", slen, s);
     }
 
-  double F77_FCN(mexgeteps,MEXGETEPS)() { return mxGetEps(); }
-  double F77_FCN(mexgetinf,MEXGETINF)() { return mxGetInf(); }
-  double F77_FCN(mexgetnan,MEXGETNAN)() { return mxGetNaN(); }
-  int F77_FCN(mexisfinite,MEXISFINITE)(double v) { return mxIsFinite(v); }
-  int F77_FCN(mexisinf,MEXISINF)(double v) { return mxIsInf(v); }
-  int F77_FCN(mexisnan,MEXISNAN)(double v) { return mxIsNaN(v); }
+  double F77_FUNC(mexgeteps,MEXGETEPS)() { return mxGetEps(); }
+  double F77_FUNC(mexgetinf,MEXGETINF)() { return mxGetInf(); }
+  double F77_FUNC(mexgetnan,MEXGETNAN)() { return mxGetNaN(); }
+  int F77_FUNC(mexisfinite,MEXISFINITE)(double v) { return mxIsFinite(v); }
+  int F77_FUNC(mexisinf,MEXISINF)(double v) { return mxIsInf(v); }
+  int F77_FUNC(mexisnan,MEXISNAN)(double v) { return mxIsNaN(v); }
 
   // ====> Array access
-  Pix F77_FCN(mxcreatefull,MXCREATEFULL)
+  Pix F77_FUNC(mxcreatefull,MXCREATEFULL)
     (const int& nr, const int& nc, const int& iscomplex)
     {
       return mxCreateDoubleMatrix(nr,nc,iscomplex);
     }
 
-  void F77_FCN(mxfreematrix,MXFREEMATRIX)
+  void F77_FUNC(mxfreematrix,MXFREEMATRIX)
     (mxArray* &ptr)
     {
       mxDestroyArray(ptr);
     }
 
-  Pix F77_FCN(mxcalloc,MXCALLOC)(const int& n, const int& size)
+  Pix F77_FUNC(mxcalloc,MXCALLOC)(const int& n, const int& size)
     {
       return mxCalloc(n,size);
     }
 
-  void F77_FCN(mxfree,MXFREE)
+  void F77_FUNC(mxfree,MXFREE)
     (const Pix &ptr)
     {
       mxFree(ptr);
     }
   
-  int F77_FCN(mxgetm,MXGETM)
+  int F77_FUNC(mxgetm,MXGETM)
     (const mxArray* &ptr) 
     { 
       return mxGetM(ptr); 
     }
 
-  int F77_FCN(mxgetn,MXGETN)
+  int F77_FUNC(mxgetn,MXGETN)
     (const mxArray* &ptr) 
     { 
       return mxGetN(ptr); 
     }
 
-  Pix F77_FCN(mxgetpi,MXGETPI)
+  Pix F77_FUNC(mxgetpi,MXGETPI)
     (const mxArray* &ptr) 
     {
       return mxGetPi(ptr);
     }
 
-  Pix F77_FCN(mxgetpr,MXGETPR)
+  Pix F77_FUNC(mxgetpr,MXGETPR)
     (const mxArray* &ptr) 
     {
       return mxGetPr(ptr);
     }
 
-  void F77_FCN(mxsetm,MXSETM)
+  void F77_FUNC(mxsetm,MXSETM)
     (mxArray* &ptr, const int& m) 
     { 
       mxSetM(ptr, m); 
     }
 
-  void F77_FCN(mxsetn,MXSETN)
+  void F77_FUNC(mxsetn,MXSETN)
     (mxArray* &ptr, const int& n) 
     { 
       mxSetN(ptr, n);
     }
 
-  void F77_FCN(mxsetpi,MXSETPI)
+  void F77_FUNC(mxsetpi,MXSETPI)
     (mxArray* &ptr, Pix &pi) 
     {
       mxSetPi(ptr, pi);
     }
 
-  void F77_FCN(mxsetpr,MXSETPR)
+  void F77_FUNC(mxsetpr,MXSETPR)
     (mxArray* &ptr, Pix &pr) 
     {
       mxSetPr(ptr, pr);
     }
   
-  int F77_FCN(mxiscomplex,MXISCOMPLEX)
+  int F77_FUNC(mxiscomplex,MXISCOMPLEX)
     (const mxArray* &ptr)
     {
       return mxIsComplex(ptr);
     }
 
-  int F77_FCN(mxisdouble,MXISDOUBLE)
+  int F77_FUNC(mxisdouble,MXISDOUBLE)
     (const mxArray* &ptr)
     {
       return mxIsDouble(ptr);
     }
   
-  int F77_FCN(mxisnumeric,MXISNUMERIC)
+  int F77_FUNC(mxisnumeric,MXISNUMERIC)
     (const mxArray* &ptr)
     {
       return mxIsNumeric(ptr);
     }
   
-  int F77_FCN(mxisfull,MXISFULL)
+  int F77_FUNC(mxisfull,MXISFULL)
     (const mxArray* &ptr)
     {
       return 1 - mxIsSparse(ptr);
     }
   
-  int F77_FCN(mxissparse,MXISSPARSE)
+  int F77_FUNC(mxissparse,MXISSPARSE)
     (const mxArray* &ptr)
     {
       return mxIsSparse(ptr);
     }
   
-  int F77_FCN(mxisstring,MXISSTRING)
+  int F77_FUNC(mxisstring,MXISSTRING)
     (const mxArray* &ptr)
     {
       return mxIsChar(ptr);
     }
 
-  int F77_FCN(mxgetstring,MXGETSTRING)
+  int F77_FUNC(mxgetstring,MXGETSTRING)
     (const mxArray* &ptr, char *str, const int& len)
     {
       return mxGetString(ptr, str, len);
     }
 
-  int F77_FCN(mexcallmatlab,MEXCALLMATLAB)
+  int F77_FUNC(mexcallmatlab,MEXCALLMATLAB)
     (const int& nargout, mxArray** argout, 
      const int& nargin, const mxArray** argin,
      const char* fname,
@@ -967,7 +967,7 @@
     }
 
   // ======> Fake pointer support
-  void F77_FCN(mxcopyreal8toptr,MXCOPYREAL8TOPTR)
+  void F77_FUNC(mxcopyreal8toptr,MXCOPYREAL8TOPTR)
     (const double *d, const int& prref, const int& len)
     {
       TRACEFN;
@@ -975,7 +975,7 @@
       for (int i=0; i < len; i++) pr[i] = d[i];
     }
   
-  void F77_FCN(mxcopyptrtoreal8,MXCOPYPTRTOREAL8)
+  void F77_FUNC(mxcopyptrtoreal8,MXCOPYPTRTOREAL8)
     (const int& prref, double *d, const int& len)
     {
       TRACEFN;
@@ -983,7 +983,7 @@
       for (int i=0; i < len; i++) d[i] = pr[i];
     }
   
-  void F77_FCN(mxcopycomplex16toptr,MXCOPYCOMPLEX16TOPTR)
+  void F77_FUNC(mxcopycomplex16toptr,MXCOPYCOMPLEX16TOPTR)
     (const double *d, int& prref, int& piref, const int& len)
     {
       TRACEFN;
@@ -992,7 +992,7 @@
       for (int i=0; i < len; i++) pr[i] = d[2*i], pi[i] = d[2*i+1];
     }
   
-  void F77_FCN(mxcopyptrtocomplex16,MXCOPYPTRTOCOMPLEX16)
+  void F77_FUNC(mxcopyptrtocomplex16,MXCOPYPTRTOCOMPLEX16)
     (const int& prref, const int& piref, double *d, const int& len)
     {
       TRACEFN;
--- a/main/splines/trisolve.cc	Fri Apr 12 16:32:18 2002 +0000
+++ b/main/splines/trisolve.cc	Fri Apr 12 20:16:12 2002 +0000
@@ -23,11 +23,11 @@
 
 // LAPACK 3.0 functions not in libcruft
 extern "C" {
-  extern int F77_FCN (dgtsv, DGTSV)
+  extern int F77_FUNC (dgtsv, DGTSV)
     (const int &n, const int &nrhs, double *l, 
 	  double *d, double *u, double *b, const int &ldb, int *info);
 
-  extern int F77_FCN (dptsv, DPTSV)
+  extern int F77_FUNC (dptsv, DPTSV)
     (const int &n, const int &nrhs, double *d, 
 	  double *e, double *b, const int &ldb, int *info);
 }
@@ -94,7 +94,7 @@
 	}
 
       int info;
-      F77_FCN (dptsv, DPTSV) (n, nrhs, d.fortran_vec(), e.fortran_vec(), 
+      F77_FUNC (dptsv, DPTSV) (n, nrhs, d.fortran_vec(), e.fortran_vec(), 
 			      b.fortran_vec(), n, &info);
        
       if (info > 0)
@@ -136,7 +136,7 @@
       z.insert(b, 0, 1);
 
       int info;
-      F77_FCN (dptsv, DPTSV) (n, nrhs+1, d.fortran_vec(), e.fortran_vec(), 
+      F77_FUNC (dptsv, DPTSV) (n, nrhs+1, d.fortran_vec(), e.fortran_vec(), 
 			      z.fortran_vec(), n, &info);
 
       if (info == 0)
@@ -180,7 +180,7 @@
 	}
 
       int info;
-      F77_FCN (dgtsv, DGTSV) (n, nrhs, l.fortran_vec(), d.fortran_vec(), 
+      F77_FUNC (dgtsv, DGTSV) (n, nrhs, l.fortran_vec(), d.fortran_vec(), 
 			      u.fortran_vec(), b.fortran_vec(), n, &info);
        
       if (info > 0)
@@ -223,7 +223,7 @@
       z.insert(b, 0, 1);
 
       int info;
-      F77_FCN (dgtsv, DGTSV) (n, nrhs+1, l.fortran_vec(), d.fortran_vec(), 
+      F77_FUNC (dgtsv, DGTSV) (n, nrhs+1, l.fortran_vec(), d.fortran_vec(), 
 			      u.fortran_vec(), z.fortran_vec(), n, &info);
 
       if (info == 0)