Mercurial > hg > octave-lyh
changeset 13024:f3c53fea9fb5
maint: more linking tweaks
* configure.ac (--enable-link-all-dependencies): New option.
(--enable-no-undefined): New option.
Don't set NO_UNDEFINED_LDFLAG specially on Windows systems.
* liboctave/link-deps.mk (LIBOCTAVE_LINK_DEPS):
Include $(LAPACK_LIBS), $(BLAS_LIBS) and $(LIBS) in the list.
* config-modules.awk: Add $(NO_UNDEFINED_LDFLAG) to LDFLAGS variables.
* src/link-deps.mk (OCT_LINK_DEPS): Remove $(NO_UNDEFINED_LDFLAG from
the list.
* src/mkoctfile.cc.in, mkoctfile.in:
Always link files with -loctinterp, -loctave, and -lcruft.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 29 Aug 2011 11:49:30 -0400 |
parents | 7d1e11d922aa |
children | 4a86826dbb0e |
files | configure.ac liboctave/link-deps.mk src/DLD-FUNCTIONS/config-module.awk src/Makefile.am src/link-deps.mk src/mkoctfile.cc.in src/mkoctfile.in |
diffstat | 7 files changed, 36 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -1458,28 +1458,41 @@ AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)]) -NO_UNDEFINED_LDFLAG= case "$canonical_host_type" in *-*-mingw*) if test "$have_msvc" = "yes"; then AC_CHECK_LIB(dirent, opendir) LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" - NO_UNDEFINED_LDFLAG=-no-undefined else LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" - NO_UNDEFINED_LDFLAG=-no-undefined fi LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" - NO_UNDEFINED_LDFLAG=-no-undefined ;; *-*-msdosmsvc*) AC_CHECK_LIB(dirent, opendir) LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" - NO_UNDEFINED_LDFLAG=-no-undefined ;; esac + +AC_ARG_ENABLE([no-undefined], + [AS_HELP_STRING([--enable-no-undefined], + [pass -no-undefined to libtool when linking linking Octave and its shared libraries (on by default)])], + [case "${enableval}" in + yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;; + no) NO_UNDEFINED_LDFLAG="" ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;; + esac], [NO_UNDEFINED_LDFLAG="-no-undefined"]) AC_SUBST(NO_UNDEFINED_LDFLAG) -AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test -n "$NO_UNDEFINED_LDFLAG"]) + +AC_ARG_ENABLE([link-all-dependencies], + [AS_HELP_STRING([--enable-link-all-dependencies], + [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])], + [case "${enableval}" in + yes) link_all_deps=true ;; + no) link_all_deps=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;; + esac], [link_all_deps=false]) +AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test x$link_all_deps = xtrue]) ### Type stuff.
--- a/liboctave/link-deps.mk +++ b/liboctave/link-deps.mk @@ -5,12 +5,15 @@ $(ARPACK_LIBS) \ $(QRUPDATE_LIBS) \ $(FFTW_XLIBS) \ + $(LAPACK_LIBS) \ + $(BLAS_LIBS) \ $(READLINE_LIBS) \ $(TERM_LIBS) \ $(LIBGLOB) \ $(REGEX_LIBS) \ $(DL_LIBS) \ - $(PTHREAD_LIBS) + $(PTHREAD_LIBS) \ + $(LIBS) LIBOCTAVE_LINK_OPTS = \ $(SPARSE_XLDFLAGS) \
--- a/src/DLD-FUNCTIONS/config-module.awk +++ b/src/DLD-FUNCTIONS/config-module.awk @@ -68,7 +68,7 @@ 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", + printf ("DLD_FUNCTIONS_%s_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) %s $(OCT_LINK_OPTS)\n", basename, ldflags[i]); printf ("DLD_FUNCTIONS_%s_la_LIBADD = liboctinterp.la ../liboctave/liboctave.la ../libcruft/libcruft.la %s $(OCT_LINK_DEPS)\n", basename, libraries[i]);
--- a/src/Makefile.am +++ b/src/Makefile.am @@ -535,7 +535,9 @@ ../libcruft/libcruft.la \ $(OCTAVE_LINK_DEPS) -octave_LDFLAGS = $(OCTAVE_LINK_OPTS) +octave_LDFLAGS = \ + $(NO_UNDEFINED_LDFLAG) \ + $(OCTAVE_LINK_OPTS) ## Section for defining and creating DEF_FILES SRC_DEF_FILES := $(shell $(srcdir)/find-defun-files.sh "$(srcdir)" $(DIST_SRC))
--- a/src/link-deps.mk +++ b/src/link-deps.mk @@ -24,9 +24,7 @@ OCT_LINK_DEPS = -OCT_LINK_OPTS = \ - $(NO_UNDEFINED_LDFLAG) \ - $(LDFLAGS) +OCT_LINK_OPTS = $(LDFLAGS) if AMCOND_LINK_ALL_DEPS LIBOCTINTERP_LINK_DEPS += $(LIBOCTAVE_LINK_DEPS)
--- a/src/mkoctfile.cc.in +++ b/src/mkoctfile.cc.in @@ -751,7 +751,8 @@ + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"] + " " + vars["ALL_LDFLAGS"] + " " + pass_on_options + " " + output_option + " " + objfiles + " " + libfiles - + " " + ldflags + " " + vars["LFLAGS"] + " " + + " " + ldflags + " " + vars["LFLAGS"] + + " -loctinterp -loctave -lcruft " + " " + vars["OCT_LINK_OPTS"] + " " + vars["OCTAVE_LINK_DEPS"]; result = run_command (cmd); @@ -767,7 +768,8 @@ { string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " " + pass_on_options + " -o " + octfile + " " + objfiles + " " - + libfiles + " " + ldflags + " " + vars["LFLAGS"] + " " + + libfiles + " " + ldflags + " " + vars["LFLAGS"] + + " -loctinterp -loctave -lcruft " + vars["OCT_LINK_OPTS"] + " " + vars["OCT_LINK_DEPS"]; result = run_command (cmd); }
--- a/src/mkoctfile.in +++ b/src/mkoctfile.in @@ -101,8 +101,8 @@ : ${FLIBS=%OCTAVE_CONF_FLIBS%} : ${OCTAVE_LINK_DEPS=%OCTAVE_CONF_OCTAVE_LINK_DEPS%} : ${OCTAVE_LINK_DEPS=%OCTAVE_CONF_OCTAVE_LINK_OPTS%} -: ${OCT_LINK_DEPS=%OCTAVE_CONF_OCT_LINK_DEPS%} -: ${OCT_LINK_DEPS=%OCTAVE_CONF_OCT_LINK_OPTS%} +: ${OCT_LINK_DEPS=%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%} +: ${OCT_LINK_DEPS=%OCTAVE_CONF_MKOCTFILE_OCT_LINK_OPTS%} : ${LD_CXX=%OCTAVE_CONF_LD_CXX%} : ${LDFLAGS=%OCTAVE_CONF_LDFLAGS%} : ${LD_STATIC_FLAG=%OCTAVE_CONF_LD_STATIC_FLAG%} @@ -534,7 +534,7 @@ if $link && [ -n "$objfiles" ]; then if $link_stand_alone; then if [ -n "$LD_CXX" ]; then - cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS $RLD_FLAG $OCTAVE_LINK_OPTS $OCTAVE_LINK_DEPS" + cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave -lcruft $RLD_FLAG $OCTAVE_LINK_OPTS $OCTAVE_LINK_DEPS" $dbg $cmd eval $cmd else @@ -542,7 +542,7 @@ exit 1 fi else - cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LFLAGS $OCT_LINK_OPTS $OCT_LINK_DEPS" + cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave -lcruft $OCT_LINK_OPTS $OCT_LINK_DEPS" $dbg $cmd eval $cmd fi