* m4/ax_prefix_config_h: added macro for renaming config.h into
   rivet_config.h (or whatever we deem a good name for this file).
   Preprocessor symbols in this file are also prefixed with RIVET_

   * src/apache-2/apache_multipart_buffer.c, src/apache-2/rivetCore.c,
   src/apache-2/TclWebapache.c,src/rivetChannel.c,src/rivetCrypt.c:
   inclusion of config.h changed to reflect renaming of config.h.

   * configure.ac: new AX_PREFIX_CONFIG_H added to 'configure'
   generation. Added switch --enable-display-version for having
   Rivet's version printed in Apache signature
* Makefile.am: added handling of the macros in the 'm4' directory.

   * src/apache-2/mod_rivet.h: removed definition of preprocessor
   symbol for hiding version number in apache logs (feature now
   controlled in 'configure')

   * src/apache-2/mod_rivet.c: Changed preprocessor symbols that
   are now prefixed by 'RIVET_'. Moved #ifdef APACHE2 test misplaced
   and maybe this test is useless as we certainly are building
   against APACHE2 when compiling this file

the macro AX_PREFIX_CONFIG_H is available at

http://autoconf-archive.cryp.to/ax_prefix_config_h.html

-- Massimo
Index: configure.ac
===================================================================
--- configure.ac	(revision 701415)
+++ configure.ac	(working copy)
@@ -23,19 +23,29 @@
 #-----------------------------------------------------------------------
 
 AC_INIT([Rivet],[0.8.0])
+TEA_INIT([3.6])
+
+AC_CONFIG_AUX_DIR(tclconfig)
+AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([config.h])
 
+# AX_PREFIX_CONFIG_H is a macro taken from the autotools macro archive.
+# The typical configure generated 'config.h' can be renamed and 
+# preprocessor symbols in it can be prefixed in order to avoid clashes 
+# with Apache's config.h
+# 
+# As of today (27 Sept 2008) this macro is not part of autotools and
+# it's in the 'm4' directory
+#
+
+AX_PREFIX_CONFIG_H([rivet_config.h],[rivet])
+
 #--------------------------------------------------------------------
 # Call TEA_INIT as the first TEA_ macro to set up initial vars.
 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
 #--------------------------------------------------------------------
 
-
-TEA_INIT([3.6])
-
-AC_CONFIG_AUX_DIR(tclconfig)
-
 #
 # Init automake stuff
 #
@@ -231,7 +241,7 @@
     AC_MSG_CHECKING(for Apache base)
     AC_ARG_WITH(
         apache,
-        [  --with-apache[=DIR]    Apache server base directory],
+        [  --with-apache[=DIR] Apache server base directory],
 	, [with_apache="/usr/local/apache"]
 	)
 	apache_base="${with_apache}"
@@ -348,7 +358,7 @@
 	    APR_LDLFAGS=`${apr_found} --link-libtool --libs`
 	    AC_SUBST(APR_LDFLAGS)
     else
-        AC_MSG_ERROR([Could not find apr-1-config.  apr-1-config must be in your PATH or you must specify the location of the apr script using --with-apr-config])
+        AC_MSG_ERROR([Could not find apr-1-config. apr-1-config must be in your PATH or you must specify the location of the apr script using --with-apr-config])
     fi
 ])
 
@@ -415,6 +425,28 @@
     AC_MSG_RESULT([$with_rivet_target_dir])
 ])
 
+# --enable-version-display=[yes|no] (default: no)
+# switches on version number display in Apache's signature.
+#
+
+AC_DEFUN([DISPLAY_RIVET_VERSION],[
+    AC_ARG_ENABLE(
+        version_display,
+	[  --enable-version-display  Display Rivet version in Apache signature],
+	[ signature_version_display=$enable_version_display ],
+	[ signature_version_display="no" ]
+    )
+
+    AC_MSG_CHECKING(whether rivet version is printed in Apache signature)
+    if test "$signature_version_display" = "yes"; then
+    	AC_MSG_RESULT([yes])
+	AC_DEFINE(DISPLAY_VERSION,1,[Display Rivet version in Apache signature])
+    else
+    	AC_MSG_RESULT([no, Rivet version will be hidden])
+	AC_DEFINE(DISPLAY_VERSION,0,[Display Rivet version in Apache signature])
+    fi
+])
+
 APACHE_VERSION
 GET_RIVET_BASE
 APACHE
@@ -422,6 +454,7 @@
 APACHE_INCLUDES
 APR_HANDLING
 RIVET_TCL_LIB
+DISPLAY_RIVET_VERSION
 AC_SUBST(apache_version_dir)
 
 AC_DEFINE_UNQUOTED(RIVETLIB_DESTDIR,"${RIVET_TCL_TARGET}",[The path to the rivet tcl library])
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 701415)
+++ Makefile.am	(working copy)
@@ -7,6 +7,7 @@
 #
 #
 
+ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST=LICENSE contrib debian doc rivet win/nmakehlp.c src/testing.c src/TclWebcgi.c
 SUBDIRS = src doc
 RIVETLIB_DESTDIR = @RIVET_TCL_TARGET@
Index: src/apache-2/apache_multipart_buffer.c
===================================================================
--- src/apache-2/apache_multipart_buffer.c	(revision 701415)
+++ src/apache-2/apache_multipart_buffer.c	(working copy)
@@ -15,7 +15,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include <apr_lib.h>
Index: src/apache-2/mod_rivet.c
===================================================================
--- src/apache-2/mod_rivet.c	(revision 701415)
+++ src/apache-2/mod_rivet.c	(working copy)
@@ -18,7 +18,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include <sys/stat.h>
@@ -75,12 +75,12 @@
 
 TCL_DECLARE_MUTEX(sendMutex);
 
-/* This snippet of code came from the mod_ruby project, which is under a BSD license. */
-#ifdef APACHE2 /* Apache 2.x */
-
 #define RIVET_FILE_CTYPE	"application/x-httpd-rivet"
 #define TCL_FILE_CTYPE		"application/x-rivet-tcl"
 
+/* This snippet of code came from the mod_ruby project, which is under a BSD license. */
+#ifdef RIVET_APACHE2 /* Apache 2.x */
+
 static void ap_chdir_file(const char *file)
 {
     const  char *x;
@@ -864,7 +864,7 @@
      * We may revert to it if we can devise a mechanism that
      * links a specific installation to RivetTcl's version
      */
-    if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) {
+    if (Tcl_EvalFile(interp,RIVET_RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) {
         ap_log_error( APLOG_MARK, APLOG_ERR, APR_EGENERAL, s,
                 "init.tcl must be installed correctly for Apache Rivet to function: %s",
                 Tcl_GetStringResult(interp) );
@@ -1064,10 +1064,10 @@
 Rivet_InitHandler(apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp,
        server_rec *s)
 {
-#ifdef HIDE_RIVET_VERSION
-    ap_add_version_component(pPool, "Rivet");
+#if RIVET_DISPLAY_VERSION
+    ap_add_version_component(pPool, RIVET_PACKAGE_NAME"/"RIVET_PACKAGE_VERSION);
 #else
-    ap_add_version_component(pPool, "Rivet/"VERSION);
+    ap_add_version_component(pPool, RIVET_PACKAGE_NAME);
 #endif
     return OK;
 }
@@ -1342,7 +1342,7 @@
     extern int ap_max_requests_per_child;
 
     /* Initialize TCL stuff  */
-    Tcl_FindExecutable(NAMEOFEXECUTABLE);
+    Tcl_FindExecutable(RIVET_NAMEOFEXECUTABLE);
     interp = Tcl_CreateInterp();
 
     if (interp == NULL)
Index: src/apache-2/mod_rivet.h
===================================================================
--- src/apache-2/mod_rivet.h	(revision 701415)
+++ src/apache-2/mod_rivet.h	(working copy)
@@ -8,8 +8,8 @@
 
 /* init.tcl file relative to the server root directory */
 
-#define RIVET_DIR  RIVETLIB_DESTDIR
-#define RIVET_INIT RIVETLIB_DESTDIR"/init.tcl"
+#define RIVET_DIR  RIVET_RIVETLIB_DESTDIR
+#define RIVET_INIT RIVET_RIVETLIB_DESTDIR"/init.tcl"
 
 #if 0
 #define FILEDEBUGINFO fprintf(stderr, "Function " __FUNCTION__ "\n")
@@ -28,13 +28,6 @@
 #define THREADED_TCL 0 /* Unless you have MINGW32, modify this one! */
 #endif
 
-/* If you want to show the mod_rivet version in the server
-   information, you can define this to 0.
-
-   Otherwise, set this to 1 to hide the version from potential
-   troublemakers.  */
-#define HIDE_RIVET_VERSION 1
-
 /* End Configuration options  */
 
 /* For Tcl 8.3/8.4 compatibility - see http://mini.net/tcl/3669 */
Index: src/apache-2/rivetCore.c
===================================================================
--- src/apache-2/rivetCore.c	(revision 701415)
+++ src/apache-2/rivetCore.c	(working copy)
@@ -21,7 +21,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include <sys/stat.h>
Index: src/apache-2/TclWebapache.c
===================================================================
--- src/apache-2/TclWebapache.c	(revision 701415)
+++ src/apache-2/TclWebapache.c	(working copy)
@@ -26,7 +26,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include <tcl.h>
Index: src/rivetChannel.c
===================================================================
--- src/rivetChannel.c	(revision 701415)
+++ src/rivetChannel.c	(working copy)
@@ -17,7 +17,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include "httpd.h"
Index: src/rivetCrypt.c
===================================================================
--- src/rivetCrypt.c	(revision 701415)
+++ src/rivetCrypt.c	(working copy)
@@ -19,7 +19,7 @@
 
 /* Rivet config */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
 #endif
 
 #include <tcl.h>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to