[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Check for getcwd(NULL, 0) Was: Re: Bug#636568: xerces-c: Updated patch, submitted upstream



On Wed, 2012-10-17 at 14:15:47 +0200, Svante Signell wrote:
> On Wed, 2012-10-17 at 11:51 +0200, Pino Toscano wrote:
> 
> > If you assume getcwd is available, this check is pointless; if you
> > don't, then you need to skip the check below is getcwd has not been
> > found.
> 
> New version: (has to be indented?)

I srtarted commenting inline, but just posting the proposed changes as
a whole seems easier (beware completely untested):

AC_CHECK_FUNCS([getcwd], [
  AC_MSG_CHECKING([whether getcwd(NULL, 0) is supported])
  AC_RUN_IFELSE([
    AC_LANG_PROGRAM([[
      #include <unistd.h>
    ]], [[
      char *result = getcwd(NULL, 0);

      if (result == NULL)
        return 1;
    ]])
  ], [
    AC_DEFINE([HAVE_GNU_GETCWD], [1],
              [Define to 1 if you have support for 'getcwd(NULL, 0)' GNU extension])
    AC_MSG_RESULT([yes])
  ], [
    AC_MSG_RESULT([no])
  ], [
    AC_MSG_NOTICE([cannot run test program while cross compiling])
  ])
])

thanks,
guillem


Reply to: