@@ -337,15 +337,20 @@ if (NOT CMAKE_BUILD_TYPE)
337337endif (NOT CMAKE_BUILD_TYPE )
338338
339339
340- # Check for missing functions: fgetln(3) is in 4.4BSD; realpath (3) is
341- # in 4.4BSD , POSIX.1-2001; regcomp (3) is in POSIX.1-2001,
342- # POSIX.1-2008.
340+ # Check for missing functions: fgetln(3) is in 4.4BSD; mkstemp (3) is
341+ # in 4.3BSD , POSIX.1-2001; realpath (3) is in 4.4BSD, POSIX.1-2001;
342+ # regex(3) is in POSIX.1-2001, POSIX.1-2008.
343343include (CheckSymbolExists)
344344check_symbol_exists(fgetln "stdio.h" HAVE_FGETLN)
345345if (HAVE_FGETLN)
346346 add_compile_definitions ("HAVE_FGETLN" )
347347endif ()
348348
349+ check_symbol_exists(mkstemp "stdlib.h" HAVE_MKSTEMP)
350+ if (HAVE_MKSTEMP)
351+ add_compile_definitions ("HAVE_MKSTEMP" )
352+ endif ()
353+
349354check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
350355if (HAVE_REALPATH)
351356 add_compile_definitions ("HAVE_REALPATH" )
@@ -1060,6 +1065,10 @@ add_executable(cbf2nexus
10601065 "${CBF__EXAMPLES} /cbf2nexus.c" )
10611066target_link_libraries (cbf2nexus
10621067 cbf)
1068+ if (NOT HAVE_MKSTEMP)
1069+ target_sources (cbf2nexus
1070+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1071+ endif ()
10631072
10641073add_executable (nexus2cbf
10651074 "${CBF__EXAMPLES} /nexus2cbf.c" )
@@ -1071,6 +1080,10 @@ add_executable(minicbf2nexus
10711080 "${CBF__EXAMPLES} /minicbf2nexus.c" )
10721081target_link_libraries (minicbf2nexus
10731082 cbf)
1083+ if (NOT HAVE_MKSTEMP)
1084+ target_sources (minicbf2nexus
1085+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1086+ endif ()
10741087
10751088add_executable (adscimg2cbf
10761089 "${CBF__EXAMPLES} /adscimg2cbf.c"
@@ -1093,11 +1106,19 @@ add_executable(convert_image
10931106 "${CBF__EXAMPLES} /convert_image.c" )
10941107target_link_libraries (convert_image
10951108 cbf)
1109+ if (NOT HAVE_MKSTEMP)
1110+ target_sources (convert_image
1111+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1112+ endif ()
10961113
10971114add_executable (convert_minicbf
10981115 "${CBF__EXAMPLES} /convert_minicbf.c" )
10991116target_link_libraries (convert_minicbf
11001117 cbf)
1118+ if (NOT HAVE_MKSTEMP)
1119+ target_sources (convert_minicbf
1120+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1121+ endif ()
11011122
11021123add_executable (makecbf
11031124 "${CBF__EXAMPLES} /makecbf.c" )
@@ -1134,13 +1155,21 @@ add_executable(img2cif
11341155 "${CBF__EXAMPLES} /img2cif.c" )
11351156target_link_libraries (img2cif
11361157 cbf)
1158+ if (NOT HAVE_MKSTEMP)
1159+ target_sources (img2cif
1160+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1161+ endif ()
11371162
11381163add_executable (cif2cbf
11391164 "${CBF__EXAMPLES} /cif2cbf.c" )
11401165target_link_libraries (cif2cbf
11411166 cbf
11421167 CQR
11431168 "${libm} " )
1169+ if (NOT HAVE_MKSTEMP)
1170+ target_sources (cif2cbf
1171+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1172+ endif ()
11441173
11451174add_executable (cbf_template_t
11461175 "${CBF__DECTRIS_EXAMPLES} /cbf_template_t.c" )
@@ -1161,6 +1190,10 @@ add_executable(sequence_match
11611190 "${CBF__EXAMPLES} /sequence_match.c" )
11621191target_link_libraries (sequence_match
11631192 cbf)
1193+ if (NOT HAVE_MKSTEMP)
1194+ target_sources (sequence_match
1195+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1196+ endif ()
11641197
11651198add_executable (test_cbf_airy_disk
11661199 "${CBF__EXAMPLES} /test_cbf_airy_disk.c" )
0 commit comments