Skip to content

Commit

Permalink
Fix broken build on AIX 7.2
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 6329174)
  • Loading branch information
eggert authored and rgmorris committed Jan 4, 2021
1 parent 2c84790 commit fa574e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -4393,6 +4393,18 @@ TERMCAP_OBJ=tparam.o
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 $LIBS_TERMCAP library 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.])
Expand Down
6 changes: 3 additions & 3 deletions src/terminfo.c
Expand Up @@ -23,10 +23,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */

/* 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

Expand Down

0 comments on commit fa574e6

Please sign in to comment.