2005-03-02 21:08:43 +03:00
|
|
|
# $NetBSD: configure.ac,v 1.50 2005/03/02 18:08:44 wiz Exp $
|
2001-12-12 00:17:56 +03:00
|
|
|
#
|
|
|
|
# Autoconf definition file for libnbcompat.
|
|
|
|
#
|
|
|
|
|
2003-07-27 00:17:31 +04:00
|
|
|
AC_INIT([libnbcompat], [noversion], [lib-bug-people@NetBSD.org])
|
2003-10-27 03:12:41 +03:00
|
|
|
AC_CONFIG_HEADERS(nbtool_config.h)
|
2001-12-12 00:17:56 +03:00
|
|
|
AC_CONFIG_FILES(defs.mk)
|
|
|
|
|
2004-06-21 02:20:14 +04:00
|
|
|
AC_DEFUN([AC_NETBSD],
|
|
|
|
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
|
|
|
|
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
|
|
|
AC_MSG_CHECKING([for NetBSD])
|
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#ifdef __NetBSD__
|
|
|
|
yes
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
AC_DEFINE(_POSIX_SOURCE, 1) AC_DEFINE(_POSIX_C_SOURCE, 200112L) AC_DEFINE(_XOPEN_SOURCE, 600)],
|
|
|
|
[AC_MSG_RESULT([no])])
|
|
|
|
])# AC_NETBSD
|
|
|
|
|
|
|
|
AC_NETBSD
|
2002-04-24 23:41:58 +04:00
|
|
|
AC_PATH_PROG(BSHELL, sh, )
|
|
|
|
if test x"$BSHELL" = x; then
|
|
|
|
AC_MSG_ERROR([sh must be somewhere on \$PATH])
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED(PATH_BSHELL, "$BSHELL")
|
|
|
|
|
2002-01-21 23:04:36 +03:00
|
|
|
AC_C_BIGENDIAN
|
2002-01-29 13:20:28 +03:00
|
|
|
AC_HEADER_STDC
|
|
|
|
|
|
|
|
# Confirm existence of zlib. (This is available as a default install
|
|
|
|
# option on many OS's; this could be added as a reachover build in the
|
|
|
|
# future.)
|
|
|
|
AC_CHECK_HEADER(zlib.h,,
|
|
|
|
AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
|
|
|
|
AC_CHECK_LIB(z, gzdopen,,
|
|
|
|
AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
|
2002-01-21 23:04:36 +03:00
|
|
|
|
|
|
|
# Make sure certain required headers are available.
|
|
|
|
# These are not necessarily required by the code, but they are not
|
|
|
|
# currently conditionalized.
|
2002-01-29 13:20:28 +03:00
|
|
|
AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
|
2003-03-13 07:30:39 +03:00
|
|
|
sys/socket.h sys/stat.h sys/time.h sys/types.h sys/utsname.h \
|
|
|
|
sys/wait.h assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
|
2002-10-07 22:12:36 +04:00
|
|
|
netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
|
2002-09-13 23:07:01 +04:00
|
|
|
termios.h unistd.h,,
|
2002-01-21 23:04:36 +03:00
|
|
|
AC_MSG_ERROR([standard system header file not found]))
|
|
|
|
|
|
|
|
# Find headers that may not be available.
|
2002-01-29 13:20:28 +03:00
|
|
|
AC_HEADER_DIRENT
|
2002-04-22 23:23:33 +04:00
|
|
|
AC_CHECK_HEADERS(sys/sysmacros.h sys/syslimits.h \
|
2004-06-21 02:20:14 +04:00
|
|
|
getopt.h features.h malloc.h sys/poll.h stddef.h)
|
2002-04-22 23:23:33 +04:00
|
|
|
AC_CHECK_HEADERS(machine/bswap.h sys/cdefs.h sys/endian.h sys/featuretest.h \
|
2002-12-01 00:43:27 +03:00
|
|
|
err.h inttypes.h libgen.h paths.h stdint.h util.h,,
|
2002-03-08 01:48:07 +03:00
|
|
|
[test -f include/$ac_header || touch include/$ac_header])
|
2004-06-21 02:20:14 +04:00
|
|
|
AC_CHECK_HEADERS(rpc/types.h netconfig.h,,
|
2003-10-27 03:12:41 +03:00
|
|
|
[echo '#include "nbtool_config.h"' >include/$ac_header.new
|
2002-03-08 01:48:07 +03:00
|
|
|
echo '#include "'$srcdir/../../include/$ac_header'"' >>include/$ac_header.new
|
|
|
|
if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
|
|
|
|
rm -f include/$ac_header.new
|
|
|
|
else
|
|
|
|
mv -f include/$ac_header.new include/$ac_header
|
|
|
|
fi])
|
2002-01-21 23:04:36 +03:00
|
|
|
|
|
|
|
# Typedefs.
|
2001-12-12 00:17:56 +03:00
|
|
|
AC_TYPE_SIZE_T
|
2004-06-21 02:20:14 +04:00
|
|
|
AC_CHECK_TYPES([id_t, long long, u_long, u_char, u_short, u_int, u_quad_t])
|
2003-03-13 19:27:03 +03:00
|
|
|
AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAVE_SOCKLEN_T)],,
|
|
|
|
[#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>])
|
2002-01-29 13:20:28 +03:00
|
|
|
|
2002-03-07 21:28:46 +03:00
|
|
|
dnl XXX - This is UGLY. Need a better way to homogenize the bitsized types,
|
|
|
|
dnl including use of compiler primitive types via AC_CHECK_SIZEOF.
|
|
|
|
dnl
|
2002-01-29 13:20:28 +03:00
|
|
|
define([NB_CHECK_INTTYPE], [
|
2002-03-07 21:28:46 +03:00
|
|
|
AC_CHECK_TYPE(uint][$1][_t,, [
|
|
|
|
AC_CHECK_TYPE(u_int][$1][_t,
|
|
|
|
AC_DEFINE(uint][$1][_t, u_int][$1][_t),
|
|
|
|
AC_MSG_ERROR([cannot find a suitable type for uint][$1][_t]))
|
|
|
|
])
|
2002-01-29 13:20:28 +03:00
|
|
|
AC_CHECK_TYPE(u_int][$1][_t,, [
|
|
|
|
AC_CHECK_TYPE(uint][$1][_t,
|
|
|
|
AC_DEFINE(u_int][$1][_t, uint][$1][_t),
|
|
|
|
AC_MSG_ERROR([cannot find a suitable type for u_int][$1][_t]))
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
NB_CHECK_INTTYPE(8)
|
|
|
|
NB_CHECK_INTTYPE(16)
|
|
|
|
NB_CHECK_INTTYPE(32)
|
|
|
|
NB_CHECK_INTTYPE(64)
|
2002-01-21 23:04:36 +03:00
|
|
|
|
|
|
|
# Struct members.
|
2002-02-27 01:29:38 +03:00
|
|
|
AC_CHECK_MEMBERS([DIR.dd_fd, struct dirent.d_namlen],,,
|
2002-12-16 03:31:59 +03:00
|
|
|
[#include <sys/types.h>
|
|
|
|
#include <dirent.h>])
|
2002-02-01 01:43:33 +03:00
|
|
|
AC_CHECK_MEMBERS([struct stat.st_flags, struct stat.st_gen,
|
2005-01-13 03:52:40 +03:00
|
|
|
struct stat.st_birthtime, struct stat.st_birthtimensec,
|
|
|
|
struct stat.st_atim, struct stat.st_mtimensec],,,
|
|
|
|
[#include <sys/stat.h>])
|
2004-07-24 20:32:01 +04:00
|
|
|
AC_CHECK_MEMBERS(struct statvfs.f_iosize,,, [#include <sys/statvfs.h>])
|
2002-01-21 23:04:36 +03:00
|
|
|
|
|
|
|
# Global variable decls.
|
2002-02-01 01:43:33 +03:00
|
|
|
AC_CHECK_DECLS([optind, optreset],,, [
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
])
|
2002-01-21 23:04:36 +03:00
|
|
|
AC_CHECK_DECLS(sys_signame,,, [#include <signal.h>])
|
|
|
|
|
|
|
|
# Library functions (where a .h check isn't enough).
|
2002-04-23 04:13:50 +04:00
|
|
|
AC_FUNC_ALLOCA
|
2003-07-25 07:21:15 +04:00
|
|
|
AC_CHECK_FUNCS(atoll asprintf asnprintf basename devname dirfd dirname \
|
2004-06-19 00:07:31 +04:00
|
|
|
fgetln flock fparseln futimes getopt getopt_long group_from_gid \
|
2004-11-28 09:57:14 +03:00
|
|
|
heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
|
|
|
|
mkdtemp poll pread putc_unlocked pwcache_userdb pwrite random setenv \
|
2003-03-14 06:38:42 +03:00
|
|
|
setgroupent setprogname setpassent snprintf strlcat strlcpy strsep \
|
2002-11-29 16:00:22 +03:00
|
|
|
strsuftoll strtoll \
|
2002-09-14 08:30:27 +04:00
|
|
|
user_from_uid vasprintf vasnprintf vsnprintf)
|
2001-12-12 00:17:56 +03:00
|
|
|
|
2005-03-02 21:08:43 +03:00
|
|
|
AC_CHECK_FUNCS([htobe16 htobe32 htobe64 htole16 htole32 htole64 be16toh be32toh be64toh le16toh le32toh le64toh],,, [
|
2004-06-21 02:20:14 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
])
|
|
|
|
|
2005-03-02 21:08:43 +03:00
|
|
|
AC_CHECK_FUNCS([bswap16 bswap32 bswap64],,, [
|
2004-06-21 02:20:14 +04:00
|
|
|
#include <machine/bswap.h>
|
|
|
|
])
|
|
|
|
|
2004-10-12 07:28:30 +04:00
|
|
|
AC_CHECK_FUNCS([fstatvfs],,, [
|
|
|
|
#include <sys/statvfs.h>
|
|
|
|
])
|
|
|
|
|
2002-02-27 01:29:38 +03:00
|
|
|
AC_CHECK_DECLS([setgroupent, setpassent],,, [
|
2002-12-16 03:35:00 +03:00
|
|
|
#include <sys/types.h>
|
2002-02-27 01:29:38 +03:00
|
|
|
#include <grp.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
])
|
|
|
|
|
2002-01-21 23:04:36 +03:00
|
|
|
# regcomp() and regexec() are also names of functions in the old V8
|
|
|
|
# regexp package. To avoid them, we need to find out who has regfree().
|
2001-12-12 00:17:56 +03:00
|
|
|
|
2002-01-21 23:04:36 +03:00
|
|
|
dnl # Cygwin: We *MUST* look at -lregex *before* the "no libs" condition.
|
|
|
|
dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
|
|
|
|
AC_CHECK_LIB(regex, regfree)
|
|
|
|
AC_SEARCH_LIBS(regfree, rx posix)
|
2001-12-12 00:17:56 +03:00
|
|
|
|
|
|
|
AC_OUTPUT
|