diff --git a/configure b/configure
index 61ae20424bdca87e706c76bd84614ebda3f7da3c..abded20262a8bca1d378e27e0bb7788bf945ac42 100755
--- a/configure
+++ b/configure
@@ -3801,6 +3801,37 @@ else
   OSMESA="no"
 fi
 
+  fi
+
+    { echo "$as_me:$LINENO: checking for ./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx" >&5
+echo $ECHO_N "checking for ./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx... $ECHO_C" >&6; }
+if test "${ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx+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/NativeFileChooser/Fl_Native_File_Chooser.cxx"; then
+  ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx=yes
+else
+  ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx=no
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx" >&5
+echo "${ECHO_T}$ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx" >&6; }
+if test $ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx = yes; then
+  NATIVE="yes"
+else
+  NATIVE="no"
+fi
+
+  if test "x${NATIVE}" = "xyes"; then
+    if test "x$enable_native_file_chooser" != "xno"; then
+       GMSH_DIRS="${GMSH_DIRS} contrib/NativeFileChooser"
+       GMSH_LIBS="${GMSH_LIBS} -lGmshNativeFileChooser"
+       FLAGS="-DHAVE_NATIVE_FILE_CHOOSER ${FLAGS}"
+    fi
   fi
 
   if test "x${OSMESA}" = "xyes"; then
@@ -4063,37 +4094,6 @@ fi
     fi
   fi
 
-    { echo "$as_me:$LINENO: checking for ./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx" >&5
-echo $ECHO_N "checking for ./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx... $ECHO_C" >&6; }
-if test "${ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx+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/NativeFileChooser/Fl_Native_File_Chooser.cxx"; then
-  ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx=yes
-else
-  ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx=no
-fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx" >&5
-echo "${ECHO_T}$ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx" >&6; }
-if test $ac_cv_file___contrib_NativeFileChooser_Fl_Native_File_Chooser_cxx = yes; then
-  NATIVE="yes"
-else
-  NATIVE="no"
-fi
-
-  if test "x${NATIVE}" = "xyes"; then
-    if test "x$enable_native_file_chooser" != "xno"; then
-       GMSH_DIRS="${GMSH_DIRS} contrib/NativeFileChooser"
-       GMSH_LIBS="${GMSH_LIBS} -lGmshNativeFileChooser"
-       FLAGS="-DHAVE_NATIVE_FILE_CHOOSER ${FLAGS}"
-    fi
-  fi
-
 else
 
   GMSH_DIRS="${GMSH_DIRS} Box"
diff --git a/configure.in b/configure.in
index e7f5200a9ab75e0a24e0615a1e0f2d1da277dbca..0ff7d71ab5c6d0a21164262c1147ebbf67948fee 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.139 2008-01-07 21:32:57 geuzaine Exp $
+dnl $Id: configure.in,v 1.140 2008-01-08 10:28:27 geuzaine Exp $
 dnl
 dnl Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 dnl
@@ -235,6 +235,17 @@ if test "x$enable_gui" != "xno"; then
     AC_CHECK_LIB(OSMesa,main,OSMESA="yes",OSMESA="no")
   fi
 
+  dnl Check for native file chooser
+  AC_CHECK_FILE(./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx, 
+                NATIVE="yes", NATIVE="no")
+  if test "x${NATIVE}" = "xyes"; then
+    if test "x$enable_native_file_chooser" != "xno"; then
+       GMSH_DIRS="${GMSH_DIRS} contrib/NativeFileChooser"
+       GMSH_LIBS="${GMSH_LIBS} -lGmshNativeFileChooser"
+       FLAGS="-DHAVE_NATIVE_FILE_CHOOSER ${FLAGS}"
+    fi
+  fi
+
   if test "x${OSMESA}" = "xyes"; then
     GMSH_LIBS="${GMSH_LIBS} `$FLTKCONFIG --use-images --ldflags` -lfltk_gl"
     FLAGS="${FLAGS} -DHAVE_OSMESA `$FLTKCONFIG --use-images --cxxflags`"
@@ -324,17 +335,6 @@ if test "x$enable_gui" != "xno"; then
     fi 
   fi
 
-  dnl Check for native file chooser
-  AC_CHECK_FILE(./contrib/NativeFileChooser/Fl_Native_File_Chooser.cxx, 
-                NATIVE="yes", NATIVE="no")
-  if test "x${NATIVE}" = "xyes"; then
-    if test "x$enable_native_file_chooser" != "xno"; then
-       GMSH_DIRS="${GMSH_DIRS} contrib/NativeFileChooser"
-       GMSH_LIBS="${GMSH_LIBS} -lGmshNativeFileChooser"
-       FLAGS="-DHAVE_NATIVE_FILE_CHOOSER ${FLAGS}"
-    fi
-  fi
-
 else
 
   GMSH_DIRS="${GMSH_DIRS} Box"