[m-rev.] for review: deep profiler installation

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Jul 3 13:44:10 AEST 2001


For review by Fergus.

Zoltan.

Add rules for installing the deep profiler from source. (Installing it from
binary distributions is future work.)

configure.in:
	Add an option, --enable-deep-profiler=/path/name, that specifies the
	path name of the directory in which the CGI script should be installed
	(the default is apache's /usr/lib/cgi-bin).

	Report an error if the user requests deep profiling but it is not
	available.

Mmakefile:
	Remind the user to copy the CGI script to its directory.

scripts/Mmakefile:
	Document why we can't install the CGI script automatically.

	Be consistent about the order of rules.

scripts/Mmake.vars.in:
	Record the CGI directory for use in the toplevel Mmakefile.
	

scripts/mdprof.in:
	Record that mdprof_cgi and mdprof_server are installed in the directory
	for non-user-visible programs, alongside mercury_compile and
	mercury_profile.

cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.66
diff -u -b -r1.66 Mmakefile
--- Mmakefile	2001/05/31 05:59:27	1.66
+++ Mmakefile	2001/07/03 03:35:02
@@ -329,6 +329,9 @@
 	@echo "-- Don't forget to add $(INSTALL_BINDIR) to your PATH,"
 	@echo "-- $(INSTALL_MAN_DIR) to your MANPATH,"
 	@echo "-- and $(INSTALL_INFO_DIR) to your INFOPATH,"
+	@if test $(ENABLE_DEEP_PROFILER) = yes; then \
+	echo "-- to copy scripts/mdprof to $(INSTALL_CGI_DIR),"; \
+	fi
 	@echo "-- and to add the following lines to the \`.emacs' file"
 	@echo "-- in your home directory:"
 	@echo "	(setq load-path (cons (expand-file-name "
@@ -339,7 +342,8 @@
 install_main: all \
 		install_scripts install_util install_runtime install_boehm_gc \
   		install_library install_browser install_trace \
-		install_compiler install_profiler install_deep_profiler install_doc 
+		install_compiler install_profiler install_deep_profiler \
+		install_doc 
  
 .PHONY: install_scripts
 install_scripts: scripts
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.268
diff -u -b -r1.268 configure.in
--- configure.in	2001/07/03 02:43:57	1.268
+++ configure.in	2001/07/03 03:40:08
@@ -189,7 +189,7 @@
 		done
 		;;
 	*)
-		# The user has specifies the gcc source directory via
+		# The user has specified the gcc source directory via
 		# `--enable-gcc-back-end=<directory>'.  Check that
 		# they specified it correctly.
 		gcc_src_dir="$enable_gcc_back_end"
@@ -465,6 +465,11 @@
 	AC_DEFINE(HAVE_UNISTD_H)
 fi
 #-----------------------------------------------------------------------------#
+AC_CHECK_HEADER(signal.h, HAVE_SIGNAL_H=1)
+if test "$HAVE_SIGNAL_H" = 1; then
+	AC_DEFINE(HAVE_SIGNAL)
+fi
+#-----------------------------------------------------------------------------#
 AC_CHECK_HEADER(sys/wait.h, HAVE_SYS_WAIT_H=1)
 if test "$HAVE_SYS_WAIT_H" = 1; then
 	AC_DEFINE(HAVE_SYS_WAIT)
@@ -1767,16 +1772,20 @@
 #
 # Add an option that disables the deep profiler.
 #
+AC_ARG_ENABLE(deep-profiler,
+[  --enable-deep-profiler=...
+                          install deep profiler CGI script in this directory],
+enable_deep_profiler="$enableval",enable_deep_profiler=default)
 AC_MSG_CHECKING(whether to enable the deep profiler)
 
     # This test may need to be made more specific at a later date.
     # Currently it only distinguishes between systems which have
     # unistd.h or not, but at a later date we may also need to test for
     # other posix features.
-if test "$HAVE_UNISTD_H" = 1; then
-    mercury_cv_enable_deep_profiler=yes
+if test "$HAVE_UNISTD_H" = 1 -a "$HAVE_SIGNAL_H" = 1; then
+    mercury_cv_can_enable_deep_profiler=yes
 else
-    mercury_cv_enable_deep_profiler=no
+    mercury_cv_can_enable_deep_profiler=no
 fi
 
 # on x86, gcc version egcs-1.1.2 has a bug which causes it to get
@@ -1785,13 +1794,47 @@
 # So if we're using an egcs version of gcc, disable deep profiling.
 case "$host" in i*86-*-*)
     case "$mercury_cv_egcs" in yes)
-	mercury_cv_enable_deep_profiler=no ;;
+	mercury_cv_can_enable_deep_profiler=no ;;
     esac ;;
 esac
 
+mercury_cv_default_cgi_dir=/usr/lib/cgi-bin
+case $enable_deep_profiler in
+	default)
+		mercury_cv_enable_deep_profiler=$mercury_cv_can_enable_deep_profiler
+		mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
+		;;
+	no)
+		mercury_cv_enable_deep_profiler=no
+		;;
+	*)
+		if test $enable_deep_profiler = yes; then
+			mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
+		else
+			mercury_cv_cgi_dir=$enable_deep_profiler
+		fi
+
+		if test $mercury_cv_can_enable_deep_profiler = no; then
+			echo
+			AC_MSG_ERROR(--enable-deep-profiler specified but system does not support it)
+			exit 1
+		fi
+
+		if test -d $mercury_cv_cgi_dir; then
+			mercury_cv_enable_deep_profiler=yes
+		else
+			echo
+			AC_MSG_ERROR(--enable-deep-profiler specified but $mercury_cv_cgi_dir does not exist)
+			exit 1
+		fi		
+		;;
+esac
+
 AC_MSG_RESULT($mercury_cv_enable_deep_profiler)
 ENABLE_DEEP_PROFILER=$mercury_cv_enable_deep_profiler
 AC_SUBST(ENABLE_DEEP_PROFILER)
+CGIDIR=$mercury_cv_cgi_dir
+AC_SUBST(CGIDIR)
 #-----------------------------------------------------------------------------#
 
 # Figure out which flavour of pthreads to use, since none of the
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.46
diff -u -b -r1.46 Mmake.vars.in
--- scripts/Mmake.vars.in	2001/06/18 05:58:15	1.46
+++ scripts/Mmake.vars.in	2001/07/02 13:58:04
@@ -476,7 +476,7 @@
 #-----------------------------------------------------------------------------#
 
 # Specify the locations for installing things.
-# These directories can all be modified independantly.
+# These directories can all be modified independently.
 # In particular, you might want to find a better place for the DVI and
 # HTML files.
 
@@ -516,6 +516,7 @@
 INSTALL_HTML_DIR	= $(INSTALL_PREFIX)/lib/mercury/html
 INSTALL_MDB_DOC_DIR	= $(INSTALL_PREFIX)/lib/mercury/mdb
 INSTALL_ELISP_DIR	= $(INSTALL_PREFIX)/lib/mercury/elisp
+INSTALL_CGI_DIR		= @CGIDIR@
 
 # You should not need to override anything below here
 
Index: scripts/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmakefile,v
retrieving revision 1.22
diff -u -b -r1.22 Mmakefile
--- scripts/Mmakefile	2001/05/27 10:52:08	1.22
+++ scripts/Mmakefile	2001/07/03 03:28:38
@@ -20,6 +20,7 @@
 	  mercury.bat
 DEBUGGER_SCRIPTS = mdbrc
 EMACS_SCRIPTS = gud.el
+CGI_SCRIPTS = mdprof
 
 #-----------------------------------------------------------------------------#
 
@@ -33,7 +34,7 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: all
-all: $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS)
+all: $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS) $(CGI_SCRIPTS)
 all: Mmake.vars
 
 #-----------------------------------------------------------------------------#
@@ -47,7 +48,7 @@
 
 .PHONY: install
 install: install_mmake install_scripts \
-	install_debugger_scripts install_emacs_scripts
+	install_debugger_scripts install_emacs_scripts install_cgi_scripts
 
 .PHONY: install_dirs
 install_dirs:
@@ -74,10 +75,6 @@
 	done
 	-rm -f $(INSTALL_BINDIR)/mmake.old
 
-.PHONY: install_emacs_scripts
-install_emacs_scripts: $(EMACS_SCRIPTS) install_dirs
-	cp $(EMACS_SCRIPTS) $(INSTALL_ELISP_DIR)
-
 .PHONY: install_debugger_scripts
 install_debugger_scripts: $(DEBUGGER_SCRIPTS) install_dirs
 	# Reportedly old versions of Mercury
@@ -88,6 +85,19 @@
 	-chmod u+w $(INSTALL_LIBDIR)/mdb/*
 	cp $(DEBUGGER_SCRIPTS) $(INSTALL_LIBDIR)/mdb 
 
+.PHONY: install_emacs_scripts
+install_emacs_scripts: $(EMACS_SCRIPTS) install_dirs
+	cp $(EMACS_SCRIPTS) $(INSTALL_ELISP_DIR)
+
+.PHONY: install_cgi_scripts
+install_cgi_scripts: $(CGI_SCRIPTS)
+	# $(INSTALL_CGI_DIR) is likely to be writeable only by root or
+	# the www system administrator, which is why we don't try to install
+	# it here. (If we did try, the action would have to be conditional on
+	# $(ENABLE_DEEP_PROFILER).) Instead, the install action in ../Mmakefile
+	# will remind the user to do the copy later.
+	# -cp $(CGI_SCRIPTS) $(INSTALL_CGI_DIR)
+
 #-----------------------------------------------------------------------------#
 
 .PHONY: uninstall
@@ -95,6 +105,12 @@
 	-rm -r $(INSTALL_LIBDIR)/mmake
 	-cd $(INSTALL_BINDIR) && rm $(SCRIPTS) 
 	-cd $(INSTALL_LIBDIR)/mdb && rm $(DEBUGGER_SCRIPTS)
+	# Is there any reason why we don't uninstall $(EMACS_SCRIPTS) here?
+	# We don't uninstall $(CGI_SCRIPTS) because we probably don't have
+	# permission, and because the deep profiler installation may not have
+	# been enabled in the first place. If we wanted to try, the action
+	# would be the following:
+	# -cd $(INSTALL_CGI_DIR) && rm $(CGI_SCRIPTS)
 
 #-----------------------------------------------------------------------------#
 
Index: scripts/mdprof.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mdprof.in,v
retrieving revision 1.1
diff -u -b -r1.1 mdprof.in
--- scripts/mdprof.in	2001/05/31 06:00:20	1.1
+++ scripts/mdprof.in	2001/07/02 14:06:02
@@ -15,6 +15,6 @@
 # unprocessed, which is what we want; the web servers breaks up QUERY_STRING
 # on boundaries inappropriate for us when computing the command line arguments.
 
-PATH=@PREFIX@/bin:$PATH
+PATH=@prefix@/lib/mercury/bin/@FULLARCH@:$PATH
 export PATH
 exec mdprof_cgi
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list