summaryrefslogtreecommitdiffstats
path: root/projects
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-08-18 01:43:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-08-18 01:43:57 +0000
commitb5d5797426f0fd0612b4098641e7e1d28c761434 (patch)
treea7d36c36a2f692242a4c2986b4f1b26b29e97261 /projects
parentd485e7bd7639cd6b39c6113a30fbc3cdc8c41c4c (diff)
downloadexternal_llvm-b5d5797426f0fd0612b4098641e7e1d28c761434.zip
external_llvm-b5d5797426f0fd0612b4098641e7e1d28c761434.tar.gz
external_llvm-b5d5797426f0fd0612b4098641e7e1d28c761434.tar.bz2
Update the sample project autoconf setup to include support for
detecting terminfo. Requested by Craig Topper, and probably should be done much more systematically. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'projects')
-rw-r--r--projects/sample/autoconf/configure.ac19
-rwxr-xr-xprojects/sample/configure124
2 files changed, 142 insertions, 1 deletions
diff --git a/projects/sample/autoconf/configure.ac b/projects/sample/autoconf/configure.ac
index dc0acf3..c7e256e 100644
--- a/projects/sample/autoconf/configure.ac
+++ b/projects/sample/autoconf/configure.ac
@@ -820,6 +820,17 @@ AC_ARG_WITH(bug-report-url,
AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval",
[Bug report URL.])
+dnl --enable-terminfo: check whether the user wants to control use of terminfo:
+AC_ARG_ENABLE(terminfo,AS_HELP_STRING(
+ [--enable-terminfo],
+ [Query the terminfo database if available (default is YES)]),
+ [case "$enableval" in
+ yes) llvm_cv_enable_terminfo="yes" ;;
+ no) llvm_cv_enable_terminfo="no" ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;;
+ esac],
+ llvm_cv_enable_terminfo="yes")
+
dnl --enable-libffi : check whether the user wants to turn off libffi:
AC_ARG_ENABLE(libffi,AS_HELP_STRING(
--enable-libffi,[Check for the presence of libffi (default is NO)]),
@@ -1068,6 +1079,14 @@ AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
[Define if dlopen() is available on this platform.]),
AC_MSG_WARN([dlopen() not found - disabling plugin support]))
+dnl The curses library is optional; used for querying terminal info
+if test "$llvm_cv_enable_terminfo" = "yes" ; then
+ dnl We need the has_color functionality in curses for it to be useful.
+ AC_SEARCH_LIBS(setupterm,tinfo curses ncurses ncursesw,
+ AC_DEFINE([HAVE_TERMINFO],[1],
+ [Define if the setupterm() function is supported this platform.]))
+fi
+
dnl libffi is optional; used to call external functions from the interpreter
if test "$llvm_cv_enable_libffi" = "yes" ; then
AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1],
diff --git a/projects/sample/configure b/projects/sample/configure
index 23e01c8..bcb1b2e 100755
--- a/projects/sample/configure
+++ b/projects/sample/configure
@@ -1409,6 +1409,8 @@ Optional Features:
(default=all)
--enable-bindings Build specific language bindings:
all,auto,none,{binding-name} (default=auto)
+ --enable-terminfo Query the terminfo database if available (default is
+ YES)
--enable-libffi Check for the presence of libffi (default is NO)
--enable-ltdl-install install libltdl
@@ -5604,6 +5606,20 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Check whether --enable-terminfo was given.
+if test "${enable_terminfo+set}" = set; then
+ enableval=$enable_terminfo; case "$enableval" in
+ yes) llvm_cv_enable_terminfo="yes" ;;
+ no) llvm_cv_enable_terminfo="no" ;;
+ *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-terminfo. Use \"yes\" or \"no\"" >&5
+echo "$as_me: error: Invalid setting for --enable-terminfo. Use \"yes\" or \"no\"" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ llvm_cv_enable_terminfo="yes"
+fi
+
+
# Check whether --enable-libffi was given.
if test "${enable_libffi+set}" = set; then
enableval=$enable_libffi; case "$enableval" in
@@ -10339,7 +10355,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10342 "configure"
+#line 10358 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12462,6 +12478,112 @@ echo "$as_me: WARNING: dlopen() not found - disabling plugin support" >&2;}
fi
+if test "$llvm_cv_enable_terminfo" = "yes" ; then
+ { echo "$as_me:$LINENO: checking for library containing setupterm" >&5
+echo $ECHO_N "checking for library containing setupterm... $ECHO_C" >&6; }
+if test "${ac_cv_search_setupterm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 setupterm ();
+int
+main ()
+{
+return setupterm ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' tinfo curses ncurses ncursesw; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_setupterm=$ac_res
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if test "${ac_cv_search_setupterm+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_setupterm+set}" = set; then
+ :
+else
+ ac_cv_search_setupterm=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_setupterm" >&5
+echo "${ECHO_T}$ac_cv_search_setupterm" >&6; }
+ac_res=$ac_cv_search_setupterm
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TERMINFO 1
+_ACEOF
+
+fi
+
+fi
+
if test "$llvm_cv_enable_libffi" = "yes" ; then
{ echo "$as_me:$LINENO: checking for library containing ffi_call" >&5
echo $ECHO_N "checking for library containing ffi_call... $ECHO_C" >&6; }