]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
menuselect: Fix curses build on Gentoo Linux
authorSean Bright <sean.bright@gmail.com>
Fri, 9 Aug 2019 10:51:28 +0000 (06:51 -0400)
committerSean Bright <sean.bright@gmail.com>
Fri, 9 Aug 2019 15:07:04 +0000 (11:07 -0400)
Because keypad() is exported by libtinfo, it needs to be explicitly
added to the linker options.

ASTERISK-28487 #close

Change-Id: I6c2ad5b95f422c263d078b5c0e84c111807dffc6

menuselect/Makefile
menuselect/autoconfig.h.in
menuselect/configure
menuselect/configure.ac
menuselect/makeopts.in

index da4a6c080e27c31bea801b70c45e6a598551dd97..c310c18dfb2f402e96cd986975389615dfac1c6d 100644 (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
index f1745516b7f2a07e96beefe716989ee3e04403a9..8047d7a84c1391db89952c6ec5d92e4b105f5e42 100644 (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
 
index fd7d24b87be6a9675003ce103857f453872c588b..9986b4f9896d1d311758ebb4a534c0f55794cd63 100755 (executable)
@@ -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 :
index e2ae2cb47e5d31ac032f7350636e00148013ecea..4629d52786e6a3d2a266323321a755a449b1b892 100644 (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>],
index efafbabfd3364e854c77bbc94bdb1c1bc98f3e9f..fa2e8dd23e38e1a97dad6988ee44a7b98348254b 100644 (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@