llvm.org GIT mirror llvm / 48fd5a7
Add support for viewing graphviz graphs with xdot.py. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114832 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 8 years ago
4 changed file(s) with 105 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
978978 AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}",
979979 [Define to path to dotty program if found or 'echo dotty' otherwise])
980980 fi
981 AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py])
982 if test "$XDOT_PY" != "echo xdot.py" ; then
983 AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available])
984 dnl If we're targeting for mingw we should emit windows paths, not msys
985 if test "$llvm_cv_os_type" = "MingW" ; then
986 XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
987 fi
988 AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}",
989 [Define to path to xdot.py program if found or 'echo xdot.py' otherwise])
990 fi
981991
982992 dnl Look for a sufficiently recent version of Perl.
983993 LLVM_PROG_PERL([5.006])
728728 CIRCO
729729 GV
730730 DOTTY
731 XDOT_PY
731732 PERL
732733 HAVE_PERL
733734 INSTALL_PROGRAM
78337834 _ACEOF
78347835
78357836 fi
7837 # Extract the first word of "xdot.py", so it can be a program name with args.
7838 set dummy xdot.py; ac_word=$2
7839 { echo "$as_me:$LINENO: checking for $ac_word" >&5
7840 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
7841 if test "${ac_cv_path_XDOT_PY+set}" = set; then
7842 echo $ECHO_N "(cached) $ECHO_C" >&6
7843 else
7844 case $XDOT_PY in
7845 [\\/]* | ?:[\\/]*)
7846 ac_cv_path_XDOT_PY="$XDOT_PY" # Let the user override the test with a path.
7847 ;;
7848 *)
7849 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7850 for as_dir in $PATH
7851 do
7852 IFS=$as_save_IFS
7853 test -z "$as_dir" && as_dir=.
7854 for ac_exec_ext in '' $ac_executable_extensions; do
7855 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
7856 ac_cv_path_XDOT_PY="$as_dir/$ac_word$ac_exec_ext"
7857 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
7858 break 2
7859 fi
7860 done
7861 done
7862 IFS=$as_save_IFS
7863
7864 test -z "$ac_cv_path_XDOT_PY" && ac_cv_path_XDOT_PY="echo xdot.py"
7865 ;;
7866 esac
7867 fi
7868 XDOT_PY=$ac_cv_path_XDOT_PY
7869 if test -n "$XDOT_PY"; then
7870 { echo "$as_me:$LINENO: result: $XDOT_PY" >&5
7871 echo "${ECHO_T}$XDOT_PY" >&6; }
7872 else
7873 { echo "$as_me:$LINENO: result: no" >&5
7874 echo "${ECHO_T}no" >&6; }
7875 fi
7876
7877
7878 if test "$XDOT_PY" != "echo xdot.py" ; then
7879
7880 cat >>confdefs.h <<\_ACEOF
7881 #define HAVE_XDOT_PY 1
7882 _ACEOF
7883
7884 if test "$llvm_cv_os_type" = "MingW" ; then
7885 XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([A-Za-z]\)\//\1:\//' `
7886 fi
7887
7888 cat >>confdefs.h <<_ACEOF
7889 #define LLVM_PATH_XDOT_PY "$XDOT_PY${EXEEXT}"
7890 _ACEOF
7891
7892 fi
78367893
78377894
78387895 # Extract the first word of "perl", so it can be a program name with args.
1139311450 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1139411451 lt_status=$lt_dlunknown
1139511452 cat > conftest.$ac_ext <
11396 #line 11397 "configure"
11453 #line 11454 "configure"
1139711454 #include "confdefs.h"
1139811455
1139911456 #if HAVE_DLFCN_H
2163921696 CIRCO!$CIRCO$ac_delim
2164021697 GV!$GV$ac_delim
2164121698 DOTTY!$DOTTY$ac_delim
21699 XDOT_PY!$XDOT_PY$ac_delim
2164221700 PERL!$PERL$ac_delim
2164321701 HAVE_PERL!$HAVE_PERL$ac_delim
2164421702 INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
2170421762 LTLIBOBJS!$LTLIBOBJS$ac_delim
2170521763 _ACEOF
2170621764
21707 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 93; then
21765 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then
2170821766 break
2170921767 elif $ac_last_try; then
2171021768 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
117117 /* Define if the neat program is available */
118118 #undef HAVE_FDP
119119
120 /* Define to 1 if you have the header file. */
121 #undef HAVE_FENV_H
122
120123 /* Define if libffi is available on this platform. */
121124 #undef HAVE_FFI_CALL
122125
454457 /* Define to 1 if you have the header file. */
455458 #undef HAVE_VALGRIND_VALGRIND_H
456459
457 /* Define to 1 if you have the header file. */
458 #undef HAVE_FENV_H
459
460460 /* Define to 1 if you have the header file. */
461461 #undef HAVE_WINDOWS_H
462462
463 /* Define if the xdot.py program is available */
464 #undef HAVE_XDOT_PY
465
463466 /* Define to 1 if you have the `__dso_handle' function. */
464467 #undef HAVE___DSO_HANDLE
465468
540543
541544 /* Define to path to twopi program if found or 'echo twopi' otherwise */
542545 #undef LLVM_PATH_TWOPI
546
547 /* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */
548 #undef LLVM_PATH_XDOT_PY
543549
544550 /* Installation prefix directory */
545551 #undef LLVM_PREFIX
6868 else
6969 Filename.eraseFromDisk();
7070
71 #elif HAVE_XDOT_PY
72 sys::Path XDotPy();
73
74 std::vector args;
75 args.push_back(LLVM_PATH_XDOT_PY);
76 args.push_back(Filename.c_str());
77
78 switch (program) {
79 case GraphProgram::DOT: args.push_back("-f"); args.push_back("dot"); break;
80 case GraphProgram::FDP: args.push_back("-f"); args.push_back("fdp"); break;
81 case GraphProgram::NEATO: args.push_back("-f"); args.push_back("neato");break;
82 case GraphProgram::TWOPI: args.push_back("-f"); args.push_back("twopi");break;
83 case GraphProgram::CIRCO: args.push_back("-f"); args.push_back("circo");break;
84 default: errs() << "Unknown graph layout name; using default.\n";
85 }
86
87 args.push_back(0);
88
89 errs() << "Running 'xdot.py' program... ";
90 if (sys::Program::ExecuteAndWait(sys::Path(LLVM_PATH_XDOT_PY),
91 &args[0],0,0,0,0,&ErrMsg))
92 errs() << "Error viewing graph " << Filename.str() << ": " << ErrMsg
93 << "\n";
94 else
95 Filename.eraseFromDisk();
96
7197 #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
7298 HAVE_TWOPI || HAVE_CIRCO))
7399 sys::Path PSFilename = Filename;