@@ -345,15 +345,20 @@ if(HAVE_UNISTD_H)
345345endif ()
346346
347347
348- # Check for missing functions: fgetln(3) is in 4.4BSD; realpath (3) is
349- # in 4.4BSD , POSIX.1-2001; regcomp (3) is in POSIX.1-2001,
350- # POSIX.1-2008.
348+ # Check for missing functions: fgetln(3) is in 4.4BSD; mkstemp (3) is
349+ # in 4.3BSD , POSIX.1-2001; realpath (3) is in 4.4BSD, POSIX.1-2001;
350+ # regex(3) is in POSIX.1-2001, POSIX.1-2008.
351351include (CheckSymbolExists)
352352check_symbol_exists(fgetln "stdio.h" HAVE_FGETLN)
353353if (HAVE_FGETLN)
354354 add_compile_definitions ("HAVE_FGETLN" )
355355endif ()
356356
357+ check_symbol_exists(mkstemp "stdlib.h" HAVE_MKSTEMP)
358+ if (HAVE_MKSTEMP)
359+ add_compile_definitions ("HAVE_MKSTEMP" )
360+ endif ()
361+
357362check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
358363if (HAVE_REALPATH)
359364 add_compile_definitions ("HAVE_REALPATH" )
@@ -1116,6 +1121,10 @@ add_executable(cbf2nexus
11161121 "${CBF__EXAMPLES} /cbf2nexus.c" )
11171122target_link_libraries (cbf2nexus
11181123 cbf)
1124+ if (NOT HAVE_MKSTEMP)
1125+ target_sources (cbf2nexus
1126+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1127+ endif ()
11191128
11201129add_executable (nexus2cbf
11211130 "${CBF__EXAMPLES} /nexus2cbf.c" )
@@ -1127,6 +1136,10 @@ add_executable(minicbf2nexus
11271136 "${CBF__EXAMPLES} /minicbf2nexus.c" )
11281137target_link_libraries (minicbf2nexus
11291138 cbf)
1139+ if (NOT HAVE_MKSTEMP)
1140+ target_sources (minicbf2nexus
1141+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1142+ endif ()
11301143
11311144add_executable (adscimg2cbf
11321145 "${CBF__EXAMPLES} /adscimg2cbf.c"
@@ -1149,11 +1162,19 @@ add_executable(convert_image
11491162 "${CBF__EXAMPLES} /convert_image.c" )
11501163target_link_libraries (convert_image
11511164 cbf)
1165+ if (NOT HAVE_MKSTEMP)
1166+ target_sources (convert_image
1167+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1168+ endif ()
11521169
11531170add_executable (convert_minicbf
11541171 "${CBF__EXAMPLES} /convert_minicbf.c" )
11551172target_link_libraries (convert_minicbf
11561173 cbf)
1174+ if (NOT HAVE_MKSTEMP)
1175+ target_sources (convert_minicbf
1176+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1177+ endif ()
11571178
11581179add_executable (makecbf
11591180 "${CBF__EXAMPLES} /makecbf.c" )
@@ -1190,13 +1211,30 @@ add_executable(img2cif
11901211 "${CBF__EXAMPLES} /img2cif.c" )
11911212target_link_libraries (img2cif
11921213 cbf)
1214+ if (NOT HAVE_MKSTEMP)
1215+ target_sources (img2cif
1216+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1217+ endif ()
1218+
1219+ add_executable (cif2c
1220+ "${CBF__EXAMPLES} /cif2c.c" )
1221+ target_link_libraries (cif2c
1222+ cbf)
1223+ if (NOT HAVE_MKSTEMP)
1224+ target_sources (cif2c
1225+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1226+ endif ()
11931227
11941228add_executable (cif2cbf
11951229 "${CBF__EXAMPLES} /cif2cbf.c" )
11961230target_link_libraries (cif2cbf
11971231 cbf
11981232 CQR
11991233 "${libm} " )
1234+ if (NOT HAVE_MKSTEMP)
1235+ target_sources (cif2cbf
1236+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1237+ endif ()
12001238
12011239add_executable (cbf_template_t
12021240 "${CBF__DECTRIS_EXAMPLES} /cbf_template_t.c" )
@@ -1224,6 +1262,10 @@ add_executable(sequence_match
12241262 "${CBF__EXAMPLES} /sequence_match.c" )
12251263target_link_libraries (sequence_match
12261264 cbf)
1265+ if (NOT HAVE_MKSTEMP)
1266+ target_sources (sequence_match
1267+ PRIVATE "${CBF__SRC} /mkstemp.c" )
1268+ endif ()
12271269
12281270add_executable (test_cbf_airy_disk
12291271 "${CBF__EXAMPLES} /test_cbf_airy_disk.c" )
0 commit comments