dnl aclocal.m4 generated automatically by aclocal 1.4-p4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl TI_CHECK_BACKEND(backend-name, test-command) AC_DEFUN([TI_CHECK_BACKEND],[ AC_MSG_CHECKING(for $1 backend) override="" if $2; then GASNET_IF_DISABLED($1,Disable use of the $1 backend (if available), override=yes) if test "$override" = "yes" ; then enable_[]patsubst([$1], -, _)=no override=" (disabled from configure command-line)" else BACKENDS="$BACKENDS $1" enable_[]patsubst([$1], -, _)=yes fi else enable_[]patsubst([$1], -, _)=no fi AC_MSG_RESULT($enable_[]patsubst([$1], -, _)$override) ]) dnl TI_TCBUILD_CFLAGS(name, description, action-if-not-set) AC_DEFUN([TI_TCBUILD_CFLAGS],[ AC_MSG_CHECKING(tcbuild $2 flags) AC_ARG_WITH(tcbuild-cflags-$1, GASNET_OPTION_HELP(with-tcbuild-cflags-$1=FLAGS,$2 flags used by tcbuild), , [$3]) TCBUILD_CFLAGS_[]translit($1, [a-z], [A-Z])="$withval" AC_SUBST(TCBUILD_CFLAGS_[]translit($1, [a-z], [A-Z])) AC_MSG_RESULT($withval)]) dnl $Source: runtime/gasnet/acinclude.m4 $ dnl $Date: Fri, 29 Jul 2005 19:33:30 -0700 $ dnl $Revision: 1.25.1.8.1.20 $ dnl Description: m4 macros dnl Copyright 2004, Dan Bonachea dnl Terms of use are as specified in license.txt dnl determine the autoconf version used to build configure script AC_DEFUN([GASNET_GET_AUTOCONF_VERSION],[ AC_REQUIRE([AC_PROG_AWK]) AC_MSG_CHECKING(autoconf version) dnl AUTOCONF_VERSION=`cat ${srcdir}/configure | perl -e '{ while () { if (m/enerated.*utoconf.*([[0-9]]+)\.([[0-9]]+).*/) { print "[$]1.[$]2\n"; exit 0 } } }'` AUTOCONF_VERSION_STR=`cat ${srcdir}/configure | $AWK '/.*enerated.*utoconf.*([[0-9]]+).([[0-9]]+).*/ { [match]([$]0,"[[0-9]]+.[[0-9]]+"); print [substr]([$]0,RSTART,RLENGTH); exit 0 } '` AUTOCONF_VERSION=`echo $AUTOCONF_VERSION_STR | $AWK -F. '{ printf("%i%i",[$]1,[$]2); }'` AC_MSG_RESULT($AUTOCONF_VERSION_STR) ]) dnl GASNET_GCC_VERSION_CHECK(type) type=CC or CXX AC_DEFUN([GASNET_GCC_VERSION_CHECK],[ AC_MSG_CHECKING(for known buggy compilers) badgccmsg="" AC_TRY_COMPILE([ #if __GNUC__ == 2 && __GNUC_MINOR__ == 96 && __GNUC_PATCHLEVEL__ == 0 # error #endif ],[ ], [:], [ AC_MSG_RESULT([$1] is gcc 2.96) badgccmsg="Use of gcc/g++ 2.96 for compiling this software is strongly discouraged. \ It is not an official GNU release and has many serious known bugs, especially \ in the optimizer, which may lead to bad code and incorrect runtime behavior. \ Consider using \$[$1] to select a different compiler." GASNET_IF_ENABLED(allow-gcc296, Allow the use of the broken gcc/g++ 2.96 compiler, [ AC_MSG_WARN([$badgccmsg]) ],[ AC_MSG_ERROR([$badgccmsg \ You may enable use of this broken compiler at your own risk by passing the --enable-allow-gcc296 flag.]) ]) ]) AC_TRY_COMPILE([ #if __GNUC__ == 3 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ <= 2 # error #endif ],[ ], [:], [ AC_MSG_RESULT([$1] is gcc 3.2.0-2) badgccmsg="Use of gcc/g++ 3.2.0-2 for compiling this software is strongly discouraged. \ This version has a serious known bug in the optimizer regarding structure copying, \ which may lead to bad code and incorrect runtime behavior when optimization is enabled. \ Consider using \$[$1] to select a different compiler." GASNET_IF_ENABLED(allow-gcc32, Allow the use of the known broken gcc/g++ 3.2.0-2 compiler, [ AC_MSG_WARN([$badgccmsg]) ],[ AC_MSG_ERROR([$badgccmsg \ You may enable use of this broken compiler at your own risk by passing the --enable-allow-gcc32 flag.]) ]) ]) if test -z "$badgccmsg"; then AC_MSG_RESULT(ok) fi ]) AC_DEFUN([GASNET_FIX_SHELL],[ AC_MSG_CHECKING(for good shell) if test "$BASH" = '' && test `uname` = HP-UX; then AC_MSG_RESULT([no, switching to bash]) case [$]# in 0) exec bash - "[$]0" ;; *) exec bash - "[$]0" "[$]@" ;; esac else AC_MSG_RESULT(yes) fi]) dnl find full pathname for a given header file, if it exists and AC_SUBST it AC_DEFUN([GASNET_FIND_HEADER],[ AC_REQUIRE([AC_PROG_AWK]) AC_CHECK_HEADERS($1) pushdef([lowername],patsubst(patsubst(patsubst([$1], [/], [_]), [\.], [_]), [-], [_])) pushdef([uppername],translit(lowername,'a-z','A-Z')) if test "$ac_cv_header_[]lowername" = "yes"; then AC_MSG_CHECKING(for location of $1) header_pathname=`echo "#include <$1>" > conftest.c ; $CPP conftest.c | grep $1 | head -1` header_pathname=`echo $header_pathname | $AWK '{ printf("%s",[$]3); }'` if test -z "$header_pathname"; then # IBM xlc doesn't always emit include file name in output: try /usr/include if test -r /usr/include/$1; then header_pathname="\"/usr/include/$1\"" fi fi AC_MSG_RESULT($header_pathname) have=1 else header_pathname= have=0 fi PATH_[]uppername=$header_pathname HAVE_[]uppername=$have AC_SUBST(PATH_[]uppername) AC_SUBST(HAVE_[]uppername) popdef([uppername]) popdef([lowername]) ]) dnl do AC_CHECK_SIZEOF and also AC_SUBST the result AC_DEFUN([GASNET_CHECK_SIZEOF],[ pushdef([lowername],patsubst(patsubst([$1], [\ ], [_]), [\*], [p])) pushdef([uppername],translit(lowername,'a-z','A-Z')) if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(SIZEOF_[]uppername,SIZEOF_[]uppername) ac_cv_sizeof_[]lowername=$SIZEOF_[]uppername fi dnl use bare AC_CHECK_SIZEOF here to get correct .h behavior & avoid duplicate defs AC_CHECK_SIZEOF($1, $SIZEOF_[]uppername) SIZEOF_[]uppername=$ac_cv_sizeof_[]lowername if test "$SIZEOF_[]uppername" = "0" -o "$SIZEOF_[]uppername" = ""; then AC_MSG_ERROR(failed to find sizeof($1)) fi AC_SUBST(SIZEOF_[]uppername) popdef([lowername]) popdef([uppername]) ]) dnl GASNET_CHECK_INTTYPES(headername) dnl AC_DEFINE and set HAVE_HEADERNAME_H if the header exists dnl AC_DEFINE and AC_SUBST COMPLETE_HEADERNAME_H if it contains all the inttypes dnl that we care about (all of which are mandated by C99 and POSIX!) AC_DEFUN([GASNET_CHECK_INTTYPES_HELPERPROG],[ #include <$1> int check() { int8_t i8; uint8_t u8; int16_t i16; uint16_t u16; int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; intptr_t ip; uintptr_t up; if (sizeof(i8) != 1) return 1; if (sizeof(u8) != 1) return 1; if (sizeof(i16) != 2) return 1; if (sizeof(u16) != 2) return 1; if (sizeof(i32) != 4) return 1; if (sizeof(u32) != 4) return 1; if (sizeof(i64) != 8) return 1; if (sizeof(u64) != 8) return 1; if (sizeof(ip) != sizeof(void*)) return 1; if (sizeof(up) != sizeof(void*)) return 1; return 0; } ]) AC_DEFUN([GASNET_CHECK_INTTYPES],[ AC_CHECK_HEADERS([$1]) pushdef([lowername],patsubst(patsubst(patsubst([$1], [/], [_]), [\.], [_]), [-], [_])) pushdef([uppername],translit(lowername,'a-z','A-Z')) if test "$ac_cv_header_[]lowername" = "yes"; then HAVE_[]uppername=1 if test "$cross_compiling" = "yes" ; then dnl if cross-compiling, just ensure the header can build the inttypes program and hope for the best GASNET_TRY_CACHE_CHECK([for a complete $1],[COMPLETE_[]uppername],[ GASNET_CHECK_INTTYPES_HELPERPROG($1) ],[ return check(); ], [ COMPLETE_[]uppername=1 AC_SUBST(COMPLETE_[]uppername) AC_DEFINE(COMPLETE_[]uppername) ]) else dnl otherwise, build and run the inttypes program to ensure the header values are actually correct GASNET_TRY_CACHE_RUN([for a complete $1],[COMPLETE_[]uppername],[ GASNET_CHECK_INTTYPES_HELPERPROG($1) int main() { return check(); } ],[ COMPLETE_[]uppername=1 AC_SUBST(COMPLETE_[]uppername) AC_DEFINE(COMPLETE_[]uppername) ]) fi fi popdef([lowername]) popdef([uppername]) ]) dnl all the inttypes goop required for portable_inttypes.h AC_DEFUN([GASNET_SETUP_INTTYPES], [ # Check sizes GASNET_CHECK_SIZEOF(char) GASNET_CHECK_SIZEOF(short) GASNET_CHECK_SIZEOF(int) GASNET_CHECK_SIZEOF(long) GASNET_CHECK_SIZEOF(long long) GASNET_CHECK_SIZEOF(void *) AM_CONDITIONAL(PLATFORM_ILP32, test x"$ac_cv_sizeof_int$ac_cv_sizeof_long$ac_cv_sizeof_void_p" = x444) AM_CONDITIONAL(PLATFORM_LP64, test x"$ac_cv_sizeof_int$ac_cv_sizeof_long$ac_cv_sizeof_void_p" = x488) AM_CONDITIONAL(PLATFORM_ILP64, test x"$ac_cv_sizeof_int$ac_cv_sizeof_long$ac_cv_sizeof_void_p" = x888) GASNET_CHECK_INTTYPES(stdint.h) GASNET_CHECK_INTTYPES(inttypes.h) GASNET_CHECK_INTTYPES(sys/types.h) INTTYPES_DEFINES="-DSIZEOF_CHAR=$SIZEOF_CHAR -DSIZEOF_SHORT=$SIZEOF_SHORT -DSIZEOF_INT=$SIZEOF_INT -DSIZEOF_LONG=$SIZEOF_LONG -DSIZEOF_LONG_LONG=$SIZEOF_LONG_LONG -DSIZEOF_VOID_P=$SIZEOF_VOID_P" GASNET_APPEND_DEFINE(INTTYPES_DEFINES, HAVE_STDINT_H) GASNET_APPEND_DEFINE(INTTYPES_DEFINES, COMPLETE_STDINT_H) GASNET_APPEND_DEFINE(INTTYPES_DEFINES, HAVE_INTTYPES_H) GASNET_APPEND_DEFINE(INTTYPES_DEFINES, COMPLETE_INTTYPES_H) GASNET_APPEND_DEFINE(INTTYPES_DEFINES, HAVE_SYS_TYPES_H) GASNET_APPEND_DEFINE(INTTYPES_DEFINES, COMPLETE_SYS_TYPES_H) AC_SUBST(INTTYPES_DEFINES) ]) dnl Appends -Dvar_to_define onto target_var, iff var_to_define is set dnl GASNET_APPEND_DEFINE(target_var, var_to_define) AC_DEFUN([GASNET_APPEND_DEFINE],[ if test "$[$2]" != ""; then [$1]="$[$1] -D[$2]" fi ]) dnl push a new value into variable varname, saving the old value dnl GASNET_PUSHVAR(varname, new value) AC_DEFUN([GASNET_PUSHVAR],[ # --------------------------------------- # [GASNET_PUSHVAR]($1, $2) dnl echo "old value of $1: $[$1]" if test "$_pushcnt_$1" = "" ; then _pushcnt_$1=0 fi if test "$_total_pushcnt" = "" ; then _total_pushcnt=0 fi eval _pushedvar_$1_$_pushcnt_$1=\$[$1] _pushcnt_$1=`expr $_pushcnt_$1 + 1` _total_pushcnt=`expr $_total_pushcnt + 1` $1=$2 dnl echo "pushed new value: $[$1]" # --------------------------------------- ]) dnl restore the old value of varname, from a previous push dnl GASNET_POPVAR(varname) AC_DEFUN([GASNET_POPVAR],[ # --------------------------------------- # [GASNET_POPVAR]($1) if test "$_pushcnt_$1" -ge "1"; then _pushcnt_$1=`expr $_pushcnt_$1 - 1` _total_pushcnt=`expr $_total_pushcnt - 1` eval $1=\$_pushedvar_$1_$_pushcnt_$1 dnl echo "popping $1 back to: $[$1]" else AC_MSG_ERROR([INTERNAL ERROR: GASNET_PUSH/POPVAR underflow on $1]) fi # --------------------------------------- ]) AC_DEFUN([GASNET_PUSHPOP_CHECK],[ if test "$_total_pushcnt" -ge "1" ; then AC_MSG_ERROR([INTERNAL ERROR: GASNET_PUSH/POPVAR mismatch: $_total_pushcnt more pushes than pops]) fi ]) dnl add file to list of executable outputs that should be marked +x dnl would be nice to use AC_CONFIG_COMMANDS() for each file, but autoconf 2.53 dnl stupidly fails to execute commands having the same tag as a config output file dnl on subsequent calls to config.status AC_DEFUN([GASNET_FIX_EXEC],[ cv_prefix[]exec_list="$cv_prefix[]exec_list $1" ]) dnl ensure the "default" command is run on every invocation of config.status AC_DEFUN([GASNET_FIX_EXEC_SETUP],[[ dnl round-about method ensure autoconf 2.53 picks up depfiles command if test "\${config_commands+set}" != set ; then config_commands="default" fi CONFIG_COMMANDS="\$config_commands" cv_prefix[]exec_list="$cv_prefix[]exec_list" ]]) AC_DEFUN([GASNET_FIX_EXEC_OUTPUT],[[ for file in $cv_prefix[]exec_list; do case "$CONFIG_FILES" in *${file}*) chmod +x ${file} ;; esac done ]]) AC_DEFUN([GASNET_LIBGCC],[ AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK(for libgcc link flags, cv_prefix[]lib_gcc, [if test "$GCC" = yes; then #LIBGCC="`$CC -v 2>&1 | sed -n 's:^Reading specs from \(.*\)/specs$:-L\1 -lgcc:p'`" LIBGCC="-L`$CC -print-libgcc-file-name | xargs dirname` -lgcc" if test -z "$LIBGCC"; then AC_MSG_ERROR(cannot find libgcc) fi fi cv_prefix[]lib_gcc="$LIBGCC"]) LIBGCC="$cv_prefix[]lib_gcc" AC_SUBST(LIBGCC) ]) AC_DEFUN([GASNET_LIBM],[ AC_REQUIRE([AC_PROG_CC]) GASNET_PUSHVAR(LIBS,"$LIBS") case "$target_os" in darwin*) # libm is just an alias for the system default lib # Naming it explicitly causes linker failures when linking w/ mpich ;; *) # sin should be in everyone's libm if they've got one. AC_CHECK_LIB(m, sin, LIBM="-lm", LIBM="") ;; esac AC_SUBST(LIBM) GASNET_POPVAR(LIBS) ]) dnl GASNET_ENV_DEFAULT(envvar-name, default-value) dnl load an environment variable, using default value if it's missing from env. dnl caches the results to guarantee reconfig gets the originally loaded value dnl also adds a --with-foo-bar= option for the env variable FOO_BAR AC_DEFUN([GASNET_ENV_DEFAULT],[ pushdef([lowerdashname],patsubst(translit([$1],'A-Z','a-z'), _, -)) pushdef([lowerscorename],patsubst(translit([$1],'A-Z','a-z'), -, _)) # --------------------------------------- # [GASNET_ENV_DEFAULT]($1, $2) AC_MSG_CHECKING(for $1 in environment) dnl create the help prompt just once ifdef(with_expanded_[$1], [], [ AC_ARG_WITH(lowerdashname, GASNET_OPTION_HELP(with-[]lowerdashname[]=, value for [$1]), [], []) ]) define(with_expanded_[$1], [set]) envval_src_[$1]="cached" AC_CACHE_VAL(cv_prefix[]envvar_$1, [ case "${[$1]-__NOT_SET__}" in __NOT_SET__) if test "$with_[]lowerscorename" != ""; then cv_prefix[]envvar_$1="$with_[]lowerscorename" envval_src_[$1]=given else cv_prefix[]envvar_$1="[$2]" envval_src_[$1]=default fi ;; *) cv_prefix[]envvar_$1="$[$1]" envval_src_[$1]=given esac ]) [$1]="$cv_prefix[]envvar_$1" case "$envval_src_[$1]" in 'cached') AC_MSG_RESULT([using cached value \"$[$1]\"]) ;; 'default') AC_MSG_RESULT([no, defaulting to \"$[$1]\"]) ;; 'given') AC_MSG_RESULT([yes, using \"$[$1]\"]) ;; *) AC_MSG_ERROR(_GASNET_ENV_DEFAULT broken) esac # --------------------------------------- popdef([lowerdashname]) popdef([lowerscorename]) ]) dnl $1 = optional env variables to restore AC_DEFUN([GASNET_START_CONFIGURE],[ GASNET_PATH_PROGS(PWD_PROG, pwd, pwd) dnl Save and display useful info about the configure environment GASNET_GET_AUTOCONF_VERSION() AC_MSG_CHECKING(for configure settings) AC_MSG_RESULT([]) CONFIGURE_ARGS="$ac_configure_args" AC_SUBST(CONFIGURE_ARGS) AC_MSG_RESULT( configure args: $CONFIGURE_ARGS) dnl ensure the cache is used in all reconfigures ac_configure_args="$ac_configure_args --cache-file=$cache_file" dnl don't trust shell's builtin pwd, because it may include symlinks TOP_SRCDIR=`cd ${srcdir} && ${PWD_PROG}` AC_MSG_RESULT( TOP_SRCDIR: $TOP_SRCDIR) AC_SUBST(TOP_SRCDIR) TOP_BUILDDIR=`${PWD_PROG}` AC_MSG_RESULT( TOP_BUILDDIR: $TOP_BUILDDIR) AC_SUBST(TOP_BUILDDIR) dnl check against bug 1083 (spaces in directory name break things) if `echo $TOP_SRCDIR | grep ' ' >/dev/null 2>/dev/null`; then AC_MSG_ERROR(TOP_SRCDIR contains space characters - please unpack the source in a different directory.) fi if `echo $TOP_BUILDDIR | grep ' ' >/dev/null 2>/dev/null`; then AC_MSG_ERROR(TOP_BUILDDIR contains space characters - please build in a different directory.) fi dnl set AM_CONDITIONAL BUILD_IS_SRC for ease of use in generated Makefiles AM_CONDITIONAL(BUILD_IS_SRC, test "$TOP_BUILDDIR" = "$TOP_SRCDIR") dnl set AC_SUBST variable BUILD_IS_SRC for ease of use in generated scripts if test "$TOP_BUILDDIR" = "$TOP_SRCDIR"; then BUILD_IS_SRC=yes else BUILD_IS_SRC=no fi AC_SUBST(BUILD_IS_SRC) SYSTEM_NAME="`hostname`" AC_SUBST(SYSTEM_NAME) SYSTEM_TUPLE="$target" AC_SUBST(SYSTEM_TUPLE) AC_MSG_RESULT( system info: $SYSTEM_NAME $SYSTEM_TUPLE) BUILD_USER=`whoami 2> /dev/null || id -un 2> /dev/null || echo $USER` BUILD_ID="`date` $BUILD_USER" AC_MSG_RESULT( build id: $BUILD_ID) AC_SUBST(BUILD_ID) GASNET_RESTORE_AUTOCONF_ENV([CC CXX CFLAGS CXXFLAGS CPPFLAGS LIBS MAKE GMAKE AR AS RANLIB PERL SUM LEX YACC $1]) ]) AC_DEFUN([GASNET_END_CONFIGURE],[ GASNET_ERR_CLEANUP() GASNET_SAVE_AUTOCONF_ENV() GASNET_PUSHPOP_CHECK() ]) dnl AC_DEFINE the configure information variables detected by GASNET_START_CONFIGURE, with prefix AC_DEFUN([GASNET_DEFINE_CONFIGURE_VARS],[ AC_REQUIRE([GASNET_START_CONFIGURE]) AC_DEFINE_UNQUOTED($1_[]CONFIGURE_ARGS, "$CONFIGURE_ARGS") AC_DEFINE_UNQUOTED($1_[]SYSTEM_NAME, "$SYSTEM_NAME") AC_DEFINE_UNQUOTED($1_[]SYSTEM_TUPLE, "$SYSTEM_TUPLE") AC_DEFINE_UNQUOTED($1_[]BUILD_ID, "$BUILD_ID") ]) dnl GASNET_RESTORE_AUTOCONF_ENV(env1 env2 env3) dnl call at top of configure.in to restore cached environment variables dnl inspected by autoconf macros. Pass in names of variables AC_DEFUN([GASNET_RESTORE_AUTOCONF_ENV],[ dnl pushdef = get a variable prefix variable which won't be cached. pushdef([nc_prefix],patsubst(cv_prefix,_cv_,_)) if test "$nc_prefix[]acenv_list" != ""; then AC_MSG_ERROR(_GASNET_RESTORE_AUTOCONF_ENV called more than once with prefix = "cv_prefix") fi nc_prefix[]acenv_list="$1" AC_MSG_CHECKING(for cached autoconf environment settings) AC_MSG_RESULT("") for varname in $1; do val=`eval echo '$'"cv_prefix[]acenv_$varname"` if test "$val" != ""; then eval $varname=\"$val\" AC_MSG_RESULT([$varname=\"$val\"]) fi done popdef([nc_prefix]) ]) dnl GASNET_SAVE_AUTOCONF_ENV() dnl cache the environment variables inspected by autoconf macros AC_DEFUN([GASNET_SAVE_AUTOCONF_ENV],[ for varname in $cv_prefix[]acenv_list; do val=`eval echo '$'"$varname"` if test "$val" != ""; then cachevarname=cv_prefix[]acenv_$varname eval $cachevarname=\"$val\" fi done ]) dnl m4 substr fiasco: dnl autoconf 2.13 has a working version of the m4 function 'substr', dnl but no m4_substr (and no format or m4_format) dnl autoconf 2.58 has working versions of m4_substr and m4_format, dnl but no substr or format dnl This incantation ensures m4_substr works regardless ifdef([substr],[define([m4_substr], defn([substr]))]) AC_DEFUN([GASNET_OPTION_HELP],[ --$1 ]m4_substr[([ ],len([$1]))[$2]]) dnl provide a --with-foo=bar configure option dnl action-withval runs for a named value in $withval (or withval=yes if named arg missing) dnl action-without runs for --without-foo or --with-foo=no dnl action-none runs for no foo arg given dnl GASNET_WITH(foo, description, action-withval, [action-without], [action-none]) AC_DEFUN([GASNET_WITH],[ AC_ARG_WITH($1,GASNET_OPTION_HELP(with-$1=value,$2), [ case "$withval" in no) : $4 ;; *) $3 ;; esac ],[ : $5 ]) ]) AC_DEFUN([GASNET_IF_ENABLED_NOHELP],[ case "$enable_[]patsubst([$1], -, _)" in '' | no) : $3 ;; *) $2 ;; esac ]) AC_DEFUN([GASNET_IF_ENABLED],[ AC_ARG_ENABLE($1,GASNET_OPTION_HELP(enable-$1,[$2])) GASNET_IF_ENABLED_NOHELP([$1],[$3],[$4]) ]) AC_DEFUN([GASNET_IF_DISABLED],[ AC_ARG_ENABLE($1,GASNET_OPTION_HELP(disable-$1,[$2])) case "$enable_[]patsubst([$1], -, _)" in '' | yes) : $4 ;; *) $3 ;; esac ]) AC_DEFUN([GASNET_IF_ENABLED_WITH_AUTO],[ AC_ARG_ENABLE($1,GASNET_OPTION_HELP(enable-$1,[$2])) AC_ARG_ENABLE($1,GASNET_OPTION_HELP(disable-$1,[$2])) case "$enable_[]patsubst([$1], -, _)" in no) $4 ;; yes) $3 ;; *) $5 ;; esac ]) AC_DEFUN([GASNET_SUBST],[ $1="$2" AC_SUBST($1)]) AC_DEFUN([GASNET_SUBST_FILE],[ $1="$2" AC_SUBST_FILE($1)]) AC_DEFUN([GASNET_CHECK_PROGS],[ case "$$1" in '') AC_CHECK_PROGS($1,$2) ;; *) AC_MSG_CHECKING(for $3) AC_MSG_RESULT($$1) ;; esac case "$$1" in '') AC_MSG_ERROR(cannot find $3) ;; esac]) AC_DEFUN([GASNET_PATH_PROGS],[ case "$$1" in '') AC_PATH_PROGS($1,$2) ;; *) AC_MSG_CHECKING(for $3) AC_MSG_RESULT($$1) ;; esac case "$$1" in '') AC_MSG_ERROR(cannot find $3) ;; esac]) dnl GASNET_GETFULLPATH(var) dnl var contains a program name, optionally followed by arguments dnl expand the program name to a fully qualified pathname if not already done AC_DEFUN([GASNET_GETFULLPATH_CHECK],[ GASNET_IF_DISABLED(full-path-expansion, [Disable expansion of program names to full pathnames], [cv_prefix[]_gfp_disable=1]) ]) AC_DEFUN([GASNET_GETFULLPATH],[ # ---------------------------------------------- # [GASNET_GETFULLPATH]($1) AC_REQUIRE([AC_PROG_AWK]) AC_REQUIRE([GASNET_GETFULLPATH_CHECK]) if test "$cv_prefix[]_gfp_disable" = ""; then gasnet_gfp_progname=`echo "$$1" | $AWK -F' ' '{ print [$]1 }'` gasnet_gfp_progargs=`echo "$$1" | $AWK -F' ' 'BEGIN { ORS=" "; } { for (i=2;i<=NF;i++) print $i; }'` gasnet_gfp_progname0=`echo "$gasnet_gfp_progname" | $AWK '{ print sub[]str([$]0,1,1) }'` if test "$gasnet_gfp_progname0" != "/" ; then # clear cached values, in case this is a pushed var unset cv_prefix[]_gfp_fullprogname_$1 unset ac_cv_path_[]cv_prefix[]_gfp_fullprogname_$1 # [AC_PATH_PROG](cv_prefix[]_gfp_fullprogname_$1, $gasnet_gfp_progname,[]) AC_PATH_PROG(cv_prefix[]_gfp_fullprogname_$1, $gasnet_gfp_progname,[]) AC_MSG_CHECKING(for full path expansion of $1) if test "$cv_prefix[]_gfp_fullprogname_$1" != "" ; then $1="$cv_prefix[]_gfp_fullprogname_$1 $gasnet_gfp_progargs" fi AC_MSG_RESULT($$1) fi fi # ---------------------------------------------- ]) dnl GASNET_CHECK_LIB(library, function, action-if-found, action-if-not-found, other-flags, other-libraries) AC_DEFUN([GASNET_CHECK_LIB],[ GASNET_PUSHVAR(LDFLAGS,"$LDFLAGS $5") AC_CHECK_LIB($1, $2, $3, $4, $6) GASNET_POPVAR(LDFLAGS) ]) dnl GASNET_TRY_RUNCMD(command, action-success-nooutput, action-success-output, action-error) dnl run a command, and take action based on the result code and output (in $gasnet_cmd_stdout/$gasnet_cmd_stderr) AC_DEFUN([GASNET_TRY_RUNCMD],[ echo \"$1\" >&5 ( $1 ) > conftest-runcmdout 2> conftest-runcmderr gasnet_cmd_result="$?" gasnet_cmd_stdout="`cat conftest-runcmdout`" gasnet_cmd_stderr="`cat conftest-runcmderr`" cat conftest-runcmdout >&5 cat conftest-runcmderr >&5 echo gasnet_cmd_result=$gasnet_cmd_result >&5 rm -rf conftest* if test "$gasnet_cmd_result" = "0" ; then if test -z "$gasnet_cmd_stdout$gasnet_cmd_stderr" ; then : $2 else : $3 fi else : $4 fi ]) dnl GASNET_TRY_CCOMPILE_WITHWARN(includes, function-body, action-success, action-warning, action-error) dnl Compile a C program and take different actions based on complete success, error or warning AC_DEFUN([GASNET_TRY_CCOMPILE_WITHWARN],[ gasnet_testname=gasnet-conftest gasnet_testfile=${gasnet_testname}.c gasnet_compile_cmd="${CC-cc} -c $CFLAGS $CPPFLAGS $gasnet_testfile" cat > $gasnet_testfile <&5 cat $gasnet_testfile >&5 $4 ],[ echo "configure: failed program was:" >&5 cat $gasnet_testfile >&5 $5 ]) rm -f ${gasnet_testname}.* ]) dnl GASNET_TRY_CXXCOMPILE_WITHWARN(includes, function-body, action-success, action-warning, action-error) dnl Compile a C++ program and take different actions based on complete success, error or warning AC_DEFUN([GASNET_TRY_CXXCOMPILE_WITHWARN],[ gasnet_testname=gasnet-conftest gasnet_testfile=${gasnet_testname}.cc gasnet_compile_cmd="${CXX-c++} -c $CXXFLAGS $CPPFLAGS $gasnet_testfile" cat > $gasnet_testfile <&5 cat $gasnet_testfile >&5 $4 ],[ echo "configure: failed program was:" >&5 cat $gasnet_testfile >&5 $5 ]) rm -f ${gasnet_testname}.* ]) dnl GASNET_TRY_CFLAG(flags, action-if-supported, action-if-not-supported) AC_DEFUN([GASNET_TRY_CFLAG],[ GASNET_PUSHVAR(CFLAGS,"$CFLAGS $1") AC_MSG_CHECKING(for C compiler flag $1) GASNET_TRY_CCOMPILE_WITHWARN([], [], [ AC_MSG_RESULT(yes) GASNET_POPVAR(CFLAGS) $2 ], [ AC_MSG_RESULT(no/warning: $gasnet_cmd_stdout$gasnet_cmd_stderr) GASNET_POPVAR(CFLAGS) $3 ], [ AC_MSG_RESULT(no/error: $gasnet_cmd_stdout$gasnet_cmd_stderr) GASNET_POPVAR(CFLAGS) $3 ])]) dnl GASNET_TRY_CXXFLAG(flags, action-if-supported, action-if-not-supported) AC_DEFUN([GASNET_TRY_CXXFLAG],[ GASNET_PUSHVAR(CXXFLAGS,"$CXXFLAGS $1") AC_MSG_CHECKING(for C++ compiler flag $1) GASNET_TRY_CXXCOMPILE_WITHWARN([], [], [ AC_MSG_RESULT(yes) GASNET_POPVAR(CXXFLAGS) $2 ], [ AC_MSG_RESULT(no/warning: $gasnet_cmd_stdout$gasnet_cmd_stderr) GASNET_POPVAR(CXXFLAGS) $3 ], [ AC_MSG_RESULT(no/error: $gasnet_cmd_stdout$gasnet_cmd_stderr) GASNET_POPVAR(CXXFLAGS) $3 ])]) dnl GASNET_SET_CHECKED_CFLAGS CCVAR CFLAGSVAR DEFAULT_CFLAGS SAFE_CFLAGS dnl Set CFLAGSVAR to a values that works with CCVAR dnl if CFLAGSVAR is already set, then keep it dnl otherwise, if DEFAULT_CFLAGS works, then use it dnl otherwise, use SAFE_CFLAGS AC_DEFUN([GASNET_SET_CHECKED_CFLAGS],[ if test "$[$2]" != "" ; then GASNET_ENV_DEFAULT([$2], []) # user-provided flags else GASNET_ENV_DEFAULT([$2], [$3]) # try DEFAULT_CFLAGS GASNET_PUSHVAR(CC,"$[$1]") GASNET_PUSHVAR(CFLAGS,"") GASNET_TRY_CFLAG([$[$2]], [], [ AC_MSG_WARN([Unable to use default $2="$[$2]" so using "$4" instead. Consider manually seting $2]) $2="$4" ]) GASNET_POPVAR(CC) GASNET_POPVAR(CFLAGS) fi ]) dnl GASNET_CHECK_OPTIMIZEDDEBUG CCVAR CFLAGSVAR EXTRAARGS INCLUDES dnl Ensure the compiler CC doesn't create a conflict between dnl optimization and debugging. AC_DEFUN([GASNET_CHECK_OPTIMIZEDDEBUG],[ if test "$enable_debug" = "yes" ; then AC_MSG_CHECKING([$1 for debug vs. optimize compilation conflict]) AC_LANG_SAVE AC_LANG_C GASNET_PUSHVAR(CC,"$[$1]") GASNET_PUSHVAR(CFLAGS,"$[$2] $3") AC_TRY_COMPILE( [ $4 #if defined(__OPTIMIZE__) || defined(NDEBUG) choke me #endif ], [ ], [ AC_MSG_RESULT(no) ], [ AC_MSG_RESULT([yes]) GASNET_MSG_ERROR([User requested --enable-debug but $1 or $2 has enabled optimization (-O) or disabled assertions (-DNDEBUG). Try setting $1='$[$1] -O0 -UNDEBUG' or changing $2]) ]) GASNET_POPVAR(CC) GASNET_POPVAR(CFLAGS) AC_LANG_RESTORE fi ]) dnl Checks if 'restrict' C99 keyword (or variants) supported dnl #defines GASNET_RESTRICT to correct variant, or to nothing AC_DEFUN([GASNET_CHECK_RESTRICT],[ dnl Check for restrict keyword restrict_keyword="" if test "$restrict_keyword" = ""; then GASNET_TRY_CACHE_CHECK(for restrict keyword, cc_keyrestrict, [int dummy(void * restrict p) { return 1; }], [], AC_DEFINE(GASNETI_RESTRICT, restrict) restrict_keyword="restrict") fi if test "$restrict_keyword" = ""; then GASNET_TRY_CACHE_CHECK(for __restrict__ keyword, cc_key__restrict__, [int dummy(void * __restrict__ p) { return 1; }], [], AC_DEFINE(GASNETI_RESTRICT, __restrict__) restrict_keyword="__restrict__") fi if test "$restrict_keyword" = ""; then GASNET_TRY_CACHE_CHECK(for __restrict keyword, cc_key__restrict, [int dummy(void * __restrict p) { return 1; }], [], AC_DEFINE(GASNETI_RESTRICT, __restrict) restrict_keyword="__restrict") fi if test "$restrict_keyword" = ""; then AC_DEFINE(GASNETI_RESTRICT,) fi ]) dnl Output compilation error information, if available and do a AC_MSG_ERROR dnl should be used within the failed branch of the compile macro, otherwise dnl use GASNET_ERR_SAVE() in the failed branch to save the error info AC_DEFUN([GASNET_MSG_ERROR],[ echo echo "configure error: $1" if test "" ; then if test -f "conftest.$ac_ext" ; then errfile=conftest.$ac_ext else errfile=gasnet_errsave_file fi if test -f "$errfile" ; then echo echo " --- Failed program --- " cat $errfile echo " -----------------------" fi fi if test -f "conftest.err" ; then errfile=conftest.err else errfile=gasnet_errsave_err fi if test -f "$errfile" ; then echo echo "Compilation error: " echo cat $errfile fi echo CONFIG_FILE=`pwd`/config.log AC_MSG_ERROR(See $CONFIG_FILE for details.) ]) AC_DEFUN([GASNET_ERR_SAVE],[ if test -f "conftest.$ac_ext" ; then cp conftest.$ac_ext gasnet_errsave_file fi if test -f "conftest.err" ; then cp conftest.err gasnet_errsave_err fi ]) AC_DEFUN([GASNET_ERR_CLEANUP],[ rm -f gasnet_errsave_file gasnet_errsave_err ]) dnl compile a program for a success/failure dnl GASNET_TRY_CACHE_CHECK(description,cache_name,includes,program,action-on-success,action-on-failure) AC_DEFUN([GASNET_TRY_CACHE_CHECK],[ AC_CACHE_CHECK($1, cv_prefix[]$2, AC_TRY_COMPILE([$3], [$4], cv_prefix[]$2=yes, cv_prefix[]$2=no)) if test "$cv_prefix[]$2" = yes; then : $5 else : $6 fi]) dnl link a program for a success/failure dnl GASNET_TRY_CACHE_LINK(description,cache_name,includes,program,action-on-success,action-on-failure) AC_DEFUN([GASNET_TRY_CACHE_LINK],[ AC_CACHE_CHECK($1, cv_prefix[]$2, AC_TRY_LINK([$3], [$4], cv_prefix[]$2=yes, cv_prefix[]$2=no)) if test "$cv_prefix[]$2" = yes; then : $5 else : $6 fi]) dnl run a program for a success/failure dnl GASNET_TRY_CACHE_RUN(description,cache_name,program,action-on-success,action-on-failure) AC_DEFUN([GASNET_TRY_CACHE_RUN],[ AC_CACHE_CHECK($1, cv_prefix[]$2, AC_TRY_RUN([$3], cv_prefix[]$2=yes, cv_prefix[]$2=no, AC_MSG_ERROR(no default value for cross compiling))) if test "$cv_prefix[]$2" = yes; then : $4 else : $5 fi]) dnl compile and run a program, error out if one fails (cross-compilation will skip the run) dnl GASNET_TRY_CACHE_VERIFY_RUN(description,cache_name,includes,program,errormsg-on-failure) AC_DEFUN([GASNET_TRY_CACHE_VERIFY_RUN],[ if test "$cross_compiling" = "yes" ; then GASNET_TRY_CACHE_LINK([$1],[$2],[$3],[$4],[ ],[ GASNET_MSG_ERROR([$5]) ]) else GASNET_TRY_CACHE_RUN([$1],[$2],[ $3 int main() { $4 } ],[ ],[ GASNET_MSG_ERROR([$5]) ]) fi ]) dnl run a program to extract the value of a runtime expression dnl the provided code should set the integer val to the relevant value dnl GASNET_TRY_CACHE_RUN_EXPR(description,cache_name,headers,code_to_set_val,result_variable) AC_DEFUN([GASNET_TRY_CACHE_RUN_EXPR],[ AC_CACHE_CHECK($1, cv_prefix[]$2, AC_TRY_RUN([ #include "confdefs.h" #include $3 int main() { FILE *f=fopen("conftestval", "w"); int val = 0; if (!f) exit(1); { $4; } fprintf(f, "%d\n", (int)(val)); return 0; }], cv_prefix[]$2=`cat conftestval`, cv_prefix[]$2=no, AC_MSG_ERROR(no default value for cross compiling))) if test "$cv_prefix[]$2" != no; then : $5=$cv_prefix[]$2 fi]) AC_DEFUN([GASNET_PROG_CPP], [ AC_PROVIDE([$0]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) GASNET_GETFULLPATH(CPP) AC_SUBST(CPP) AC_SUBST(CPPFLAGS) AC_MSG_CHECKING(for working C preprocessor) AC_LANG_SAVE AC_LANG_C gasnet_progcpp_extrainfo= dnl deal with preprocessors who foolishly return success exit code even when they saw #error if test -n "`$CPP -version 2>&1 < /dev/null | grep MIPSpro`" ; then dnl The MIPSPro compiler has a broken preprocessor exit code by default, fix it dnl Using this flag is preferable to ensure that #errors encountered during compilation are fatal gasnet_progcpp_extrainfo=" (added -diag_error 1035 to deal with broken MIPSPro preprocessor)" CFLAGS="$CFLAGS -diag_error 1035" CPPFLAGS="$CPPFLAGS -diag_error 1035" fi dnl final check AC_TRY_CPP([ # error ], [AC_MSG_ERROR(Your C preprocessor is broken - reported success when it should have failed)], []) AC_TRY_CPP([], [], [GASNET_MSG_ERROR(Your C preprocessor is broken - reported failure when it should have succeeded)]) AC_MSG_RESULT(yes$gasnet_progcpp_extrainfo) AC_LANG_RESTORE ]) AC_DEFUN([GASNET_PROG_CXXCPP], [ AC_PROVIDE([$0]) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) GASNET_GETFULLPATH(CXXCPP) AC_SUBST(CXXCPP) AC_SUBST(CXXCPPFLAGS) AC_MSG_CHECKING(for working C++ preprocessor) AC_LANG_SAVE AC_LANG_CPLUSPLUS gasnet_progcxxcpp_extrainfo= dnl deal with preprocessors who foolishly return success exit code even when they saw #error if test -n "`$CXXCPP -version 2>&1 < /dev/null | grep MIPSpro`" ; then dnl The MIPSPro compiler has a broken preprocessor exit code by default, fix it dnl Using this flag is preferable to ensure that #errors encountered during compilation are fatal gasnet_progcxxcpp_extrainfo=" (added -diag_error 1035 to deal with broken MIPSPro preprocessor)" CXXFLAGS="$CXXFLAGS -diag_error 1035" CXXCPPFLAGS="$CXXCPPFLAGS -diag_error 1035" fi dnl final check AC_TRY_CPP([ # error ], [AC_MSG_ERROR(Your C++ preprocessor is broken - reported success when it should have failed)], []) AC_TRY_CPP([], [], [GASNET_MSG_ERROR(Your C++ preprocessor is broken - reported failure when it should have succeeded)]) AC_MSG_RESULT(yes$gasnet_progcxxcpp_extrainfo) AC_LANG_RESTORE ]) AC_DEFUN([GASNET_PROG_CC], [ AC_REQUIRE([GASNET_PROG_CPP]) GASNET_GETFULLPATH(CC) AC_SUBST(CC) AC_SUBST(CFLAGS) AC_MSG_CHECKING(for working C compiler) AC_LANG_SAVE AC_LANG_C AC_TRY_COMPILE([], [ fail for me ], [AC_MSG_ERROR(Your C compiler is broken - reported success when it should have failed)], []) AC_TRY_COMPILE([], [], [], [GASNET_MSG_ERROR(Your C compiler is broken - reported failure when it should have succeeded)]) AC_TRY_LINK([ extern int some_bogus_nonexistent_symbol(); ], [ int x = some_bogus_nonexistent_symbol(); ], [AC_MSG_ERROR(Your C linker is broken - reported success when it should have failed)], []) AC_TRY_LINK([], [], [], [GASNET_MSG_ERROR(Your C link is broken - reported failure when it should have succeeded)]) AC_MSG_RESULT(yes) AC_MSG_CHECKING(if user enabled cross-compile) GASNET_IF_ENABLED(cross-compile, [ Enable cross-compilation (experimental) ], [ AC_MSG_RESULT(yes) cross_compiling=yes CROSS_COMPILING=1 ac_cv_prog_cc_cross=yes ], [ dnl reset autoconf cross compilation setting, which is wrong if executables are broken AC_MSG_RESULT(no) cross_compiling=no CROSS_COMPILING=0 ac_cv_prog_cc_cross=no AC_MSG_CHECKING([working C compiler executables]) AC_TRY_RUN([int main() { return 0; }], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) GASNET_MSG_ERROR(Cannot run executables created with C compiler. If you're attempting to cross-compile, use --enable-cross-compile)], [AC_MSG_ERROR(Internal configure error - please report)]) ]) AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") AC_SUBST(CROSS_COMPILING) AC_LANG_RESTORE ]) AC_DEFUN([GASNET_PROG_CXX], [ AC_REQUIRE([GASNET_PROG_CXXCPP]) GASNET_GETFULLPATH(CXX) AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_MSG_CHECKING(for working C++ compiler) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([], [ fail for me ], [AC_MSG_ERROR(Your C++ compiler is broken - reported success when it should have failed)], []) AC_TRY_COMPILE([], [], [], [GASNET_MSG_ERROR(Your C++ compiler is broken - reported failure when it should have succeeded)]) AC_TRY_LINK([ extern int some_bogus_nonexistent_symbol(); ], [ int x = some_bogus_nonexistent_symbol(); ], [AC_MSG_ERROR(Your C++ linker is broken - reported success when it should have failed)], []) AC_TRY_LINK([], [], [], [GASNET_MSG_ERROR(Your C++ link is broken - reported failure when it should have succeeded)]) AC_MSG_RESULT(yes) dnl reset autoconf cross compilation setting, which is wrong if executables are broken AC_MSG_CHECKING(if user enabled cross-compile) GASNET_IF_ENABLED(cross-compile, [ Enable cross-compilation (experimental) ], [ AC_MSG_RESULT(yes) cross_compiling=yes ac_cv_prog_cxx_cross=yes ], [ dnl reset autoconf cross compilation setting, which is wrong if executables are broken AC_MSG_RESULT(no) cross_compiling=no ac_cv_prog_cxx_cross=no AC_MSG_CHECKING([working C++ compiler executables]) AC_TRY_RUN([int main() { return 0; }], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) GASNET_MSG_ERROR(Cannot run executables created with C++ compiler. If you're attempting to cross-compile, use --enable-cross-compile)], [AC_MSG_ERROR(Internal configure error - please report)]) ]) AC_LANG_RESTORE ]) AC_DEFUN([GASNET_PROG_HOSTCC], [ if test "$cross_compiling" = "yes" ; then HOST_MSG="When cross-compiling, \$HOST_CC or --with-host-cc= must be set to indicate a C compiler for the host machine (ie the machine running this configure script)" GASNET_ENV_DEFAULT(HOST_CC, ) GASNET_ENV_DEFAULT(HOST_CFLAGS, ) if test ! "$HOST_CC" ; then AC_MSG_ERROR([$HOST_MSG]) fi GASNET_PUSHVAR(CC,"$HOST_CC") GASNET_PUSHVAR(CFLAGS,"$HOST_CFLAGS") GASNET_PROG_CC GASNET_PUSHVAR(cross_compiling,"no") AC_MSG_CHECKING([working host C compiler executables]) AC_TRY_RUN([int main() { return 0; }], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) GASNET_MSG_ERROR($HOST_MSG)], [AC_MSG_ERROR(Internal configure error - please report)]) GASNET_POPVAR(cross_compiling) HOST_CC="$CC" HOST_CFLAGS="$CFLAGS" AC_SUBST(HOST_CC) AC_SUBST(HOST_CFLAGS) GASNET_POPVAR(CC) GASNET_POPVAR(CFLAGS) fi ]) dnl find working version of perl. Checks to see if 'bytes' module is available, dnl and sets GASNET_PERL_BYTESFLAG to either '-Mbytes' or empty string, for dnl scripts that need to ward off Perl/UTF-8 issues AC_DEFUN([GASNET_PROG_PERL],[ GASNET_PATH_PROGS(PERL, perl5 perl, perl) MIN_PERL_VERSION="5.005" AC_MSG_CHECKING(for perl version $MIN_PERL_VERSION or later) if $PERL -e "require $MIN_PERL_VERSION;" 2>/dev/null; then AC_MSG_RESULT(yes) else AC_MSG_ERROR(cannot find perl $MIN_PERL_VERSION or later) fi if $PERL -Mbytes -e "exit 0" 2>/dev/null; then GASNET_PERL_BYTESFLAG="-Mbytes" else GASNET_PERL_BYTESFLAG= fi AC_SUBST(GASNET_PERL_BYTESFLAG) ]) AC_DEFUN([GASNET_IFDEF],[ AC_TRY_CPP([ #ifndef $1 # error #endif], [$2], [$3])]) AC_DEFUN([GASNET_FAMILY_CACHE_CHECK],[ AC_REQUIRE_CPP AC_CACHE_CHECK(for $1 compiler family, $3, [ $3=unknown dnl start with compilers having very slow preprocessors if test "$$3" = "unknown"; then GASNET_IFDEF(__xlC__, $3=XLC) fi if test "$$3" = "unknown"; then GASNET_IFDEF(_CRAYC, $3=Cray) fi dnl gcc-like compilers, which may define __GNUC__ - order matters here if test "$$3" = "unknown"; then GASNET_IFDEF(__GNUC__, $3=GNU) dnl Note this one must precede many of those below GASNET_IFDEF(__PATHCC__, $3=Pathscale) GASNET_IFDEF(__PGI, $3=PGI) GASNET_IFDEF(__INTEL_COMPILER, $3=Intel) fi dnl other vendor compilers if test "$$3" = "unknown"; then GASNET_IFDEF(__DECC, $3=Compaq) # Compaq C GASNET_IFDEF(__DECCXX, $3=Compaq) # Compaq C++ fi if test "$$3" = "unknown"; then GASNET_IFDEF(__SUNPRO_C, $3=Sun) # Sun C GASNET_IFDEF(__SUNPRO_CC, $3=Sun) # Sun C++ fi if test "$$3" = "unknown"; then GASNET_IFDEF(__HP_cc, $3=HP) # HP C GASNET_IFDEF(__HP_aCC, $3=HP) # HP aCC (C++) fi if test "$$3" = "unknown"; then GASNET_IFDEF(__MTA__, $3=MTA) fi if test "$$3" = "unknown"; then GASNET_IFDEF(__KCC, $3=KAI) fi dnl compilers lacking specific identifying marks - identify by platform if test "$$3" = "unknown"; then GASNET_IFDEF(mips, $3=MIPS) GASNET_IFDEF(_SX, $3=NEC) fi ]) if test "$$3" != "GNU" ; then dnl Some compilers (eg Intel 8.0) define __GNUC__ even though they are definitely not GNU C dnl Don't believe their filthy lies case $2 in CC) ac_cv_c_compiler_gnu=no GCC="" ;; CXX) ac_cv_cxx_compiler_gnu=no GXX="" ;; esac fi $2_FAMILY=$$3 $2_UNWRAPPED=$$2 case $$3 in GNU) $2_WRAPPED=$$2 ;; *) $2_WRAPPED="\$(top_builddir)/cc-wrapper \$($2_FAMILY) \$($2_UNWRAPPED)" ;; esac AC_SUBST($2_FAMILY) AC_SUBST($2_UNWRAPPED) AC_SUBST($2_WRAPPED) GASNET_SUBST_FILE(cc_wrapper_mk, cc-wrapper.mk) ]) dnl deal with a buggy version of autoconf which assumes alloca returns char * AC_DEFUN([GASNET_FUNC_ALLOCA_HELPER],[ patsubst([$*], [p = alloca], [p = (char *)alloca]) ]) AC_DEFUN([GASNET_FUNC_ALLOCA],[ AC_SUBST(ALLOCA) GASNET_FUNC_ALLOCA_HELPER(AC_FUNC_ALLOCA) ]) dnl Set command for use in Makefile.am to install various files dnl This command should remove all the magic used to run from the build dnl directory, as well as deal with setting of the prefix at install time. AC_DEFUN([GASNET_SET_INSTALL_CMD],[ GASNET_INSTALL_CMD="sed -e '/###NOINSTALL###/d' -e 's@###INSTALL_PREFIX###@\$(prefix)@g'" AC_SUBST(GASNET_INSTALL_CMD) ]) dnl pass $1 to all subconfigures invoked recursively from this configure script AC_DEFUN([GASNET_SUBCONFIGURE_ARG],[ ac_configure_args="$ac_configure_args $1" ]) dnl fetch a cross-compilation variable, if we are cross compiling dnl GASNET_CROSS_VAR(variable-to-set, basicname) AC_DEFUN([GASNET_CROSS_VAR],[ pushdef([cross_varname],CROSS_$2) if test "$cross_compiling" = "yes" ; then GASNET_ENV_DEFAULT(cross_varname,) if test "$cross_varname" = "" ; then AC_MSG_ERROR([This configure script requires \$cross_varname be set for cross-compilation]) else $1="$cross_varname" fi fi popdef([cross_varname]) ]) dnl query the numerical value of a system signal and AC_SUBST it AC_DEFUN([GASNET_GET_SIG], [ if test "$cross_compiling" = "yes" ; then GASNET_CROSS_VAR(SIG$1,SIG$1) else GASNET_TRY_CACHE_RUN_EXPR([value of SIG$1], SIG$1, [#include ], [val = (int)SIG$1;], SIG$1) fi AC_SUBST(SIG$1) ]) dnl If PTHREAD_INCLUDE and/or PTHREAD_LIB set, check to see that pthread.h and libpthread exist, dnl and set -I and -L to use them. Die if set, but files don't exist AC_DEFUN([GASNET_CHECK_OVERRIDE_PTHREADS], [ GASNET_ENV_DEFAULT(PTHREADS_INCLUDE, ) GASNET_ENV_DEFAULT(PTHREADS_LIB, ) if test -n "$PTHREADS_INCLUDE" || test -n "$PTHREADS_LIB"; then if test -z "$PTHREADS_INCLUDE" || test -z "$PTHREADS_LIB"; then AC_MSG_ERROR(['Both \$PTHREADS_INCLUDE and \$PTHREADS_LIB must be set, or neither']) fi # test to see if files exist if test ! -f "$PTHREADS_INCLUDE/pthread.h"; then AC_MSG_ERROR(["Could not find $PTHREADS_INCLUDE/pthread.h: bad \$PTHREADS_INCLUDE"]) fi if test ! -f "$PTHREADS_LIB/libpthread.a" || test ! -f "$PTHREADS_LIB/libpthread.so" ; then AC_MSG_ERROR(["Could not find $PTHREADS_LIB/libpthread.{a,so}: bad \$PTHREADS_LIB"]) fi CFLAGS="-I$PTHREADS_INCLUDE -L$PTHREADS_LIB $CFLAGS" fi ]) dnl check for endianness in a cross-compiling friendly way (using an object scan) AC_DEFUN([GASNET_C_BIGENDIAN], [ AC_REQUIRE([GASNET_PROG_PERL]) if test "$cross_compiling" = "no" ; then GASNET_TRY_CACHE_RUN_EXPR([whether byte ordering is bigendian], c_bigendian,[ ],[ { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[[sizeof (long)]]; } u; u.l = 1; val = (u.c[[sizeof (long) - 1]] == 1); }], WORDS_BIGENDIAN) else AC_MSG_CHECKING(whether byte ordering is bigendian (binary probe)) [ cat >conftest.c < conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) dnl AM_PROG_LEX dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT AC_DEFUN(AM_PROG_LEX, [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") AC_PROG_LEX AC_DECL_YYTEXT])