11 AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
15 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-ustar])
16 AM_MAINTAINER_MODE([enable])
26 if test ${target_cpu} == "powerpc64"; then
27 AC_MSG_WARN([set compiler with -m64])
33 AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
34 [directory for sysio library]),
35 [ case "${withval}" in
36 "yes"|"no"|"") have_lib_dir=no ;;
37 *) LIBBUILD_DIR=${withval};
38 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} ||
41 [ LIBBUILD_DIR=`pwd`/lib;
42 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} || have_lib_dir=no;])
43 if test x${have_lib_dir} = xyes; then
44 echo "Using sysio library directory ${LIBBUILD_DIR}"
46 AC_MSG_ERROR(Need writeable path to sysio library directory ${LIBBUILD_DIR})
48 AC_SUBST(LIBBUILD_DIR)
50 AC_ARG_WITH(native_driver,
51 AC_HELP_STRING([--with-native-driver],[build native test driver]),
52 [ case "${withval}" in
55 *) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
57 [with_native_driver=yes;])
58 AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
60 AC_ARG_WITH(incore-driver,
61 AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
62 [ case "${withval}" in
65 *) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
67 [with_incore_driver=yes])
68 AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
71 AC_HELP_STRING([--with-tests],[build tests]),
72 [ case "${withval}" in
75 *) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
78 AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
80 AC_ARG_WITH(automount,
81 AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
82 [with automounts @<:@<automount-file-name>=.mount@:>@]),
83 [ if test x${withval} = xyes; then
84 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
85 elif test x${withval} != x; then
86 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
90 AC_ARG_WITH(stdfd-dev,
91 AC_HELP_STRING([--with-stdfd-dev],
92 [build standard file descriptors pseudo-driver]),
93 [ case "${withval}" in
96 *) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
99 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
101 AC_ARG_WITH(zero-sum-memory,
102 AC_HELP_STRING([--with-zero-sum-memory],
103 [free all dynamically allocated memory at the end -- useful for debugging]),
104 [ case "${withval}" in
105 yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;;
107 *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;;
109 [with_zero_sum_memory=no])
110 AC_SUBST(ZERO_SUM_MEMORY)
112 AC_ARG_WITH(defer-init-cwd,
113 AC_HELP_STRING([--with-defer-init-cwd],
114 [defer initialization of current working directory]),
115 [ case "${withval}" in
116 yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
118 *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
120 [with_defer_init_cwd=no])
121 AC_SUBST(DEFER_INIT_CWD)
124 AC_HELP_STRING([--with-tracing],
125 [enable tracing support]),
126 [ case "${withval}" in
127 yes) TRACING=-DSYSIO_TRACING=1 ;;
129 *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
131 [TRACING=-DSYSIO_TRACING=1])
134 AC_ARG_WITH(cplant_yod,
135 AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
136 [ case "${withval}" in
137 yes) if test x${with_stdfd_dev} != xyes; then
139 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
142 *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
144 [with_cplant_yod=no])
145 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
147 AC_ARG_WITH(cplant_tests,
148 AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
149 [build libsysio tests for cplant platform]),
150 [ case "${withval}" in
151 yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
152 no) with_cplant_tests=no;;
157 [ if test x${with_cplant_yod} != xyes; then
159 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
161 [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
163 [with_cplant_tests=no])
164 AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
167 AC_HELP_STRING([--with-sockets],
168 [build sockets interface driver (EXPERIMENTAL)]),
169 [ case "${withval}" in
172 *) AC_MSG_ERROR(bad value ${withval} for --with-sockets) ;;
175 AM_CONDITIONAL(WITH_SOCKETS_DRIVER, test x$with_sockets = xyes)
177 AC_ARG_WITH(lustre-hack,
178 AC_HELP_STRING([--with-lustre-hack],
179 [have hacking code which needed to support liblustre driver (EXPERIMENTAL)]),
180 [ case "${withval}" in
183 *) AC_MSG_ERROR(bad value ${withval} for --with-lustre-hack) ;;
185 [with_lustre_hack=no])
186 AM_CONDITIONAL(WITH_LUSTRE_HACK, test x$with_lustre_hack = xyes)
187 if test x$with_lustre_hack = xyes; then
188 AC_DEFINE(HAVE_LUSTRE_HACK)
191 AC_ARG_WITH(alternate-symbols,
192 AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
193 [Prepend standard, public, symbols with a unique qualifer]),
194 [ case "${withval}" in
195 yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
197 *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
199 AC_SUBST(SYSIO_LABEL_NAMES)
201 # We keep the original values in `$config_*' and never modify them, so we
202 # can write them unchanged into config.make. Everything else uses
203 # $machine, $vendor, and $os, and changes them whenever convenient.
204 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
206 # Don't allow vendor == "unknown"
207 test "$config_vendor" = unknown && config_vendor=
208 config_os="`echo $config_os | sed 's/^unknown-//'`"
210 # Some configurations imply other options.
212 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
213 # These systems always use GNU tools.
214 gnu_ld=yes gnu_as=yes ;;
217 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
218 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
220 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
221 # These systems (almost) always use the ELF format.
225 # These systems are always xcoff
231 machine=$config_machine
232 vendor=$config_vendor
235 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
237 if test "$machine" = rs6000; then
243 AC_DEFINE(_XOPEN_SOURCE, 600)
246 # ... and always needed...
247 AC_DEFINE(__USE_LARGEFILE64)
248 AC_DEFINE(_LARGE_FILES)
249 AC_DEFINE(_LARGE_FILE_API)
250 AC_DEFINE(_ALL_SOURCE)
251 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
255 AC_MSG_CHECKING(for symlink support)
257 #include <sys/types.h>
258 #include <sys/stat.h>
264 symlink_support="yes",
267 AC_MSG_RESULT($symlink_support)
269 if test x$symlink_support = xyes; then
270 AC_MSG_CHECKING(if readlink returns int)
274 extern int readlink(const char *, char *, size_t);
276 readlink_returns_int="yes",
277 readlink_returns_int="no"
279 AC_MSG_RESULT($readlink_returns_int)
280 if test x$readlink_returns_int = no; then
281 AC_DEFINE(HAVE_POSIX_1003_READLINK,
283 [readlink returns ssize_t])
287 AC_MSG_CHECKING(if readlink returns ssize_t)
291 ssize_t readlink(const char *, char *, size_t);
294 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
299 # If we can't provoke the declaration of stat64 then we assume the
300 # environment supports 64-bit file support naturally. Beware!
301 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
303 #include <sys/types.h>
304 #include <sys/stat.h>
305 #include <unistd.h>], [
306 struct stat64 st64;],
307 sysio_largefile64_source_required=no,
308 sysio_largefile64_source_required=maybe)
309 if test x$sysio_largefile64_source_required = xmaybe; then
311 #define _LARGEFILE64_SOURCE
312 #include <sys/types.h>
313 #include <sys/stat.h>
314 #include <unistd.h>], [
315 struct stat64 st64;],
316 sysio_largefile64_source_required=yes,
317 sysio_largefile64_source_required=no)
319 AC_MSG_RESULT($sysio_largefile64_source_required)
320 if test x$sysio_largefile64_source_required = xyes; then
321 AC_DEFINE(_LARGEFILE64_SOURCE)
324 # Alpha linux defines
326 AC_MSG_CHECKING(for alpha linux)
328 if test `expr ${machine} : "alpha"` = 5 && \
329 test `expr ${os} : "linux"` = 5; then
331 AC_DEFINE(ALPHA_LINUX)
333 AC_MSG_RESULT($alpha_linux_env)
334 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
338 AC_MSG_CHECKING(for __st_ino)
340 #include <sys/stat.h>],
345 AC_MSG_RESULT($have__st_ino)
346 if test x$have__st_ino = xyes; then
347 AC_DEFINE(HAVE__ST_INO)
352 AC_MSG_CHECKING(for st_gen)
354 #include <sys/stat.h>],
359 AC_MSG_RESULT($have_st_gen)
360 if test x$have_st_gen = xyes; then
361 AC_DEFINE(HAVE_GENERATION)
364 AC_MSG_CHECKING(for POSIX 2008 preadv)
366 CFLAGS="$CFLAGS -Wall -Werror"
369 ssize_t preadv (int __fd, const struct iovec *__iovec,
370 int __count, off_t off)
376 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
383 AC_MSG_CHECKING(for POSIX 2008 scandir)
385 CFLAGS="$CFLAGS -Wall -Werror"
392 int scandir(const char *dir,
393 struct dirent ***namelist,
394 int(*filter)(const struct dirent *),
395 int(*compar)(const struct dirent **,
396 const struct dirent **)
401 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
409 AC_MSG_CHECKING(for POSIX 2008 preadv)
411 CFLAGS="$CFLAGS -Wall -Werror"
414 ssize_t preadv (int __fd, const struct iovec *__iovec,
415 int __count, off_t off)
421 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
428 AC_MSG_CHECKING(for POSIX 2008 scandir)
430 CFLAGS="$CFLAGS -Wall -Werror"
437 int scandir(const char *dir,
438 struct dirent ***namelist,
439 int(*filter)(const struct dirent *),
440 int(*compar)(const struct dirent **,
441 const struct dirent **)
446 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
454 AC_MSG_CHECKING(whether .text pseudo-op must be used)
455 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
456 cat > conftest.s <<EOF
459 am_cv_sysio_asm_dot_text=
460 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
461 am_cv_sysio_asm_dot_text=.text
464 if test -z "$am_cv_sysio_asm_dot_text"; then
470 AC_CACHE_CHECK(for assembler global-symbol directive,
471 am_cv_sysio_asm_global_directive, [dnl
472 am_cv_sysio_asm_global_directive=UNKNOWN
473 for ac_globl in .globl .global .EXPORT; do
474 cat > conftest.s <<EOF
475 ${am_cv_sysio_asm_dot_text}
479 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
480 am_cv_sysio_asm_global_directive=${ac_globl}
483 test $am_cv_sysio_asm_global_directive != UNKNOWN && break
485 if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
486 AC_MSG_ERROR(cannot determine asm global directive)
488 # AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
491 AC_CACHE_CHECK(for .set assembler directive,
492 am_cv_sysio_asm_set_directive, [dnl
493 cat > conftest.s<<EOF
494 ${am_cv_sysio_asm_dot_text}
497 ${am_cv_sysio_asm_global_directive} bar
499 # The alpha-dec-osf1 assembler gives only a warning for `.set'
500 # (but it doesn't work), so we must do a linking check to be sure.
501 cat > conftest1.c <<EOF
503 main () { printf ("%d\n", bar); }
505 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
506 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
507 am_cv_sysio_asm_set_directive=yes
509 am_cv_sysio_asm_set_directive=no
512 #if test $am_cv_sysio_asm_set_directive = yes; then
513 # AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
516 AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
518 cat > conftest.s <<EOF
519 ${am_cv_sysio_asm_dot_text}
523 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
524 am_cv_sysio_asm_weak_directive=yes
526 am_cv_sysio_asm_weak_directive=no
530 if test $am_cv_sysio_asm_weak_directive = no; then
531 AC_CACHE_CHECK(for assembler .weakext directive,
532 am_cv_sysio_asm_weakext_directive, [dnl
533 cat > conftest.s <<EOF
534 ${am_cv_sysio_asm_dot_text}
535 ${am_cv_sysio_asm_global_directive} foo
539 ${am_cv_sysio_asm_global_directive} baz
542 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
543 am_cv_sysio_asm_weakext_directive=yes
545 am_cv_sysio_asm_weakext_directive=no
550 if test x$am_cv_sysio_asm_weak_directive = xyes; then
551 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
553 if test x$am_cv_sysio_asm_weakext_directive = xyes; then
554 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)