view src/DLD-FUNCTIONS/config-module.awk @ 13010:edc5ec6e949b

maint: allow --enable-static --disable-dl to work again * oct-conf.h.in (OCTAVE_CONF_OCTAVE_LINK_DEPS, OCTAVE_CONF_OCTAVE_LINK_OPTS, OCTAVE_CONF_OCT_LINK_DEPS, OCTAVE_CONF_OCT_LINK_OPTS): New macros. * common.mk (do_subst_config_vals): Substitute them. * toplev.cc (octave_config_info): Add them to the info map * libcruft/link-deps.mk, liboctave/link-deps.mk, src/link-deps.mk: New files. * libcruft/Makefile.am, liboctave/Makefile.am, src/Makefile.am: Include link-deps.mk files to get link options and dependencies. Set link options in _LDFLAGS variable, not _LIBADD variable. * configure.ac (--enable-dl): Update help message. * configure.ac (AMCOND_LINK_ALL_DEPS): New conditional. * liboctave/link-deps.mk, src/link-deps.mk: Use it. * src/DLD-FUNCTIONS/module-files: Store file-specific CPPFLAGS, * LDFLAGS, and LIBRARY info here. src/Makefile.am: Not here. * src/DLD-FUNCTIONS/config-module.awk: Use file-specific CPPFLAGS, LDFLAGS, and LIBRARY info from module-files to generate variable definitions and rules. * src/Makefile.am (DLD_DYNAMIC_SRC, DLD_STATIC_SRC, OCTAVE_LIBS, OCTINTERP_LINK_DEPS): Delete. (octave_LDADD): Set to liboctinerp.la and $(OCTAVE_LINK_DEPS), not $(OCTAVE_LIBS). (octave_LDFLAGS): New variable. (DLD_STATIC_DEF_FILES, DLD_DYNAMIC_DEF_FILES): Delete. (DLD_FUNCTIONS_DEF_FILES): New variable. (DEF_FILES): Set conditionally. (DLD_FUNCTIONS_PKG_ADD_FILE): New conditionally defined variable. Change all uses of hard-coded file name. (DLD-FUNCTIONS/PKG_ADD:): Conditionally define rule. * mkoctfile.in, mkoctfile.cc.in: Update for new linking rules.
author John W. Eaton <jwe@octave.org>
date Fri, 26 Aug 2011 15:36:14 -0400
parents 55ebf5df9ea6
children 7d1e11d922aa
line wrap: on
line source

BEGIN {
  print "## DO NOT EDIT -- generated from module-files by config-module.awk";
  print ""
  print "EXTRA_DIST += \\"
  print "  DLD-FUNCTIONS/config-module.sh \\"
  print "  DLD-FUNCTIONS/config-module.awk \\"
  print "  DLD-FUNCTIONS/module-files"
  print ""
  nfiles = 0;
}
/^#.*/ { next; }
{
  split ($1, fields, "|");
  nfiles++;
  files[nfiles] = fields[1];
  cppflags[nfiles] = fields[2];
  ldflags[nfiles] = fields[3];
  libraries[nfiles] = fields[4];
} END {
  sep = " \\\n";
  print "DLD_FUNCTIONS_SRC = \\";
  for (i = 1; i <= nfiles; i++) {
    if (i == nfiles)
      sep = "\n";
    printf ("  DLD-FUNCTIONS/%s%s", files[i], sep);
  }
  print "";

  sep = " \\\n";
  print "DLD_FUNCTIONS_LIBS = $(DLD_FUNCTIONS_SRC:.cc=.la)";
  print "";
  print "if AMCOND_ENABLE_DYNAMIC_LINKING";
  print "";
  print "octlib_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)";
  print "";
  print "## Use stamp files to avoid problems with checking timestamps";
  print "## of symbolic links";
  print "";
  for (i = 1; i <= nfiles; i++) {
    basename = files[i];
    sub (/\.cc$/, "", basename);
    printf ("DLD-FUNCTIONS/$(am__leading_dot)%s.oct-stamp: DLD-FUNCTIONS/%s.la\n", basename, basename);
    print "\trm -f $(<:.la=.oct)";
    print "\tla=$(<F) && \\";
    print "\t  of=$(<F:.la=.oct) && \\";
    print "\t  cd DLD-FUNCTIONS && \\";
    print "\t  $(LN_S) .libs/`$(SED) -n -e \"s/dlname='\\([^']*\\)'/\\1/p\" < $$la` $$of && \\";
    print "\t  touch $(@F)";
    print "";
  }
  print "else";
  print "";
  print "noinst_LTLIBRARIES = $(DLD_FUNCTIONS_LIBS)";
  print "";
  print "endif";

  for (i = 1; i <= nfiles; i++) {
    basename = files[i];
    sub (/\.cc$/, "", basename);
    print "";
    printf ("DLD_FUNCTIONS_%s_la_SOURCES = DLD-FUNCTIONS/%s\n",
	    basename, files[i]);
    if (cppflags[i])
      {
        printf ("DLD-FUNCTIONS/%s.df: CPPFLAGS += %s\n",
                basename, cppflags[i]);
        printf ("DLD_FUNCTIONS_%s_la_CPPFLAGS = $(AM_CPPFLAGS) %s\n",
                basename, cppflags[i]);
      }
    printf ("DLD_FUNCTIONS_%s_la_LDFLAGS = -avoid-version -module %s $(OCT_LINK_OPTS)\n",
            basename, ldflags[i]);
    printf ("DLD_FUNCTIONS_%s_la_LIBADD = %s $(OCT_LINK_DEPS)\n",
            basename, libraries[i]);
  }
}