emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107504: configure: fix ncurses 'conf


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107504: configure: fix ncurses 'configure' issue on Solaris 10 (Bug#10677)
Date: Sun, 04 Mar 2012 10:07:33 -0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107504
fixes bug(s): http://debbugs.gnu.org/10677
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-04 10:07:33 -0800
message:
  configure: fix ncurses 'configure' issue on Solaris 10 (Bug#10677)
  
  * configure.in (LIBS_TERMCAP): Default this to the result of
  the tputs library search.  Do a run-time test for the linkability
  of tputs unless cross-compiling, as that's more reliable if the
  link flags and libraries are messed up.  Don't change LIBS as
  a result of the test, as that may mess up later tests.
modified:
  ChangeLog
  configure.in
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-03-01 07:33:29 +0000
+++ b/ChangeLog 2012-03-04 18:07:33 +0000
@@ -1,3 +1,12 @@
+2012-03-04  Paul Eggert  <address@hidden>
+
+       configure: fix ncurses 'configure' issue on Solaris 10 (Bug#10677)
+       * configure.in (LIBS_TERMCAP): Default this to the result of
+       the tputs library search.  Do a run-time test for the linkability
+       of tputs unless cross-compiling, as that's more reliable if the
+       link flags and libraries are messed up.  Don't change LIBS as
+       a result of the test, as that may mess up later tests.
+
 2012-02-05  Christoph Scholtes  <address@hidden>
 
        * make-dist (README.W32): Include file in source tarball. (Bug#9750)

=== modified file 'configure.in'
--- a/configure.in      2012-02-27 03:20:00 +0000
+++ b/configure.in      2012-03-04 18:07:33 +0000
@@ -2784,11 +2784,43 @@
 # It's better to believe a function is not available
 # than to expect to find it in ncurses.
 # Also we need tputs and friends to be able to build at all.
-have_tputs_et_al=true
+AC_MSG_CHECKING([for library containing tputs])
+# Run a test program that contains a call to tputs, a call that is
+# never executed.  This tests whether a pre-'main' dynamic linker
+# works with the library.  It's too much trouble to actually call
+# tputs in the test program, due to portability hassles.  When
+# cross-compiling, assume the test program will run if it links.
+AC_DEFUN([tputs_link_source], [
+  AC_LANG_SOURCE(
+     [[extern void tputs (const char *, int, int (*)(int));
+       int main (int argc, char **argv)
+       {
+         if (argc == 10000)
+           tputs (argv[0], 0, 0);
+         return 0;
+       }]])
+])
 # Maybe curses should be tried earlier?
 # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
-AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap curses], , 
have_tputs_et_al=false)
-if test "$have_tputs_et_al" != true; then
+for tputs_library in '' ncurses terminfo termcap curses; do
+  OLIBS=$LIBS
+  if test -z "$tputs_library"; then
+    LIBS_TERMCAP=
+    msg='none required'
+  else
+    LIBS_TERMCAP=-l$tputs_library
+    msg=$LIBS_TERMCAP
+    LIBS="$LIBS_TERMCAP $LIBS"
+  fi
+  AC_RUN_IFELSE([tputs_link_source], [], [msg=no],
+    [AC_LINK_IFELSE([tputs_link_source], [], [msg=no])])
+  LIBS=$OLIBS
+  if test "X$msg" != Xno; then
+    break
+  fi
+done
+AC_MSG_RESULT([$msg])
+if test "X$msg" = Xno; then
   AC_MSG_ERROR([The required function `tputs' was not found in any library.
 These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
 Please try installing whichever of these libraries is most appropriate
@@ -2807,7 +2839,6 @@
 ## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
 ## darwin|gnu without ncurses.
 TERMINFO=no
-LIBS_TERMCAP=
 case "$opsys" in
   ## cygwin: Fewer environment variables to go wrong, more terminal types.
   ## hpux10-20: Use the system provided termcap(3) library.
@@ -2872,10 +2903,6 @@
 TERMCAP_OBJ=tparam.o
 if test $TERMINFO = yes; then
   AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
-
-  ## Default used to be -ltermcap.  Add a case above if need something else.
-  test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses"
-
   TERMCAP_OBJ=terminfo.o
 fi
 AC_SUBST(LIBS_TERMCAP)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]