a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Huntdnl Copyright (c) 2007 The NetBSD Foundation, Inc.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl All rights reserved.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl Redistribution and use in source and binary forms, with or without
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl modification, are permitted provided that the following conditions
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl 1. Redistributions of source code must retain the above copyright
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl notice, this list of conditions and the following disclaimer.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl 2. Redistributions in binary form must reproduce the above copyright
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl notice, this list of conditions and the following disclaimer in the
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl documentation and/or other materials provided with the distribution.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ef421f66f47224a42073deaf087378c5d0c9952eEvan HuntAC_DEFUN([ATF_MODULE_FS], [
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_CHECKING(whether basename takes a constant pointer)
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_COMPILE_IFELSE(
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt [AC_LANG_PROGRAM([#include <libgen.h>], [
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt const char* s = "/foo/bar/";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt (void)::basename(s);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_RESULT(yes)
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_DEFINE([HAVE_CONST_BASENAME], [1],
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt [Define to 1 if basename takes a constant pointer]),
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_RESULT(no))
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_CHECKING(whether dirname takes a constant pointer)
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_COMPILE_IFELSE(
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt [AC_LANG_PROGRAM([#include <libgen.h>], [
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt const char* s = "/foo/bar/";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt (void)::dirname(s);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_RESULT(yes)
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_DEFINE([HAVE_CONST_DIRNAME], [1],
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt [Define to 1 if dirname takes a constant pointer]),
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_MSG_RESULT(no))
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt AC_CACHE_CHECK(
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [whether getcwd(NULL, 0) works],
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [kyua_cv_getcwd_works], [
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt AC_RUN_IFELSE(
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [AC_LANG_PROGRAM([#include <stdlib.h>
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt#include <unistd.h>], [
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt char *cwd = getcwd(NULL, 0);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return (cwd != NULL) ? EXIT_SUCCESS : EXIT_FAILURE;
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [kyua_cv_getcwd_works=yes],
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [kyua_cv_getcwd_works=no])
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt if test x"${kyua_cv_getcwd_works}" = xyes; then
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt AC_DEFINE([HAVE_GETCWD_DYN], [1],
a747113422afaa29ce72d2c5ba7f0b7ea9ec2054Evan Hunt [Define to 1 if getcwd(NULL, 0) works])