Skip to content

Commit

Permalink
Merge branch 'master' into windows-standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
jonclayden committed Jan 11, 2024
2 parents 216dd6b + ac1016f commit 2201f16
Show file tree
Hide file tree
Showing 66 changed files with 14,511 additions and 16,092 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3

- name: Compile standalone programs
run: cd standalone && make
run: cd standalone && make -f nii_info.make

- name: Test standalone programs
run: |
Expand Down
3 changes: 2 additions & 1 deletion cleanup
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh

rm -f src/Makevars src/*.o src/niftilib/*.o src/zlib/*.o src/znzlib/*.o
rm -f src/Makevars src/*.o src/niftilib/*.o src/znzlib/*.o inst/include/zlib.h inst/include/zconf.h
rm -f src/zlib/*.o src/zlib/libz.*
49 changes: 32 additions & 17 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for RNifti 1.4.0.
# Generated by GNU Autoconf 2.71 for RNifti 1.6.0.
#
# Report bugs to <code@clayden.org>.
#
Expand Down Expand Up @@ -610,15 +610,15 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='RNifti'
PACKAGE_TARNAME='rnifti'
PACKAGE_VERSION='1.4.0'
PACKAGE_STRING='RNifti 1.4.0'
PACKAGE_VERSION='1.6.0'
PACKAGE_STRING='RNifti 1.6.0'
PACKAGE_BUGREPORT='code@clayden.org'
PACKAGE_URL=''

ac_subst_vars='LTLIBOBJS
LIBOBJS
ZLIB_OBJECTS
ZLIB_FLAGS
ZLIB_LIBPATH
ZLIB_OBJECT
OBJEXT
EXEEXT
ac_ct_CC
Expand Down Expand Up @@ -1225,7 +1225,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures RNifti 1.4.0 to adapt to many kinds of systems.
\`configure' configures RNifti 1.6.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1287,7 +1287,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of RNifti 1.4.0:";;
short | recursive ) echo "Configuration of RNifti 1.6.0:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1367,7 +1367,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
RNifti configure 1.4.0
RNifti configure 1.6.0
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1490,7 +1490,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by RNifti $as_me 1.4.0, which was
It was created by RNifti $as_me 1.6.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -2153,8 +2153,6 @@ CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
# Checks for libraries.
ZLIB_FLAGS="-Izlib"
ZLIB_OBJECTS=`ls -1 src/zlib/*.c | sed 's/^src\///' | sed 's/\\.c$/\\.o/' | tr '\n' ' '`
Expand Down Expand Up @@ -3208,8 +3206,12 @@ if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
ZLIB_FLAGS=""
ZLIB_OBJECTS=""
else $as_nop
ac_config_commands="$ac_config_commands zlib"
ZLIB_OBJECT="zlib/libz.a"
ZLIB_LIBPATH="-Lzlib"
fi
Expand Down Expand Up @@ -3754,7 +3756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by RNifti $as_me 1.4.0, which was
This file was extended by RNifti $as_me 1.6.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand All @@ -3777,6 +3779,7 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_commands="$ac_config_commands"
_ACEOF
Expand All @@ -3801,6 +3804,9 @@ Usage: $0 [OPTION]... [TAG]...
Configuration files:
$config_files
Configuration commands:
$config_commands
Report bugs to <code@clayden.org>."
_ACEOF
Expand All @@ -3809,7 +3815,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
RNifti config.status 1.4.0
RNifti config.status 1.6.0
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
Expand Down Expand Up @@ -3919,6 +3925,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"zlib") CONFIG_COMMANDS="$CONFIG_COMMANDS zlib" ;;
"src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Expand All @@ -3932,6 +3939,7 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
Expand Down Expand Up @@ -4120,7 +4128,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
eval set X " :F $CONFIG_FILES "
eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
shift
for ac_tag
do
Expand Down Expand Up @@ -4330,9 +4338,16 @@ which seems to be undefined. Please make sure it is defined" >&2;}
;;
:C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"zlib":C) cd src/zlib && ./configure --static ;;
esac
done # for ac_tag
Expand Down
15 changes: 7 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.71])
AC_INIT([RNifti], [1.4.0], [code@clayden.org])
AC_INIT([RNifti], [1.6.0], [code@clayden.org])

# Get compiler flags from R
: ${R_HOME=`R RHOME`}
Expand All @@ -18,15 +18,14 @@ CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`

# Checks for libraries.
ZLIB_FLAGS="-Izlib"
ZLIB_OBJECTS=`ls -1 src/zlib/*.c | sed 's/^src\///' | sed 's/\\.c$/\\.o/' | tr '\n' ' '`
AC_SEARCH_LIBS([inflate], [z], [
ZLIB_FLAGS=""
ZLIB_OBJECTS=""
AC_SEARCH_LIBS([inflate], [z], [], [
AC_CONFIG_COMMANDS([zlib], [cd src/zlib && ./configure --static])
ZLIB_OBJECT="zlib/libz.a"
ZLIB_LIBPATH="-Lzlib"
])

AC_SUBST(ZLIB_FLAGS)
AC_SUBST(ZLIB_OBJECTS)
AC_SUBST(ZLIB_OBJECT)
AC_SUBST(ZLIB_LIBPATH)

AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
2 changes: 2 additions & 0 deletions inst/include/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/zconf.h
/zlib.h
2 changes: 1 addition & 1 deletion inst/include/znzlib/znzlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extern "C" {
#if defined(ITKZLIB) && !defined(ITK_USE_SYSTEM_ZLIB)
#include "itk_zlib.h"
#else
#include "zlib/zlib.h"
#include "zlib.h"
#endif
#endif

Expand Down
12 changes: 9 additions & 3 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
PKG_CPPFLAGS = -DNDEBUG -DHAVE_ZLIB -DUSING_R -DRNIFTI_NIFTILIB_DEDUPLICATE -I../inst/include @ZLIB_FLAGS@
PKG_LIBS = @LIBS@
PKG_CPPFLAGS = -DNDEBUG -DHAVE_ZLIB -DUSING_R -DRNIFTI_NIFTILIB_DEDUPLICATE -I../inst/include
PKG_LIBS = @LIBS@ @ZLIB_LIBPATH@

NIFTI_OBJECTS = znzlib/znzlib.o niftilib/nifti1_io.o niftilib/nifti2_io.o
OBJECTS = main.o zzz.o @ZLIB_OBJECTS@ $(NIFTI_OBJECTS)
OBJECTS = @ZLIB_OBJECT@ main.o zzz.o $(NIFTI_OBJECTS)

$(SHLIB): $(OBJECTS)

zlib/libz.a:
cd zlib && $(MAKE) libz.a CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)"
cp zlib/zlib.h zlib/zconf.h ../inst/include/
3 changes: 2 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PKG_CPPFLAGS = -DNDEBUG -DHAVE_ZLIB -DUSING_R -DRNIFTI_NIFTILIB_DEDUPLICATE -I../inst/include
PKG_LIBS = -lz

OBJECTS = main.o zzz.o znzlib/znzlib.o niftilib/nifti1_io.o niftilib/nifti2_io.o
NIFTI_OBJECTS = znzlib/znzlib.o niftilib/nifti1_io.o niftilib/nifti2_io.o
OBJECTS = main.o zzz.o $(NIFTI_OBJECTS)
1 change: 1 addition & 0 deletions src/niftilib/nifti1_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "niftilib/nifti1_io_version.h"

#include <errno.h>
#include <limits.h>

/*****===================================================================*****/
/***** Sample functions to deal with NIFTI-1 and ANALYZE files *****/
Expand Down
12 changes: 12 additions & 0 deletions src/zlib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.a
*.o
*.dylib

*.gcda
*.gcno
*.gcov

/Makefile
/zconf.h
/zlib.pc
/configure.log

0 comments on commit 2201f16

Please sign in to comment.