diff configure.in @ 4110:b9238356dd07

[project @ 2002-10-17 16:14:44 by jwe]
author jwe
date Thu, 17 Oct 2002 16:14:45 +0000
parents 92f4552ea359
children c4ede5f4a03c
line wrap: on
line diff
--- a/configure.in	Thu Oct 17 03:11:30 2002 +0000
+++ b/configure.in	Thu Oct 17 16:14:45 2002 +0000
@@ -22,7 +22,7 @@
 ### 02111-1307, USA. 
 
 AC_INIT
-AC_REVISION($Revision: 1.379 $)
+AC_REVISION($Revision: 1.380 $)
 AC_PREREQ(2.52)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -575,26 +575,7 @@
 AC_SUBST(BLAS_DIR)
 AC_SUBST(LAPACK_DIR)
 
-### Handle dynamic linking and shared library options.
-
-### Allow the user to experiment with dynamic linking using dlopen/dlsym.
-
-AC_ARG_ENABLE(dl,
-  [  --enable-dl             use dlopen/dlsym for dynamic linking (not all systems)],
-  [if test "$enableval" = no; then WITH_DL=no;
-   elif test "$enableval" = yes; then WITH_DL=yes;
-   else WITH_DL=maybe; fi],
-  WITH_DL=maybe)
-
-### Allow the user to experiment with dynamic linking using
-### shl_load/shl_findsym (HP/UX only?).
-
-AC_ARG_ENABLE(shl,
-  [  --enable-shl            use shl_load/shl_findsym for dynamic linking (HP only)],
-  [if test "$enableval" = no; then WITH_SHL=no;
-   elif test "$enableval" = yes; then WITH_SHL=yes;
-   else WITH_SHL=maybe; fi],
-  WITH_SHL=maybe)
+### Handle shared library options.
 
 ### Enable creation of static libraries.
 
@@ -776,32 +757,6 @@
 AC_SUBST(INCLUDE_LINK_DEPS)
 AC_SUBST(library_path_var)
 
-if $SHARED_LIBS; then
-  LIBOCTINTERP=-loctinterp$SHLLINKEXT
-  LIBOCTAVE=-loctave$SHLLINKEXT
-  LIBCRUFT=-lcruft$SHLLINKEXT
-else
-  LIBOCTINTERP='$(TOPDIR)/src/liboctinterp.$(LIBEXT)'
-  LIBOCTAVE='$(TOPDIR)/liboctave/liboctave.$(LIBEXT)'
-  LIBCRUFT='$(TOPDIR)/libcruft/libcruft.$(LIBEXT)'
-fi
-AC_SUBST(LIBOCTINTERP)
-AC_SUBST(LIBOCTAVE)
-AC_SUBST(LIBCRUFT)
-
-### Allow compilation of smaller kernel.  This only works if some form
-### of dynamic linking is also supported and used.
-
-AC_ARG_ENABLE(lite-kernel,
-  [  --enable-lite-kernel    compile smaller kernel (requires dynamic linking)],
-  [if test "$enableval" = no; then OCTAVE_LITE=false;
-   else OCTAVE_LITE=true; fi],
-  OCTAVE_LITE=false)
-if $OCTAVE_LITE; then
-  AC_DEFINE(OCTAVE_LITE, 1, [Define to compile smaller kernel.])
-fi
-AC_SUBST(OCTAVE_LITE)
-
 ### special checks for odd OS specific things.
 ###
 ### I am told that on some SCO systems, the only place to find some
@@ -922,76 +877,84 @@
 
 OCTAVE_SMART_PUTENV
 
+### Dynamic linking is now enabled only if we are building shared
+### libs and some API for dynamic linking is detected.
+
 LD_CXX='$(CXX)'
 LIBDLFCN=
 DLFCN_INCFLAGS=
 RDYNAMIC_FLAG=
-if test "$WITH_DL" = yes || test "$WITH_DL" = maybe; then
-  case "$canonical_host_type" in
-    rs6000-ibm-aix* | powerpc-ibm-aix*)
-      LIBDLFCN="-ldlfcn -ll -lld"
-      DLFCN_INCFLAGS='-I$(top_srcdir)/dlfcn -I$(TOPDIR)/dlfcn'
-      WITH_DL=true
-    ;;
-    i[[3456]]86-*-sco3.2v5*)
-      LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
-      WITH_DL=true
-    ;;
-    *)
-      AC_CHECK_LIB(dl, dlopen)
-      AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose, [], [have_dl=false])
-      if test "x$have_dl" != xfalse; then
-        WITH_DL=true
+WITH_DYNAMIC_LINKING=false
+DL_API_MSG=""
+dlopen_api=false
+shl_load_api=false
+loadlibrary_api=false
+if $SHARED_LIBS; then
+
+  LIBOCTINTERP=-loctinterp$SHLLINKEXT
+  LIBOCTAVE=-loctave$SHLLINKEXT
+  LIBCRUFT=-lcruft$SHLLINKEXT
+
+  AC_CHECK_LIB(dl, dlopen)
+  AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
+  if test $ac_cv_func_dlclose = yes && test $ac_cv_func_dlerror = yes \
+    && test $ac_cv_func_dlopen = yes && test $ac_cv_func_dlsym = yes; then
+    dlopen_api=true
+  else
+    AC_CHECK_LIB(dld, shl_load)
+    AC_CHECK_FUNCS(shl_load shl_findsym)
+    if test $ac_cv_func_shl_load = yes \
+      && test $ac_cv_func_shl_findsym = yes; then
+      shl_load_api=true
+    else
+      AC_CHECK_LIB(wsock32, LoadLibrary)
+      AC_CHECK_FUNCS(LoadLibrary)
+      if test $ac_cv_func_loadlibrary = yes; then
+	loadlibrary_api=true
       else
-	if test "$WITH_DL" = yes; then
-	  AC_MSG_ERROR([--enable-dl specified, but functions are missing!])
-	fi
-	WITH_DL=false
+	case "$canonical_host_type" in
+	  rs6000-ibm-aix* | powerpc-ibm-aix*)
+	    LIBDLFCN="-ldlfcn -ll -lld"
+	    DLFCN_INCFLAGS='-I$(top_srcdir)/dlfcn -I$(TOPDIR)/dlfcn'
+	    dlopen_api=true
+	  ;;
+	  i[[3456]]86-*-sco3.2v5*)
+	    LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
+	    dlopen_api=true
+	  ;;
+	esac
       fi
-    ;;
-  esac
-  if $WITH_DL; then
+    fi
+  fi
+
+  if $dlopen_api; then
+    DL_API_MSG="(dlopen)"
+    AC_DEFINE(HAVE_DLOPEN_API, 1, [Define if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking])
     OCTAVE_CXX_FLAG(-rdynamic, [RDYNAMIC_FLAG=-rdynamic])
-    AC_DEFINE(WITH_DL, 1, [Define if using dlopen/dlsym.])
+  elif $shl_load_api; then
+    DL_API_MSG="(shl_load)"
+    AC_DEFINE(HAVE_SHL_LOAD_API, 1, [Define if your system has shl_load and shl_findsym for dynamic linking])
+  elif $loadlibrary_api; then
+    DL_API_MSG="(LoadLibrary)"
+    AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define if your system has LoadLibrary for dynamic linking])
+  fi
+
+  if $dlopen_api || $shl_load_api || $loadlibrary_api; then
+    WITH_DYNAMIC_LINKING=true
   fi
 else
-  WITH_DL=false
+  LIBOCTINTERP='$(TOPDIR)/src/liboctinterp.$(LIBEXT)'
+  LIBOCTAVE='$(TOPDIR)/liboctave/liboctave.$(LIBEXT)'
+  LIBCRUFT='$(TOPDIR)/libcruft/libcruft.$(LIBEXT)'
 fi
-AC_SUBST(WITH_DL)
+AC_SUBST(LD_CXX)
 AC_SUBST(LIBDLFCN)
 AC_SUBST(DLFCN_INCFLAGS)
 AC_SUBST(RDYNAMIC_FLAG)
-AC_SUBST(LD_CXX)
-
-if test "$WITH_SHL" = yes || test "$WITH_SHL" = maybe; then
-  AC_CHECK_LIB(dld, shl_load)
-  AC_CHECK_FUNCS(shl_load shl_findsym, [], [have_shl=false])
-  if test "x$have_shl" != xfalse; then
-    WITH_SHL=true
-  else
-    if test "$WITH_SHL" = yes; then
-      AC_MSG_ERROR([--enable-shl specified, but functions are missing!])
-    fi
-    WITH_SHL=false
-  fi
-  if $WITH_SHL; then
-    AC_DEFINE(WITH_SHL, 1, [Define if using dld for dynamic linking.])
-  fi
-else
-  WITH_SHL=false
-fi
-AC_SUBST(WITH_SHL)
-
-### Set WITH_DYNAMIC_LINKING after all the other shared library stuff
-### has been determined.
-
-if $WITH_DL || $WITH_SHL; then
-  AC_DEFINE(WITH_DYNAMIC_LINKING, 1, [Define if using dynamic linking.])
-  WITH_DYNAMIC_LINKING=true
-else
-  WITH_DYNAMIC_LINKING=false
-fi
 AC_SUBST(WITH_DYNAMIC_LINKING)
+AC_SUBST(LIBOCTINTERP)
+AC_SUBST(LIBOCTAVE)
+AC_SUBST(LIBCRUFT)
 
 ### There is more than one possible prototype for gettimeofday.  See
 ### which one (if any) appears in sys/time.h.  These tests are from
@@ -1132,13 +1095,6 @@
 
 ### A system dependent kluge or two.
 
-### Extra libs needed when using the win32api
-case "$cannonical_host_type" in
-  *-*-mingw*)
-    LIBS="-lwsock32 $LIBS"
-    ;;
-esac
-
 AC_CHECK_FUNCS(getrusage times)
 case "$canonical_host_type" in
   *-*-cygwin*)
@@ -1378,13 +1334,11 @@
   Default pager:        $DEFAULT_PAGER
   gnuplot:              $GNUPLOT_BINARY
 
-  Do internal array bounds checking:       $BOUNDS_CHECKING
-  Build static libraries:                  $STATIC_LIBS
-  Build shared libraries:                  $SHARED_LIBS
-  Minimal kernel option:                   $OCTAVE_LITE
-  Dynamic Linking (dlopen/dlsym):          $WITH_DL
-  Dynamic Linking (shl_load/shl_findsym):  $WITH_SHL
-  Include support for GNU readline:        $USE_READLINE
+  Do internal array bounds checking:  $BOUNDS_CHECKING
+  Build static libraries:             $STATIC_LIBS
+  Build shared libraries:             $SHARED_LIBS
+  Dynamic Linking:                    $WITH_DYNAMIC_LINKING $DL_API_MSG
+  Include support for GNU readline:   $USE_READLINE
 ])
 
 warn_msg_printed=false