[Asterisk-code-review] menuselect: Fix curses build on Gentoo Linux (...asterisk[13])
Kevin Harwell
asteriskteam at digium.com
Mon Aug 12 16:07:15 CDT 2019
Kevin Harwell has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12730 )
Change subject: menuselect: Fix curses build on Gentoo Linux
......................................................................
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
---
M menuselect/Makefile
M menuselect/autoconfig.h.in
M menuselect/configure
M menuselect/configure.ac
M menuselect/makeopts.in
5 files changed, 356 insertions(+), 4 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved; Approved for Submit
diff --git a/menuselect/Makefile b/menuselect/Makefile
index da4a6c0..c310c18 100644
--- a/menuselect/Makefile
+++ b/menuselect/Makefile
@@ -38,8 +38,8 @@
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 @@
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
diff --git a/menuselect/autoconfig.h.in b/menuselect/autoconfig.h.in
index f174551..8047d7a 100644
--- a/menuselect/autoconfig.h.in
+++ b/menuselect/autoconfig.h.in
@@ -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
diff --git a/menuselect/configure b/menuselect/configure
index fd7d24b..9986b4f 100755
--- a/menuselect/configure
+++ b/menuselect/configure
@@ -635,6 +635,10 @@
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_curses
with_ncurses
with_libxml2
+with_libtinfo
'
ac_precious_vars='build_alias
host_alias
@@ -1366,6 +1371,7 @@
--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 @@
+ 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
+
+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 :
diff --git a/menuselect/configure.ac b/menuselect/configure.ac
index e2ae2cb..4629d52 100644
--- a/menuselect/configure.ac
+++ b/menuselect/configure.ac
@@ -65,6 +65,7 @@
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 @@
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>],
diff --git a/menuselect/makeopts.in b/menuselect/makeopts.in
index efafbab..fa2e8dd 100644
--- a/menuselect/makeopts.in
+++ b/menuselect/makeopts.in
@@ -19,6 +19,9 @@
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@
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12730
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6c2ad5b95f422c263d078b5c0e84c111807dffc6
Gerrit-Change-Number: 12730
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190812/4e21028d/attachment-0001.html>
More information about the asterisk-code-review
mailing list