mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-23 00:16:03 +02:00
14033: reduce unnecessary library linking for modules and main binary
This commit is contained in:
parent
e3ff47f8ee
commit
a43aa761cd
|
@ -1,3 +1,11 @@
|
||||||
|
2001-04-19 Clint Adams <schizo@debian.org>
|
||||||
|
|
||||||
|
* 14033: acconfig.h, aczsh.m4, configure.in, Config/defs.mk.in,
|
||||||
|
Src/Makefile.in, Src/mkmakemod.sh, Src/zsh.mdd,
|
||||||
|
Src/Modules/cap.mdd, Src/Modules/termcap.mdd,
|
||||||
|
Src/Modules/terminfo.mdd: only link modules and main binary
|
||||||
|
against needed libraries.
|
||||||
|
|
||||||
2001-04-19 Sven Wischnowsky <wischnow@zsh.org>
|
2001-04-19 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
* 14028: Src/Zle/complete.mdd: use the right path patterns for
|
* 14028: Src/Zle/complete.mdd: use the right path patterns for
|
||||||
|
|
|
@ -63,6 +63,14 @@ DLLD = @DLLD@
|
||||||
EXPOPT = @EXPOPT@
|
EXPOPT = @EXPOPT@
|
||||||
IMPOPT = @IMPOPT@
|
IMPOPT = @IMPOPT@
|
||||||
|
|
||||||
|
# extra libraries
|
||||||
|
LIBS_M = @LIBS_M@
|
||||||
|
LIBS_CAP = @LIBS_CAP@
|
||||||
|
LIBS_SOCKET = @LIBS_SOCKET@
|
||||||
|
LIBS_TERMCAP = @LIBS_TERMCAP@
|
||||||
|
LIBS_TERMINFO = @LIBS_TERMINFO@
|
||||||
|
LIBS_YP = @LIBS_YP@
|
||||||
|
|
||||||
# utilities
|
# utilities
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
YODL = @YODL@
|
YODL = @YODL@
|
||||||
|
|
|
@ -82,11 +82,11 @@ EXTRAZSHOBJS = @EXTRAZSHOBJS@
|
||||||
|
|
||||||
zsh$(EXEEXT): $(@L@IBZSH) $(@L@STMP) $(MAIN_OBJS) zsh.export $(EXTRAZSHOBJS)
|
zsh$(EXEEXT): $(@L@IBZSH) $(@L@STMP) $(MAIN_OBJS) zsh.export $(EXTRAZSHOBJS)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(@L@DRUNPATH) $(LINK) $(MAIN_OBJS) $(EXTRAZSHOBJS) $(@L@LIST) $(ZSH_@E@XPORT) $(@L@IBZSH) $(LIBS)
|
$(@L@DRUNPATH) $(LINK) $(MAIN_OBJS) $(EXTRAZSHOBJS) $(@L@LIST) $(ZSH_@E@XPORT) $(@L@IBZSH) $(LIBS_M) $(LIBS_TERMCAP) $(LIBS_YP) $(LIBS)
|
||||||
|
|
||||||
$(LIBZSH): $(LIBOBJS) $(NSTMP)
|
$(LIBZSH): $(LIBOBJS) $(NSTMP)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
$(DLLINK) $(LIBOBJS) $(NLIST) $(LIBS)
|
$(DLLINK) $(LIBOBJS) $(NLIST) $(LIBS_M) $(LIBS_TERMCAP) $(LIBS)
|
||||||
|
|
||||||
zsh.res.o: $(sdir)/zsh.rc $(sdir)/zsh.ico
|
zsh.res.o: $(sdir)/zsh.rc $(sdir)/zsh.ico
|
||||||
windres -O coff --include-dir $(sdir) -i $(sdir)/zsh.rc -o zsh.res.o
|
windres -O coff --include-dir $(sdir) -i $(sdir)/zsh.rc -o zsh.res.o
|
||||||
|
|
|
@ -5,3 +5,5 @@ load=no
|
||||||
autobins="cap getcap setcap"
|
autobins="cap getcap setcap"
|
||||||
|
|
||||||
objects="cap.o"
|
objects="cap.o"
|
||||||
|
|
||||||
|
extralibs="cap"
|
||||||
|
|
|
@ -15,3 +15,5 @@ load=yes
|
||||||
autobins="echotc"
|
autobins="echotc"
|
||||||
|
|
||||||
objects="termcap.o"
|
objects="termcap.o"
|
||||||
|
|
||||||
|
extralibs="termcap"
|
||||||
|
|
|
@ -16,3 +16,5 @@ autobins="echoti"
|
||||||
autoparams="terminfo"
|
autoparams="terminfo"
|
||||||
|
|
||||||
objects="terminfo.o"
|
objects="terminfo.o"
|
||||||
|
|
||||||
|
extralibs="terminfo"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
# autoprefixconds like autoinfixconds, but for prefix condition codes
|
# autoprefixconds like autoinfixconds, but for prefix condition codes
|
||||||
# autoparams parameters defined by the module, for autoloading
|
# autoparams parameters defined by the module, for autoloading
|
||||||
# automathfuncs math functions defined by the module, for autoloading
|
# automathfuncs math functions defined by the module, for autoloading
|
||||||
|
# extralibs libraries specific to this module (default none)
|
||||||
# objects .o files making up this module (*must* be defined)
|
# objects .o files making up this module (*must* be defined)
|
||||||
# proto .syms files for this module (default generated from $objects)
|
# proto .syms files for this module (default generated from $objects)
|
||||||
# headers extra headers for this module (default none)
|
# headers extra headers for this module (default none)
|
||||||
|
@ -190,7 +191,8 @@ if $first_stage; then
|
||||||
|
|
||||||
unset name moddeps nozshdep alwayslink hasexport
|
unset name moddeps nozshdep alwayslink hasexport
|
||||||
unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
|
unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
|
||||||
unset objects proto headers hdrdeps otherincs
|
unset extralibs objects proto headers hdrdeps otherincs
|
||||||
|
unset EXTRALIBS
|
||||||
. $top_srcdir/$the_subdir/${mddname}.mdd
|
. $top_srcdir/$the_subdir/${mddname}.mdd
|
||||||
q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
|
q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
|
||||||
test -n "${moddeps+set}" || moddeps=
|
test -n "${moddeps+set}" || moddeps=
|
||||||
|
@ -199,6 +201,24 @@ if $first_stage; then
|
||||||
proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
|
proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
|
||||||
|
|
||||||
dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
|
dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
|
||||||
|
|
||||||
|
for lib in $extralibs; do
|
||||||
|
case $lib in
|
||||||
|
m) EXTRALIBS="$EXTRALIBS \$(LIBS_M)"
|
||||||
|
;;
|
||||||
|
cap) EXTRALIBS="$EXTRALIBS \$(LIBS_CAP)"
|
||||||
|
;;
|
||||||
|
socket) EXTRALIBS="$EXTRALIBS \$(LIBS_SOCKET)"
|
||||||
|
;;
|
||||||
|
termcap) EXTRALIBS="$EXTRALIBS \$(LIBS_TERMCAP)"
|
||||||
|
;;
|
||||||
|
terminfo) EXTRALIBS="$EXTRALIBS \$(LIBS_TERMINFO)"
|
||||||
|
;;
|
||||||
|
yp) EXTRALIBS="$EXTRALIBS \$(LIBS_YP)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
modhdeps=
|
modhdeps=
|
||||||
mododeps=
|
mododeps=
|
||||||
exportdeps=
|
exportdeps=
|
||||||
|
@ -302,6 +322,7 @@ if $first_stage; then
|
||||||
echo "NXPIMP_${mddname} ="
|
echo "NXPIMP_${mddname} ="
|
||||||
echo "LINKMODS_${mddname} = $mododeps"
|
echo "LINKMODS_${mddname} = $mododeps"
|
||||||
echo "NOLINKMODS_${mddname} = "
|
echo "NOLINKMODS_${mddname} = "
|
||||||
|
echo "EXTRALIBS_${mddname} = $EXTRALIBS"
|
||||||
echo
|
echo
|
||||||
echo "proto.${mddname}: \$(EPRO_${mddname})"
|
echo "proto.${mddname}: \$(EPRO_${mddname})"
|
||||||
echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
|
echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
|
||||||
|
@ -328,7 +349,7 @@ if $first_stage; then
|
||||||
echo
|
echo
|
||||||
echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
|
echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
|
||||||
echo ' rm -f $@'
|
echo ' rm -f $@'
|
||||||
echo " \$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) "
|
echo " \$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) $EXTRALIBS \$(LIBS)"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
|
echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
|
||||||
|
|
|
@ -17,6 +17,8 @@ signames.o string.o subst.o text.o utils.o watch.o"
|
||||||
headers="../config.h system.h zsh.h sigcount.h signals.h \
|
headers="../config.h system.h zsh.h sigcount.h signals.h \
|
||||||
prototypes.h hashtable.h ztype.h"
|
prototypes.h hashtable.h ztype.h"
|
||||||
|
|
||||||
|
extralibs="m termcap yp"
|
||||||
|
|
||||||
:<<\Make
|
:<<\Make
|
||||||
@CONFIG_MK@
|
@CONFIG_MK@
|
||||||
|
|
||||||
|
|
|
@ -317,3 +317,9 @@
|
||||||
|
|
||||||
/* Define if you have the terminfo strnames symbol. */
|
/* Define if you have the terminfo strnames symbol. */
|
||||||
#undef HAVE_STRNAMES
|
#undef HAVE_STRNAMES
|
||||||
|
|
||||||
|
/* Define if you have the cap library. */
|
||||||
|
#undef HAVE_LIBCAP
|
||||||
|
|
||||||
|
/* Define if you have the socket library. */
|
||||||
|
#undef HAVE_LIBSOCKET
|
||||||
|
|
24
aczsh.m4
24
aczsh.m4
|
@ -683,3 +683,27 @@ AC_DEFUN(zsh_COMPILE_FLAGS,
|
||||||
then LIBS="$4"
|
then LIBS="$4"
|
||||||
else LIBS="$enable_libs"
|
else LIBS="$enable_libs"
|
||||||
fi)])
|
fi)])
|
||||||
|
|
||||||
|
dnl zsh_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
|
||||||
|
dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
|
||||||
|
dnl Search for a library defining FUNC, if it's not already available.
|
||||||
|
|
||||||
|
AC_DEFUN(zsh_SEARCH_LIBS,
|
||||||
|
[AC_PREREQ([2.13])
|
||||||
|
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
|
||||||
|
[ac_func_search_save_LIBS="$LIBS"
|
||||||
|
ac_cv_search_$1="no"
|
||||||
|
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
|
||||||
|
test "$ac_cv_search_$1" = "no" && for i in $2; do
|
||||||
|
LIBS="-l$i $5 $ac_func_search_save_LIBS"
|
||||||
|
AC_TRY_LINK_FUNC([$1],
|
||||||
|
[ac_cv_search_$1="-l$i"
|
||||||
|
break])
|
||||||
|
done
|
||||||
|
LIBS="$ac_func_search_save_LIBS"])
|
||||||
|
if test "$ac_cv_search_$1" != "no"; then
|
||||||
|
test "$ac_cv_search_$1" = "none required" || ZS_LIBS="$ac_cv_search_$1"
|
||||||
|
$3
|
||||||
|
else :
|
||||||
|
$4
|
||||||
|
fi])
|
||||||
|
|
35
configure.in
35
configure.in
|
@ -504,7 +504,7 @@ dnl On ReliantUNIX -lc better be the last library, else funny things
|
||||||
dnl may happen.
|
dnl may happen.
|
||||||
AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
|
AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
|
||||||
|
|
||||||
AC_CHECK_LIB(m, pow)
|
AC_CHECK_LIB(m, pow, [LIBS_M="-lm"])
|
||||||
|
|
||||||
dnl Prefer BSD termcap library to SysV curses library, except on certain
|
dnl Prefer BSD termcap library to SysV curses library, except on certain
|
||||||
dnl SYSV-derived systems.
|
dnl SYSV-derived systems.
|
||||||
|
@ -514,7 +514,12 @@ case "$host_os" in
|
||||||
*) termcap_curses_order="termcap curses ncurses" ;;
|
*) termcap_curses_order="termcap curses ncurses" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_SEARCH_LIBS(tgetent, [$termcap_curses_order])
|
zsh_SEARCH_LIBS(tgetent, [$termcap_curses_order])
|
||||||
|
LIBS_TERMCAP=$ZS_LIBS
|
||||||
|
|
||||||
|
zsh_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
|
||||||
|
LIBS_TERMINFO=$ZS_LIBS
|
||||||
|
|
||||||
AC_MSG_CHECKING(if boolcodes is available)
|
AC_MSG_CHECKING(if boolcodes is available)
|
||||||
AC_TRY_COMPILE([#include <curses.h>
|
AC_TRY_COMPILE([#include <curses.h>
|
||||||
#include <term.h>], [char **test = boolcodes;],
|
#include <term.h>], [char **test = boolcodes;],
|
||||||
|
@ -549,7 +554,8 @@ AC_MSG_RESULT($strnames)
|
||||||
dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
|
dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
|
||||||
dnl libnsl (Network Services Library) to find yp_all
|
dnl libnsl (Network Services Library) to find yp_all
|
||||||
|
|
||||||
AC_SEARCH_LIBS(yp_all, nsl)
|
zsh_SEARCH_LIBS(yp_all, nsl)
|
||||||
|
LIBS_YP=$ZS_LIBS
|
||||||
|
|
||||||
dnl I am told that told that unicos reqire these for nis_list
|
dnl I am told that told that unicos reqire these for nis_list
|
||||||
if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
|
if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
|
||||||
|
@ -560,9 +566,11 @@ if test "x$dynamic" = xyes; then
|
||||||
AC_CHECK_LIB(dl, dlopen)
|
AC_CHECK_LIB(dl, dlopen)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_LIB(cap, cap_get_proc)
|
AC_CHECK_LIB(cap, cap_get_proc, [LIBS_CAP="-lcap"
|
||||||
|
AC_DEFINE(HAVE_LIBCAP)])
|
||||||
|
|
||||||
AC_CHECK_LIB(socket, socket)
|
AC_CHECK_LIB(socket, socket, [LIBS_SOCKET="-lsocket"
|
||||||
|
AC_DEFINE(HAVE_LIBSOCKET)])
|
||||||
|
|
||||||
dnl ---------------------
|
dnl ---------------------
|
||||||
dnl CHECK TERMCAP LIBRARY
|
dnl CHECK TERMCAP LIBRARY
|
||||||
|
@ -831,6 +839,9 @@ dnl ---------------
|
||||||
dnl need to integrate this function
|
dnl need to integrate this function
|
||||||
dnl AC_FUNC_STRFTIME
|
dnl AC_FUNC_STRFTIME
|
||||||
|
|
||||||
|
SAVELIBS=$LIBS
|
||||||
|
LIBS="$LIBS_TERMCAP $LIBS_TERMINFO $LIBS"
|
||||||
|
|
||||||
AC_CHECK_FUNCS(strftime difftime gettimeofday \
|
AC_CHECK_FUNCS(strftime difftime gettimeofday \
|
||||||
select poll \
|
select poll \
|
||||||
readlink lstat lchown faccessx fchdir ftruncate \
|
readlink lstat lchown faccessx fchdir ftruncate \
|
||||||
|
@ -887,6 +898,8 @@ if test $zsh_cv_func_tgetent_accepts_null = yes; then
|
||||||
AC_DEFINE(TGETENT_ACCEPTS_NULL)
|
AC_DEFINE(TGETENT_ACCEPTS_NULL)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
LIBS=$SAVELIBS
|
||||||
|
|
||||||
AC_FUNC_MMAP
|
AC_FUNC_MMAP
|
||||||
if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
|
if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
|
||||||
AC_CHECK_FUNCS(munmap msync)
|
AC_CHECK_FUNCS(munmap msync)
|
||||||
|
@ -1675,10 +1688,16 @@ if test "x$dynamic" = xyes; then
|
||||||
test "$zsh_cv_shared_environ" = yes || dynamic=no
|
test "$zsh_cv_shared_environ" = yes || dynamic=no
|
||||||
dnl test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no
|
dnl test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no
|
||||||
if test "$ac_cv_func_tgetent" = yes; then
|
if test "$ac_cv_func_tgetent" = yes; then
|
||||||
|
SAVELIBS=$LIBS
|
||||||
|
LIBS="$LIBS_TERMCAP $LIBS"
|
||||||
zsh_SHARED_FUNCTION([tgetent])
|
zsh_SHARED_FUNCTION([tgetent])
|
||||||
|
LIBS=$SAVELIBS
|
||||||
fi
|
fi
|
||||||
if test "$ac_cv_func_tigetstr" = yes; then
|
if test "$ac_cv_func_tigetstr" = yes; then
|
||||||
|
SAVELIBS=$LIBS
|
||||||
|
LIBS="$LIBS_TERMINFO $LIBS"
|
||||||
zsh_SHARED_FUNCTION([tigetstr])
|
zsh_SHARED_FUNCTION([tigetstr])
|
||||||
|
LIBS=$SAVELIBS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1752,6 +1771,12 @@ AC_SUBST(MOD_EXPORT)dnl
|
||||||
AC_SUBST(MOD_IMPORT_VARIABLE)dnl
|
AC_SUBST(MOD_IMPORT_VARIABLE)dnl
|
||||||
AC_SUBST(MOD_IMPORT_FUNCTION)dnl
|
AC_SUBST(MOD_IMPORT_FUNCTION)dnl
|
||||||
AC_SUBST(EXTRAZSHOBJS)dnl
|
AC_SUBST(EXTRAZSHOBJS)dnl
|
||||||
|
AC_SUBST(LIBS_M)dnl
|
||||||
|
AC_SUBST(LIBS_CAP)dnl
|
||||||
|
AC_SUBST(LIBS_SOCKET)dnl
|
||||||
|
AC_SUBST(LIBS_TERMCAP)dnl
|
||||||
|
AC_SUBST(LIBS_TERMINFO)dnl
|
||||||
|
AC_SUBST(LIBS_YP)dnl
|
||||||
|
|
||||||
# Generate config.modules. We look for *.mdd files in first and second
|
# Generate config.modules. We look for *.mdd files in first and second
|
||||||
# level subdirectories. Any existing line not containing 'auto=y' will be
|
# level subdirectories. Any existing line not containing 'auto=y' will be
|
||||||
|
|
Loading…
Reference in New Issue