diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-12-31 07:06:47 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-12-31 07:06:47 +0000 |
commit | b909d38dfa0fd09dcbcead07b61e5ba3fedd6f7a (patch) | |
tree | 9e5596d4838955e04968e414bdafffc7cb7117f4 | |
parent | fbb23c67d66556071c459e19bc8896419bb6cfc6 (diff) | |
download | fsf-binutils-gdb-b909d38dfa0fd09dcbcead07b61e5ba3fedd6f7a.zip fsf-binutils-gdb-b909d38dfa0fd09dcbcead07b61e5ba3fedd6f7a.tar.gz fsf-binutils-gdb-b909d38dfa0fd09dcbcead07b61e5ba3fedd6f7a.tar.bz2 |
sim: erc32: fix linking against local readline on modern (ncurses) systems
The current erc32 configure script only searches for -ltermcap to provide
any termcap funcs (which readlines needs). When building against a local
readline (which is static), we hit link failures like so:
gcc ...-I/-D flags... -o sis \
sis.o exec.o erc32.o func.o help.o float.o \
../../bfd/libbfd.a ../../opcodes/libopcodes.a \
../../libiberty/libiberty.a -lz -lnsl \
../../readline/libreadline.a -lm
../../readline/libreadline.a(display.o): In function 'cr':
.../readline/display.c:2486: undefined reference to 'tputs'
collect2: ld returned 1 exit status
make[2]: *** [sis] Error 1
Use AC_SEARCH_LIBS from gdb's configure.ac as suggested by Joel Brobecker
to check for additional termcap providers.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | sim/erc32/ChangeLog | 6 | ||||
-rwxr-xr-x | sim/erc32/configure | 63 | ||||
-rw-r--r-- | sim/erc32/configure.ac | 4 |
3 files changed, 52 insertions, 21 deletions
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index eacec76..edd77ec 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,9 @@ +2011-12-31 Mike Frysinger <vapier@gentoo.org> + + * configure.ac: Change AC_CHECK_LIB to AC_SEARCH_LIBS to match + the code in gdb's configure.ac with $TERMCAP. + * configure: Regenerated. + 2011-12-03 Mike Frysinger <vapier@gentoo.org> * aclocal.m4: New file. diff --git a/sim/erc32/configure b/sim/erc32/configure index 7a74c47..0de9c7d 100755 --- a/sim/erc32/configure +++ b/sim/erc32/configure @@ -2434,9 +2434,9 @@ sim_inline="-DDEFAULT_INLINE=0" # AC_PROG_CPP_WERROR # Test for GNAT. -# We require the gnatbind program, and a compiler driver that -# understands Ada. We use the user's CC setting, already found, -# and possibly add $1 to the command-line parameters. +# We require the gnatbind & gnatmake programs, as well as a compiler driver +# that understands Ada. We use the user's CC setting, already found, and +# possibly add $1 to the command-line parameters. # # Sets the shell variable have_gnat to yes or no as appropriate, and # substitutes GNATBIND and GNATMAKE. @@ -4765,38 +4765,61 @@ $as_echo "$sim_cv_os_cygwin" >&6; } if test x$sim_cv_os_cygwin = xyes; then TERMCAP='`if test -r ../../libtermcap/libtermcap.a; then echo ../../libtermcap/libtermcap.a; else echo -ltermcap; fi` -luser32' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ltermcap" >&5 -$as_echo_n "checking for main in -ltermcap... " >&6; } -if test "${ac_cv_lib_termcap_main+set}" = set; then : + # Keep in sync with gdb's configure.ac list. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 +$as_echo_n "checking for library containing tgetent... " >&6; } +if test "${ac_cv_search_tgetent+set}" = set; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltermcap $LIBS" + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (); int main () { -return main (); +return tgetent (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_termcap_main=yes -else - ac_cv_lib_termcap_main=no +for ac_lib in '' termcap tinfo curses ncurses; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_tgetent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if test "${ac_cv_search_tgetent+set}" = set; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_main" >&5 -$as_echo "$ac_cv_lib_termcap_main" >&6; } -if test "x$ac_cv_lib_termcap_main" = x""yes; then : - TERMCAP=-ltermcap +done +if test "${ac_cv_search_tgetent+set}" = set; then : + +else + ac_cv_search_tgetent=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tgetent" >&5 +$as_echo "$ac_cv_search_tgetent" >&6; } +ac_res=$ac_cv_search_tgetent +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + TERMCAP=$ac_cv_search_tgetent else TERMCAP="" fi diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac index 5a43b5e..bc46091 100644 --- a/sim/erc32/configure.ac +++ b/sim/erc32/configure.ac @@ -17,7 +17,9 @@ lose if test x$sim_cv_os_cygwin = xyes; then TERMCAP='`if test -r ../../libtermcap/libtermcap.a; then echo ../../libtermcap/libtermcap.a; else echo -ltermcap; fi` -luser32' else - AC_CHECK_LIB(termcap, main, TERMCAP=-ltermcap, TERMCAP="") + # Keep in sync with gdb's configure.ac list. + AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses], + [TERMCAP=$ac_cv_search_tgetent], [TERMCAP=""]) fi AC_SUBST(TERMCAP) |