unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Emacs Development <Emacs-devel@gnu.org>
Subject: need to unbreak Emacs build on AIX
Date: Fri, 1 Jan 2021 15:17:41 -0800	[thread overview]
Message-ID: <2387f0f2-2b61-da56-4a52-345bd8aaee36@cs.ucla.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Commit 2020-09-12T07:11:26Z!eliz@gnu.org 
(694acda5f24e356264c3f2a55a49812e02bcb49a) broke the build on AIX 7.2, 
as AIX uses libncurses for terminfo and its libncurses does not define 
UP, BC, or CP. Normally I'd just install the attached patch into the 
emacs-27 branch and then merge to master, but I thought I'd check on the 
mailing list since I don't offhand know how close we are to a 27.2 release.


[-- Attachment #2: 0001-Fix-broken-build-on-AIX-7.2.patch --]
[-- Type: text/x-patch, Size: 2385 bytes --]

From 2504eef721805401397822accbcadc14a0cc1d0d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 1 Jan 2021 15:15:54 -0800
Subject: [PATCH] Fix broken build on AIX 7.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD
temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined
symbol: BC’.  This is because -lcurses does not define BC etc.
* configure.ac: When building terminfo.o, define
TERMINFO_DEFINES_BC if the library defines BC etc.
* src/terminfo.c (UP, BC, PC): Define depending on
TERMINFO_DEFINES_BC, not on TERMINFO.
---
 configure.ac   | 12 ++++++++++++
 src/terminfo.c |  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 48e96529ff..07a11cc990 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4366,6 +4366,18 @@ AC_DEFUN
 if test $TERMINFO = yes; then
   AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
   TERMCAP_OBJ=terminfo.o
+  AC_CACHE_CHECK([whether terminfo defines BC],
+    [emacs_cv_terminfo_defines_BC],
+    [OLD_LIBS=$LIBS
+     LIBS="$LIBS $LIBS_TERMCAP"
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])],
+       [emacs_cv_terminfo_defines_BC=yes],
+       [emacs_cv_terminfo_defines_BC=no])
+     LIBS=$OLD_LIBS])
+  if test "$emacs_cv_terminfo_defines_BC" = yes; then
+    AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the
+      terminfo library defines the variables BC, PC, and UP.])
+  fi
 fi
 if test "X$LIBS_TERMCAP" = "X-lncurses"; then
   AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.])
diff --git a/src/terminfo.c b/src/terminfo.c
index 15aff317f1..a9c9572bbb 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -23,10 +23,10 @@
 
 /* Define these variables that serve as global parameters to termcap,
    so that we do not need to conditionalize the places in Emacs
-   that set them.  But don't do that for terminfo, as that could
-   cause link errors when using -fno-common.  */
+   that set them.  But don't do that if terminfo defines them, as that
+   could cause link errors when using -fno-common.  */
 
-#if !TERMINFO
+#ifndef TERMINFO_DEFINES_BC
 char *UP, *BC, PC;
 #endif
 
-- 
2.27.0


             reply	other threads:[~2021-01-01 23:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 23:17 Paul Eggert [this message]
2021-01-02  6:47 ` need to unbreak Emacs build on AIX Eli Zaretskii
2021-01-03 20:56   ` Paul Eggert
2021-01-04  3:25     ` Eli Zaretskii
2021-01-06 15:28     ` Stefan Kangas
2021-01-06 19:29       ` Paul Eggert
2021-01-06 19:38         ` Eli Zaretskii
2021-01-07  6:20           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2387f0f2-2b61-da56-4a52-345bd8aaee36@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=Emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).