From 167c2a98b4d32ac47a4ab6c6e5d90890ea44100b Mon Sep 17 00:00:00 2001
From: Akash Anand <akasha@iitk.ac.in>
Date: Tue, 7 Aug 2007 22:13:53 +0000
Subject: [PATCH] Updating Gmsh to use new, "external" version of FourierModel.

---
 Fltk/GUI_Projection.cpp |  10 +-
 Fltk/Makefile           |   4 +-
 Geo/FEdge.cpp           |   2 +-
 Geo/FEdge.h             |   8 +-
 Geo/FFace.cpp           |   4 +-
 Geo/FFace.h             |  10 +-
 Geo/FProjectionFace.h   |   2 +-
 Geo/FVertex.h           |   6 +-
 Geo/GModelIO_F.cpp      |  35 ++--
 Geo/GModelIO_F.h        |   2 +-
 Geo/Makefile            |   6 +-
 configure               | 414 +++++++++++++++++++++++-----------------
 configure.in            |  78 ++++----
 13 files changed, 324 insertions(+), 257 deletions(-)

diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp
index e59887bec0..b4df0ec02e 100644
--- a/Fltk/GUI_Projection.cpp
+++ b/Fltk/GUI_Projection.cpp
@@ -12,11 +12,11 @@ extern Context_T CTX;
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "FPatch.h"
-#include "PlaneProjectionSurface.h"
-#include "ParaboloidProjectionSurface.h"
-#include "CylindricalProjectionSurface.h"
-#include "RevolvedParabolaProjectionSurface.h"
+#include "FM_FPatch.h"
+#include "FM_PlaneProjectionSurface.h"
+#include "FM_ParaboloidProjectionSurface.h"
+#include "FM_CylindricalProjectionSurface.h"
+#include "FM_RevolvedParabolaProjectionSurface.h"
 
 static FProjectionFace *createProjectionFaceFromName(char *name)
 {
diff --git a/Fltk/Makefile b/Fltk/Makefile
index 44f58a3a94..8a53ed139d 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.139 2007-08-07 03:14:24 geuzaine Exp $
+# $Id: Makefile,v 1.140 2007-08-07 22:13:52 anand Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -24,7 +24,7 @@ include ../variables
 LIB     = ../lib/libGmshFltk.a
 INCLUDE = -I../Common -I../DataStr -I../Graphics -I../Geo -I../Mesh -I../Post\
           -I../Numeric -I../Parser -I../Fltk -I../Plugin -I../utils/solvers\
-          -I../contrib/ANN/include -I../contrib/FourierModel
+          -I../contrib/ANN/include
 CFLAGS  = ${OPTIM} ${FLAGS} ${INCLUDE}
 
 SRC = Main.cpp \
diff --git a/Geo/FEdge.cpp b/Geo/FEdge.cpp
index 2c78d630cc..f84f1e74f4 100644
--- a/Geo/FEdge.cpp
+++ b/Geo/FEdge.cpp
@@ -3,7 +3,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-FEdge::FEdge(GModel *model, FM::FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1) 
+FEdge::FEdge(GModel *model, FM::TopoEdge* edge_, int tag, GVertex *v0, GVertex *v1) 
   : GEdge(model, tag, v0, v1), edge(edge_) 
 {
   //meshAttributes.Method = TRANSFINI; 
diff --git a/Geo/FEdge.h b/Geo/FEdge.h
index 810d36d9a4..2cfbd1fb36 100644
--- a/Geo/FEdge.h
+++ b/Geo/FEdge.h
@@ -9,15 +9,15 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "FM_Edge.h"
-#include "FM_Face.h"
+#include "FM_TopoEdge.h"
+#include "FM_TopoFace.h"
 
 class FEdge : public GEdge {
  protected:
-  FM::FM_Edge* edge;
+  FM::TopoEdge* edge;
   int edgeNum;
  public:
-  FEdge(GModel *model, FM::FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1);
+  FEdge(GModel *model, FM::TopoEdge* edge_, int tag, GVertex *v0, GVertex *v1);
   virtual ~FEdge() {}
   double period() const { throw ; }
   virtual bool periodic(int dim=0) const { return false; }
diff --git a/Geo/FFace.cpp b/Geo/FFace.cpp
index 6e78bd8443..c9fc2d4ad6 100644
--- a/Geo/FFace.cpp
+++ b/Geo/FFace.cpp
@@ -5,7 +5,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-FFace::FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_) 
+FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_) 
   : GFace(m,tag), face(face_)
 {
   for (std::list<GEdge*>::iterator it = l_edges_.begin();
@@ -15,7 +15,7 @@ FFace::FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_)
   }
 }
 
-FFace::FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
+FFace::FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_,
 	     std::list<int> l_dirs_) : GFace(m,tag), face(face_)
 {
   for (std::list<GEdge*>::iterator it = l_edges_.begin();
diff --git a/Geo/FFace.h b/Geo/FFace.h
index 7bfa020aac..0d0571a434 100644
--- a/Geo/FFace.h
+++ b/Geo/FFace.h
@@ -8,14 +8,14 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "FM_Face.h"
+#include "FM_TopoFace.h"
 
 class FFace : public GFace {
  protected:
-  FM::FM_Face *face;
+  FM::TopoFace *face;
  public:
-  FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_);
-  FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
+  FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_);
+  FFace(GModel *m, FM::TopoFace *face_, int tag, std::list<GEdge*> l_edges_,
 	std::list<int> l_dirs_);
 
   virtual ~FFace() {}
@@ -42,7 +42,7 @@ class FFace : public GFace {
   ModelType getNativeType() const { return FourierModel; }
   void * getNativePtr() const {throw;} 
   virtual bool surfPeriodic(int dim) const;
-  FM::FM_Face* GetFMFace() { return face; }
+  FM::TopoFace* GetFMFace() { return face; }
 };
 
 #endif
diff --git a/Geo/FProjectionFace.h b/Geo/FProjectionFace.h
index 07663682b3..a9b27c9f1b 100644
--- a/Geo/FProjectionFace.h
+++ b/Geo/FProjectionFace.h
@@ -6,7 +6,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "ProjectionSurface.h"
+#include "FM_ProjectionSurface.h"
 
 class FProjectionFace : public GFace {
  protected:
diff --git a/Geo/FVertex.h b/Geo/FVertex.h
index c3c86c89c1..8b22980e9b 100644
--- a/Geo/FVertex.h
+++ b/Geo/FVertex.h
@@ -6,14 +6,14 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "FM_Vertex.h"
+#include "FM_TopoVertex.h"
 
 class FVertex : public GVertex {
  protected:
-  FM::FM_Vertex* v;
+  FM::TopoVertex* v;
 
  public:
-  FVertex(GModel *m, int num, FM::FM_Vertex* _v) : GVertex(m, num), v(_v)
+  FVertex(GModel *m, int num, FM::TopoVertex* _v) : GVertex(m, num), v(_v)
   {
     mesh_vertices.push_back(new MVertex(x(), y(), z(), this));
   }
diff --git a/Geo/GModelIO_F.cpp b/Geo/GModelIO_F.cpp
index 6982049800..b60bd3dbac 100644
--- a/Geo/GModelIO_F.cpp
+++ b/Geo/GModelIO_F.cpp
@@ -1,19 +1,18 @@
 #include <string>
 #include "GModel.h"
 #include "Message.h"
+#include "FVertex.h"
+#include "FEdge.h"
 #include "FFace.h"
 #include "GModelIO_F.h"
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "FVertex.h"
-#include "FEdge.h"
-#include "FFace.h"
-#include "FPatch.h"
-#include "FCurve.h"
-#include "FM_Vertex.h"
-#include "FM_Edge.h"
-#include "FM_Face.h"
+#include "FM_FPatch.h"
+#include "FM_FCurve.h"
+#include "FM_TopoVertex.h"
+#include "FM_TopoEdge.h"
+#include "FM_TopoFace.h"
 #include "FM_Reader.h"
 
 extern GModel *GMODEL;
@@ -31,16 +30,16 @@ void makeGFace(FM::Patch* patch)
   
   int tagVertex = GMODEL->numVertex();
   patch->F(LL[0],LL[1],xx,yy,zz);
-  FM::FM_Vertex* vLL = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::TopoVertex* vLL = new FM::TopoVertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vLL->GetTag(),vLL));
   patch->F(LR[0],LR[1],xx,yy,zz);
-  FM::FM_Vertex* vLR = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::TopoVertex* vLR = new FM::TopoVertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vLR->GetTag(),vLR));
   patch->F(UL[0],UL[1],xx,yy,zz);
-  FM::FM_Vertex* vUL = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::TopoVertex* vUL = new FM::TopoVertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vUL->GetTag(),vUL));
   patch->F(UR[0],UR[1],xx,yy,zz);
-  FM::FM_Vertex* vUR = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::TopoVertex* vUR = new FM::TopoVertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vUR->GetTag(),vUR));
   
   FM::Curve* curveB = new FM::FCurve(0,patch,LL,LR);
@@ -49,28 +48,28 @@ void makeGFace(FM::Patch* patch)
   FM::Curve* curveL = new FM::FCurve(0,patch,UL,LL);
   
   int tagEdge = GMODEL->numEdge();
-  FM::FM_Edge* eB = new FM::FM_Edge(++tagEdge,curveB,vLL,vLR);
+  FM::TopoEdge* eB = new FM::TopoEdge(++tagEdge,curveB,vLL,vLR);
   i1 = eB->GetStartPoint()->GetTag();
   i2 = eB->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eB,eB->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
-  FM::FM_Edge* eR = new FM::FM_Edge(++tagEdge,curveR,vLR,vUR); 
+  FM::TopoEdge* eR = new FM::TopoEdge(++tagEdge,curveR,vLR,vUR); 
   i1 = eR->GetStartPoint()->GetTag();
   i2 = eR->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eR,eR->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2))); 
-  FM::FM_Edge* eT = new FM::FM_Edge(++tagEdge,curveT,vUR,vUL);
+  FM::TopoEdge* eT = new FM::TopoEdge(++tagEdge,curveT,vUR,vUL);
   i1 = eT->GetStartPoint()->GetTag();
   i2 = eT->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eT,eT->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
-  FM::FM_Edge* eL = new FM::FM_Edge(++tagEdge,curveL,vUL,vLL); 
+  FM::TopoEdge* eL = new FM::TopoEdge(++tagEdge,curveL,vUL,vLL); 
   i1 = eL->GetStartPoint()->GetTag();
   i2 = eL->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eL,eL->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
   
-  FM::FM_Face* face = new FM::FM_Face(GMODEL->numFace() + 1,patch);
+  FM::TopoFace* face = new FM::TopoFace(GMODEL->numFace() + 1,patch);
   face->AddEdge(eB); face->AddEdge(eR); 
   face->AddEdge(eT); face->AddEdge(eL);
   std::list<GEdge*> l_edges;
@@ -83,7 +82,7 @@ void makeGFace(FM::Patch* patch)
 
 int GModel::readF(const std::string &filename)
 {
-  FM::FM_Reader* reader = new FM::FM_Reader(filename.c_str());
+  FM::Reader* reader = new FM::Reader(filename.c_str());
   for (int i = 0; i < reader->GetNumPatches(); i++)
     makeGFace(reader->GetPatch(i));
 
diff --git a/Geo/GModelIO_F.h b/Geo/GModelIO_F.h
index fc3a4fe3f5..38b011aeda 100644
--- a/Geo/GModelIO_F.h
+++ b/Geo/GModelIO_F.h
@@ -5,7 +5,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-#include "Patch.h"
+#include "FM_Patch.h"
 
 void makeGFace(FM::Patch* patch);
 
diff --git a/Geo/Makefile b/Geo/Makefile
index cc659121f6..96fa18deed 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.155 2007-08-07 03:14:24 geuzaine Exp $
+# $Id: Makefile,v 1.156 2007-08-07 22:13:53 anand Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -23,8 +23,8 @@ include ../variables
 
 LIB     = ../lib/libGmshGeo.a
 INCLUDE = -I../Common -I../DataStr -I../Geo -I../Mesh -I../Post -I../Numeric\
-          -I../Parser -I../Fltk -I../contrib/NR -I../contrib/FourierModel\
-          -I../contrib/ANN/include -I../contrib/MathEval
+          -I../Parser -I../Fltk -I../contrib/NR -I../contrib/ANN/include\
+          -I../contrib/MathEval
 CFLAGS  = ${OPTIM} ${FLAGS} ${INCLUDE} 
 
 SRC = GEntity.cpp\
diff --git a/configure b/configure
index 44c62cf6b3..5029d2c4e7 100755
--- a/configure
+++ b/configure
@@ -870,7 +870,7 @@ Optional Features:
   --enable-cgns           enable CGNS output (default=no)
   --enable-occ            enable OpenCascade support (default=no)
   --enable-med            enable MED support (default=yes)
-  --enable-fm             enable support for Fourier models (default=yes)
+  --enable-fm             enable support for FourierModel (default=yes)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -890,6 +890,7 @@ Optional Packages:
   --with-hdf5-prefix=PFX  prefix where OpenCascade is installed
   --with-med-prefix=PFX   prefix where OpenCascade is installed
   --with-fftw3-prefix=PFX prefix where FFTW3 is installed
+  --with-fm-prefix=PFX    prefix where FourierModel is installed
 
 Some influential environment variables:
   CC          C compiler command
@@ -1409,6 +1410,12 @@ if test "${with_fftw3_prefix+set}" = set; then
   FFTW3_PREFIX=$withval
 fi;
 
+# Check whether --with-fm-prefix or --without-fm-prefix was given.
+if test "${with_fm_prefix+set}" = set; then
+  withval="$with_fm_prefix"
+  FM_PREFIX=$withval
+fi;
+
 # Check whether --enable-gsl or --disable-gsl was given.
 if test "${enable_gsl+set}" = set; then
   enableval="$enable_gsl"
@@ -4303,184 +4310,6 @@ fi
     fi
   fi
 
-    if test "x$enable_fm" != "xno"; then
-    echo "$as_me:$LINENO: checking for ./contrib/FourierModel/FM_Face.cpp" >&5
-echo $ECHO_N "checking for ./contrib/FourierModel/FM_Face.cpp... $ECHO_C" >&6
-if test "${ac_cv_file___contrib_FourierModel_FM_Face_cpp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "./contrib/FourierModel/FM_Face.cpp"; then
-  ac_cv_file___contrib_FourierModel_FM_Face_cpp=yes
-else
-  ac_cv_file___contrib_FourierModel_FM_Face_cpp=no
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_file___contrib_FourierModel_FM_Face_cpp" >&5
-echo "${ECHO_T}$ac_cv_file___contrib_FourierModel_FM_Face_cpp" >&6
-if test $ac_cv_file___contrib_FourierModel_FM_Face_cpp = yes; then
-  FOURIER="yes"
-else
-  FOURIER="no"
-fi
-
-    if test "x${FOURIER}" = "xyes"; then
-            echo "$as_me:$LINENO: checking for main in -llapack" >&5
-echo $ECHO_N "checking for main in -llapack... $ECHO_C" >&6
-if test "${ac_cv_lib_lapack_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llapack  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_lapack_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_lapack_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_lapack_main" >&5
-echo "${ECHO_T}$ac_cv_lib_lapack_main" >&6
-if test $ac_cv_lib_lapack_main = yes; then
-  LAPACK="yes"
-else
-  LAPACK="no"
-fi
-
-      if test "x${LAPACK}" != "xyes"; then
-        { echo "$as_me:$LINENO: WARNING: Could not find lapack: disabling FourierModel." >&5
-echo "$as_me: WARNING: Could not find lapack: disabling FourierModel." >&2;}
-      else
-                if test "x${FFTW3_PREFIX}" != "x"; then
-          LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
-        fi
-        echo "$as_me:$LINENO: checking for main in -lfftw3" >&5
-echo $ECHO_N "checking for main in -lfftw3... $ECHO_C" >&6
-if test "${ac_cv_lib_fftw3_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfftw3  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_fftw3_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_fftw3_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_fftw3_main" >&5
-echo "${ECHO_T}$ac_cv_lib_fftw3_main" >&6
-if test $ac_cv_lib_fftw3_main = yes; then
-  FFTW3="yes"
-else
-  FFTW3="no"
-fi
-
-        if test "x${FFTW3}" != "xyes"; then
-          { echo "$as_me:$LINENO: WARNING: Could not find FFTW3: disabling FourierModel." >&5
-echo "$as_me: WARNING: Could not find FFTW3: disabling FourierModel." >&2;}
-        else
-          GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
-          if test "x${FFTW3_PREFIX}" = "x"; then
-            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
-            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
-          else
-            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
-            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
-          fi
-          GMSH_LIBS="${GMSH_LIBS} -llapack"
-        fi
-      fi
-    fi
-  fi
-
 fi
 
 if test "x$enable_gsl" != "xno"; then
@@ -4858,6 +4687,233 @@ fi
   fi
 fi
 
+if test "x$enable_fm" != "xno"; then
+  if test "x${FM_PREFIX}" != "x"; then
+    LDFLAGS="-L${FM_PREFIX}/lib ${LDFLAGS}"
+  fi
+  echo "$as_me:$LINENO: checking for main in -lFourierModel" >&5
+echo $ECHO_N "checking for main in -lFourierModel... $ECHO_C" >&6
+if test "${ac_cv_lib_FourierModel_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lFourierModel  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_FourierModel_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_FourierModel_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_FourierModel_main" >&5
+echo "${ECHO_T}$ac_cv_lib_FourierModel_main" >&6
+if test $ac_cv_lib_FourierModel_main = yes; then
+  FM="yes"
+else
+  FM="no"
+fi
+
+  if test "x${FM}" = "xyes"; then
+        echo "$as_me:$LINENO: checking for main in -llapack" >&5
+echo $ECHO_N "checking for main in -llapack... $ECHO_C" >&6
+if test "${ac_cv_lib_lapack_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llapack  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_lapack_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_lapack_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_lapack_main" >&5
+echo "${ECHO_T}$ac_cv_lib_lapack_main" >&6
+if test $ac_cv_lib_lapack_main = yes; then
+  LAPACK="yes"
+else
+  LAPACK="no"
+fi
+
+    if test "x${LAPACK}" != "xyes"; then
+      { echo "$as_me:$LINENO: WARNING: Could not find lapack: disabling FourierModel." >&5
+echo "$as_me: WARNING: Could not find lapack: disabling FourierModel." >&2;}
+    else
+            if test "x${FFTW3_PREFIX}" != "x"; then
+        LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
+      fi
+      echo "$as_me:$LINENO: checking for main in -lfftw3" >&5
+echo $ECHO_N "checking for main in -lfftw3... $ECHO_C" >&6
+if test "${ac_cv_lib_fftw3_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfftw3  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_fftw3_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_fftw3_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_fftw3_main" >&5
+echo "${ECHO_T}$ac_cv_lib_fftw3_main" >&6
+if test $ac_cv_lib_fftw3_main = yes; then
+  FFTW3="yes"
+else
+  FFTW3="no"
+fi
+
+      if test "x${FFTW3}" != "xyes"; then
+        { echo "$as_me:$LINENO: WARNING: Could not find FFTW3: disabling FourierModel." >&5
+echo "$as_me: WARNING: Could not find FFTW3: disabling FourierModel." >&2;}
+      else
+        if test "x${FM_PREFIX}" = "x"; then
+          GMSH_LIBS="${GMSH_LIBS} -lFourierModel"
+          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
+        else
+          GMSH_LIBS="${GMSH_LIBS} -L${FM_PREFIX}/lib -lFourierModel"
+          FLAGS="-DHAVE_FOURIER_MODEL -I${FM_PREFIX} ${FLAGS}"
+        fi
+        if test "x${FFTW3_PREFIX}" = "x"; then
+          GMSH_LIBS="${GMSH_LIBS} -lfftw3"
+        else
+          GMSH_LIBS="${GMSH_LIBS} -L${FFTW3_PREFIX}/lib -lfftw3"
+          FLAGS="${FLAGS} -I${FFTW3_PREFIX}/include"
+        fi
+        GMSH_LIBS="${GMSH_LIBS} -llapack"
+      fi
+    fi
+  fi
+fi
+
 if test "x${ZLIB}" = "xyes"; then
   if test "x$enable_med" != "xno"; then
     if test "x${HDF5_PREFIX}" != "x"; then
diff --git a/configure.in b/configure.in
index 9ca36c559e..79556f47ca 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.129 2007-08-02 22:28:05 geuzaine Exp $
+dnl $Id: configure.in,v 1.130 2007-08-07 22:13:52 anand Exp $
 dnl
 dnl Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 dnl
@@ -73,6 +73,10 @@ AC_ARG_WITH(fftw3-prefix,
             AC_HELP_STRING([--with-fftw3-prefix=PFX],
                            [prefix where FFTW3 is installed]),
             [FFTW3_PREFIX=$withval])
+AC_ARG_WITH(fm-prefix,
+            AC_HELP_STRING([--with-fm-prefix=PFX],
+                           [prefix where FourierModel is installed]),
+            [FM_PREFIX=$withval])
 
 dnl Parse '--enable' command line options
 AC_ARG_ENABLE(gsl,
@@ -131,7 +135,7 @@ AC_ARG_ENABLE(med,
                              [enable MED support (default=yes)]))
 AC_ARG_ENABLE(fm,
               AC_HELP_STRING([--enable-fm],
-                             [enable support for Fourier models (default=yes)]))
+                             [enable support for FourierModel (default=yes)]))
 
 dnl Get the operating system name
 UNAME=`uname`
@@ -495,37 +499,6 @@ if test "x$enable_contrib" != "xno"; then
     fi
   fi
 
-  dnl Check for FourierModel
-  if test "x$enable_fm" != "xno"; then
-    AC_CHECK_FILE(./contrib/FourierModel/FM_Face.cpp, FOURIER="yes", FOURIER="no")
-    if test "x${FOURIER}" = "xyes"; then
-      dnl Check for lapack
-      AC_CHECK_LIB(lapack,main,LAPACK="yes",LAPACK="no")
-      if test "x${LAPACK}" != "xyes"; then
-        AC_MSG_WARN([Could not find lapack: disabling FourierModel.])
-      else
-        dnl Check for FFTW3
-        if test "x${FFTW3_PREFIX}" != "x"; then
-          LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
-        fi
-        AC_CHECK_LIB(fftw3,main,FFTW3="yes",FFTW3="no")
-        if test "x${FFTW3}" != "xyes"; then
-          AC_MSG_WARN([Could not find FFTW3: disabling FourierModel.])
-        else
-          GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
-          if test "x${FFTW3_PREFIX}" = "x"; then
-            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
-            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
-          else
-            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
-            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
-          fi
-          GMSH_LIBS="${GMSH_LIBS} -llapack"
-        fi
-      fi
-    fi
-  fi
-
 fi
 
 dnl Check for GSL
@@ -627,6 +600,45 @@ if test "x$enable_occ" = "xyes"; then
   fi
 fi
 
+dnl Check for FourierModel
+if test "x$enable_fm" != "xno"; then
+  if test "x${FM_PREFIX}" != "x"; then
+    LDFLAGS="-L${FM_PREFIX}/lib ${LDFLAGS}"
+  fi
+  AC_CHECK_LIB(FourierModel,main,FM="yes",FM="no")
+  if test "x${FM}" = "xyes"; then
+    dnl Check for lapack
+    AC_CHECK_LIB(lapack,main,LAPACK="yes",LAPACK="no")
+    if test "x${LAPACK}" != "xyes"; then
+      AC_MSG_WARN([Could not find lapack: disabling FourierModel.])
+    else
+      dnl Check for FFTW3
+      if test "x${FFTW3_PREFIX}" != "x"; then
+        LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
+      fi
+      AC_CHECK_LIB(fftw3,main,FFTW3="yes",FFTW3="no")
+      if test "x${FFTW3}" != "xyes"; then
+        AC_MSG_WARN([Could not find FFTW3: disabling FourierModel.])
+      else
+        if test "x${FM_PREFIX}" = "x"; then
+          GMSH_LIBS="${GMSH_LIBS} -lFourierModel"
+          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
+        else
+          GMSH_LIBS="${GMSH_LIBS} -L${FM_PREFIX}/lib -lFourierModel"
+          FLAGS="-DHAVE_FOURIER_MODEL -I${FM_PREFIX} ${FLAGS}"
+        fi
+        if test "x${FFTW3_PREFIX}" = "x"; then
+          GMSH_LIBS="${GMSH_LIBS} -lfftw3"
+        else
+          GMSH_LIBS="${GMSH_LIBS} -L${FFTW3_PREFIX}/lib -lfftw3"
+          FLAGS="${FLAGS} -I${FFTW3_PREFIX}/include"
+        fi
+        GMSH_LIBS="${GMSH_LIBS} -llapack"
+      fi
+    fi
+  fi
+fi
+
 dnl Check for HDF5 (required by MED, needs zlib)
 if test "x${ZLIB}" = "xyes"; then
   if test "x$enable_med" != "xno"; then
-- 
GitLab