Home | History | Annotate | Line # | Download | only in compat
configure.ac revision 1.15
      1 #	$NetBSD: configure.ac,v 1.15 2002/04/18 15:31:52 bjh21 Exp $
      2 #
      3 # Autoconf definition file for libnbcompat.
      4 #
      5 
      6 AC_INIT([libnbcompat], [noversion], [lib-bug-people (a] netbsd.org])
      7 AC_CONFIG_HEADERS(config.h)
      8 AC_CONFIG_FILES(defs.mk)
      9 
     10 AC_C_BIGENDIAN
     11 AC_HEADER_STDC
     12 
     13 # Confirm existence of zlib.  (This is available as a default install
     14 # option on many OS's; this could be added as a reachover build in the
     15 # future.)
     16 AC_CHECK_HEADER(zlib.h,,
     17 	AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
     18 AC_CHECK_LIB(z, gzdopen,,
     19 	AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
     20 
     21 # Make sure certain required headers are available.
     22 # These are not necessarily required by the code, but they are not
     23 # currently conditionalized.
     24 AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
     25 	sys/stat.h sys/time.h sys/types.h sys/utsname.h sys/wait.h \
     26 	assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
     27 	netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
     28 	unistd.h,,
     29 	AC_MSG_ERROR([standard system header file not found]))
     30 
     31 # Find headers that may not be available.
     32 AC_HEADER_DIRENT
     33 AC_CHECK_HEADERS(sys/sysmacros.h sys/syslimits.h features.h malloc.h stddef.h stdint.h)
     34 AC_CHECK_HEADERS(machine/bswap.h sys/cdefs.h sys/featuretest.h \
     35 	err.h inttypes.h libgen.h paths.h util.h,,
     36 	[test -f include/$ac_header || touch include/$ac_header])
     37 AC_CHECK_HEADERS(rpc/types.h fts.h getopt.h md2.h md4.h md5.h netconfig.h \
     38 	rmd160.h sha1.h vis.h,,
     39 	[echo '#include "config.h"' >include/$ac_header.new
     40 	echo '#include "'$srcdir/../../include/$ac_header'"' >>include/$ac_header.new
     41 	if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
     42 		rm -f include/$ac_header.new
     43 	else
     44 		mv -f include/$ac_header.new include/$ac_header
     45 	fi])
     46 
     47 # Typedefs.
     48 AC_TYPE_SIZE_T
     49 AC_CHECK_TYPES([id_t, long long, u_quad_t])
     50 
     51 dnl XXX - This is UGLY.  Need a better way to homogenize the bitsized types,
     52 dnl including use of compiler primitive types via AC_CHECK_SIZEOF.
     53 dnl
     54 define([NB_CHECK_INTTYPE], [
     55 	AC_CHECK_TYPE(uint][$1][_t,, [
     56 		AC_CHECK_TYPE(u_int][$1][_t,
     57 			AC_DEFINE(uint][$1][_t, u_int][$1][_t),
     58 			AC_MSG_ERROR([cannot find a suitable type for uint][$1][_t]))
     59 	])
     60 	AC_CHECK_TYPE(u_int][$1][_t,, [
     61 		AC_CHECK_TYPE(uint][$1][_t,
     62 			AC_DEFINE(u_int][$1][_t, uint][$1][_t),
     63 			AC_MSG_ERROR([cannot find a suitable type for u_int][$1][_t]))
     64 	])
     65 ])
     66 
     67 NB_CHECK_INTTYPE(8)
     68 NB_CHECK_INTTYPE(16)
     69 NB_CHECK_INTTYPE(32)
     70 NB_CHECK_INTTYPE(64)
     71 
     72 # Struct members.
     73 AC_CHECK_MEMBERS([DIR.dd_fd, struct dirent.d_namlen],,,
     74 	[#include <dirent.h>])
     75 AC_CHECK_MEMBERS([struct stat.st_flags, struct stat.st_gen,
     76 	struct stat.st_mtimensec],,, [#include <sys/stat.h>])
     77 AC_CHECK_MEMBERS(struct statfs.f_iosize,,, [#include <sys/mount.h>])
     78 
     79 # Global variable decls.
     80 AC_CHECK_DECLS([optind, optreset],,, [
     81 #include <stdio.h>
     82 #include <stdlib.h>
     83 #include <unistd.h>
     84 ])
     85 AC_CHECK_DECLS(sys_signame,,, [#include <signal.h>])
     86 
     87 # Library functions (where a .h check isn't enough).
     88 AC_SEARCH_LIBS(fparseln, util)
     89 AC_CHECK_FUNCS(asprintf asnprintf basename dirfd dirname \
     90 	fgetln flock fparseln futimes getopt getopt_long \
     91 	isblank issetugid lchmod lchown lutimes pread pwcache_userdb \
     92 	pwrite setenv setgroupent setprogname setpassent \
     93 	snprintf strlcat strlcpy strsep vasprintf vasnprintf vsnprintf)
     94 
     95 AC_CHECK_DECLS([setgroupent, setpassent],,, [
     96 #include <grp.h>
     97 #include <pwd.h>
     98 ])
     99 
    100 # regcomp() and regexec() are also names of functions in the old V8
    101 # regexp package.  To avoid them, we need to find out who has regfree().
    102 
    103 dnl # Cygwin: We *MUST* look at -lregex *before* the "no libs" condition.
    104 dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
    105 AC_CHECK_LIB(regex, regfree)
    106 AC_SEARCH_LIBS(regfree, rx posix)
    107 
    108 AC_OUTPUT
    109