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

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


On 03-Jul-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> [  --enable-deep-profiler=<directory>
>                           install the deep profiler CGI scripts in <directory>]
> 
> or
> 
> [  --enable-deep-profiler[=<directory>]
>                           enable the deep profiler, and install the
>                           deep profiler CGI scripts in <directory>
> 			  (default <directory> is /usr/lib/cgi-bin)],

I chose the former, because invoking this option without an argument is
not very useful: since the deep profiler is enabled by default if the system
has the features it needs, all it gets you is an error instead of a message
if the system does *not* have those features. That's not something you can do
much about. The negative form, --disable-deep-profiler, may be more useful,
but is hard to document in a way that does not cause more confusion than it
cures.

> It's not uncommon to do `make install' as root (many packages require that).

However, it is almost as common :-( for sysadmins with sense to refuse to do
installs as root unless they *really* trust the software provider.

> This can be done quite easily, by uncommenting the `-cp' line
> above, and making the reminder in ../Mmakefile conditional on the
> file not having already been installed.

That's what I was originally doing, but then realized that a simple test for
the existence of the installed file would do the wrong thing if the contents
have changed. At 3am, I did not think of checking the contents with cmp :-(.

> Otherwise that looks fine, but I'd like to see another diff.

It follows. I'll commit it after I test it.

BTW, does anyone know the answer to the question I added in a comment in
scripts/Mmakefile, which is why the scripts uninstall action does not remove
the Emacs Lisp file installed by that same Mmakefile?

Zoltan.

diff -u Mmakefile Mmakefile
--- Mmakefile
+++ Mmakefile
@@ -329,8 +329,10 @@
 	@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),"; \
+	@if test $(ENABLE_DEEP_PROFILER) != yes || \
+		cmp -s scripts/mdprof.in $(INSTALL_CGI_DIR)/mdprof; \
+	then true ; else \
+		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:"
diff -u configure.in configure.in
--- configure.in
+++ configure.in
@@ -465,11 +465,6 @@
 	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)
@@ -1773,8 +1768,8 @@
 # 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=<directory>
+                          install deep profiler CGI script in <directory>],
 enable_deep_profiler="$enableval",enable_deep_profiler=default)
 AC_MSG_CHECKING(whether to enable the deep profiler)
 
@@ -1782,7 +1777,7 @@
     # 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 -a "$HAVE_SIGNAL_H" = 1; then
+if test "$HAVE_UNISTD_H" = 1; then
     mercury_cv_can_enable_deep_profiler=yes
 else
     mercury_cv_can_enable_deep_profiler=no
@@ -1801,8 +1796,12 @@
 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
+		if test -d $mercury_cv_default_cgi_dir; then
+			mercury_cv_enable_deep_profiler=$mercury_cv_can_enable_deep_profiler
+			mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
+		else
+			mercury_cv_enable_deep_profiler=no
+		fi
 		;;
 	no)
 		mercury_cv_enable_deep_profiler=no
@@ -1820,15 +1819,19 @@
 			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		
+		mercury_cv_enable_deep_profiler=yes
 		;;
 esac
+
+if test $mercury_cv_enable_deep_profiler = yes; then
+	if test -d $mercury_cv_cgi_dir; then
+		true
+	else
+		echo
+		AC_MSG_ERROR(CGI script directory $mercury_cv_cgi_dir does not exist)
+		exit 1
+	fi		
+fi
 
 AC_MSG_RESULT($mercury_cv_enable_deep_profiler)
 ENABLE_DEEP_PROFILER=$mercury_cv_enable_deep_profiler
diff -u scripts/Mmakefile scripts/Mmakefile
--- scripts/Mmakefile
+++ scripts/Mmakefile
@@ -92,11 +92,13 @@
 .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)
+	# the www system administrator, which is why we don't consider a
+	# failure of this action to be an error. If the command fails,
+	# the install action in ../Mmakefile will remind the user to do
+	# the copy later.
+	-if test $(ENABLE_DEEP_PROFILER) = yes ; then \
+		cp $(CGI_SCRIPTS) $(INSTALL_CGI_DIR) ; \
+	fi
 
 #-----------------------------------------------------------------------------#
 
@@ -106,11 +108,14 @@
 	-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)
+	# We try to uninstall $(CGI_SCRIPTS), but failure to do so is not an
+	# error for two reasons: because we may simply lack permission to
+	# update the directory, and because the deep profiler installation
+	# may not have been enabled in the first place. (Looking at the current
+	# value of $(ENABLE_DEEP_PROFILER) to check for the latter wouldn't
+	# necessarily do any good, since its setting may have changed since
+	# the original install.)
+	-cd $(INSTALL_CGI_DIR) && rm $(CGI_SCRIPTS)
 
 #-----------------------------------------------------------------------------#
 
--------------------------------------------------------------------------
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