Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ if (NOT CMAKE_BUILD_TYPE)
endif (NOT CMAKE_BUILD_TYPE)


# Check for missing header files.
include(CheckIncludeFile)
check_include_file("unistd.h" HAVE_UNISTD_H)
if(HAVE_UNISTD_H)
add_compile_definitions("HAVE_UNISTD_H")
endif()


# Check for missing functions: fgetln(3) is in 4.4BSD; realpath(3) is
# in 4.4BSD, POSIX.1-2001; regcomp(3) is in POSIX.1-2001,
# POSIX.1-2008.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@ endif
CC = gcc
C++ = g++
ifneq ($(CBFDEBUG),)
CFLAGS = -g -O0 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DCBFDEBUG=1 $(HDF5CFLAGS)
CFLAGS = -g -O0 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DCBFDEBUG=1 -DHAVE_UNISTD_H $(HDF5CFLAGS)
else
CFLAGS = -g -O3 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O3 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
endif
LDFLAGS =
F90C = gfortran
Expand Down
2 changes: 1 addition & 1 deletion Makefile_LINUX
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ endif
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down
2 changes: 1 addition & 1 deletion Makefile_MINGW
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ endif
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -I/usr/include -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -I/usr/include -fno-strict-aliasing -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = g95
F90FLAGS = -g
Expand Down
3 changes: 2 additions & 1 deletion Makefile_MSYS2
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,8 @@ endif
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -DH5_HAVE_WIN32_API \
-DH5_HAVE_MINGW -DH5_USE_110_API -fno-strict-aliasing $(HDF5CFLAGS)
-DH5_HAVE_MINGW -DH5_USE_110_API -fno-strict-aliasing -DHAVE_UNISTD_H \
$(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down
2 changes: 1 addition & 1 deletion Makefile_OSX
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ endif
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down
2 changes: 2 additions & 0 deletions examples/cbf2nexus.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@
#include <ctype.h>
#include <time.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdint.h>

#include "cbf.h"
Expand Down
4 changes: 3 additions & 1 deletion examples/cif2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@
#include <time.h>
#include <errno.h>
#include "cbf_getopt.h"
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#define C2CBUFSIZ 8192

Expand Down
2 changes: 2 additions & 0 deletions examples/cif2cbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@
#include <time.h>
#include <errno.h>
#include "cbf_getopt.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

#define C2CBUFSIZ 8192
#define NUMDICTS 50
Expand Down
4 changes: 3 additions & 1 deletion examples/convert_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@
#include <math.h>
#include <errno.h>
#include "cbf_getopt.h"
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif



Expand Down
4 changes: 3 additions & 1 deletion examples/convert_minicbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@
#include <math.h>
#include <errno.h>
#include "cbf_getopt.h"
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#define CVTBUFSIZ 8192

Expand Down
1 change: 0 additions & 1 deletion examples/dectris_cbf_template_test/cbf_template_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand Down
4 changes: 3 additions & 1 deletion examples/img2cif.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@
#include <ctype.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#include "cbf_getopt.h"

Expand Down
2 changes: 2 additions & 0 deletions examples/minicbf2nexus.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@
#include <ctype.h>
#include <time.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef CBF_USE_ULP
#include <stdint.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion examples/nexus2cbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@
#include <ctype.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
#include <stdint.h>

#include <hdf5.h>
Expand Down
4 changes: 3 additions & 1 deletion examples/sequence_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
#include <time.h>
#include <errno.h>
#include "cbf_getopt.h"
#include <unistd.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>

Expand Down
1 change: 0 additions & 1 deletion examples/testflat.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <unistd.h>


int local_exit (int status);
Expand Down
1 change: 0 additions & 1 deletion examples/testflatpacked.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <unistd.h>


int local_exit (int status);
Expand Down
1 change: 0 additions & 1 deletion examples/testreals.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <unistd.h>


int local_exit (int status);
Expand Down
37 changes: 20 additions & 17 deletions m4/Makefile.m4
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ endif
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand All @@ -769,7 +769,7 @@ cbf_system,`OSX_gcc42',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand All @@ -795,7 +795,7 @@ cbf_system,`OSX_gcc42_DMALLOC',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DDMALLOC -DDMALLOC_FUNC_CHECK -DHAVE_REALPATH -I$(HOME)/include $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -std=c99 -pedantic -DDMALLOC -DDMALLOC_FUNC_CHECK -I$(HOME)/include -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand All @@ -822,7 +822,7 @@ cbf_system,`LINUX_64',`
#########################################################
CC = gcc -m64
C++ = g++ -m64
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran -m64
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down Expand Up @@ -850,7 +850,7 @@ cbf_system,`LINUX_gcc42',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand All @@ -877,7 +877,7 @@ cbf_system,`LINUX',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down Expand Up @@ -905,8 +905,9 @@ cbf_system,`LINUX_gcc42_DMALLOC', `
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing \
-DDMALLOC -DDMALLOC_FUNC_CHECK $(HDF5CFLAGS) -I$(HOME)/include
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing \
-DDMALLOC -DDMALLOC_FUNC_CHECK -DHAVE_REALPATH \
-DHAVE_UNISTD_H $(HDF5CFLAGS) -I$(HOME)/include
LDFLAGS =
F90C = gfortran
F90FLAGS = -g -fno-range-check -fno-range-check
Expand All @@ -932,8 +933,9 @@ cbf_system,`LINUX_DMALLOC',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing \
-DDMALLOC -DDMALLOC_FUNC_CHECK $(HDF5CFLAGS) -I$(HOME)/include
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing \
-DDMALLOC -DDMALLOC_FUNC_CHECK -DHAVE_REALPATH \
-DHAVE_UNISTD_H $(HDF5CFLAGS) -I$(HOME)/include
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand All @@ -960,7 +962,7 @@ cbf_system,`AIX',`
#########################################################
CC = xlc
C++ = xlC
CFLAGS = -g -O2 -Wall $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = xlf90
F90FLAGS = -g -qsuffix=f=f90
Expand All @@ -980,7 +982,7 @@ cbf_system,`MINGW',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -I/usr/include -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -I/usr/include -fno-strict-aliasing -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C = g95
F90FLAGS = -g
Expand Down Expand Up @@ -1019,7 +1021,7 @@ cbf_system,`MINGW_CROSS',`
# use default paths for utilities
#
#########################################################
CFLAGS = -m64 -g -O2 -Wall -fno-strict-aliasing -DH5_HAVE_MINGW
CFLAGS = -m64 -g -O2 -Wall -fno-strict-aliasing -DH5_HAVE_MINGW -DHAVE_UNISTD_H
LDFLAGS =
F90FLAGS = -g
F90LDFLAGS =
Expand Down Expand Up @@ -1049,7 +1051,8 @@ cbf_system,`MSYS2',`
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall -D_USE_XOPEN_EXTENDED -DH5_HAVE_WIN32_API \
-DH5_HAVE_MINGW -DH5_USE_110_API -fno-strict-aliasing $(HDF5CFLAGS)
-DH5_HAVE_MINGW -DH5_USE_110_API -fno-strict-aliasing -DHAVE_UNISTD_H \
$(HDF5CFLAGS)
LDFLAGS =
F90C = gfortran
#F90FLAGS = -g -fno-range-check -fallow-invalid-boz
Expand Down Expand Up @@ -1077,7 +1080,7 @@ cbf_system,`IRIX_gcc',`
#########################################################
CC = gcc
C++ = g++
CFLAGS = -g -O2 -Wall $(HDF5CFLAGS)
CFLAGS = -g -O2 -Wall -DHAVE_UNISTD_H $(HDF5CFLAGS)
LDFLAGS =
F90C =
F90FLAGS =
Expand Down Expand Up @@ -1105,9 +1108,9 @@ RANLIB = ',
CC = gcc
C++ = g++
ifneq ($(CBFDEBUG),)
CFLAGS = -g -O0 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DCBFDEBUG=1 $(HDF5CFLAGS)
CFLAGS = -g -O0 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DCBFDEBUG=1 -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
else
CFLAGS = -g -O3 -Wall -DHAVE_REALPATH -D_USE_XOPEN_EXTENDED -fno-strict-aliasing $(HDF5CFLAGS)
CFLAGS = -g -O3 -Wall -D_USE_XOPEN_EXTENDED -fno-strict-aliasing -DHAVE_REALPATH -DHAVE_UNISTD_H $(HDF5CFLAGS)
endif
LDFLAGS =
F90C = gfortran
Expand Down
4 changes: 3 additions & 1 deletion src/cbf_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#ifdef _WIN32
#include <direct.h>
Expand Down
2 changes: 2 additions & 0 deletions src/cbf_uncompressed.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ extern "C" {
#if !defined(_MSC_VER)
#define __USE_XOPEN
#define _XOPEN_SOURCE
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

Expand Down