menuselect: Fix curses build on Gentoo Linux

Because keypad() is exported by libtinfo, it needs to be explicitly
added to the linker options.

ASTERISK-28487 #close

Change-Id: I6c2ad5b95f422c263d078b5c0e84c111807dffc6
This commit is contained in:
Sean Bright 2019-08-09 06:51:28 -04:00
parent bcc0b85da8
commit e40f248fac
5 changed files with 356 additions and 4 deletions

View File

@ -38,8 +38,8 @@ endif
ifdef NCURSES_LIB
C_OBJS += menuselect_curses.o
C_LIBS +=$(NCURSES_LIB)
C_INCLUDE += $(NCURSES_INCLUDE)
C_LIBS += $(NCURSES_LIB) $(TINFO_LIB)
C_INCLUDE += $(NCURSES_INCLUDE) $(TINFO_INCLUDE)
ALL_TGTS += cmenuselect
CFLAGS += -DHAVE_NCURSES
ifeq ($(HAVE_NCURSES_SUBDIR),yes)
@ -48,8 +48,8 @@ ifdef NCURSES_LIB
else
ifdef CURSES_LIB
C_OBJS += menuselect_curses.o
C_LIBS +=$(CURSES_LIB)
C_INCLUDE += $(CURSES_INCLUDE)
C_LIBS += $(CURSES_LIB) $(TINFO_LIB)
C_INCLUDE += $(CURSES_INCLUDE) $(TINFO_INCLUDE)
ALL_TGTS += cmenuselect
endif
endif

View File

@ -79,6 +79,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the terminfo library. */
#undef HAVE_TINFO
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

334
menuselect/configure vendored
View File

@ -635,6 +635,10 @@ PKG_CONFIG
CONFIG_LIBXML2
SED
HAVE_NCURSES_SUBDIR
PBX_TINFO
TINFO_DIR
TINFO_INCLUDE
TINFO_LIB
PBX_LIBXML2
LIBXML2_DIR
LIBXML2_INCLUDE
@ -720,6 +724,7 @@ with_newt
with_curses
with_ncurses
with_libxml2
with_libtinfo
'
ac_precious_vars='build_alias
host_alias
@ -1366,6 +1371,7 @@ Optional Packages:
--with-curses=PATH use curses files in PATH
--with-ncurses=PATH use ncurses files in PATH
--with-libxml2=PATH use LibXML2 files in PATH
--with-libtinfo=PATH use terminfo files in PATH
Some influential environment variables:
CC C compiler command
@ -3928,6 +3934,38 @@ fi
TINFO_DESCRIP="terminfo"
TINFO_OPTION="libtinfo"
PBX_TINFO=0
# Check whether --with-libtinfo was given.
if test "${with_libtinfo+set}" = set; then :
withval=$with_libtinfo;
case ${withval} in
n|no)
USE_TINFO=no
# -1 is a magic value used by menuselect to know that the package
# was disabled, other than 'not found'
PBX_TINFO=-1
;;
y|ye|yes)
ac_mandatory_list="${ac_mandatory_list} TINFO"
;;
*)
TINFO_DIR="${withval}"
ac_mandatory_list="${ac_mandatory_list} TINFO"
;;
esac
fi
if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
pbxlibdir=""
@ -4320,6 +4358,302 @@ fi
fi
fi
if test "${PBX_NCURSES}" = 1; then
if test "${HAVE_NCURSES_SUBDIR}" = "yes"; then
if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
pbxlibdir=""
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
if test -d ${TINFO_DIR}/lib; then
pbxlibdir="-L${TINFO_DIR}/lib"
else
pbxlibdir="-L${TINFO_DIR}"
fi
fi
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for keypad in -ltinfo" >&5
$as_echo_n "checking for keypad in -ltinfo... " >&6; }
if ${ac_cv_lib_tinfo_keypad+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltinfo ${pbxlibdir} $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 keypad ();
int
main ()
{
return keypad ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_tinfo_keypad=yes
else
ac_cv_lib_tinfo_keypad=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_keypad" >&5
$as_echo "$ac_cv_lib_tinfo_keypad" >&6; }
if test "x$ac_cv_lib_tinfo_keypad" = xyes; then :
AST_TINFO_FOUND=yes
else
AST_TINFO_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
# now check for the header.
if test "${AST_TINFO_FOUND}" = "yes"; then
TINFO_LIB="${pbxlibdir} -ltinfo "
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
TINFO_INCLUDE="-I${TINFO_DIR}/include"
fi
TINFO_INCLUDE="${TINFO_INCLUDE} "
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default"
if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then :
TINFO_HEADER_FOUND=1
else
TINFO_HEADER_FOUND=0
fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
TINFO_LIB=""
TINFO_INCLUDE=""
else
PBX_TINFO=1
cat >>confdefs.h <<_ACEOF
#define HAVE_TINFO 1
_ACEOF
fi
fi
fi
else
if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
pbxlibdir=""
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
if test -d ${TINFO_DIR}/lib; then
pbxlibdir="-L${TINFO_DIR}/lib"
else
pbxlibdir="-L${TINFO_DIR}"
fi
fi
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for keypad in -ltinfo" >&5
$as_echo_n "checking for keypad in -ltinfo... " >&6; }
if ${ac_cv_lib_tinfo_keypad+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltinfo ${pbxlibdir} $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 keypad ();
int
main ()
{
return keypad ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_tinfo_keypad=yes
else
ac_cv_lib_tinfo_keypad=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_keypad" >&5
$as_echo "$ac_cv_lib_tinfo_keypad" >&6; }
if test "x$ac_cv_lib_tinfo_keypad" = xyes; then :
AST_TINFO_FOUND=yes
else
AST_TINFO_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
# now check for the header.
if test "${AST_TINFO_FOUND}" = "yes"; then
TINFO_LIB="${pbxlibdir} -ltinfo "
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
TINFO_INCLUDE="-I${TINFO_DIR}/include"
fi
TINFO_INCLUDE="${TINFO_INCLUDE} "
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default"
if test "x$ac_cv_header_ncurses_h" = xyes; then :
TINFO_HEADER_FOUND=1
else
TINFO_HEADER_FOUND=0
fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
TINFO_LIB=""
TINFO_INCLUDE=""
else
PBX_TINFO=1
cat >>confdefs.h <<_ACEOF
#define HAVE_TINFO 1
_ACEOF
fi
fi
fi
fi
else
if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
pbxlibdir=""
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
if test -d ${TINFO_DIR}/lib; then
pbxlibdir="-L${TINFO_DIR}/lib"
else
pbxlibdir="-L${TINFO_DIR}"
fi
fi
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} "
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for keypad in -ltinfo" >&5
$as_echo_n "checking for keypad in -ltinfo... " >&6; }
if ${ac_cv_lib_tinfo_keypad+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltinfo ${pbxlibdir} $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 keypad ();
int
main ()
{
return keypad ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_tinfo_keypad=yes
else
ac_cv_lib_tinfo_keypad=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_keypad" >&5
$as_echo "$ac_cv_lib_tinfo_keypad" >&6; }
if test "x$ac_cv_lib_tinfo_keypad" = xyes; then :
AST_TINFO_FOUND=yes
else
AST_TINFO_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
# now check for the header.
if test "${AST_TINFO_FOUND}" = "yes"; then
TINFO_LIB="${pbxlibdir} -ltinfo "
# if --with-TINFO=DIR has been specified, use it.
if test "x${TINFO_DIR}" != "x"; then
TINFO_INCLUDE="-I${TINFO_DIR}/include"
fi
TINFO_INCLUDE="${TINFO_INCLUDE} "
# check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
if test "x$ac_cv_header_curses_h" = xyes; then :
TINFO_HEADER_FOUND=1
else
TINFO_HEADER_FOUND=0
fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
TINFO_LIB=""
TINFO_INCLUDE=""
else
PBX_TINFO=1
cat >>confdefs.h <<_ACEOF
#define HAVE_TINFO 1
_ACEOF
fi
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :

View File

@ -65,6 +65,7 @@ AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
AST_EXT_LIB_SETUP([TINFO], [terminfo], [libtinfo])
AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses.h])
@ -78,6 +79,17 @@ if test "${PBX_NCURSES}" != 1; then
fi
fi
AC_SUBST(HAVE_NCURSES_SUBDIR)
if test "${PBX_NCURSES}" = 1; then
if test "${HAVE_NCURSES_SUBDIR}" = "yes"; then
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [ncurses/ncurses.h])
else
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [ncurses.h])
fi
else
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [curses.h])
fi
AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
[#include <libxml/tree.h>
#include <libxml/parser.h>],

View File

@ -19,6 +19,9 @@ NCURSES_INCLUDE=@NCURSES_INCLUDE@
NCURSES_LIB=@NCURSES_LIB@
HAVE_NCURSES_SUBDIR=@HAVE_NCURSES_SUBDIR@
TINFO_INCLUDE=@TINFO_INCLUDE@
TINFO_LIB=@TINFO_LIB@
NEWT_INCLUDE=@NEWT_INCLUDE@
NEWT_LIB=@NEWT_LIB@