11 AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
15 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-ustar])
16 AM_MAINTAINER_MODE([enable])
20 AC_CHECK_TOOL(CC, gcc, [no])
21 AC_CHECK_TOOL(LD, ld, [no])
22 AC_CHECK_TOOL(AR, ar, [no])
23 AC_CHECK_TOOL(OBJDUMP, objdump, [no])
24 AC_CHECK_TOOL(STRIP, strip, [no])
30 case $target_vendor in
31 # The K1OM architecture is an extension of the x86 architecture.
32 # So, the $target_arch is x86_64.
34 CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
35 if test $CC_TARGET_ARCH != x86_64-$target_vendor-linux ; then
36 AC_MSG_ERROR([Cross compiler not found in PATH.])
44 if test ${target_cpu} == "powerpc64"; then
45 AC_MSG_WARN([set compiler with -m64])
51 AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
52 [directory for sysio library]),
53 [ case "${withval}" in
54 "yes"|"no"|"") have_lib_dir=no ;;
55 *) LIBBUILD_DIR=${withval};
56 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} ||
59 [ LIBBUILD_DIR=`pwd`/lib;
60 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} || have_lib_dir=no;])
61 if test x${have_lib_dir} = xyes; then
62 echo "Using sysio library directory ${LIBBUILD_DIR}"
64 AC_MSG_ERROR(Need writeable path to sysio library directory ${LIBBUILD_DIR})
66 AC_SUBST(LIBBUILD_DIR)
68 AC_ARG_WITH(native_driver,
69 AC_HELP_STRING([--with-native-driver],[build native test driver]),
70 [ case "${withval}" in
73 *) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
75 [with_native_driver=yes;])
76 AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
78 AC_ARG_WITH(incore-driver,
79 AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
80 [ case "${withval}" in
83 *) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
85 [with_incore_driver=yes])
86 AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
89 AC_HELP_STRING([--with-tests],[build tests]),
90 [ case "${withval}" in
93 *) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
96 AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
98 AC_ARG_WITH(automount,
99 AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
100 [with automounts @<:@<automount-file-name>=.mount@:>@]),
101 [ if test x${withval} = xyes; then
102 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
103 elif test x${withval} != x; then
104 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
108 AC_ARG_WITH(stdfd-dev,
109 AC_HELP_STRING([--with-stdfd-dev],
110 [build standard file descriptors pseudo-driver]),
111 [ case "${withval}" in
114 *) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
116 [with_stdfd_dev=yes])
117 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
119 AC_ARG_WITH(zero-sum-memory,
120 AC_HELP_STRING([--with-zero-sum-memory],
121 [free all dynamically allocated memory at the end -- useful for debugging]),
122 [ case "${withval}" in
123 yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;;
125 *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;;
127 [with_zero_sum_memory=no])
128 AC_SUBST(ZERO_SUM_MEMORY)
130 AC_ARG_WITH(defer-init-cwd,
131 AC_HELP_STRING([--with-defer-init-cwd],
132 [defer initialization of current working directory]),
133 [ case "${withval}" in
134 yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
136 *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
138 [with_defer_init_cwd=no])
139 AC_SUBST(DEFER_INIT_CWD)
142 AC_HELP_STRING([--with-tracing],
143 [enable tracing support]),
144 [ case "${withval}" in
145 yes) TRACING=-DSYSIO_TRACING=1 ;;
147 *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
149 [TRACING=-DSYSIO_TRACING=1])
152 AC_ARG_WITH(cplant_yod,
153 AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
154 [ case "${withval}" in
155 yes) if test x${with_stdfd_dev} != xyes; then
157 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
160 *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
162 [with_cplant_yod=no])
163 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
165 AC_ARG_WITH(cplant_tests,
166 AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
167 [build libsysio tests for cplant platform]),
168 [ case "${withval}" in
169 yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
170 no) with_cplant_tests=no;;
175 [ if test x${with_cplant_yod} != xyes; then
177 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
179 [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
181 [with_cplant_tests=no])
182 AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
185 AC_HELP_STRING([--with-sockets],
186 [build sockets interface driver (EXPERIMENTAL)]),
187 [ case "${withval}" in
190 *) AC_MSG_ERROR(bad value ${withval} for --with-sockets) ;;
193 AM_CONDITIONAL(WITH_SOCKETS_DRIVER, test x$with_sockets = xyes)
195 AC_ARG_WITH(lustre-hack,
196 AC_HELP_STRING([--with-lustre-hack],
197 [have hacking code which needed to support liblustre driver (EXPERIMENTAL)]),
198 [ case "${withval}" in
201 *) AC_MSG_ERROR(bad value ${withval} for --with-lustre-hack) ;;
203 [with_lustre_hack=no])
204 AM_CONDITIONAL(WITH_LUSTRE_HACK, test x$with_lustre_hack = xyes)
205 if test x$with_lustre_hack = xyes; then
206 AC_DEFINE(HAVE_LUSTRE_HACK)
209 AC_ARG_WITH(alternate-symbols,
210 AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
211 [Prepend standard, public, symbols with a unique qualifer]),
212 [ case "${withval}" in
213 yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
215 *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
217 AC_SUBST(SYSIO_LABEL_NAMES)
219 # We keep the original values in `$config_*' and never modify them, so we
220 # can write them unchanged into config.make. Everything else uses
221 # $machine, $vendor, and $os, and changes them whenever convenient.
222 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
224 # Don't allow vendor == "unknown"
225 test "$config_vendor" = unknown && config_vendor=
226 config_os="`echo $config_os | sed 's/^unknown-//'`"
228 # Some configurations imply other options.
230 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
231 # These systems always use GNU tools.
232 gnu_ld=yes gnu_as=yes ;;
235 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
236 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
238 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
239 # These systems (almost) always use the ELF format.
243 # These systems are always xcoff
249 machine=$config_machine
250 vendor=$config_vendor
253 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
255 if test "$machine" = rs6000; then
261 AC_DEFINE(_XOPEN_SOURCE, 600)
264 # ... and always needed...
265 AC_DEFINE(__USE_LARGEFILE64)
266 AC_DEFINE(_LARGE_FILES)
267 AC_DEFINE(_LARGE_FILE_API)
268 AC_DEFINE(_ALL_SOURCE)
269 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
273 AC_MSG_CHECKING(for symlink support)
275 #include <sys/types.h>
276 #include <sys/stat.h>
282 symlink_support="yes",
285 AC_MSG_RESULT($symlink_support)
287 if test x$symlink_support = xyes; then
288 AC_MSG_CHECKING(if readlink returns int)
292 extern int readlink(const char *, char *, size_t);
294 readlink_returns_int="yes",
295 readlink_returns_int="no"
297 AC_MSG_RESULT($readlink_returns_int)
298 if test x$readlink_returns_int = no; then
299 AC_DEFINE(HAVE_POSIX_1003_READLINK,
301 [readlink returns ssize_t])
305 AC_MSG_CHECKING(if readlink returns ssize_t)
309 ssize_t readlink(const char *, char *, size_t);
312 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
317 # If we can't provoke the declaration of stat64 then we assume the
318 # environment supports 64-bit file support naturally. Beware!
319 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
321 #include <sys/types.h>
322 #include <sys/stat.h>
323 #include <unistd.h>], [
324 struct stat64 st64;],
325 sysio_largefile64_source_required=no,
326 sysio_largefile64_source_required=maybe)
327 if test x$sysio_largefile64_source_required = xmaybe; then
329 #define _LARGEFILE64_SOURCE
330 #include <sys/types.h>
331 #include <sys/stat.h>
332 #include <unistd.h>], [
333 struct stat64 st64;],
334 sysio_largefile64_source_required=yes,
335 sysio_largefile64_source_required=no)
337 AC_MSG_RESULT($sysio_largefile64_source_required)
338 if test x$sysio_largefile64_source_required = xyes; then
339 AC_DEFINE(_LARGEFILE64_SOURCE)
342 # Alpha linux defines
344 AC_MSG_CHECKING(for alpha linux)
346 if test `expr ${machine} : "alpha"` = 5 && \
347 test `expr ${os} : "linux"` = 5; then
349 AC_DEFINE(ALPHA_LINUX)
351 AC_MSG_RESULT($alpha_linux_env)
352 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
356 AC_MSG_CHECKING(for __st_ino)
358 #include <sys/stat.h>],
363 AC_MSG_RESULT($have__st_ino)
364 if test x$have__st_ino = xyes; then
365 AC_DEFINE(HAVE__ST_INO)
370 AC_MSG_CHECKING(for st_gen)
372 #include <sys/stat.h>],
377 AC_MSG_RESULT($have_st_gen)
378 if test x$have_st_gen = xyes; then
379 AC_DEFINE(HAVE_GENERATION)
382 AC_MSG_CHECKING(for POSIX 2008 preadv)
384 CFLAGS="$CFLAGS -Wall -Werror"
387 ssize_t preadv (int __fd, const struct iovec *__iovec,
388 int __count, off_t off)
394 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
401 AC_MSG_CHECKING(for POSIX 2008 scandir)
403 CFLAGS="$CFLAGS -Wall -Werror"
410 int scandir(const char *dir,
411 struct dirent ***namelist,
412 int(*filter)(const struct dirent *),
413 int(*compar)(const struct dirent **,
414 const struct dirent **)
419 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
427 AC_MSG_CHECKING(for POSIX 2008 preadv)
429 CFLAGS="$CFLAGS -Wall -Werror"
432 ssize_t preadv (int __fd, const struct iovec *__iovec,
433 int __count, off_t off)
439 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
446 AC_MSG_CHECKING(for POSIX 2008 scandir)
448 CFLAGS="$CFLAGS -Wall -Werror"
455 int scandir(const char *dir,
456 struct dirent ***namelist,
457 int(*filter)(const struct dirent *),
458 int(*compar)(const struct dirent **,
459 const struct dirent **)
464 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
472 AC_MSG_CHECKING(whether .text pseudo-op must be used)
473 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
474 cat > conftest.s <<EOF
477 am_cv_sysio_asm_dot_text=
478 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
479 am_cv_sysio_asm_dot_text=.text
482 if test -z "$am_cv_sysio_asm_dot_text"; then
488 AC_CACHE_CHECK(for assembler global-symbol directive,
489 am_cv_sysio_asm_global_directive, [dnl
490 am_cv_sysio_asm_global_directive=UNKNOWN
491 for ac_globl in .globl .global .EXPORT; do
492 cat > conftest.s <<EOF
493 ${am_cv_sysio_asm_dot_text}
497 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
498 am_cv_sysio_asm_global_directive=${ac_globl}
501 test $am_cv_sysio_asm_global_directive != UNKNOWN && break
503 if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
504 AC_MSG_ERROR(cannot determine asm global directive)
506 # AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
509 AC_CACHE_CHECK(for .set assembler directive,
510 am_cv_sysio_asm_set_directive, [dnl
511 cat > conftest.s<<EOF
512 ${am_cv_sysio_asm_dot_text}
515 ${am_cv_sysio_asm_global_directive} bar
517 # The alpha-dec-osf1 assembler gives only a warning for `.set'
518 # (but it doesn't work), so we must do a linking check to be sure.
519 cat > conftest1.c <<EOF
521 main () { printf ("%d\n", bar); }
523 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
524 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
525 am_cv_sysio_asm_set_directive=yes
527 am_cv_sysio_asm_set_directive=no
530 #if test $am_cv_sysio_asm_set_directive = yes; then
531 # AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
534 AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
536 cat > conftest.s <<EOF
537 ${am_cv_sysio_asm_dot_text}
541 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
542 am_cv_sysio_asm_weak_directive=yes
544 am_cv_sysio_asm_weak_directive=no
548 if test $am_cv_sysio_asm_weak_directive = no; then
549 AC_CACHE_CHECK(for assembler .weakext directive,
550 am_cv_sysio_asm_weakext_directive, [dnl
551 cat > conftest.s <<EOF
552 ${am_cv_sysio_asm_dot_text}
553 ${am_cv_sysio_asm_global_directive} foo
557 ${am_cv_sysio_asm_global_directive} baz
560 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
561 am_cv_sysio_asm_weakext_directive=yes
563 am_cv_sysio_asm_weakext_directive=no
568 if test x$am_cv_sysio_asm_weak_directive = xyes; then
569 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
571 if test x$am_cv_sysio_asm_weakext_directive = xyes; then
572 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)