changeset 1598:d7ec5d7c1a3b

Check for fork(); use for file decompression if available
author stever <stever>
date Mon, 01 Dec 2003 22:45:58 +0000
parents 148502d26f62
children 75a273bcef22
files ChangeLog NEWS configure.in libsrc/netcdf_convenience.c
diffstat 4 files changed, 37 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-11-23  Steve M. Robbins  <steve@nyongwa.montreal.qc.ca>
+
+	* configure.in: Set version to 1.3.  Check for headers sys/stat.h,
+	sys/wait.h, unistd.h; and for functions fork, system, and popen.
+
+	* libsrc/netcdf_convenience.c: Use above checks for conditional 
+	inclusion of headers.
+	(execute_decompress_command): Use fork or system to decompress
+	file, if facility available.
+
 2003-11-21  Steve ROBBINS  <stever@bic.mni.mcgill.ca>
 
 	* volume_io/Include/basic.h: Include <math.h> for M_PI definition.
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+	        New in Release 1.3
+        	------------------
+
+* Build fixes.
+
+
 	        New in Release 1.2
         	------------------
 
--- a/configure.in
+++ b/configure.in
@@ -3,10 +3,10 @@
 AC_INIT
 AC_CONFIG_SRCDIR([libsrc/minc.h])
 AC_CONFIG_AUX_DIR(ac_config_aux)
-AM_INIT_AUTOMAKE(minc, 1.2)
+AM_INIT_AUTOMAKE(minc, 1.3)
 AC_CONFIG_HEADERS([config.h])
 
-AC_REVISION($Revision: 6.12 $)
+AC_REVISION($Revision: 6.13 $)
 
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -19,7 +19,7 @@
 AC_PROG_YACC
 
 AC_HEADER_TIME
-AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_HEADERS(sys/time.h sys/stat.h sys/wait.h unistd.h)
 
 dnl Build only static libs by default
 AC_DISABLE_SHARED
@@ -39,6 +39,10 @@
 dnl Verify existence of mkstemp, tempnam, and tmpnam
 AC_CHECK_FUNCS(mkstemp tempnam tmpnam)
 
+# Functions required for execute_decompress_command().
+AC_FUNC_FORK
+AC_CHECK_FUNCS(system popen)
+
 dnl This link is needed to allow <volume_io/foo.h> style includes.
 AC_CONFIG_LINKS(volume_io/Include/volume_io:volume_io/Include)
 
--- a/libsrc/netcdf_convenience.c
+++ b/libsrc/netcdf_convenience.c
@@ -36,7 +36,10 @@
 @CREATED    : July 27, 1992. (Peter Neelin, Montreal Neurological Institute)
 @MODIFIED   : 
  * $Log: netcdf_convenience.c,v $
- * Revision 6.8  2003-03-17 16:15:33  bert
+ * Revision 6.9  2003-12-01 22:45:58  stever
+ * Check for fork(); use for file decompression if available
+ *
+ * Revision 6.8  2003/03/17 16:15:33  bert
  * Added micreate_tempfile() to resolve issues with tempfile naming and creation, especially to suppress those annoying GNU linker messages about tempnam() and tmpnam().
  *
  * Revision 6.7  2001/08/20 13:19:15  neelin
@@ -136,14 +139,21 @@
 ---------------------------------------------------------------------------- */
 
 #ifndef lint
-static char rcsid[] = "$Header: /private-cvsroot/minc/libsrc/netcdf_convenience.c,v 6.8 2003-03-17 16:15:33 bert Exp $ MINC (MNI)";
+static char rcsid[] = "$Header: /private-cvsroot/minc/libsrc/netcdf_convenience.c,v 6.9 2003-12-01 22:45:58 stever Exp $ MINC (MNI)";
 #endif
 
 #include "config.h"             /* From configure */
 #include <minc_private.h>
-#ifdef unix
+
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+
+#if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
+
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>           /* For S_IREAD, S_IWRITE */
 #endif
 
@@ -189,7 +199,7 @@
 #define BYTES_PER_OPEN (1024*64)
 #define NUM_BUFFERS_PER_OPEN ((BYTES_PER_OPEN - 1) / sizeof(buffer) + 1)
 
-#ifndef unix
+#if !(HAVE_WORKING_FORK && HAVE_SYSTEM && HAVE_POPEN)
 
    return 1;