diff options
-rwxr-xr-x | configure | 23 | ||||
-rw-r--r-- | stream.c | 12 |
2 files changed, 30 insertions, 5 deletions
@@ -3228,7 +3228,7 @@ if [ -z "$have_winsize" ] ; then printf "no\n" fi -printf "Checking for mkstemp/mkdtemp ... " +printf "Checking for mkstemp ... " cat > conftest.c <<! #include <stdlib.h> @@ -3237,7 +3237,6 @@ int main(int argc, char **argv) { char templ[] = "abcXXXXXX"; int fd = mkstemp(templ); - char *s = mkdtemp(templ); return 0; } ! @@ -3249,6 +3248,26 @@ else printf "no\n" fi +printf "Checking for mkdtemp ... " + +cat > conftest.c <<! +#include <stdlib.h> + +int main(int argc, char **argv) +{ + char templ[] = "abcXXXXXX"; + char *s = mkdtemp(templ); + return 0; +} +! + +if conftest ; then + printf "yes\n" + printf "#define HAVE_MKDTEMP 1\n" >> config.h +else + printf "no\n" +fi + printf "Checking for mkstemps ... " cat > conftest.c <<! @@ -4954,7 +4954,7 @@ val tmpfile_wrap(void) num(errno), errno_to_str(errno), nao); } -#if HAVE_MKSTEMP +#if HAVE_MKDTEMP val mkdtemp_wrap(val prefix) { @@ -4971,6 +4971,10 @@ val mkdtemp_wrap(val prefix) num(errno), errno_to_str(errno), nao); } +#endif + +#if HAVE_MKSTEMP + val mkstemp_wrap(val prefix, val suffix) { val self = lit("mkstemp"); @@ -4988,7 +4992,7 @@ val mkstemp_wrap(val prefix, val suffix) free(tmpl); uw_throwf(system_error_s, lit("~a: suffix not supported"), self, nao); } - fd = mkstemps(tmpl); + fd = mkstemp(tmpl); #endif name = string_utf8(tmpl); free(tmpl); @@ -5196,8 +5200,10 @@ void stream_init(void) reg_varl(intern(lit("indent-code"), user_package), num_fast(indent_code)); reg_varl(intern(lit("indent-foff"), user_package), num_fast(indent_foff)); reg_fun(intern(lit("tmpfile"), user_package), func_n0(tmpfile_wrap)); -#if HAVE_MKSTEMP +#if HAVE_MKDTEMP reg_fun(intern(lit("mkdtemp"), user_package), func_n1(mkdtemp_wrap)); +#endif +#if HAVE_MKSTEMP reg_fun(intern(lit("mkstemp"), user_package), func_n2o(mkstemp_wrap, 1)); #endif |