jim 99/05/21 16:58:01
Modified: src Configure
src/helpers TestCompile
src/modules/standard mod_include.c
Log:
The final phases of the great 'quad' update.
ap_snprintf() can now handle quads, assuming the compiler knows
about them, and we now determine which type is the off_t
typedef
Revision Changes Path
1.347 +38 -0 apache-1.3/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -r1.346 -r1.347
--- Configure 1999/05/17 08:00:03 1.346
+++ Configure 1999/05/21 23:57:48 1.347
@@ -1845,6 +1845,44 @@
fi
####################################################################
+## More building ap_config_auto.h
+##
+## We check to see if this OS and/or compiler supports long-long
+##
+echo " + checking for the long long data type"
+if ./helpers/TestCompile sizeof "long long"; then
+ AP_LONGEST_LONG="long long"
+else
+ AP_LONGEST_LONG="long"
+fi
+echo "" >>$AP_CONFIG_AUTO_H
+echo "/* determine: longest possible integer type */" >>$AP_CONFIG_AUTO_H
+echo "#ifndef AP_LONGEST_LONG" >>$AP_CONFIG_AUTO_H
+echo "#define AP_LONGEST_LONG $AP_LONGEST_LONG" >>$AP_CONFIG_AUTO_H
+echo "#endif" >>$AP_CONFIG_AUTO_H
+
+##
+## Now compare the sizes of off_t to long
+##
+echo " + determining if off_t is quad or long"
+AP_TYPE_OFF_T=`./helpers/TestCompile -r sizeof off_t`
+AP_TYPE_LONG=`./helpers/TestCompile -r sizeof long`
+if [ "x$AP_TYPE_OFF_T" != "x" ] && [ "x$AP_TYPE_OFF_T" != "x$AP_TYPE_LONG" ]
+then
+ echo "" >>$AP_CONFIG_AUTO_H
+ echo "/* determine: is off_t a quad */" >>$AP_CONFIG_AUTO_H
+ echo "#ifndef AP_OFF_T_IS_QUAD" >>$AP_CONFIG_AUTO_H
+ echo "#define AP_OFF_T_IS_QUAD 1" >>$AP_CONFIG_AUTO_H
+ echo "#endif" >>$AP_CONFIG_AUTO_H
+else
+ echo "" >>$AP_CONFIG_AUTO_H
+ echo "/* determine: is off_t a quad */" >>$AP_CONFIG_AUTO_H
+ echo "#ifndef AP_OFF_T_IS_QUAD" >>$AP_CONFIG_AUTO_H
+ echo "#undef AP_OFF_T_IS_QUAD" >>$AP_CONFIG_AUTO_H
+ echo "#endif" >>$AP_CONFIG_AUTO_H
+fi
+
+####################################################################
## Finish building ap_config_auto.h
##
## We pick out all -D's from CFLAGS and insert them as defines into
1.28 +33 -1 apache-1.3/src/helpers/TestCompile
Index: TestCompile
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/helpers/TestCompile,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- TestCompile 1999/04/28 08:40:44 1.27
+++ TestCompile 1999/05/21 23:57:53 1.28
@@ -22,6 +22,10 @@
# ./helpers/TestCompile sanity
# Which does a simple sanity check/test compile
#
+# ./helpers/TestCompile sizeof <type>
+# Which prints out the sizeof <type> (sure would be nice
+# if sizeof could be use in preprocessor if's)
+#
# It does these by creating a small mini-makefile, based on
# ../Makefile.config and trying to compile a small dummy
# program. If the compilation succeeds, we assume the test
@@ -41,8 +45,9 @@
cd ./helpers
#
-# Handle "verbose" and "silent" flags
+# Handle "verbose", "silent" and "runit" flags
#
+RUNIT="no"
case "$1" in
"-v")
VERBOSE="yes"
@@ -52,6 +57,10 @@
VERBOSE="no"
shift
;;
+ "-r")
+ RUNIT="yes"
+ shift
+ ;;
esac
#
@@ -76,6 +85,26 @@
echo "int main(void) { $3(); return(0); }" > testfunc.c
fi
;;
+ "sizeof")
+ if [ "x$2" = "x" ]; then
+ exit
+ fi
+ TLIB=""
+ if [ "x$VERBOSE" = "xyes" ]; then
+ ERRDIR=""
+ else
+ ERRDIR='2>/dev/null'
+ fi
+ TARGET='testfunc'
+ cat <<EOF >testfunc.c
+#include <stdio.h>
+#include <sys/types.h>
+int main(void) {
+ printf("%d\n", sizeof($2));
+ return(0);
+}
+EOF
+ ;;
"sanity")
TLIB=""
if [ "x$VERBOSE" = "xno" ]; then
@@ -154,5 +183,8 @@
# have PrintPath just search this directory.
if ./PrintPath -s -p`pwd` $TARGET ; then
+ if [ "x$RUNIT" = "xyes" ]; then
+ `pwd`/$TARGET
+ fi
exstat=0
fi
1.118 +2 -3 apache-1.3/src/modules/standard/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_include.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- mod_include.c 1999/05/21 12:16:25 1.117
+++ mod_include.c 1999/05/21 23:57:57 1.118
@@ -1134,9 +1134,8 @@
}
else {
int l, x;
-#if defined(BSD) && BSD > 199305
- /* ap_snprintf can't handle %qd */
- sprintf(tag, "%qd", finfo.st_size);
+#if defined(AP_OFF_T_IS_QUAD)
+ ap_snprintf(tag, sizeof(tag), "%qd", finfo.st_size);
#else
ap_snprintf(tag, sizeof(tag), "%ld", finfo.st_size);
#endif