Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: comptest* failed to load module: zsh/termcap



On Apr 30,  8:47pm, Andrej Borsenkow wrote:
} Subject: Re: comptest* failed to load module: zsh/termcap
}
} On Mon, 30 Apr 2001, Bart Schaefer wrote:
} 
} > Modules/termcap.o: In function `scantermcap':
} > Modules/termcap.o(.text+0x450): undefined reference to `boolcodes'
} >
} > So the problem is that configure.in is still missing the AC_SEARCH_LIBS
} > call to find the ncurses libraries (it does one only for tgetent, which
} > finds old termcap first).
} 
} But it should not find the above variables then and should not try use
} them (or use local static placeholders). So, the question is - why
} configure sets HAVE_BOOLCODES and others at all? I believe, we finally
} cleaned this up ... are you sure you are using the lates CVS?

Yes, I did a "cvs up -d -P" immediately before buiding.

Checking config.log, it turns out that even without -lcurses in the link,
AC_TRY_LINK is succeeding for boolcodes et al. -- possibly gcc is doing
an optimization and throwing out the `test' variable because it's not
used, and therefore not actually trying to find boolcodes at link time:

configure:3112: checking if boolcodes is available
configure:3124: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2 -D _LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  conftest.c -ltermcap -lm  -lc 1>&5
configure: In function `main':
configure:3120: warning: initialization discards qualifiers from pointer target type
configure:3120: warning: unused variable `test'

The compilation then succeeds and goes on to the next thing.  On my RH5.2
system at home, there's a link failure at this point.

Sure enough, if I change configure.in to:

#include <term.h>], [char **test = boolcodes; printf(*test);],

(so that `test' is used), then AC_TRY_LINK fails and all is well.  We've
been bitten by an overoptimizing compiler.

Index: configure.in
===================================================================
--- configure.in	2001/04/27 05:21:54	1.4
+++ configure.in	2001/04/30 17:13:21
@@ -533,36 +533,36 @@
 AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
 #include <curses.h>
 #endif
-#include <term.h>], [char **test = boolcodes;],
+#include <term.h>], [char **test = boolcodes; printf(*test);],
 AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
 AC_MSG_RESULT($boolcodes)
 AC_MSG_CHECKING(if numcodes is available)
 AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
 #include <curses.h>
 #endif
-#include <term.h>], [char **test = numcodes;],
+#include <term.h>], [char **test = numcodes; printf(*test);],
 AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
 AC_MSG_RESULT($numcodes)
 AC_MSG_CHECKING(if strcodes is available)
 AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
 #include <curses.h>
 #endif
-#include <term.h>], [char **test = strcodes;],
+#include <term.h>], [char **test = strcodes; printf(*test);],
 AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
 AC_MSG_RESULT($strcodes)
 AC_MSG_CHECKING(if boolnames is available)
 AC_TRY_LINK([#include <curses.h>
-#include <term.h>], [char **test = boolnames;],
+#include <term.h>], [char **test = boolnames; printf(*test);],
 AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
 AC_MSG_RESULT($boolnames)
 AC_MSG_CHECKING(if numnames is available)
 AC_TRY_LINK([#include <curses.h>
-#include <term.h>], [char **test = numnames;],
+#include <term.h>], [char **test = numnames; printf(*test);],
 AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
 AC_MSG_RESULT($numnames)
 AC_MSG_CHECKING(if strnames is available)
 AC_TRY_LINK([#include <curses.h>
-#include <term.h>], [char **test = strnames;],
+#include <term.h>], [char **test = strnames; printf(*test);],
 AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
 AC_MSG_RESULT($strnames)
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author