llvm.org GIT mirror llvm / b5d5797
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 Chandler Carruth 6 years ago
2 changed file(s) with 142 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
819819 AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval",
820820 [Bug report URL.])
821821
822 dnl --enable-terminfo: check whether the user wants to control use of terminfo:
823 AC_ARG_ENABLE(terminfo,AS_HELP_STRING(
824 [--enable-terminfo],
825 [Query the terminfo database if available (default is YES)]),
826 [case "$enableval" in
827 yes) llvm_cv_enable_terminfo="yes" ;;
828 no) llvm_cv_enable_terminfo="no" ;;
829 *) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;;
830 esac],
831 llvm_cv_enable_terminfo="yes")
832
822833 dnl --enable-libffi : check whether the user wants to turn off libffi:
823834 AC_ARG_ENABLE(libffi,AS_HELP_STRING(
824835 --enable-libffi,[Check for the presence of libffi (default is NO)]),
10661077 AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
10671078 [Define if dlopen() is available on this platform.]),
10681079 AC_MSG_WARN([dlopen() not found - disabling plugin support]))
1080
1081 dnl The curses library is optional; used for querying terminal info
1082 if test "$llvm_cv_enable_terminfo" = "yes" ; then
1083 dnl We need the has_color functionality in curses for it to be useful.
1084 AC_SEARCH_LIBS(setupterm,tinfo curses ncurses ncursesw,
1085 AC_DEFINE([HAVE_TERMINFO],[1],
1086 [Define if the setupterm() function is supported this platform.]))
1087 fi
10691088
10701089 dnl libffi is optional; used to call external functions from the interpreter
10711090 if test "$llvm_cv_enable_libffi" = "yes" ; then
14081408 (default=all)
14091409 --enable-bindings Build specific language bindings:
14101410 all,auto,none,{binding-name} (default=auto)
1411 --enable-terminfo Query the terminfo database if available (default is
1412 YES)
14111413 --enable-libffi Check for the presence of libffi (default is NO)
14121414 --enable-ltdl-install install libltdl
14131415
56035605 _ACEOF
56045606
56055607
5608 # Check whether --enable-terminfo was given.
5609 if test "${enable_terminfo+set}" = set; then
5610 enableval=$enable_terminfo; case "$enableval" in
5611 yes) llvm_cv_enable_terminfo="yes" ;;
5612 no) llvm_cv_enable_terminfo="no" ;;
5613 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-terminfo. Use \"yes\" or \"no\"" >&5
5614 echo "$as_me: error: Invalid setting for --enable-terminfo. Use \"yes\" or \"no\"" >&2;}
5615 { (exit 1); exit 1; }; } ;;
5616 esac
5617 else
5618 llvm_cv_enable_terminfo="yes"
5619 fi
5620
5621
56065622 # Check whether --enable-libffi was given.
56075623 if test "${enable_libffi+set}" = set; then
56085624 enableval=$enable_libffi; case "$enableval" in
1033810354 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1033910355 lt_status=$lt_dlunknown
1034010356 cat > conftest.$ac_ext <
10341 #line 10342 "configure"
10357 #line 10358 "configure"
1034210358 #include "confdefs.h"
1034310359
1034410360 #if HAVE_DLFCN_H
1246012476 echo "$as_me: WARNING: dlopen() not found - disabling plugin support" >&2;}
1246112477 fi
1246212478
12479
12480 if test "$llvm_cv_enable_terminfo" = "yes" ; then
12481 { echo "$as_me:$LINENO: checking for library containing setupterm" >&5
12482 echo $ECHO_N "checking for library containing setupterm... $ECHO_C" >&6; }
12483 if test "${ac_cv_search_setupterm+set}" = set; then
12484 echo $ECHO_N "(cached) $ECHO_C" >&6
12485 else
12486 ac_func_search_save_LIBS=$LIBS
12487 cat >conftest.$ac_ext <<_ACEOF
12488 /* confdefs.h. */
12489 _ACEOF
12490 cat confdefs.h >>conftest.$ac_ext
12491 cat >>conftest.$ac_ext <<_ACEOF
12492 /* end confdefs.h. */
12493
12494 /* Override any GCC internal prototype to avoid an error.
12495 Use char because int might match the return type of a GCC
12496 builtin and then its argument prototype would still apply. */
12497 #ifdef __cplusplus
12498 extern "C"
12499 #endif
12500 char setupterm ();
12501 int
12502 main ()
12503 {
12504 return setupterm ();
12505 ;
12506 return 0;
12507 }
12508 _ACEOF
12509 for ac_lib in '' tinfo curses ncurses ncursesw; do
12510 if test -z "$ac_lib"; then
12511 ac_res="none required"
12512 else
12513 ac_res=-l$ac_lib
12514 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
12515 fi
12516 rm -f conftest.$ac_objext conftest$ac_exeext
12517 if { (ac_try="$ac_link"
12518 case "(($ac_try" in
12519 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12520 *) ac_try_echo=$ac_try;;
12521 esac
12522 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12523 (eval "$ac_link") 2>conftest.er1
12524 ac_status=$?
12525 grep -v '^ *+' conftest.er1 >conftest.err
12526 rm -f conftest.er1
12527 cat conftest.err >&5
12528 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12529 (exit $ac_status); } &&
12530 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
12531 { (case "(($ac_try" in
12532 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12533 *) ac_try_echo=$ac_try;;
12534 esac
12535 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12536 (eval "$ac_try") 2>&5
12537 ac_status=$?
12538 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12539 (exit $ac_status); }; } &&
12540 { ac_try='test -s conftest$ac_exeext'
12541 { (case "(($ac_try" in
12542 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12543 *) ac_try_echo=$ac_try;;
12544 esac
12545 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12546 (eval "$ac_try") 2>&5
12547 ac_status=$?
12548 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12549 (exit $ac_status); }; }; then
12550 ac_cv_search_setupterm=$ac_res
12551 else
12552 echo "$as_me: failed program was:" >&5
12553 sed 's/^/| /' conftest.$ac_ext >&5
12554
12555
12556 fi
12557
12558 rm -f core conftest.err conftest.$ac_objext \
12559 conftest$ac_exeext
12560 if test "${ac_cv_search_setupterm+set}" = set; then
12561 break
12562 fi
12563 done
12564 if test "${ac_cv_search_setupterm+set}" = set; then
12565 :
12566 else
12567 ac_cv_search_setupterm=no
12568 fi
12569 rm conftest.$ac_ext
12570 LIBS=$ac_func_search_save_LIBS
12571 fi
12572 { echo "$as_me:$LINENO: result: $ac_cv_search_setupterm" >&5
12573 echo "${ECHO_T}$ac_cv_search_setupterm" >&6; }
12574 ac_res=$ac_cv_search_setupterm
12575 if test "$ac_res" != no; then
12576 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12577
12578 cat >>confdefs.h <<\_ACEOF
12579 #define HAVE_TERMINFO 1
12580 _ACEOF
12581
12582 fi
12583
12584 fi
1246312585
1246412586 if test "$llvm_cv_enable_libffi" = "yes" ; then
1246512587 { echo "$as_me:$LINENO: checking for library containing ffi_call" >&5