From xemacs-m  Sun May 18 22:10:03 1997
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id WAA16779
	for <xemacs-beta@xemacs.org>; Sun, 18 May 1997 22:10:02 -0500 (CDT)
Received: from Eng.Sun.COM ([129.146.1.25]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id UAA24491; Sun, 18 May 1997 20:24:08 -0700
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id UAA27173; Sun, 18 May 1997 20:09:23 -0700
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id UAA07100; Sun, 18 May 1997 20:09:26 -0700
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id UAA10171; Sun, 18 May 1997 20:09:21 -0700
Date: Sun, 18 May 1997 20:09:21 -0700
Message-Id: <199705190309.UAA10171@xemacs.eng.sun.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Kyle Jones <kyle_jones@wonderworks.com>
Cc: xemacs-beta@xemacs.org
Subject: Re: 20.3-b1: build fails on BSD/OS 2.0
In-Reply-To: <QQcqdk07621.199705190210@crystal.WonderWorks.COM>
References: <QQcqdi07048.199705190138@crystal.WonderWorks.COM>
	<m2aflsnsj6.fsf@altair.xemacs.org>
	<QQcqdj07400.199705190159@crystal.WonderWorks.COM>
	<QQcqdk07621.199705190210@crystal.WonderWorks.COM>
X-Mailer: VM 6.31 under 20.2 XEmacs Lucid
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>

>>>>> "Kyle" == Kyle Jones <kyle_jones@wonderworks.com> writes:

Kyle> OK, I got it to build.  Three things went wrong
Kyle> 1. -lSM/-lICE lossage.

More -lICE nit-picking is required.  Why aren't the X lib directories
included on the command line by configure?

Kyle> 2. -lc put at the beginning of the load library list instead at
Kyle>    the end.

I think I've got it. All build flags should be determined dynamically 
by configure, then used consistently by all the Makefiles.  We're not
quite there yet.  Try this:

--- src/Makefile.in.in.orig	Sun May 18 19:49:32 1997
+++ src/Makefile.in.in	Sun May 18 19:54:27 1997
@@ -701,7 +701,5 @@
 	   ${lispdir}utils/advice.elc
 
-LIBES = $(LWLIB_LIBS) $(energize_libs) $(quantify_libs) \
-	LIBS_DEBUG $(GNULIB_VAR) LIB_STANDARD \
-	$(GNULIB_VAR) $(ld_libs_all)
+LIBES = $(LWLIB_LIBS) $(quantify_libs) $(ld_libs_all) LIBS_DEBUG $(GNULIB_VAR)
 
 /* Enable recompilation of certain other files depending on system type.  */


LIBS_DEBUG should also disappear from here, but I don't understand it
well enough yet.

Kyle> 3. termcap.o was not put into objs list in Makefile, and was not
Kyle>    compiled.  I tried linking with -ltercap and got errors.  I
Kyle>    then added termcap.o to the list, and it was compiled and
Kyle>    linked into temacs successfully.


This is a real mess, but the infrastructure is there for this to be
maintainable.  Here's the configure.in snippet:

  else dnl "$with_ncurses" = "no"
    dnl Autodetect terminfo/-ltermlib/-ltermcap/-lcurses
    AC_CHECK_LIB(termlib, tgoto, have_libtermlib=yes, have_libtermlib=no)
    AC_CHECK_LIB(termcap, tgoto, have_libtermcap=yes, have_libtermcap=no)
    AC_CHECK_LIB(curses,  tparm, have_libcurses=yes,  have_libcurses=no)

    if test "$have_terminfo" = "yes"; then
      extra_objs="$extra_objs terminfo.o"
      if   test -n "$libs_termcap";         then LIBS="$LIBS $libs_termcap"
      elif test "$have_libcurses"  = "yes"; then LIBS="$LIBS -lcurses"
      elif test "$have_libtermlib" = "yes"; then LIBS="$LIBS -ltermlib"
      elif test "$have_libtermcap" = "yes"; then LIBS="$LIBS -ltermcap"
      fi
    else dnl "$have_terminfo" = "no" && "with_ncurses" = "no"
      extra_objs="$extra_objs tparam.o"
      if   test -n "$libs_termcap";         then LIBS="$LIBS $libs_termcap"
      elif test "$have_libtermcap" = "yes"; then LIBS="$LIBS -ltermcap"
      elif test "$have_libcurses"  = "yes"; then LIBS="$LIBS -lcurses"
      else extra_objs="$extra_objs termcap.o"
      fi
    fi
  fi

(libs_termcap has been extracted from the s&m files)

This is a translation from the Old Crufty Way in 20.2:


#ifdef HAVE_TTY
#  ifdef HAVE_NCURSES
/* If your machine needs -ltermcap, define LIBS_TERMCAP to include
   -lncurses -ltermcap in your s or m file (conditionalized on
   HAVE_NCURSES). */
#    ifndef LIBS_TERMCAP
#      define LIBS_TERMCAP -lncurses
#    endif /* LIBS_TERMCAP */
termcapobjs = terminfo.o
#  elif defined (TERMINFO)
/* Used to be -ltermcap here.  If your machine needs that,
   define LIBS_TERMCAP in the m/<machine>.h file.  */
#    ifndef LIBS_TERMCAP
#      define LIBS_TERMCAP -lcurses
#    endif /* LIBS_TERMCAP */
termcapobjs = terminfo.o
#  else /* ! defined (TERMINFO) */
#    ifndef LIBS_TERMCAP
#      define LIBS_TERMCAP
termcapobjs = termcap.o tparam.o
#    else /* LIBS_TERMCAP */
termcapobjs = tparam.o
#    endif /* LIBS_TERMCAP */
#  endif /* ! defined (TERMINFO) */
#else /* !HAVE_TTY */
#  undef LIBS_TERMCAP
#  define LIBS_TERMCAP
#endif /* !HAVE_TTY */


Where is my translation error?

My reverse-engineering assumption about the code was that termcap.o
should only be necessary if LIBS_TERMCAP is not defined in the s&m
files, and if there is no -ltermcap or -lcurses on the system.

Martin

