Alternative version for those legacy systems without atfile-source
atfile source is posix 2008, but some legacy systems seems to not ship with those, in that case use slower version. SVN revision: 39958
This commit is contained in:
parent
44a5dff5f9
commit
689146ef39
22
configure.ac
22
configure.ac
|
@ -12,6 +12,7 @@ AC_ISC_POSIX
|
||||||
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
|
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
|
AC_GNU_SOURCE
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
|
@ -28,6 +29,27 @@ AC_PROG_LIBTOOL
|
||||||
AC_CHECK_FUNCS(setenv)
|
AC_CHECK_FUNCS(setenv)
|
||||||
AC_CHECK_FUNCS(unsetenv)
|
AC_CHECK_FUNCS(unsetenv)
|
||||||
|
|
||||||
|
have_atfile_source=auto
|
||||||
|
AC_ARG_ENABLE(atfile-source,
|
||||||
|
AC_HELP_STRING([--disable-atfile-source],
|
||||||
|
[disable use of atfile source functions as openat and mkdirat @<:@default=detect@:>@]),
|
||||||
|
[have_atfile_source=$enableval], [have_atfile_source=auto])
|
||||||
|
|
||||||
|
if test "x$have_atfile_source" != "xno"; then
|
||||||
|
AC_CHECK_FUNCS(mkdirat,
|
||||||
|
[
|
||||||
|
have_atfile_source=yes
|
||||||
|
AC_DEFINE(HAVE_ATFILE_SOURCE, 1, [mkdirat exists])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
if test "x$have_atfile_source" = "xyes"; then
|
||||||
|
AC_MSG_ERROR([required atfile-source but no mkdirat()])
|
||||||
|
fi
|
||||||
|
have_atfile_source=no
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
|
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
|
||||||
|
|
||||||
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
|
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
|
||||||
|
|
|
@ -1225,11 +1225,13 @@ _e_main_dirs_init(void)
|
||||||
retval = 1;
|
retval = 1;
|
||||||
for (i = 0; i < (int)(sizeof(dirs) / sizeof(char *)); i++)
|
for (i = 0; i < (int)(sizeof(dirs) / sizeof(char *)); i++)
|
||||||
{
|
{
|
||||||
/* TODO: probably need to handle cases without ATSOURCE files?
|
|
||||||
* let's wait people to report and if any I'll fix it.
|
|
||||||
*/
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
#ifndef HAVE_ATFILE_SOURCE
|
||||||
|
ecore_strlcpy(buf + baselen, dirs[i], sizeof(buf) - baselen);
|
||||||
|
if (stat(buf, &st) == 0)
|
||||||
|
#else
|
||||||
if (fstatat(fd, dirs[i], &st, 0) == 0)
|
if (fstatat(fd, dirs[i], &st, 0) == 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (S_ISDIR(st.st_mode))
|
if (S_ISDIR(st.st_mode))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1244,7 +1246,11 @@ _e_main_dirs_init(void)
|
||||||
{
|
{
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_ATFILE_SOURCE
|
||||||
|
if (mkdir(buf, default_mode) == 0)
|
||||||
|
#else
|
||||||
if (mkdirat(fd, dirs[i], default_mode) == 0)
|
if (mkdirat(fd, dirs[i], default_mode) == 0)
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue