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 AS_IF([test "x$cross_compiling" = xyes],
32 # The K1OM architecture is an extension of the x86 architecture.
33 # So, the $host_arch is x86_64.
35 CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
36 if test $CC_TARGET_ARCH != x86_64-$host_vendor-linux ; then
37 AC_MSG_ERROR([Cross compiler not found in PATH.])
46 if test ${target_cpu} == "powerpc64"; then
47 AC_MSG_WARN([set compiler with -m64])
53 AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
54 [directory for sysio library]),
55 [ case "${withval}" in
56 "yes"|"no"|"") have_lib_dir=no ;;
57 *) LIBBUILD_DIR=${withval};
58 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} ||
61 [ LIBBUILD_DIR=`pwd`/lib;
62 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} || have_lib_dir=no;])
63 if test x${have_lib_dir} = xyes; then
64 echo "Using sysio library directory ${LIBBUILD_DIR}"
66 AC_MSG_ERROR(Need writeable path to sysio library directory ${LIBBUILD_DIR})
68 AC_SUBST(LIBBUILD_DIR)
70 AC_ARG_WITH(native_driver,
71 AC_HELP_STRING([--with-native-driver],[build native test driver]),
72 [ case "${withval}" in
75 *) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
77 [with_native_driver=yes;])
78 AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
80 AC_ARG_WITH(incore-driver,
81 AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
82 [ case "${withval}" in
85 *) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
87 [with_incore_driver=yes])
88 AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
91 AC_HELP_STRING([--with-tests],[build tests]),
92 [ case "${withval}" in
95 *) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
98 AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
100 AC_ARG_WITH(automount,
101 AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
102 [with automounts @<:@<automount-file-name>=.mount@:>@]),
103 [ if test x${withval} = xyes; then
104 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
105 elif test x${withval} != x; then
106 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
110 AC_ARG_WITH(stdfd-dev,
111 AC_HELP_STRING([--with-stdfd-dev],
112 [build standard file descriptors pseudo-driver]),
113 [ case "${withval}" in
116 *) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
118 [with_stdfd_dev=yes])
119 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
121 AC_ARG_WITH(zero-sum-memory,
122 AC_HELP_STRING([--with-zero-sum-memory],
123 [free all dynamically allocated memory at the end -- useful for debugging]),
124 [ case "${withval}" in
125 yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;;
127 *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;;
129 [with_zero_sum_memory=no])
130 AC_SUBST(ZERO_SUM_MEMORY)
132 AC_ARG_WITH(defer-init-cwd,
133 AC_HELP_STRING([--with-defer-init-cwd],
134 [defer initialization of current working directory]),
135 [ case "${withval}" in
136 yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
138 *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
140 [with_defer_init_cwd=no])
141 AC_SUBST(DEFER_INIT_CWD)
144 AC_HELP_STRING([--with-tracing],
145 [enable tracing support]),
146 [ case "${withval}" in
147 yes) TRACING=-DSYSIO_TRACING=1 ;;
149 *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
151 [TRACING=-DSYSIO_TRACING=1])
154 AC_ARG_WITH(cplant_yod,
155 AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
156 [ case "${withval}" in
157 yes) if test x${with_stdfd_dev} != xyes; then
159 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
162 *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
164 [with_cplant_yod=no])
165 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
167 AC_ARG_WITH(cplant_tests,
168 AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
169 [build libsysio tests for cplant platform]),
170 [ case "${withval}" in
171 yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
172 no) with_cplant_tests=no;;
177 [ if test x${with_cplant_yod} != xyes; then
179 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
181 [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
183 [with_cplant_tests=no])
184 AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
187 AC_HELP_STRING([--with-sockets],
188 [build sockets interface driver (EXPERIMENTAL)]),
189 [ case "${withval}" in
192 *) AC_MSG_ERROR(bad value ${withval} for --with-sockets) ;;
195 AM_CONDITIONAL(WITH_SOCKETS_DRIVER, test x$with_sockets = xyes)
197 AC_ARG_WITH(lustre-hack,
198 AC_HELP_STRING([--with-lustre-hack],
199 [have hacking code which needed to support liblustre driver (EXPERIMENTAL)]),
200 [ case "${withval}" in
203 *) AC_MSG_ERROR(bad value ${withval} for --with-lustre-hack) ;;
205 [with_lustre_hack=no])
206 AM_CONDITIONAL(WITH_LUSTRE_HACK, test x$with_lustre_hack = xyes)
207 if test x$with_lustre_hack = xyes; then
208 AC_DEFINE(HAVE_LUSTRE_HACK)
211 AC_ARG_WITH(alternate-symbols,
212 AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
213 [Prepend standard, public, symbols with a unique qualifer]),
214 [ case "${withval}" in
215 yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
217 *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
219 AC_SUBST(SYSIO_LABEL_NAMES)
221 # We keep the original values in `$config_*' and never modify them, so we
222 # can write them unchanged into config.make. Everything else uses
223 # $machine, $vendor, and $os, and changes them whenever convenient.
224 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
226 # Don't allow vendor == "unknown"
227 test "$config_vendor" = unknown && config_vendor=
228 config_os="`echo $config_os | sed 's/^unknown-//'`"
230 # Some configurations imply other options.
232 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
233 # These systems always use GNU tools.
234 gnu_ld=yes gnu_as=yes ;;
237 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
238 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
240 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
241 # These systems (almost) always use the ELF format.
245 # These systems are always xcoff
251 machine=$config_machine
252 vendor=$config_vendor
255 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
257 if test "$machine" = rs6000; then
263 AC_DEFINE(_XOPEN_SOURCE, 600)
266 # ... and always needed...
267 AC_DEFINE(__USE_LARGEFILE64)
268 AC_DEFINE(_LARGE_FILES)
269 AC_DEFINE(_LARGE_FILE_API)
270 AC_DEFINE(_ALL_SOURCE)
271 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
275 AC_MSG_CHECKING(for symlink support)
277 #include <sys/types.h>
278 #include <sys/stat.h>
284 symlink_support="yes",
287 AC_MSG_RESULT($symlink_support)
289 if test x$symlink_support = xyes; then
290 AC_MSG_CHECKING(if readlink returns int)
294 extern int readlink(const char *, char *, size_t);
296 readlink_returns_int="yes",
297 readlink_returns_int="no"
299 AC_MSG_RESULT($readlink_returns_int)
300 if test x$readlink_returns_int = no; then
301 AC_DEFINE(HAVE_POSIX_1003_READLINK,
303 [readlink returns ssize_t])
307 AC_MSG_CHECKING(if readlink returns ssize_t)
311 ssize_t readlink(const char *, char *, size_t);
314 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
319 # If we can't provoke the declaration of stat64 then we assume the
320 # environment supports 64-bit file support naturally. Beware!
321 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
323 #include <sys/types.h>
324 #include <sys/stat.h>
325 #include <unistd.h>], [
326 struct stat64 st64;],
327 sysio_largefile64_source_required=no,
328 sysio_largefile64_source_required=maybe)
329 if test x$sysio_largefile64_source_required = xmaybe; then
331 #define _LARGEFILE64_SOURCE
332 #include <sys/types.h>
333 #include <sys/stat.h>
334 #include <unistd.h>], [
335 struct stat64 st64;],
336 sysio_largefile64_source_required=yes,
337 sysio_largefile64_source_required=no)
339 AC_MSG_RESULT($sysio_largefile64_source_required)
340 if test x$sysio_largefile64_source_required = xyes; then
341 AC_DEFINE(_LARGEFILE64_SOURCE)
344 # Alpha linux defines
346 AC_MSG_CHECKING(for alpha linux)
348 if test `expr ${machine} : "alpha"` = 5 && \
349 test `expr ${os} : "linux"` = 5; then
351 AC_DEFINE(ALPHA_LINUX)
353 AC_MSG_RESULT($alpha_linux_env)
354 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
358 AC_MSG_CHECKING(for __st_ino)
360 #include <sys/stat.h>],
365 AC_MSG_RESULT($have__st_ino)
366 if test x$have__st_ino = xyes; then
367 AC_DEFINE(HAVE__ST_INO)
372 AC_MSG_CHECKING(for st_gen)
374 #include <sys/stat.h>],
379 AC_MSG_RESULT($have_st_gen)
380 if test x$have_st_gen = xyes; then
381 AC_DEFINE(HAVE_GENERATION)
384 AC_MSG_CHECKING(for POSIX 2008 preadv)
386 CFLAGS="$CFLAGS -Wall -Werror"
389 ssize_t preadv (int __fd, const struct iovec *__iovec,
390 int __count, off_t off)
396 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
403 AC_MSG_CHECKING(for POSIX 2008 scandir)
405 CFLAGS="$CFLAGS -Wall -Werror"
412 int scandir(const char *dir,
413 struct dirent ***namelist,
414 int(*filter)(const struct dirent *),
415 int(*compar)(const struct dirent **,
416 const struct dirent **)
421 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
429 AC_MSG_CHECKING(for POSIX 2008 preadv)
431 CFLAGS="$CFLAGS -Wall -Werror"
434 ssize_t preadv (int __fd, const struct iovec *__iovec,
435 int __count, off_t off)
441 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
448 AC_MSG_CHECKING(for POSIX 2008 scandir)
450 CFLAGS="$CFLAGS -Wall -Werror"
457 int scandir(const char *dir,
458 struct dirent ***namelist,
459 int(*filter)(const struct dirent *),
460 int(*compar)(const struct dirent **,
461 const struct dirent **)
466 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
474 AC_MSG_CHECKING(whether .text pseudo-op must be used)
475 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
476 cat > conftest.s <<EOF
479 am_cv_sysio_asm_dot_text=
480 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
481 am_cv_sysio_asm_dot_text=.text
484 if test -z "$am_cv_sysio_asm_dot_text"; then
490 AC_CACHE_CHECK(for assembler global-symbol directive,
491 am_cv_sysio_asm_global_directive, [dnl
492 am_cv_sysio_asm_global_directive=UNKNOWN
493 for ac_globl in .globl .global .EXPORT; do
494 cat > conftest.s <<EOF
495 ${am_cv_sysio_asm_dot_text}
499 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
500 am_cv_sysio_asm_global_directive=${ac_globl}
503 test $am_cv_sysio_asm_global_directive != UNKNOWN && break
505 if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
506 AC_MSG_ERROR(cannot determine asm global directive)
508 # AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
511 AC_CACHE_CHECK(for .set assembler directive,
512 am_cv_sysio_asm_set_directive, [dnl
513 cat > conftest.s<<EOF
514 ${am_cv_sysio_asm_dot_text}
517 ${am_cv_sysio_asm_global_directive} bar
519 # The alpha-dec-osf1 assembler gives only a warning for `.set'
520 # (but it doesn't work), so we must do a linking check to be sure.
521 cat > conftest1.c <<EOF
523 main () { printf ("%d\n", bar); }
525 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
526 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
527 am_cv_sysio_asm_set_directive=yes
529 am_cv_sysio_asm_set_directive=no
532 #if test $am_cv_sysio_asm_set_directive = yes; then
533 # AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
536 AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
538 cat > conftest.s <<EOF
539 ${am_cv_sysio_asm_dot_text}
543 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
544 am_cv_sysio_asm_weak_directive=yes
546 am_cv_sysio_asm_weak_directive=no
550 if test $am_cv_sysio_asm_weak_directive = no; then
551 AC_CACHE_CHECK(for assembler .weakext directive,
552 am_cv_sysio_asm_weakext_directive, [dnl
553 cat > conftest.s <<EOF
554 ${am_cv_sysio_asm_dot_text}
555 ${am_cv_sysio_asm_global_directive} foo
559 ${am_cv_sysio_asm_global_directive} baz
562 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
563 am_cv_sysio_asm_weakext_directive=yes
565 am_cv_sysio_asm_weakext_directive=no
570 if test x$am_cv_sysio_asm_weak_directive = xyes; then
571 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
573 if test x$am_cv_sysio_asm_weakext_directive = xyes; then
574 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)