diff --git a/config2.h.in b/config2.h.in index 61406678..bca65592 100644 --- a/config2.h.in +++ b/config2.h.in @@ -822,6 +822,9 @@ /* Define to 1 if you have the `__argz_stringify' function. */ #mesondefine HAVE___ARGZ_STRINGIFY +/* Define to 1 if you have the `mkstemps' function. */ +#mesondefine HAVE_MKSTEMPS + /* Define as const if the declaration of iconv() needs const. */ #mesondefine ICONV_CONST @@ -916,6 +919,11 @@ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif +/* Enable DEFAULT_SOURCE */ +#ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE +#endif + /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS diff --git a/configure.ac b/configure.ac index 65e9eddf..d69fcb4e 100644 --- a/configure.ac +++ b/configure.ac @@ -324,6 +324,7 @@ AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes) AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes) AC_CHECK_FUNCS(fork) +AC_CHECK_FUNCS(mkstemps) # These aren't probably needed now, as they are commented in links.h. # I've no idea about their historical background, but I keep them here diff --git a/meson.build b/meson.build index 72d92b7d..0028d7dc 100644 --- a/meson.build +++ b/meson.build @@ -689,6 +689,10 @@ if compiler.has_function('gnutls_certificate_set_x509_system_trust', prefix: '#i conf_data.set('HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST', 1) endif +if compiler.has_function('mkstemps', prefix: '#include ', args: '-D_GNU_SOURCE') + conf_data.set('HAVE_MKSTEMPS', 1) +endif + conf_data.set('ICONV_CONST', true) sysconfdir = get_option('prefix') / get_option('sysconfdir')/'elinks' diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index bfc45b13..03ab40a8 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -1019,7 +1019,7 @@ get_system_str(int xwin) return xwin ? SYSTEM_STR "-xwin" : SYSTEM_STR; } -#if _DEFAULT_SOURCE || _SVID_SOURCE || _BSD_SOURCE +#ifdef HAVE_MKSTEMPS /* tempnam() replacement without races */