diff configure.in @ 997:89cca5f594bd

[xemacs-hg @ 2002-09-10 15:37:48 by james] Commit the stuff in the top-level directory that CVS didn't commit the first time around. This completes the module changes begun with the previous commit.
author james
date Tue, 10 Sep 2002 15:38:03 +0000
parents 151d438d2d55
children 989ddde6705d
line wrap: on
line diff
--- a/configure.in	Tue Sep 10 15:27:39 2002 +0000
+++ b/configure.in	Tue Sep 10 15:38:03 2002 +0000
@@ -3065,6 +3065,80 @@
 dnl offix.c, so that the thing is dumped after lastfile.o
 AC_SUBST(dnd_objs)
 
+dnl Autodetect dll support
+dnl This must come before the detection code for anything that is in a module
+if test "$with_modules" != "no"; then
+  AC_CHECKING(for module support)
+
+  dnl Check for MS-Windows
+  if test "$with_msw" = "yes"; then
+    have_dl=yes;
+  else
+    dnl Find headers and libraries
+    AC_CHECK_HEADER(dlfcn.h, [
+      AC_MSG_CHECKING([for dlopen in -lc])
+      AC_TRY_LINK([#include <dlfcn.h>],dnl
+	[dlopen ("", 0);], [ have_dl=yes ], [
+      AC_MSG_CHECKING([for dlopen in -ldl])
+      ac_save_LIBS="$LIBS"
+      LIBS="-ldl $LIBS"
+      AC_TRY_LINK([#include <dlfcn.h>],dnl
+	[dlopen ("", 0);], [ have_dl=yes ],
+	[LIBS="$ac_save_LIBS"])
+      ac_save_LIBS=])])
+    if test -n "$have_dl"; then
+      AC_DEFINE(HAVE_DLOPEN)
+    else
+      AC_CHECK_LIB(dld, shl_load, [
+        libdl=dld have_dl=yes;
+        AC_DEFINE(HAVE_SHL_LOAD)], [
+        AC_CHECK_LIB(dld, dld_init, [
+        libdl=dld have_dl=yes;
+        AC_DEFINE(HAVE_DLD_INIT)])])
+    fi
+  fi dnl end !MS-Windows
+
+  if test -n "$have_dl"; then
+    dnl XE_SHLIB_STUFF (in aclocal.m4) defines $can_build_shared
+    XE_SHLIB_STUFF
+  fi
+
+  if test "$can_build_shared" = "yes"; then
+    AC_DEFINE(HAVE_SHLIB)
+    XE_APPEND(src, INSTALL_ARCH_DEP_SUBDIR)
+    test -n "$libdl" && XE_PREPEND(-l${libdl}, LIBS)
+    AC_CHECK_FUNCS(dlerror _dlerror)
+    with_modules=yes
+    MOD_CC="../../lib-src/ellcc"
+    MODCFLAGS="\$(CFLAGS) --mode=compile --mod-output=\$@ -I../../src -I\$(srcdir)/../../src"
+    INSTALLPATH="\$(moduledir)"
+    MOD_INSTALL_PROGRAM=${INSTALL_PROGRAM}
+    OBJECT_TO_BUILD="\$(MODNAME).ell"
+  else
+    if test "$with_modules" = "yes"; then
+      XE_DIE("Required module support cannot be provided.")
+    else
+      echo "    No module support."
+    fi
+    with_modules=no
+    MOD_CC=${CC}
+    MODCFLAGS="\$(CFLAGS) -I../../src -I\$(srcdir)/../../src"
+    INSTALLPATH=""
+    MOD_INSTALL_PROGRAM="true"
+    OBJECT_TO_BUILD="\$(MODNAME).o"
+  fi
+fi
+MODARCHDIR=
+MAKE_DOCFILE="../../lib-src/make-docfile"
+AC_SUBST(with_modules)
+AC_SUBST(MOD_CC)
+AC_SUBST(MODARCHDIR)
+AC_SUBST(MAKE_DOCFILE)
+AC_SUBST(MODCFLAGS)
+AC_SUBST(INSTALLPATH)
+AC_SUBST(MOD_INSTALL_PROGRAM)
+AC_SUBST(OBJECT_TO_BUILD)
+
 dnl Autodetect tooltalk
 if test "$with_tooltalk" != "no" ; then
   dnl autodetect the location of tt_c.h
@@ -3167,6 +3241,7 @@
 
 dnl Autodetect LDAP
 AC_CHECKING(for LDAP)
+ldap_libs=
 test -z "$with_ldap" && { AC_CHECK_HEADER(ldap.h, ,with_ldap=no) }
 test -z "$with_ldap" && { AC_CHECK_HEADER(lber.h, ,with_ldap=no) }
 if test "$with_ldap" != "no"; then
@@ -3179,20 +3254,27 @@
 if test "$with_ldap" = "yes"; then
   AC_DEFINE(HAVE_LDAP)
   if test "$with_ldap_nolber" = "yes" ; then
-    XE_PREPEND(-lldap, LIBS)
+    XE_PREPEND(-lldap, ldap_libs)
   else
     if test "$with_ldap_krb" = "yes" ; then
-      XE_PREPEND(-lkrb, LIBS)
+      XE_PREPEND(-lkrb, ldap_libs)
     fi
     if test "$with_ldap_krbdes" = "yes" ; then
-      XE_PREPEND(-ldes, LIBS)
-      XE_PREPEND(-lkrb, LIBS)
+      XE_PREPEND(-ldes, ldap_libs)
+      XE_PREPEND(-lkrb, ldap_libs)
     fi
-    XE_PREPEND(-llber, LIBS)
-    XE_PREPEND(-lldap, LIBS)
+    XE_PREPEND(-llber, ldap_libs)
+    XE_PREPEND(-lldap, ldap_libs)
   fi
+  save_LIBS="$LIBS" LIBS="$LIBS $ldap_libs"
   AC_CHECK_FUNCS(ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result)
+  LIBS="$save_LIBS"
+  XE_APPEND(modules/ldap, MAKE_SUBDIR)
+  if test "$with_modules" = "yes"; then
+    XE_APPEND(modules/ldap, INSTALL_ARCH_DEP_SUBDIR)
+  fi
 fi
+AC_SUBST(ldap_libs)
 
 dnl Autodetect PostgreSQL
 dnl On many Linux systems, PostgreSQL is packaged to be installed in /usr;
@@ -3201,6 +3283,7 @@
 dnl If PostgreSQL is installed into a different prefix,
 dnl (such as the default /usr/local/pgsql when building from source),
 dnl that prefix must be specified using the --site-prefixes flag.
+postgresql_libs=
 if test "$with_postgresql" != "no"; then
   AC_CHECKING(for PostgreSQL)
 
@@ -3219,11 +3302,16 @@
                  with_postgresqlv7=yes;
                  AC_DEFINE(HAVE_POSTGRESQLV7)])
     AC_DEFINE_UNQUOTED(LIBPQ_FE_H_FILE, "$libpq_fe_h_file")
-    XE_PREPEND(-lpq, LIBS)
+    XE_PREPEND(-lpq, postgresql_libs)
+    XE_APPEND(modules/postgresql, MAKE_SUBDIR)
+    if test "$with_modules" = "yes"; then
+      XE_APPEND(modules/postgresql, INSTALL_ARCH_DEP_SUBDIR)
+    fi
   elif test "$with_postgresql" = "yes"; then
     XE_DIE("Required PostgreSQL support cannot be provided.  Check --site-prefixes.")
   fi
 fi
+AC_SUBST(postgresql_libs)
 
 dnl ----------------------
 dnl Graphics libraries
@@ -4396,59 +4484,6 @@
   XE_PREPEND(-Bstatic -lut -Bdynamic, LIBS)
 fi
 
-dnl autodetect dll support
-if test "$with_modules" != "no"; then
-  AC_CHECKING(for module support)
-
-  dnl Check for MS-Windows
-  if test "$with_msw" = "yes"; then
-    have_dl=yes;
-  else
-    dnl Find headers and libraries
-    AC_CHECK_HEADER(dlfcn.h, [
-      AC_MSG_CHECKING([for dlopen in -lc])
-      AC_TRY_LINK([#include <dlfcn.h>],dnl
-	[dlopen ("", 0);], [ have_dl=yes ], [
-      AC_MSG_CHECKING([for dlopen in -ldl])
-      ac_save_LIBS="$LIBS"
-      LIBS="-ldl $LIBS"
-      AC_TRY_LINK([#include <dlfcn.h>],dnl
-	[dlopen ("", 0);], [ have_dl=yes ],
-	[LIBS="$ac_save_LIBS"])
-      ac_save_LIBS=])])
-    if test -n "$have_dl"; then
-      AC_DEFINE(HAVE_DLOPEN)
-    else
-      AC_CHECK_LIB(dld, shl_load, [
-        libdl=dld have_dl=yes;
-        AC_DEFINE(HAVE_SHL_LOAD)], [
-        AC_CHECK_LIB(dld, dld_init, [
-        libdl=dld have_dl=yes;
-        AC_DEFINE(HAVE_DLD_INIT)])])
-    fi
-  fi dnl end !MS-Windows
-
-  if test -n "$have_dl"; then
-    dnl XE_SHLIB_STUFF (in aclocal.m4) defines $can_build_shared
-    XE_SHLIB_STUFF
-  fi
-
-  if test "$can_build_shared" = "yes"; then
-    AC_DEFINE(HAVE_SHLIB)
-    XE_APPEND(src, INSTALL_ARCH_DEP_SUBDIR)
-    test -n "$libdl" && XE_PREPEND(-l${libdl}, LIBS)
-    AC_CHECK_FUNCS(dlerror _dlerror)
-    with_modules=yes
-  else
-    if test "$with_modules" = "yes"; then
-      XE_DIE("Required module support cannot be provided.")
-    else
-      echo "    No module support."
-    fi
-    with_modules=no
-  fi
-fi
-
 dnl Unfortunately, just because we can link doesn't mean we can run.
 dnl One of the above link tests may have succeeded but caused resulting
 dnl executables to fail to run.  Also any tests using AC_TRY_RUN will
@@ -4481,6 +4516,12 @@
 
 dnl We ignore (C|LD)_SWITCH_X_(MACHINE|SYSTEM)
 dnl Use XE_SPACE instead of plain assignment statements to remove extraneous blanks
+if test "$with_modules" = "yes"; then
+  ld_libs_module=
+else
+  XE_SPACE(ld_libs_module, $ldap_libs $postgresql_libs)
+fi
+
 XE_SPACE(CFLAGS, $CFLAGS)
 XE_SPACE(extra_objs, $extra_objs)
 XE_SPACE(c_switch_general, -DHAVE_CONFIG_H $c_switch_site $c_switch_machine $c_switch_system)
@@ -4491,7 +4532,7 @@
 XE_SPACE(ld_switch_all, $ld_switch_general $ld_switch_window_system)
 XE_SPACE(ld_libs_general, $LIBS $libs_machine $libs_system $libs_standard)
 XE_SPACE(ld_libs_window_system, $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS)
-XE_SPACE(ld_libs_all, $ld_libs_window_system $ld_libs_general)
+XE_SPACE(ld_libs_all, $ld_libs_window_system $ld_libs_general $ld_libs_module)
 
 dnl Compute lists of Makefiles and subdirs
 AC_SUBST(SRC_SUBDIR_DEPS)