diff --git a/configure b/configure
index 83682de8e4da95a622f86a5078c38b4d6a3f2aea..9216de0a69604c1a7d9d95a50175f4bbf95f139d 100755
--- a/configure
+++ b/configure
@@ -830,16 +830,18 @@ if test -n "$ac_init_help"; then
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-gsl            use GSL as numerical toolkit (default=yes)
   --enable-gui            build the graphical user interface (default=yes)
   --enable-parallel       enable parallel version (default=no)
   --enable-triangle       compile Triangle if available (default=yes)
-  --enable-gsl            use GSL as numerical toolkit (default=yes)
+  --enable-static         GCC only: build a statically linked executable
+                          (default=no)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-gsl-prefix=PFX   prefix where GSL is installed
   --with-fltk-prefix=PFX  prefix where FLTK is installed
+  --with-gsl-prefix=PFX   prefix where GSL is installed
   --with-jpeg-prefix=PFX  prefix where the JPEG code is installed
 
 Some influential environment variables:
@@ -1203,14 +1205,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-# Check whether --with-gsl-prefix or --without-gsl-prefix was given.
-if test "${with_gsl_prefix+set}" = set; then
-  withval="$with_gsl_prefix"
-  GSL_PREFIX=$withval
-else
-  GSL_PREFIX="$GSL_DIR"
-fi;
-
 # Check whether --with-fltk-prefix or --without-fltk-prefix was given.
 if test "${with_fltk_prefix+set}" = set; then
   withval="$with_fltk_prefix"
@@ -1219,6 +1213,14 @@ else
   FLTK_PREFIX="$FLTK_DIR"
 fi;
 
+# Check whether --with-gsl-prefix or --without-gsl-prefix was given.
+if test "${with_gsl_prefix+set}" = set; then
+  withval="$with_gsl_prefix"
+  GSL_PREFIX=$withval
+else
+  GSL_PREFIX="$GSL_DIR"
+fi;
+
 # Check whether --with-jpeg-prefix or --without-jpeg-prefix was given.
 if test "${with_jpeg_prefix+set}" = set; then
   withval="$with_jpeg_prefix"
@@ -1227,6 +1229,11 @@ else
   JPEG_PREFIX="$JPEG_DIR"
 fi;
 
+# Check whether --enable-gsl or --disable-gsl was given.
+if test "${enable_gsl+set}" = set; then
+  enableval="$enable_gsl"
+
+fi;
 # Check whether --enable-gui or --disable-gui was given.
 if test "${enable_gui+set}" = set; then
   enableval="$enable_gui"
@@ -1242,9 +1249,9 @@ if test "${enable_triangle+set}" = set; then
   enableval="$enable_triangle"
 
 fi;
-# Check whether --enable-gsl or --disable-gsl was given.
-if test "${enable_gsl+set}" = set; then
-  enableval="$enable_gsl"
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
 
 fi;
 
@@ -3140,8 +3147,6 @@ echo "$as_me: error: " >&2;}
   fi
 fi
 
-GMSH_LIBS="${GMSH_LIBS} -lm"
-
 if test "x$enable_parallel" = "xyes"; then
   FLAGS="-DPARALLEL ${FLAGS}"
 fi
@@ -3149,6 +3154,13 @@ fi
 LINKER="${CXX}"
 POSTBUILD=""
 
+if test "x$enable_static" = "xyes"; then
+  GMSH_LIBS="${GMSH_LIBS} -ldl -lpthread -lm"
+  LINKER="${LINKER} -static"
+else
+  GMSH_LIBS="${GMSH_LIBS} -lm"
+fi
+
 case "$UNAME" in
 
   CYGWIN* | MINGW*)
diff --git a/configure.in b/configure.in
index 7d3786b6da98fd5f099257e5bcf14fca3792bda3..9f69d1216e7ffdcbecafa7abd18e97fd733ec283 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl "$Id: configure.in,v 1.27 2003-02-23 05:51:27 geuzaine Exp $"
+dnl "$Id: configure.in,v 1.28 2003-02-28 17:54:27 geuzaine Exp $"
 dnl
 dnl Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle
 dnl
@@ -29,20 +29,23 @@ dnl Check that this is the gmsh source tree
 AC_INIT(Parser/Gmsh.y)
 
 dnl Parse '--with' command-line options
-AC_ARG_WITH(gsl-prefix,
-            AC_HELP_STRING([--with-gsl-prefix=PFX],
-                           [prefix where GSL is installed]),
-            [GSL_PREFIX=$withval],[GSL_PREFIX="$GSL_DIR"])
 AC_ARG_WITH(fltk-prefix,
             AC_HELP_STRING([--with-fltk-prefix=PFX],
                            [prefix where FLTK is installed]),
             [FLTK_PREFIX=$withval],[FLTK_PREFIX="$FLTK_DIR"])
+AC_ARG_WITH(gsl-prefix,
+            AC_HELP_STRING([--with-gsl-prefix=PFX],
+                           [prefix where GSL is installed]),
+            [GSL_PREFIX=$withval],[GSL_PREFIX="$GSL_DIR"])
 AC_ARG_WITH(jpeg-prefix,
             AC_HELP_STRING([--with-jpeg-prefix=PFX],
                            [prefix where the JPEG code is installed]),
             [JPEG_PREFIX=$withval],[JPEG_PREFIX="$JPEG_DIR"])
 
 dnl Parse '--enable' command line options
+AC_ARG_ENABLE(gsl,
+              AC_HELP_STRING([--enable-gsl],
+                             [use GSL as numerical toolkit (default=yes)]))
 AC_ARG_ENABLE(gui,
               AC_HELP_STRING([--enable-gui],
                              [build the graphical user interface (default=yes)]))
@@ -52,9 +55,9 @@ AC_ARG_ENABLE(parallel,
 AC_ARG_ENABLE(triangle,
               AC_HELP_STRING([--enable-triangle],
                              [compile Triangle if available (default=yes)]))
-AC_ARG_ENABLE(gsl,
-              AC_HELP_STRING([--enable-gsl],
-                             [use GSL as numerical toolkit (default=yes)]))
+AC_ARG_ENABLE(static,
+              AC_HELP_STRING([--enable-static],
+                             [GCC only: build a statically linked executable (default=no)]))
 
 dnl Get the operating system and version number
 UNAME=`uname`
@@ -215,9 +218,6 @@ if test "x${GSL}" != "xyes"; then
   fi
 fi
 
-dnl Finish link line
-GMSH_LIBS="${GMSH_LIBS} -lm"
-
 dnl Check if we should build the parallel version
 if test "x$enable_parallel" = "xyes"; then
   FLAGS="-DPARALLEL ${FLAGS}"
@@ -227,6 +227,14 @@ dnl Set default linker and post build action
 LINKER="${CXX}"
 POSTBUILD=""
 
+dnl Finish link line
+if test "x$enable_static" = "xyes"; then
+  GMSH_LIBS="${GMSH_LIBS} -ldl -lpthread -lm"
+  LINKER="${LINKER} -static"
+else
+  GMSH_LIBS="${GMSH_LIBS} -lm"
+fi
+
 dnl Modify defaults according to OS
 case "$UNAME" in