diff --git a/CMakeLists.txt b/CMakeLists.txt index a29d9f6a2..80effbf4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ ENDIF() # Get system configuration find_program(UNAME NAMES uname) +IF(UNAME) macro(getuname name flag) exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") endmacro(getuname) @@ -26,7 +27,7 @@ getuname(osname -s) getuname(osrel -r) getuname(cpu -m) set(BUILDNAME "${osname}-${osrel}-${cpu}" CACHE STRING "Build name variable for CDash") - +ENDIF() ENABLE_TESTING() INCLUDE(CTest) diff --git a/include/netcdf.h b/include/netcdf.h index c644310f3..8891d4074 100644 --- a/include/netcdf.h +++ b/include/netcdf.h @@ -14,6 +14,10 @@ for more info. #include /* size_t, ptrdiff_t */ #include /* netcdf functions sometimes return system errors */ +/* Required for alloca on Windows */ +#if defined(_WIN32) || defined(_WIN64) +#include +#endif #ifdef _WIN64 #include diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am index d5bb2bafd..1320f9968 100644 --- a/libsrc/Makefile.am +++ b/libsrc/Makefile.am @@ -39,7 +39,7 @@ noinst_LTLIBRARIES = libnetcdf3.la # with m4), but they are included in the distribution so that the user # does not have to have m4. MAINTAINERCLEANFILES = attr.c ncx.c putget.c $(man_MANS) attrx.c putgetx.c -EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt +EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c # This tells make how to turn .m4 files into .c files. .m4.c: diff --git a/libsrc/putget.c b/libsrc/putget.c index 3add44aaf..f72a65b57 100644 --- a/libsrc/putget.c +++ b/libsrc/putget.c @@ -23,6 +23,9 @@ #endif #include "nc3dispatch.h" +#if defined(_WIN32) || defined(_WIN64) +#include +#endif #undef MIN /* system may define MIN somewhere and complain */ #define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn)) diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index 795955930..2bab7937d 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -123,7 +123,7 @@ ref_nc_test_netcdf4.cdl ref_tst_special_atts3.cdl tst_brecs.cdl \ ref_tst_grp_spec0.cdl ref_tst_grp_spec.cdl tst_grp_spec.sh \ ref_tst_charfill.cdl tst_charfill.cdl tst_charfill.sh \ tst_iter.sh tst_mud.sh ref_tst_mud4.cdl \ -ref_tst_ncf213.cdl CMakeLists.txt +ref_tst_ncf213.cdl CMakeLists.txt XGetopt.c # NCGEN4 additions SUBDIRS=cdl4 expected4 diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index 998da4714..14daed1a6 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -22,7 +22,7 @@ man_MANS = ncgen.1 # These files all need to be distributed. EXTRA_DIST = ncgen.y ncgenyy.c ncgen.l $(man_MANS) internals.html \ run_tests.sh run_nc4_tests.sh c0.cdl ref_camrun.cdl \ -ncf199.cdl CMakeLists.txt +ncf199.cdl CMakeLists.txt XGetopt.c # This shell script causes ncgen to build a classic and a 64-bit # offset file from a cdl file shipped with the distribution. diff --git a/ncgen3/Makefile.am b/ncgen3/Makefile.am index 2112d2d0f..a1485abf7 100644 --- a/ncgen3/Makefile.am +++ b/ncgen3/Makefile.am @@ -30,7 +30,7 @@ endif # USE_NETCDF4 CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc -EXTRA_DIST += CMakeLists.txt +EXTRA_DIST += CMakeLists.txt XGetopt.c # This is used if someone wants to rebuild ncgenyy.c or ncgentab.c # Otherwise never invoked, but records how to do it. Don't forget to diff --git a/oc2/ocinternal.h b/oc2/ocinternal.h index 42ec1e6ab..bf1a960a0 100644 --- a/oc2/ocinternal.h +++ b/oc2/ocinternal.h @@ -6,6 +6,11 @@ #include "config.h" + +#if defined(_WIN32) || defined(_WIN64) +#include +#endif + #ifdef _AIX #include #endif