| 1 |
dnl Copyright (c) 2007 The NetBSD Foundation, Inc. |
| 2 |
dnl All rights reserved. |
| 3 |
dnl |
| 4 |
dnl Redistribution and use in source and binary forms, with or without |
| 5 |
dnl modification, are permitted provided that the following conditions |
| 6 |
dnl are met: |
| 7 |
dnl 1. Redistributions of source code must retain the above copyright |
| 8 |
dnl notice, this list of conditions and the following disclaimer. |
| 9 |
dnl 2. Redistributions in binary form must reproduce the above copyright |
| 10 |
dnl notice, this list of conditions and the following disclaimer in the |
| 11 |
dnl documentation and/or other materials provided with the distribution. |
| 12 |
dnl |
| 13 |
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND |
| 14 |
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 15 |
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 16 |
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 17 |
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY |
| 18 |
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 19 |
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 20 |
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 |
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 22 |
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 23 |
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 24 |
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 |
|
| 26 |
AC_DEFUN([ATF_MODULE_FS], [ |
| 27 |
AC_MSG_CHECKING(whether basename takes a constant pointer) |
| 28 |
AC_COMPILE_IFELSE( |
| 29 |
[AC_LANG_PROGRAM([#include <libgen.h>], [ |
| 30 |
const char* s = "/foo/bar/"; |
| 31 |
(void)::basename(s); |
| 32 |
])], |
| 33 |
AC_MSG_RESULT(yes) |
| 34 |
AC_DEFINE([HAVE_CONST_BASENAME], [1], |
| 35 |
[Define to 1 if basename takes a constant pointer]), |
| 36 |
AC_MSG_RESULT(no)) |
| 37 |
|
| 38 |
AC_MSG_CHECKING(whether dirname takes a constant pointer) |
| 39 |
AC_COMPILE_IFELSE( |
| 40 |
[AC_LANG_PROGRAM([#include <libgen.h>], [ |
| 41 |
const char* s = "/foo/bar/"; |
| 42 |
(void)::dirname(s); |
| 43 |
])], |
| 44 |
AC_MSG_RESULT(yes) |
| 45 |
AC_DEFINE([HAVE_CONST_DIRNAME], [1], |
| 46 |
[Define to 1 if dirname takes a constant pointer]), |
| 47 |
AC_MSG_RESULT(no)) |
| 48 |
|
| 49 |
AC_CACHE_CHECK( |
| 50 |
[whether getcwd(NULL, 0) works], |
| 51 |
[kyua_cv_getcwd_works], [ |
| 52 |
AC_RUN_IFELSE( |
| 53 |
[AC_LANG_PROGRAM([#include <stdlib.h> |
| 54 |
#include <unistd.h>], [ |
| 55 |
char *cwd = getcwd(NULL, 0); |
| 56 |
return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE; |
| 57 |
])], |
| 58 |
[kyua_cv_getcwd_works=yes], |
| 59 |
[kyua_cv_getcwd_works=no]) |
| 60 |
]) |
| 61 |
if test x"${kyua_cv_getcwd_works}" = xyes; then |
| 62 |
AC_DEFINE([HAVE_GETCWD_DYN], [1], |
| 63 |
[Define to 1 if getcwd(NULL, 0) works]) |
| 64 |
fi |
| 65 |
]) |