[MINC-development] minc-patch: fixing check for gunzip

Steve ROBBINS minc-development@bic.mni.mcgill.ca
Sun, 23 Nov 2003 14:17:08 -0500


--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Nov 23, 2003 at 10:59:09AM -0500, Steve ROBBINS wrote:
 
> The function execute_decompress_command() requires the unix-like (probably
> POSIX is enough) functions: system(), popen(), and fork().  I'd suggest
> an alternate patch that checks for those three functions, rather than
> for "gzip".  I'll post a patch later today.
 
Here's the proposed patch.

-S


 

--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

? minc-1.3.tar.gz
Index: ChangeLog
===================================================================
RCS file: /software/source/minc/cvsroot/minc/ChangeLog,v
retrieving revision 1.26
diff -u -b -B -r1.26 ChangeLog
--- ChangeLog	23 Nov 2003 16:07:11 -0000	1.26
+++ ChangeLog	23 Nov 2003 19:14:14 -0000
@@ -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.
Index: NEWS
===================================================================
RCS file: /software/source/minc/cvsroot/minc/NEWS,v
retrieving revision 1.7
diff -u -b -B -r1.7 NEWS
--- NEWS	14 Nov 2003 05:01:51 -0000	1.7
+++ NEWS	23 Nov 2003 19:14:15 -0000
@@ -1,3 +1,9 @@
+	        New in Release 1.3
+        	------------------
+
+* Build fixes.
+
+
 	        New in Release 1.2
         	------------------
 
Index: configure.in
===================================================================
RCS file: /software/source/minc/cvsroot/minc/configure.in,v
retrieving revision 6.12
diff -u -b -B -r6.12 configure.in
--- configure.in	14 Nov 2003 05:01:51 -0000	6.12
+++ configure.in	23 Nov 2003 19:14:15 -0000
@@ -3,7 +3,7 @@
 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 $)
@@ -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
@@ -38,6 +38,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)
Index: libsrc/netcdf_convenience.c
===================================================================
RCS file: /software/source/minc/cvsroot/minc/libsrc/netcdf_convenience.c,v
retrieving revision 6.8
diff -u -b -B -r6.8 netcdf_convenience.c
--- libsrc/netcdf_convenience.c	17 Mar 2003 16:15:33 -0000	6.8
+++ libsrc/netcdf_convenience.c	23 Nov 2003 19:14:17 -0000
@@ -141,9 +141,16 @@
 
 #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 +196,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;
 

--fdj2RfSjLxBAspz7--