11 AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
15 AM_INIT_AUTOMAKE([subdir-objects])
25 if test ${target_cpu} == "powerpc64"; then
26 AC_MSG_WARN([set compiler with -m64])
32 AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
33 [directory for sysio library]),
34 [ case "${withval}" in
35 "yes"|"no"|"") have_lib_dir=no ;;
36 *) LIBBUILD_DIR=${withval};
37 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} ||
40 [ LIBBUILD_DIR=`pwd`/lib;
41 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} || have_lib_dir=no;])
42 if test x${have_lib_dir} = xyes; then
43 echo "Using sysio library directory ${LIBBUILD_DIR}"
45 AC_MSG_ERROR(Need writeable path to sysio library directory ${LIBBUILD_DIR})
47 AC_SUBST(LIBBUILD_DIR)
49 AC_ARG_WITH(native_driver,
50 AC_HELP_STRING([--with-native-driver],[build native test driver]),
51 [ case "${withval}" in
54 *) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
56 [with_native_driver=yes;])
57 AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
59 AC_ARG_WITH(incore-driver,
60 AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
61 [ case "${withval}" in
64 *) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
66 [with_incore_driver=yes])
67 AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
70 AC_HELP_STRING([--with-tests],[build tests]),
71 [ case "${withval}" in
74 *) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
77 AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
79 AC_ARG_WITH(automount,
80 AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
81 [with automounts @<:@<automount-file-name>=.mount@:>@]),
82 [ if test x${withval} = xyes; then
83 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
84 elif test x${withval} != x; then
85 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
89 AC_ARG_WITH(stdfd-dev,
90 AC_HELP_STRING([--with-stdfd-dev],
91 [build standard file descriptors pseudo-driver]),
92 [ case "${withval}" in
95 *) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
98 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
100 AC_ARG_WITH(zero-sum-memory,
101 AC_HELP_STRING([--with-zero-sum-memory],
102 [free all dynamically allocated memory at the end -- useful for debugging]),
103 [ case "${withval}" in
104 yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;;
106 *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;;
108 [with_zero_sum_memory=no])
109 AC_SUBST(ZERO_SUM_MEMORY)
111 AC_ARG_WITH(defer-init-cwd,
112 AC_HELP_STRING([--with-defer-init-cwd],
113 [defer initialization of current working directory]),
114 [ case "${withval}" in
115 yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
117 *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
119 [with_defer_init_cwd=no])
120 AC_SUBST(DEFER_INIT_CWD)
123 AC_HELP_STRING([--with-tracing],
124 [enable tracing support]),
125 [ case "${withval}" in
126 yes) TRACING=-DSYSIO_TRACING=1 ;;
128 *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
130 [TRACING=-DSYSIO_TRACING=1])
133 AC_ARG_WITH(cplant_yod,
134 AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
135 [ case "${withval}" in
136 yes) if test x${with_stdfd_dev} != xyes; then
138 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
141 *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
143 [with_cplant_yod=no])
144 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
146 AC_ARG_WITH(cplant_tests,
147 AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
148 [build libsysio tests for cplant platform]),
149 [ case "${withval}" in
150 yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
151 no) with_cplant_tests=no;;
156 [ if test x${with_cplant_yod} != xyes; then
158 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
160 [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
162 [with_cplant_tests=no])
163 AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
166 AC_HELP_STRING([--with-sockets],
167 [build sockets interface driver (EXPERIMENTAL)]),
168 [ case "${withval}" in
171 *) AC_MSG_ERROR(bad value ${withval} for --with-sockets) ;;
174 AM_CONDITIONAL(WITH_SOCKETS_DRIVER, test x$with_sockets = xyes)
176 AC_ARG_WITH(lustre-hack,
177 AC_HELP_STRING([--with-lustre-hack],
178 [have hacking code which needed to support liblustre driver (EXPERIMENTAL)]),
179 [ case "${withval}" in
182 *) AC_MSG_ERROR(bad value ${withval} for --with-lustre-hack) ;;
184 [with_lustre_hack=no])
185 AM_CONDITIONAL(WITH_LUSTRE_HACK, test x$with_lustre_hack = xyes)
186 if test x$with_lustre_hack = xyes; then
187 AC_DEFINE(HAVE_LUSTRE_HACK)
190 AC_ARG_WITH(alternate-symbols,
191 AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
192 [Prepend standard, public, symbols with a unique qualifer]),
193 [ case "${withval}" in
194 yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
196 *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
198 AC_SUBST(SYSIO_LABEL_NAMES)
200 # We keep the original values in `$config_*' and never modify them, so we
201 # can write them unchanged into config.make. Everything else uses
202 # $machine, $vendor, and $os, and changes them whenever convenient.
203 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
205 # Don't allow vendor == "unknown"
206 test "$config_vendor" = unknown && config_vendor=
207 config_os="`echo $config_os | sed 's/^unknown-//'`"
209 # Some configurations imply other options.
211 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
212 # These systems always use GNU tools.
213 gnu_ld=yes gnu_as=yes ;;
216 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
217 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
219 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
220 # These systems (almost) always use the ELF format.
224 # These systems are always xcoff
230 machine=$config_machine
231 vendor=$config_vendor
234 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
236 if test "$machine" = rs6000; then
242 AC_DEFINE(_XOPEN_SOURCE, 600)
245 # ... and always needed...
246 AC_DEFINE(__USE_LARGEFILE64)
247 AC_DEFINE(_LARGE_FILES)
248 AC_DEFINE(_LARGE_FILE_API)
249 AC_DEFINE(_ALL_SOURCE)
250 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
254 AC_MSG_CHECKING(for symlink support)
256 #include <sys/types.h>
257 #include <sys/stat.h>
263 symlink_support="yes",
266 AC_MSG_RESULT($symlink_support)
268 if test x$symlink_support = xyes; then
269 AC_MSG_CHECKING(if readlink returns int)
273 extern int readlink(const char *, char *, size_t);
275 readlink_returns_int="yes",
276 readlink_returns_int="no"
278 AC_MSG_RESULT($readlink_returns_int)
279 if test x$readlink_returns_int = no; then
280 AC_DEFINE(HAVE_POSIX_1003_READLINK,
282 [readlink returns ssize_t])
286 AC_MSG_CHECKING(if readlink returns ssize_t)
290 ssize_t readlink(const char *, char *, size_t);
293 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
298 # If we can't provoke the declaration of stat64 then we assume the
299 # environment supports 64-bit file support naturally. Beware!
300 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
302 #include <sys/types.h>
303 #include <sys/stat.h>
304 #include <unistd.h>], [
305 struct stat64 st64;],
306 sysio_largefile64_source_required=no,
307 sysio_largefile64_source_required=maybe)
308 if test x$sysio_largefile64_source_required = xmaybe; then
310 #define _LARGEFILE64_SOURCE
311 #include <sys/types.h>
312 #include <sys/stat.h>
313 #include <unistd.h>], [
314 struct stat64 st64;],
315 sysio_largefile64_source_required=yes,
316 sysio_largefile64_source_required=no)
318 AC_MSG_RESULT($sysio_largefile64_source_required)
319 if test x$sysio_largefile64_source_required = xyes; then
320 AC_DEFINE(_LARGEFILE64_SOURCE)
323 # Alpha linux defines
325 AC_MSG_CHECKING(for alpha linux)
327 if test `expr ${machine} : "alpha"` = 5 && \
328 test `expr ${os} : "linux"` = 5; then
330 AC_DEFINE(ALPHA_LINUX)
332 AC_MSG_RESULT($alpha_linux_env)
333 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
337 AC_MSG_CHECKING(for __st_ino)
339 #include <sys/stat.h>],
344 AC_MSG_RESULT($have__st_ino)
345 if test x$have__st_ino = xyes; then
346 AC_DEFINE(HAVE__ST_INO)
351 AC_MSG_CHECKING(for st_gen)
353 #include <sys/stat.h>],
358 AC_MSG_RESULT($have_st_gen)
359 if test x$have_st_gen = xyes; then
360 AC_DEFINE(HAVE_GENERATION)
363 AC_MSG_CHECKING(for POSIX 2008 preadv)
365 CFLAGS="$CFLAGS -Wall -Werror"
368 ssize_t preadv (int __fd, const struct iovec *__iovec,
369 int __count, off_t off)
375 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
382 AC_MSG_CHECKING(for POSIX 2008 scandir)
384 CFLAGS="$CFLAGS -Wall -Werror"
391 int scandir(const char *dir,
392 struct dirent ***namelist,
393 int(*filter)(const struct dirent *),
394 int(*compar)(const struct dirent **,
395 const struct dirent **)
400 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
408 AC_MSG_CHECKING(for POSIX 2008 preadv)
410 CFLAGS="$CFLAGS -Wall -Werror"
413 ssize_t preadv (int __fd, const struct iovec *__iovec,
414 int __count, off_t off)
420 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
427 AC_MSG_CHECKING(for POSIX 2008 scandir)
429 CFLAGS="$CFLAGS -Wall -Werror"
436 int scandir(const char *dir,
437 struct dirent ***namelist,
438 int(*filter)(const struct dirent *),
439 int(*compar)(const struct dirent **,
440 const struct dirent **)
445 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
453 AC_MSG_CHECKING(whether .text pseudo-op must be used)
454 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
455 cat > conftest.s <<EOF
458 am_cv_sysio_asm_dot_text=
459 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
460 am_cv_sysio_asm_dot_text=.text
463 if test -z "$am_cv_sysio_asm_dot_text"; then
469 AC_CACHE_CHECK(for assembler global-symbol directive,
470 am_cv_sysio_asm_global_directive, [dnl
471 am_cv_sysio_asm_global_directive=UNKNOWN
472 for ac_globl in .globl .global .EXPORT; do
473 cat > conftest.s <<EOF
474 ${am_cv_sysio_asm_dot_text}
478 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
479 am_cv_sysio_asm_global_directive=${ac_globl}
482 test $am_cv_sysio_asm_global_directive != UNKNOWN && break
484 if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
485 AC_MSG_ERROR(cannot determine asm global directive)
487 # AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
490 AC_CACHE_CHECK(for .set assembler directive,
491 am_cv_sysio_asm_set_directive, [dnl
492 cat > conftest.s<<EOF
493 ${am_cv_sysio_asm_dot_text}
496 ${am_cv_sysio_asm_global_directive} bar
498 # The alpha-dec-osf1 assembler gives only a warning for `.set'
499 # (but it doesn't work), so we must do a linking check to be sure.
500 cat > conftest1.c <<EOF
502 main () { printf ("%d\n", bar); }
504 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
505 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
506 am_cv_sysio_asm_set_directive=yes
508 am_cv_sysio_asm_set_directive=no
511 #if test $am_cv_sysio_asm_set_directive = yes; then
512 # AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
515 AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
517 cat > conftest.s <<EOF
518 ${am_cv_sysio_asm_dot_text}
522 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
523 am_cv_sysio_asm_weak_directive=yes
525 am_cv_sysio_asm_weak_directive=no
529 if test $am_cv_sysio_asm_weak_directive = no; then
530 AC_CACHE_CHECK(for assembler .weakext directive,
531 am_cv_sysio_asm_weakext_directive, [dnl
532 cat > conftest.s <<EOF
533 ${am_cv_sysio_asm_dot_text}
534 ${am_cv_sysio_asm_global_directive} foo
538 ${am_cv_sysio_asm_global_directive} baz
541 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
542 am_cv_sysio_asm_weakext_directive=yes
544 am_cv_sysio_asm_weakext_directive=no
549 if test x$am_cv_sysio_asm_weak_directive = xyes; then
550 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
552 if test x$am_cv_sysio_asm_weakext_directive = xyes; then
553 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)