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 # and in MPSS 2.1 it's defined in $host_vendor. But in MPSS 3.x
34 # it's defined in $host_arch. So, try to support both case.
36 AC_MSG_RESULT([Intel(R) Xeon Phi(TM)])
37 CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
38 if test \( $CC_TARGET_ARCH != x86_64-k1om-linux \
39 -a $CC_TARGET_ARCH != k1om-mpss-linux \)
41 AC_MSG_ERROR([Cross compiler not found in PATH.])
50 if test ${target_cpu} == "powerpc64"; then
51 AC_MSG_WARN([set compiler with -m64])
57 AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
58 [directory for sysio library]),
59 [ case "${withval}" in
60 "yes"|"no"|"") have_lib_dir=no ;;
61 *) LIBBUILD_DIR=${withval};
62 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} ||
65 [ LIBBUILD_DIR=`pwd`/lib;
66 test -d ${LIBBUILD_DIR} || mkdir ${LIBBUILD_DIR} || have_lib_dir=no;])
67 if test x${have_lib_dir} = xyes; then
68 echo "Using sysio library directory ${LIBBUILD_DIR}"
70 AC_MSG_ERROR(Need writeable path to sysio library directory ${LIBBUILD_DIR})
72 AC_SUBST(LIBBUILD_DIR)
74 AC_ARG_WITH(native_driver,
75 AC_HELP_STRING([--with-native-driver],[build native test driver]),
76 [ case "${withval}" in
79 *) AC_MSG_ERROR(bad value ${withval} for --with-native-driver) ;;
81 [with_native_driver=yes;])
82 AM_CONDITIONAL(WITH_NATIVE_DRIVER, test x$with_native_driver = xyes)
84 AC_ARG_WITH(incore-driver,
85 AC_HELP_STRING([--with-incore-driver],[build incore test driver]),
86 [ case "${withval}" in
89 *) AC_MSG_ERROR(bad value ${withval} for --with-incore-driver) ;;
91 [with_incore_driver=yes])
92 AM_CONDITIONAL(WITH_INCORE_DRIVER, test x$with_incore_driver = xyes)
95 AC_HELP_STRING([--with-tests],[build tests]),
96 [ case "${withval}" in
99 *) AC_MSG_ERROR(bad value ${withval} for --with-tests) ;;
102 AM_CONDITIONAL(WITH_TESTS, test x$with_tests = xyes)
104 AC_ARG_WITH(automount,
105 AC_HELP_STRING([--with-automount@<:@=<automount-file-name>@:>@],
106 [with automounts @<:@<automount-file-name>=.mount@:>@]),
107 [ if test x${withval} = xyes; then
108 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\".mount\\\""
109 elif test x${withval} != x; then
110 AUTOMOUNT=-DAUTOMOUNT_FILE_NAME="\\\"${withval}\\\""
114 AC_ARG_WITH(stdfd-dev,
115 AC_HELP_STRING([--with-stdfd-dev],
116 [build standard file descriptors pseudo-driver]),
117 [ case "${withval}" in
120 *) AC_MSG_ERROR(bad value ${withval} for --with-stdfd-dev) ;;
122 [with_stdfd_dev=yes])
123 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
125 AC_ARG_WITH(zero-sum-memory,
126 AC_HELP_STRING([--with-zero-sum-memory],
127 [free all dynamically allocated memory at the end -- useful for debugging]),
128 [ case "${withval}" in
129 yes) ZERO_SUM_MEMORY=-DZERO_SUM_MEMORY=1 ;;
131 *) AC_MSG_ERROR(bad value ${withval} for --with-zero-sum-memory) ;;
133 [with_zero_sum_memory=no])
134 AC_SUBST(ZERO_SUM_MEMORY)
136 AC_ARG_WITH(defer-init-cwd,
137 AC_HELP_STRING([--with-defer-init-cwd],
138 [defer initialization of current working directory]),
139 [ case "${withval}" in
140 yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
142 *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
144 [with_defer_init_cwd=no])
145 AC_SUBST(DEFER_INIT_CWD)
148 AC_HELP_STRING([--with-tracing],
149 [enable tracing support]),
150 [ case "${withval}" in
151 yes) TRACING=-DSYSIO_TRACING=1 ;;
153 *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
155 [TRACING=-DSYSIO_TRACING=1])
158 AC_ARG_WITH(cplant_yod,
159 AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
160 [ case "${withval}" in
161 yes) if test x${with_stdfd_dev} != xyes; then
163 AM_CONDITIONAL(WITH_STDFD_DEV, test x$with_stdfd_dev = xyes)
166 *) AC_MSG_ERROR(bad value ${withval} for --with-cplant-yod);;
168 [with_cplant_yod=no])
169 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
171 AC_ARG_WITH(cplant_tests,
172 AC_HELP_STRING([--with-cplant-tests=<cplant-build-path>],
173 [build libsysio tests for cplant platform]),
174 [ case "${withval}" in
175 yes) AC_MSG_ERROR(need path to compiler for --with-cplant-tests);;
176 no) with_cplant_tests=no;;
181 [ if test x${with_cplant_yod} != xyes; then
183 AM_CONDITIONAL(WITH_CPLANT_YOD, test x$with_cplant_yod = xyes)
185 [ AC_MSG_ERROR(path not found ${CC} for --with-cplant-tests) ]);;
187 [with_cplant_tests=no])
188 AM_CONDITIONAL(WITH_CPLANT_TESTS, test x$with_cplant_tests != xno)
191 AC_HELP_STRING([--with-sockets],
192 [build sockets interface driver (EXPERIMENTAL)]),
193 [ case "${withval}" in
196 *) AC_MSG_ERROR(bad value ${withval} for --with-sockets) ;;
199 AM_CONDITIONAL(WITH_SOCKETS_DRIVER, test x$with_sockets = xyes)
201 AC_ARG_WITH(lustre-hack,
202 AC_HELP_STRING([--with-lustre-hack],
203 [have hacking code which needed to support liblustre driver (EXPERIMENTAL)]),
204 [ case "${withval}" in
207 *) AC_MSG_ERROR(bad value ${withval} for --with-lustre-hack) ;;
209 [with_lustre_hack=no])
210 AM_CONDITIONAL(WITH_LUSTRE_HACK, test x$with_lustre_hack = xyes)
211 if test x$with_lustre_hack = xyes; then
212 AC_DEFINE(HAVE_LUSTRE_HACK)
215 AC_ARG_WITH(alternate-symbols,
216 AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
217 [Prepend standard, public, symbols with a unique qualifer]),
218 [ case "${withval}" in
219 yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
221 *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
223 AC_SUBST(SYSIO_LABEL_NAMES)
225 # We keep the original values in `$config_*' and never modify them, so we
226 # can write them unchanged into config.make. Everything else uses
227 # $machine, $vendor, and $os, and changes them whenever convenient.
228 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
230 # Don't allow vendor == "unknown"
231 test "$config_vendor" = unknown && config_vendor=
232 config_os="`echo $config_os | sed 's/^unknown-//'`"
234 # Some configurations imply other options.
236 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
237 # These systems always use GNU tools.
238 gnu_ld=yes gnu_as=yes ;;
241 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
242 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
244 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
245 # These systems (almost) always use the ELF format.
249 # These systems are always xcoff
255 machine=$config_machine
256 vendor=$config_vendor
259 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
261 if test "$machine" = rs6000; then
267 AC_DEFINE(_XOPEN_SOURCE, 600)
270 # ... and always needed...
271 AC_DEFINE(__USE_LARGEFILE64)
272 AC_DEFINE(_LARGE_FILES)
273 AC_DEFINE(_LARGE_FILE_API)
274 AC_DEFINE(_ALL_SOURCE)
275 AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
279 AC_MSG_CHECKING(for symlink support)
281 #include <sys/types.h>
282 #include <sys/stat.h>
288 symlink_support="yes",
291 AC_MSG_RESULT($symlink_support)
293 if test x$symlink_support = xyes; then
294 AC_MSG_CHECKING(if readlink returns int)
298 extern int readlink(const char *, char *, size_t);
300 readlink_returns_int="yes",
301 readlink_returns_int="no"
303 AC_MSG_RESULT($readlink_returns_int)
304 if test x$readlink_returns_int = no; then
305 AC_DEFINE(HAVE_POSIX_1003_READLINK,
307 [readlink returns ssize_t])
311 AC_MSG_CHECKING(if readlink returns ssize_t)
315 ssize_t readlink(const char *, char *, size_t);
318 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
323 # If we can't provoke the declaration of stat64 then we assume the
324 # environment supports 64-bit file support naturally. Beware!
325 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
327 #include <sys/types.h>
328 #include <sys/stat.h>
329 #include <unistd.h>], [
330 struct stat64 st64;],
331 sysio_largefile64_source_required=no,
332 sysio_largefile64_source_required=maybe)
333 if test x$sysio_largefile64_source_required = xmaybe; then
335 #define _LARGEFILE64_SOURCE
336 #include <sys/types.h>
337 #include <sys/stat.h>
338 #include <unistd.h>], [
339 struct stat64 st64;],
340 sysio_largefile64_source_required=yes,
341 sysio_largefile64_source_required=no)
343 AC_MSG_RESULT($sysio_largefile64_source_required)
344 if test x$sysio_largefile64_source_required = xyes; then
345 AC_DEFINE(_LARGEFILE64_SOURCE)
348 # Alpha linux defines
350 AC_MSG_CHECKING(for alpha linux)
352 if test `expr ${machine} : "alpha"` = 5 && \
353 test `expr ${os} : "linux"` = 5; then
355 AC_DEFINE(ALPHA_LINUX)
357 AC_MSG_RESULT($alpha_linux_env)
358 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
362 AC_MSG_CHECKING(for __st_ino)
364 #include <sys/stat.h>],
369 AC_MSG_RESULT($have__st_ino)
370 if test x$have__st_ino = xyes; then
371 AC_DEFINE(HAVE__ST_INO)
376 AC_MSG_CHECKING(for st_gen)
378 #include <sys/stat.h>],
383 AC_MSG_RESULT($have_st_gen)
384 if test x$have_st_gen = xyes; then
385 AC_DEFINE(HAVE_GENERATION)
388 AC_MSG_CHECKING(for POSIX 2008 preadv)
390 CFLAGS="$CFLAGS -Wall -Werror"
393 ssize_t preadv (int __fd, const struct iovec *__iovec,
394 int __count, off_t off)
400 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
407 AC_MSG_CHECKING(for POSIX 2008 scandir)
409 CFLAGS="$CFLAGS -Wall -Werror"
416 int scandir(const char *dir,
417 struct dirent ***namelist,
418 int(*filter)(const struct dirent *),
419 int(*compar)(const struct dirent **,
420 const struct dirent **)
425 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
433 AC_MSG_CHECKING(for POSIX 2008 preadv)
435 CFLAGS="$CFLAGS -Wall -Werror"
438 ssize_t preadv (int __fd, const struct iovec *__iovec,
439 int __count, off_t off)
445 AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
452 AC_MSG_CHECKING(for POSIX 2008 scandir)
454 CFLAGS="$CFLAGS -Wall -Werror"
461 int scandir(const char *dir,
462 struct dirent ***namelist,
463 int(*filter)(const struct dirent *),
464 int(*compar)(const struct dirent **,
465 const struct dirent **)
470 AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
478 AC_MSG_CHECKING(whether .text pseudo-op must be used)
479 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
480 cat > conftest.s <<EOF
483 am_cv_sysio_asm_dot_text=
484 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
485 am_cv_sysio_asm_dot_text=.text
488 if test -z "$am_cv_sysio_asm_dot_text"; then
494 AC_CACHE_CHECK(for assembler global-symbol directive,
495 am_cv_sysio_asm_global_directive, [dnl
496 am_cv_sysio_asm_global_directive=UNKNOWN
497 for ac_globl in .globl .global .EXPORT; do
498 cat > conftest.s <<EOF
499 ${am_cv_sysio_asm_dot_text}
503 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
504 am_cv_sysio_asm_global_directive=${ac_globl}
507 test $am_cv_sysio_asm_global_directive != UNKNOWN && break
509 if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
510 AC_MSG_ERROR(cannot determine asm global directive)
512 # AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
515 AC_CACHE_CHECK(for .set assembler directive,
516 am_cv_sysio_asm_set_directive, [dnl
517 cat > conftest.s<<EOF
518 ${am_cv_sysio_asm_dot_text}
521 ${am_cv_sysio_asm_global_directive} bar
523 # The alpha-dec-osf1 assembler gives only a warning for `.set'
524 # (but it doesn't work), so we must do a linking check to be sure.
525 cat > conftest1.c <<EOF
527 main () { printf ("%d\n", bar); }
529 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
530 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
531 am_cv_sysio_asm_set_directive=yes
533 am_cv_sysio_asm_set_directive=no
536 #if test $am_cv_sysio_asm_set_directive = yes; then
537 # AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
540 AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
542 cat > conftest.s <<EOF
543 ${am_cv_sysio_asm_dot_text}
547 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
548 am_cv_sysio_asm_weak_directive=yes
550 am_cv_sysio_asm_weak_directive=no
554 if test $am_cv_sysio_asm_weak_directive = no; then
555 AC_CACHE_CHECK(for assembler .weakext directive,
556 am_cv_sysio_asm_weakext_directive, [dnl
557 cat > conftest.s <<EOF
558 ${am_cv_sysio_asm_dot_text}
559 ${am_cv_sysio_asm_global_directive} foo
563 ${am_cv_sysio_asm_global_directive} baz
566 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
567 am_cv_sysio_asm_weakext_directive=yes
569 am_cv_sysio_asm_weakext_directive=no
574 if test x$am_cv_sysio_asm_weak_directive = xyes; then
575 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
577 if test x$am_cv_sysio_asm_weakext_directive = xyes; then
578 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)