mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* lib/tempname.c, lib/mkstemp.c, m4/mkstemp.m4: New, stolen from
Fileutils 4.1.5. * configure.in: Invoke UTILS_FUNC_MKSTEMP. * src/output.c (output_skeleton): Use mkstemp to create a real temporary file. Move the filling of `skeleton' and its muscle to... (prepare): here. (output): Move the definition of the prologue muscle to... (prepare): here. * src/system.h (DEFAULT_TMPDIR): New.
This commit is contained in:
@@ -12,6 +12,7 @@ lcmessage.m4 \
|
||||
malloc.m4 \
|
||||
mbrtowc.m4 \
|
||||
mbstate_t.m4 \
|
||||
mkstemp.m4 \
|
||||
prereq.m4 \
|
||||
progtest.m4 \
|
||||
realloc.m4 \
|
||||
|
||||
46
m4/mkstemp.m4
Normal file
46
m4/mkstemp.m4
Normal file
@@ -0,0 +1,46 @@
|
||||
#serial 1
|
||||
|
||||
# On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
|
||||
# silly limit that it can create no more than 26 files from a given template.
|
||||
# Other systems lack mkstemp altogether. On either type of system, arrange
|
||||
# to use the replacement function.
|
||||
AC_DEFUN([UTILS_FUNC_MKSTEMP],
|
||||
[dnl
|
||||
AC_REPLACE_FUNCS(mkstemp)
|
||||
if test $ac_cv_func_mkstemp = no; then
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
else
|
||||
AC_CACHE_CHECK([for mkstemp limitations],
|
||||
utils_cv_func_mkstemp_limitations,
|
||||
[
|
||||
AC_TRY_RUN([
|
||||
# include <stdlib.h>
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 30; i++)
|
||||
{
|
||||
char template[] = "conftestXXXXXX";
|
||||
int fd = mkstemp (template);
|
||||
if (fd == -1)
|
||||
exit (1);
|
||||
close (fd);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
],
|
||||
utils_cv_func_mkstemp_limitations=no,
|
||||
utils_cv_func_mkstemp_limitations=yes,
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test $utils_cv_func_mkstemp_limitations = yes; then
|
||||
AC_LIBOBJ(mkstemp)
|
||||
AC_LIBOBJ(tempname)
|
||||
AC_DEFINE(mkstemp, rpl_mkstemp,
|
||||
[Define to rpl_mkstemp if the replacement function should be used.])
|
||||
fi
|
||||
])
|
||||
Reference in New Issue
Block a user