On Tue, 2012-10-16 at 21:30 +0200, Samuel Thibault wrote:
> Svante Signell, le Tue 16 Oct 2012 13:29:58 +0200, a écrit :

> No need to define HAVE_GETCWD_GLIBC to 0, people usually only define it
> to 1 when the feature is available, thus allowing to just use #ifdef
> HAVE_GETCWD_GLIBC.
> 
> > ])
> > #[AC_MSG_FAILURE([test getcwd(NULL,0) failed])]): Add this for 
> > cross-compiling?
> 
> Better handle cross-compiling yes. I would however not write that it
> failed, but just that it could not be tested.

OK now?
AC_CHECK_FUNCS([getcwd])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#ifdef HAVE_GETCWD
#include <unistd.h>
#endif
],[
char *result = getcwd(NULL,0);
if (result == NULL)
  return 1;
])],[
  AC_MSG_RESULT([checking for getcwd(NULL, 0)... yes])
  AC_DEFINE([HAVE_GETCWD_GLIBC], 1, [Define to 1 if you have support for
`getcwd(NULL,0)`])
],[
  AC_MSG_RESULT([checking for getcwd(NULL, 0)... no])
],[
  AC_MSG_WARN([getcwd(NULL,0)... cannot run test program while cross
compiling])
])

If so, this code snippet could be added to the GNU/Hurd porting pages.
This is a very common case of portability issues.


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1350458839.5747.26.ca...@hp.my.own.domain

Reply via email to