llvm.org GIT mirror llvm / 3729d7d
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 Chandler Carruth 7 years ago
6 changed file(s) with 11 addition(s) and 252 deletion(s). Raw diff Collapse all Expand all
15721572 AC_SUBST(HAVE_LIBZ, 0)
15731573 fi
15741574
1575 dnl Try to find a suitable curses header.
1576 if test "$llvm_cv_enable_terminfo" = "yes" ; then
1577 AC_CHECK_HEADERS([term.h curses.h ncurses.h ncursesw.h ncurses/curses.h ncursesw/curses.h])
1578 fi
1579
15801575 dnl Try to find ffi.h.
15811576 if test "$llvm_cv_enable_libffi" = "yes" ; then
15821577 AC_CHECK_HEADERS([ffi.h ffi/ffi.h])
7373 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
7474 check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
7575
76 check_include_file(term.h HAVE_TERM_H)
77 check_include_file(curses.h HAVE_CURSES_H)
78 check_include_file(ncurses.h HAVE_NCURSES_H)
79 check_include_file(ncursesw.h HAVE_NCURSESW_H)
80 check_include_file(ncurses/curses.h HAVE_NCURSES_CURSES_H)
81 check_include_file(ncursesw/curses.h HAVE_NCURSESW_CURSES_H)
82
8376 # library checks
8477 if( NOT PURE_WINDOWS )
8578 check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
10396 else()
10497 set(HAVE_LIBZ 0)
10598 endif()
106 if(LLVM_ENABLE_TERMINFO AND
107 (HAVE_TERM_H OR HAVE_CURSES_H OR HAVE_NCURSES_H OR HAVE_NCURSESW_H OR
108 HAVE_NCURSES_CURSES_H OR HAVE_NCURSESW_CURSES_H))
99 if(LLVM_ENABLE_TERMINFO)
109100 set(HAVE_TERMINFO 0)
110101 foreach(library tinfo curses ncurses ncursesw)
111102 string(TOUPPER ${library} library_suffix)
1654216542
1654316543 fi
1654416544
16545 if test "$llvm_cv_enable_terminfo" = "yes" ; then
16546
16547
16548
16549
16550
16551
16552 for ac_header in term.h curses.h ncurses.h ncursesw.h ncurses/curses.h ncursesw/curses.h
16553 do
16554 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
16555 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
16556 { echo "$as_me:$LINENO: checking for $ac_header" >&5
16557 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
16558 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
16559 echo $ECHO_N "(cached) $ECHO_C" >&6
16560 fi
16561 ac_res=`eval echo '${'$as_ac_Header'}'`
16562 { echo "$as_me:$LINENO: result: $ac_res" >&5
16563 echo "${ECHO_T}$ac_res" >&6; }
16564 else
16565 # Is the header compilable?
16566 { echo "$as_me:$LINENO: checking $ac_header usability" >&5
16567 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
16568 cat >conftest.$ac_ext <<_ACEOF
16569 /* confdefs.h. */
16570 _ACEOF
16571 cat confdefs.h >>conftest.$ac_ext
16572 cat >>conftest.$ac_ext <<_ACEOF
16573 /* end confdefs.h. */
16574 $ac_includes_default
16575 #include <$ac_header>
16576 _ACEOF
16577 rm -f conftest.$ac_objext
16578 if { (ac_try="$ac_compile"
16579 case "(($ac_try" in
16580 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16581 *) ac_try_echo=$ac_try;;
16582 esac
16583 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16584 (eval "$ac_compile") 2>conftest.er1
16585 ac_status=$?
16586 grep -v '^ *+' conftest.er1 >conftest.err
16587 rm -f conftest.er1
16588 cat conftest.err >&5
16589 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16590 (exit $ac_status); } &&
16591 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
16592 { (case "(($ac_try" in
16593 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16594 *) ac_try_echo=$ac_try;;
16595 esac
16596 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16597 (eval "$ac_try") 2>&5
16598 ac_status=$?
16599 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16600 (exit $ac_status); }; } &&
16601 { ac_try='test -s conftest.$ac_objext'
16602 { (case "(($ac_try" in
16603 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16604 *) ac_try_echo=$ac_try;;
16605 esac
16606 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16607 (eval "$ac_try") 2>&5
16608 ac_status=$?
16609 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16610 (exit $ac_status); }; }; then
16611 ac_header_compiler=yes
16612 else
16613 echo "$as_me: failed program was:" >&5
16614 sed 's/^/| /' conftest.$ac_ext >&5
16615
16616 ac_header_compiler=no
16617 fi
16618
16619 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16620 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
16621 echo "${ECHO_T}$ac_header_compiler" >&6; }
16622
16623 # Is the header present?
16624 { echo "$as_me:$LINENO: checking $ac_header presence" >&5
16625 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
16626 cat >conftest.$ac_ext <<_ACEOF
16627 /* confdefs.h. */
16628 _ACEOF
16629 cat confdefs.h >>conftest.$ac_ext
16630 cat >>conftest.$ac_ext <<_ACEOF
16631 /* end confdefs.h. */
16632 #include <$ac_header>
16633 _ACEOF
16634 if { (ac_try="$ac_cpp conftest.$ac_ext"
16635 case "(($ac_try" in
16636 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16637 *) ac_try_echo=$ac_try;;
16638 esac
16639 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16640 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
16641 ac_status=$?
16642 grep -v '^ *+' conftest.er1 >conftest.err
16643 rm -f conftest.er1
16644 cat conftest.err >&5
16645 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16646 (exit $ac_status); } >/dev/null; then
16647 if test -s conftest.err; then
16648 ac_cpp_err=$ac_c_preproc_warn_flag
16649 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
16650 else
16651 ac_cpp_err=
16652 fi
16653 else
16654 ac_cpp_err=yes
16655 fi
16656 if test -z "$ac_cpp_err"; then
16657 ac_header_preproc=yes
16658 else
16659 echo "$as_me: failed program was:" >&5
16660 sed 's/^/| /' conftest.$ac_ext >&5
16661
16662 ac_header_preproc=no
16663 fi
16664
16665 rm -f conftest.err conftest.$ac_ext
16666 { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
16667 echo "${ECHO_T}$ac_header_preproc" >&6; }
16668
16669 # So? What about this header?
16670 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
16671 yes:no: )
16672 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
16673 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
16674 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
16675 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
16676 ac_header_preproc=yes
16677 ;;
16678 no:yes:* )
16679 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
16680 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
16681 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
16682 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
16683 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
16684 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
16685 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
16686 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
16687 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
16688 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
16689 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
16690 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
16691 ( cat <<\_ASBOX
16692 ## ------------------------------------ ##
16693 ## Report this to http://llvm.org/bugs/ ##
16694 ## ------------------------------------ ##
16695 _ASBOX
16696 ) | sed "s/^/$as_me: WARNING: /" >&2
16697 ;;
16698 esac
16699 { echo "$as_me:$LINENO: checking for $ac_header" >&5
16700 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
16701 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
16702 echo $ECHO_N "(cached) $ECHO_C" >&6
16703 else
16704 eval "$as_ac_Header=\$ac_header_preproc"
16705 fi
16706 ac_res=`eval echo '${'$as_ac_Header'}'`
16707 { echo "$as_me:$LINENO: result: $ac_res" >&5
16708 echo "${ECHO_T}$ac_res" >&6; }
16709
16710 fi
16711 if test `eval echo '${'$as_ac_Header'}'` = yes; then
16712 cat >>confdefs.h <<_ACEOF
16713 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
16714 _ACEOF
16715
16716 fi
16717
16718 done
16719
16720 fi
16721
1672216545 if test "$llvm_cv_enable_libffi" = "yes" ; then
1672316546
1672416547
4646
4747 /* Define to 1 if you have the `closedir' function. */
4848 #cmakedefine HAVE_CLOSEDIR ${HAVE_CLOSEDIR}
49
50 /* Define to 1 if you have the header file. */
51 #cmakedefine HAVE_CURSES_H
5249
5350 /* Define to 1 if you have the header file. */
5451 #cmakedefine HAVE_CXXABI_H ${HAVE_CXXABI_H}
258255 /* Define if mmap() can map files into memory */
259256 #undef HAVE_MMAP_FILE
260257
261 /* Define to 1 if you have the header file. */
262 #cmakedefine HAVE_NCURSESW_CURSES_H
263
264 /* Define to 1 if you have the header file. */
265 #cmakedefine HAVE_NCURSESW_H
266
267 /* Define to 1 if you have the header file. */
268 #cmakedefine HAVE_NCURSES_CURSES_H
269
270 /* Define to 1 if you have the header file. */
271 #cmakedefine HAVE_NCURSES_H
272
273258 /* Define to 1 if you have the header file, and it defines `DIR'. */
274259 #cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H}
275260
422407 /* Define to 1 if you have the header file. */
423408 #cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H}
424409
425 /* Define to 1 if you have the header file. */
426 #cmakedefine HAVE_TERM_H
427
428410 /* Define if the neat program is available */
429411 #cmakedefine HAVE_TWOPI ${HAVE_TWOPI}
430412
6767
6868 /* can use __crashreporter_info__ */
6969 #undef HAVE_CRASHREPORTER_INFO
70
71 /* Define to 1 if you have the header file. */
72 #undef HAVE_CURSES_H
7370
7471 /* Define to 1 if you have the header file. */
7572 #undef HAVE_CXXABI_H
284281 /* Define if mmap() can map files into memory */
285282 #undef HAVE_MMAP_FILE
286283
287 /* Define to 1 if you have the header file. */
288 #undef HAVE_NCURSESW_CURSES_H
289
290 /* Define to 1 if you have the header file. */
291 #undef HAVE_NCURSESW_H
292
293 /* Define to 1 if you have the header file. */
294 #undef HAVE_NCURSES_CURSES_H
295
296 /* Define to 1 if you have the header file. */
297 #undef HAVE_NCURSES_H
298
299284 /* Define to 1 if you have the header file, and it defines `DIR'. */
300285 #undef HAVE_NDIR_H
301286
457442 /* Define to 1 if you have the header file. */
458443 #undef HAVE_TERMIOS_H
459444
460 /* Define to 1 if you have the header file. */
461 #undef HAVE_TERM_H
462
463445 /* Define if the neat program is available */
464446 #undef HAVE_TWOPI
465447
3535 #endif
3636 #ifdef HAVE_TERMIOS_H
3737 # include
38 #endif
39
40 // Pull in the headers we found to go with the terminfo reading library (tinfo,
41 // curses, whatever it may be). We have to pull in the 'curses.h' header as the
42 // SysV spec only provides certain values and defines from that header even
43 // though we work hard to not link against all of the curses implementation
44 // when avoidable.
45 #ifdef HAVE_TERMINFO
46 # if defined(HAVE_CURSES_H)
47 # include
48 # elif defined(HAVE_NCURSES_H)
49 # include
50 # elif defined(HAVE_NCURSESW_H)
51 # include
52 # elif defined(HAVE_NCURSES_CURSES_H)
53 # include
54 # elif defined(HAVE_NCURSESW_CURSES_H)
55 # include
56 # endif
57 # if defined(HAVE_TERM_H)
58 # include
59 # endif
6038 #endif
6139
6240 //===----------------------------------------------------------------------===//
268246 return getColumns(2);
269247 }
270248
249 #ifdef HAVE_TERMINFO
250 // We manually declare these two extern functions because finding the correct
251 // headers from various terminfo, curses, or other sources is harder than
252 // writing their specs down.
253 extern "C" int setupterm(char *term, int filedes, int *errret);
254 extern "C" int tigetnum(char *capname);
255 #endif
256
271257 static bool terminalHasColors(int fd) {
272258 #ifdef HAVE_TERMINFO
273259 // First, acquire a global lock because these C routines are thread hostile.
275261 MutexGuard G(M);
276262
277263 int errret = 0;
278 if (setupterm((char *)0, fd, &errret) != OK)
264 if (setupterm((char *)0, fd, &errret) != 0)
279265 // Regardless of why, if we can't get terminfo, we shouldn't try to print
280266 // colors.
281267 return false;
293279 //
294280 // The 'tigetnum' routine returns -2 or -1 on errors, and might return 0 if
295281 // the terminfo says that no colors are supported.
296 if (tigetnum("colors") > 0)
282 if (tigetnum((char *)"colors") > 0)
297283 return true;
298284 #endif
299285