diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-08-12 10:40:11 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-08-12 10:40:11 +0000 |
commit | 3729d7d62b9973baa60d253fe0463d6d607dd815 (patch) | |
tree | 5fbd3c29ccb29fc17ee40ed64593bd7bd23feacb | |
parent | dfb5ceae90c016ba4ca8a7f1a3b79c360d888f30 (diff) | |
download | external_llvm-3729d7d62b9973baa60d253fe0463d6d607dd815.zip external_llvm-3729d7d62b9973baa60d253fe0463d6d607dd815.tar.gz external_llvm-3729d7d62b9973baa60d253fe0463d6d607dd815.tar.bz2 |
Remove all checking for the various terminfo headers (term.h and
curses.h). Finding these headers is next to impossible. For example, on
Debian systems libtinfo-dev provides the terminfo reading library we
want, but *not* term.h. For the header, you have to use libncurses-dev.
And libncursesw-dev provides a *different* term.h in a different
location!
These headers aren't worth it. We want two functions the signatures of
which are clearly spec'ed in sys-v and other documentation. Just declare
them ourselves and call them. This should fix some debian builders and
provide better support for "minimal" debian systems that do want color
autodetection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188165 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | autoconf/configure.ac | 5 | ||||
-rwxr-xr-x | cmake/config-ix.cmake | 11 | ||||
-rwxr-xr-x | configure | 177 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 18 | ||||
-rw-r--r-- | include/llvm/Config/config.h.in | 18 | ||||
-rw-r--r-- | lib/Support/Unix/Process.inc | 34 |
6 files changed, 11 insertions, 252 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 127eb6f..ceb0b9a 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1573,11 +1573,6 @@ else AC_SUBST(HAVE_LIBZ, 0) fi -dnl Try to find a suitable curses header. -if test "$llvm_cv_enable_terminfo" = "yes" ; then - AC_CHECK_HEADERS([term.h curses.h ncurses.h ncursesw.h ncurses/curses.h ncursesw/curses.h]) -fi - dnl Try to find ffi.h. if test "$llvm_cv_enable_libffi" = "yes" ; then AC_CHECK_HEADERS([ffi.h ffi/ffi.h]) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 13bd40d..9162caf 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -74,13 +74,6 @@ check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) check_include_file(mach/mach.h HAVE_MACH_MACH_H) check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H) -check_include_file(term.h HAVE_TERM_H) -check_include_file(curses.h HAVE_CURSES_H) -check_include_file(ncurses.h HAVE_NCURSES_H) -check_include_file(ncursesw.h HAVE_NCURSESW_H) -check_include_file(ncurses/curses.h HAVE_NCURSES_CURSES_H) -check_include_file(ncursesw/curses.h HAVE_NCURSESW_CURSES_H) - # library checks if( NOT PURE_WINDOWS ) check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) @@ -104,9 +97,7 @@ if( NOT PURE_WINDOWS ) else() set(HAVE_LIBZ 0) endif() - if(LLVM_ENABLE_TERMINFO AND - (HAVE_TERM_H OR HAVE_CURSES_H OR HAVE_NCURSES_H OR HAVE_NCURSESW_H OR - HAVE_NCURSES_CURSES_H OR HAVE_NCURSESW_CURSES_H)) + if(LLVM_ENABLE_TERMINFO) set(HAVE_TERMINFO 0) foreach(library tinfo curses ncurses ncursesw) string(TOUPPER ${library} library_suffix) @@ -16543,183 +16543,6 @@ else fi -if test "$llvm_cv_enable_terminfo" = "yes" ; then - - - - - - -for ac_header in term.h curses.h ncurses.h ncursesw.h ncurses/curses.h ncursesw/curses.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -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_compile") 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_objext' - { (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_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -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_cpp conftest.$ac_ext") 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); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to http://llvm.org/bugs/ ## -## ------------------------------------ ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -fi - if test "$llvm_cv_enable_libffi" = "yes" ; then diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 5090a65..572fb6f 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -48,9 +48,6 @@ /* Define to 1 if you have the `closedir' function. */ #cmakedefine HAVE_CLOSEDIR ${HAVE_CLOSEDIR} -/* Define to 1 if you have the <curses.h> header file. */ -#cmakedefine HAVE_CURSES_H - /* Define to 1 if you have the <cxxabi.h> header file. */ #cmakedefine HAVE_CXXABI_H ${HAVE_CXXABI_H} @@ -259,18 +256,6 @@ /* Define if mmap() can map files into memory */ #undef HAVE_MMAP_FILE -/* Define to 1 if you have the <ncursesw/curses.h> header file. */ -#cmakedefine HAVE_NCURSESW_CURSES_H - -/* Define to 1 if you have the <ncursesw.h> header file. */ -#cmakedefine HAVE_NCURSESW_H - -/* Define to 1 if you have the <ncurses/curses.h> header file. */ -#cmakedefine HAVE_NCURSES_CURSES_H - -/* Define to 1 if you have the <ncurses.h> header file. */ -#cmakedefine HAVE_NCURSES_H - /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H} @@ -423,9 +408,6 @@ /* Define to 1 if you have the <termios.h> header file. */ #cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H} -/* Define to 1 if you have the <term.h> header file. */ -#cmakedefine HAVE_TERM_H - /* Define if the neat program is available */ #cmakedefine HAVE_TWOPI ${HAVE_TWOPI} diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 55c66cc..6dc8c6e 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -69,9 +69,6 @@ /* can use __crashreporter_info__ */ #undef HAVE_CRASHREPORTER_INFO -/* Define to 1 if you have the <curses.h> header file. */ -#undef HAVE_CURSES_H - /* Define to 1 if you have the <cxxabi.h> header file. */ #undef HAVE_CXXABI_H @@ -285,18 +282,6 @@ /* Define if mmap() can map files into memory */ #undef HAVE_MMAP_FILE -/* Define to 1 if you have the <ncursesw/curses.h> header file. */ -#undef HAVE_NCURSESW_CURSES_H - -/* Define to 1 if you have the <ncursesw.h> header file. */ -#undef HAVE_NCURSESW_H - -/* Define to 1 if you have the <ncurses/curses.h> header file. */ -#undef HAVE_NCURSES_CURSES_H - -/* Define to 1 if you have the <ncurses.h> header file. */ -#undef HAVE_NCURSES_H - /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H @@ -458,9 +443,6 @@ /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H -/* Define to 1 if you have the <term.h> header file. */ -#undef HAVE_TERM_H - /* Define if the neat program is available */ #undef HAVE_TWOPI diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 1bb3e22..768c338 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -38,28 +38,6 @@ # include <termios.h> #endif -// Pull in the headers we found to go with the terminfo reading library (tinfo, -// curses, whatever it may be). We have to pull in the 'curses.h' header as the -// SysV spec only provides certain values and defines from that header even -// though we work hard to not link against all of the curses implementation -// when avoidable. -#ifdef HAVE_TERMINFO -# if defined(HAVE_CURSES_H) -# include <curses.h> -# elif defined(HAVE_NCURSES_H) -# include <ncurses.h> -# elif defined(HAVE_NCURSESW_H) -# include <ncursesw.h> -# elif defined(HAVE_NCURSES_CURSES_H) -# include <ncurses/curses.h> -# elif defined(HAVE_NCURSESW_CURSES_H) -# include <ncursesw/curses.h> -# endif -# if defined(HAVE_TERM_H) -# include <term.h> -# endif -#endif - //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only generic UNIX code that //=== is guaranteed to work on *all* UNIX variants. @@ -269,6 +247,14 @@ unsigned Process::StandardErrColumns() { return getColumns(2); } +#ifdef HAVE_TERMINFO +// We manually declare these two extern functions because finding the correct +// headers from various terminfo, curses, or other sources is harder than +// writing their specs down. +extern "C" int setupterm(char *term, int filedes, int *errret); +extern "C" int tigetnum(char *capname); +#endif + static bool terminalHasColors(int fd) { #ifdef HAVE_TERMINFO // First, acquire a global lock because these C routines are thread hostile. @@ -276,7 +262,7 @@ static bool terminalHasColors(int fd) { MutexGuard G(M); int errret = 0; - if (setupterm((char *)0, fd, &errret) != OK) + if (setupterm((char *)0, fd, &errret) != 0) // Regardless of why, if we can't get terminfo, we shouldn't try to print // colors. return false; @@ -294,7 +280,7 @@ static bool terminalHasColors(int fd) { // // The 'tigetnum' routine returns -2 or -1 on errors, and might return 0 if // the terminfo says that no colors are supported. - if (tigetnum("colors") > 0) + if (tigetnum((char *)"colors") > 0) return true; #endif |