+++ /dev/null
-dnl @synopsis AC_FUNC_SNPRINTF
-dnl
-dnl Checks for a fully C99 compliant snprintf, in particular checks
-dnl whether it does bounds checking and returns the correct string
-dnl length; does the same check for vsnprintf. If no working snprintf
-dnl or vsnprintf is found, request a replacement and warn the user
-dnl about it. Note: the mentioned replacement is freely available and
-dnl may be used in any project regardless of it's licence (just like
-dnl the autoconf special exemption).
-dnl
-dnl @category C
-dnl @author RĂ¼diger Kuhlmann <info@ruediger-kuhlmann.de>
-dnl @version 2002-09-26
-dnl @license AllPermissive
-
-AC_DEFUN([AC_FUNC_SNPRINTF],
-[AC_CHECK_FUNCS(snprintf vsnprintf)
-AC_MSG_CHECKING(for working snprintf)
-AC_CACHE_VAL(ac_cv_have_working_snprintf,
-[AC_TRY_RUN(
-[#include <stdio.h>
-
-int main(void)
-{
- char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
- char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
- int i;
- i = snprintf (bufs, 2, "%s", "111");
- if (strcmp (bufs, "1")) exit (1);
- if (i != 3) exit (1);
- i = snprintf (bufd, 2, "%d", 111);
- if (strcmp (bufd, "1")) exit (1);
- if (i != 3) exit (1);
- exit(0);
-}], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
-AC_MSG_RESULT([$ac_cv_have_working_snprintf])
-AC_MSG_CHECKING(for working vsnprintf)
-AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
-[AC_TRY_RUN(
-[#include <stdio.h>
-#include <stdarg.h>
-
-int my_vsnprintf (char *buf, const char *tmpl, ...)
-{
- int i;
- va_list args;
- va_start (args, tmpl);
- i = vsnprintf (buf, 2, tmpl, args);
- va_end (args);
- return i;
-}
-
-int main(void)
-{
- char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
- char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
- int i;
- i = my_vsnprintf (bufs, "%s", "111");
- if (strcmp (bufs, "1")) exit (1);
- if (i != 3) exit (1);
- i = my_vsnprintf (bufd, "%d", 111);
- if (strcmp (bufd, "1")) exit (1);
- if (i != 3) exit (1);
- exit(0);
-}], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
-AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
-if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
- AC_LIBOBJ(snprintf)
- AC_MSG_WARN([Replacing missing/broken (v)snprintf() with version from http://www.ijs.si/software/snprintf/.])
- AC_DEFINE(PREFER_PORTABLE_SNPRINTF, 1, "enable replacement (v)snprintf if system (v)snprintf is broken")
-fi])
-
\ No newline at end of file
+++ /dev/null
-dnl
-dnl ACI macros -- intra and extra package dependencies handling macros.
-dnl those autoconf macro allows you to declare which parts of your project
-dnl depend on which external package, or even on other parts of your code.
-dnl
-
-dnl Copyright (C) 2000,2001,2002,2003 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 History:
-dnl one day, I'll do a public release. Until then, check the FAST changelogs.
-
-
-dnl ACI_PREREQ: Check that at least version $1 of ACI macros are available
-
-m4_define([aci_version],[2003.01.16])
-m4_define([ACI_PREREQ],
-[m4_if(m4_version_compare(m4_defn([aci_version]), [$1]), -1,
- [m4_default([$3],
- [m4_fatal([ACI macros version $1 or higher is required])])],
- [$2])[]dnl
-])
-
-
-dnl ACI_D: echo something to the config.log
-AC_DEFUN([ACI_D],[echo $1>&5;])dnl >&5
-AC_DEFUN([ACI_ECHO],[echo $1;echo $1>&5])
-
-
-dnl ACI_PACKAGE: defines a package (ie, an external package we should search)
-dnl SYNOPSIS:
-dnl 1=Package (name of the package)
-dnl 2=Description (human readable, for documentation)
-dnl 3=Function (the main function to search)
-dnl 4=Library list (where to search, space separated list of group of LDFLAGS
-dnl each LDFLAGS is ! separated.
-dnl example: "-lldap -lldap!-llber"
-dnl warning: can't contain tabs or newlines)
-dnl 5=Header to check
-dnl 6=what to do if found
-dnl 7=what to do if not found (default: AC_MSG_ERROR(blabla))
-dnl It is possible to change any of the exported values in $6 or $7
-dnl ACTIONS:
-dnl - try to find the function in each part of LDFLAGS and the header.
-dnl - AC_SUBST the following values:
-dnl HAVE_$1: 'yes' or 'no'
-dnl CFLAGS_$1: CFLAGS to acces to this package
-dnl LIBS_$1: LDFLAGS to acces to this package
-dnl - define the following arguments to ./configure:
-dnl --with-$1 root dir of install
-dnl --with-$1-includes where to search the header
-dnl --with-$1-libs where to search the libs
-dnl --with-$1-extra extra LDFLAGS to pass to the linker
-AC_DEFUN([ACI_PACKAGE],[
- pushdef([aci_name], [$1])
- pushdef([aci_help], [$2])
- pushdef([aci_func], [$3])
- pushdef([aci_paths], [$4])
- pushdef([aci_header], [$5])
- pushdef([aci_if_yes], [$6])
- pushdef([aci_if_no], [$7])
-
- aci_nameok=`echo $1|sed 'y/-/./'`
- if test "x$1" != "x$aci_nameok" ; then
- AC_MSG_ERROR([ACI error: Please no '-' in package name. (ie, $1 is not a valid name)])
- fi
- ACI_D("[BEGINING OF ACI-PACKAGE($1)]")
- aci_module_desc_$1="$2"
- AC_SUBST([aci_module_desc_$1])dnl
- aci_packages="$aci_packages $1"
-
- dnl
- dnl Specify the options
- dnl
- AC_ARG_WITH([$1],
- AS_HELP_STRING(--with-$1=DIR,root directory of aci_help installation),
- [with_$1=$withval
- good=yes
- if test "$withval" = yes ; then good=no; fi
- if test "$withval" = no ; then good=no; fi
- if test $good = no ; then
- AC_MSG_ERROR([You gave me --with-$1=$withval. I wait for a location[,] not yes or no (use --enable-[]aci_help or --disable-[]aci_help for that)])
- fi
- aci_pkg_prefix_$1="$withval"
- CFLAGS_$1="-I$withval/include $CFLAGS_$1"
- LIBS_$1="-L$withval/lib $LIBS_$1"
- ])
-
- AC_ARG_WITH([$1-includes],
- AS_HELP_STRING(--with-$1-includes=DIR,specify exact include dir for aci_help headers),
- [CFLAGS_$1="-I$withval $CFLAGS_$1"
- aci_pkg_inc_$1="$withval"
- ])
-
- AC_ARG_WITH([$1-libraries],
- AS_HELP_STRING(--with-$1-libraries=DIR,specify exact library dir for aci_help library
- ),[LIBS_$1="-L$withval $LIBS_$1"
- aci_pkg_lib_$1="$withval"])
-
- AC_ARG_WITH([$1-extra],
- AS_HELP_STRING(--with-$1-extra=ARG,specify extra args to pass to the linker to get the aci_help library (with no space. A sed to change "!" to " " is run)
- ),[LIBS_$1=`echo $withval|sed 's/!/ /g'`" $LIBS_$1"
- aci_pkg_extra_$1="$withval"])
-
- AC_SUBST([aci_pkg_prefix_$1])dnl
- AC_SUBST([aci_pkg_inc_$1])dnl
- AC_SUBST([aci_pkg_lib_$1])dnl
- AC_SUBST([aci_pkg_extra_$1])dnl
-
- dnl
- dnl Search the lib
- dnl
- OLD_LDFLAGS=$LDFLAGS
- OLD_CFLAGS=$CFLAGS
- OLD_CPPFLAGS=$CPPFLAGS
-
- dnl make sure there is no newline in paths
- i=`echo aci_paths|wc -l`
- if test $i != 1 && test $i != 0 ; then
- AC_MSG_ERROR([Badly formed args for function ACI-PACKAGE.
- please no newline and no tab.])
- fi
-
- ac_func_search_save_LIBS="$LIBS"
- ac_func_search_save_this_LIBS="$LIBS_$1"
- aci_found="no"
- echo "----------------------------------------" >&5
- AC_MSG_CHECKING([for aci_name. Can I access aci_func without new libs])
- AC_TRY_LINK_FUNC([$3],[AC_MSG_RESULT([yes]) aci_found="yes"],[AC_MSG_RESULT([no])])
- if test "$aci_found" = "no"; then
- if test -n "$LIBS_$1" ; then
- LIBS="$LIBS_$1"
- echo "----------------------------------------" >&5
- AC_MSG_CHECKING([for aci_name. Can I access aci_func the specified extra args])
- AC_TRY_LINK_FUNC(aci_func,aci_found="yes",aci_found="no")
- AC_MSG_RESULT($aci_found)
- fi
- fi
- for i in aci_paths
- do
- if test "x$aci_found" = "xno"; then
- LIBS_$1=`echo "$i $ac_func_search_save_this_LIBS"|sed 's/!/ /g'`
- LIBS="$LIBS_$1 $ac_func_search_save_LIBS"
- echo "----------------------------------------" >&5
- AC_MSG_CHECKING([for aci_name. Can I access aci_func with $LIBS_$1])
- AC_TRY_LINK_FUNC(aci_func,aci_found="yes",aci_found="no")
- AC_MSG_RESULT($aci_found)
- fi
- done
- LIBS="$ac_func_search_save_LIBS"
-
- dnl
- dnl search for the header (only if the lib was found)
- dnl
- if test "x$aci_found" = "xyes" && test "x"aci_header != "x" ; then
- CPPFLAGS="$CPPFLAGS $CFLAGS_$1"
- ACI_D("CPPFLAGS=$CPPFLAGS")
- AC_CHECK_HEADER(aci_header,good=yes,good=no)
- fi
- if test "x$aci_found" = "xno" ; then
- dnl Something where not found.
- dnl If the caller specified what to do in this case, do it.
- dnl Else, complain.
- ifelse(aci_if_no, ,
- [AC_MSG_ERROR(Can't find the package $1. Please install it[,] or if it is installed[,] tell me where with the --with-$1 argument (see ./configure --help=short).)],
- aci_if_no)
- else
- dnl Anything where found
- HAVE_$1="yes"
- ifelse(aci_if_yes, , echo >/dev/null, aci_if_yes)
- fi
- if test "x$HAVE_$1" != "xyes" ; then
- CFLAGS_$1=""
- LIBS_$1=""
- fi
- dnl AC_SUBST what should be
- AC_SUBST(HAVE_$1)
- AC_SUBST(CFLAGS_$1)
- AC_SUBST(LIBS_$1)
-
- ACI_D("[END OF ACI-PACKAGE($1)]")
- dnl restore the old settings
- LDFLAGS=$OLDLDFLAGS
- CPPFLAGS=$OLDCPPFLAGS
- CFLAGS=$OLDCFLAGS
-])
-
-dnl ACI_PACKAGE_SAVED: same as ACI_PACKAGE, but with an external cache
-dnl SYNOPSIS:
-dnl 1=Package (name of the package)
-dnl 2=Description (human readable, for documentation)
-dnl 3=Cache program.Should accept --libs and --cflags (like gnome-config does)
-dnl 4=Extra arg to pass to this prog (like a name of library)
-dnl 5=what to do if found
-dnl 6=what to do if not found (default AC_MSG_ERROR(blabla))
-dnl ACTIONS:
-dnl - try to find the cache program
-dnl - AC_SUBST the following values:
-dnl HAVE_$1: 'yes' or 'no'
-dnl CFLAGS_$1: CFLAGS to acces to this package
-dnl LIBS_$1: LDFLAGS to acces to this package
-
-AC_DEFUN([ACI_PACKAGE_SAVED],[
- ACI_D("[BEGINING OF ACI-PACKAGE-SAVED($1)]")
- AC_PATH_PROG(ACI_CACHE_PROG,$3,no)
- aci_module_desc_$1="$2"
- AC_SUBST([aci_module_desc_$1])dnl
- aci_pkg_config_$1=$3
- AC_SUBST([aci_pkg_config_$1])dnl
- aci_packages="$aci_packages $1"
- if test x$ACI_CACHE_PROG = xno; then
- HAVE_$1=no
- CFLAGS_$1=""
- LIBS_$1=""
- ifelse($6, ,[AC_MSG_ERROR([Cannot find $1: Is $3 in your path?])],$6)
- else
- HAVE_$1=yes
- CFLAGS_$1=`$ACI_CACHE_PROG --cflags $4`
- LIBS_$1=`$ACI_CACHE_PROG --libs $4`
- ifelse($5, ,echo >/dev/null,$5)
- fi
- dnl AC_SUBST what should be
- AC_SUBST([HAVE_$1])dnl
- AC_SUBST([CFLAGS_$1])dnl
- AC_SUBST([LIBS_$1])dnl
- ACI_D("[END OF ACI-PACKAGE-SAVED($1)]")
-])
-
-
-dnl ACI_MODULE: defines a module (ie, a part of the code we are building)
-dnl 1=abbrev
-dnl 2=human readable description
-dnl 3=dependencies (space separated list of abbrev)
-dnl 4=submodules (space separated list of abbrev)
-dnl 5=default ([yes]/no) (if not given, yes is assumed)
-dnl 6=extra childs, which are listed under it in tree, without being a module
-
-AC_DEFUN([ACI_MODULE],[
- ACI_D("[BEGINING OF ACI-MODULE($1)]")
- aci_nameok=`echo $1|sed 'y/-/./'`
- if test "x$1" != "x$aci_nameok" ; then
- AC_MSG_ERROR([ACI error: Please no '-' in module name. (ie, $1 is not a valid name)])
- fi
- aci_module_desc_$1="$2"
- aci_module_dep_$1="$3"
- aci_module_sub_$1="$4"
- aci_module_child_$1="$4 $6"
- AC_SUBST(aci_module_desc_$1)
- AC_SUBST(aci_module_dep_$1)
- AC_SUBST(aci_module_sub_$1)
- AC_SUBST(aci_module_child_$1)
- AC_SUBST(SUBMODULES_$1)
- AC_SUBST(DIST_SUBMODULES_$1)
-
- AC_ARG_ENABLE($1,
- AS_HELP_STRING(--enable-$1,Enable the module $1, $2.))
-
- ifelse(ifelse([$5], ,[yes],[$5]),[yes],
- dnl what to do if module is enabled by default
- [aci_module_default_$1="enabled"],
- [aci_module_default_$1="disabled"])
-
- if test "x$enable_$1" == "xyes" ; then
- aci_module_status_$1="enabled"
- else if test "x$enable_$1" == "xno" ; then
- aci_module_status_$1="disabled"
- else
- aci_module_status_$1="$aci_module_default_$1"
- fi fi
- if test "$aci_module_status_$1" == "enabled" ; then
- aci_modules_possible="$aci_modules_possible $1"
- else
- aci_modules_disabled="$aci_modules_disabled $1"
- fi
- ACI_D("[END OF ACI-MODULE($1). Default:$aci_module_default_$1; Result:$aci_module_status_$1]")
-])
-
-dnl ACI_MODULES_VERIFY: verify which module can be satisfied
-dnl export:
-dnl - SUBMODULES_$1 to Makefiles, init'ed to the list of submodules to build
-dnl (use it in SUBDIRS in Makefile.am)
-dnl - DIST_SUBMODULES_$1 to Makefiles, init'ed to the list of submodules which could
-dnl be build but have unsatisfied dependencies
-dnl (use it in DIST_SUBDIRS in Makefile.am)
-dnl 1: the name of this group of modules
-
-AC_DEFUN([ACI_MODULES_VERIFY],[
- ##
- # Sanity check
- ##
- if echo $aci_modules_disabled $aci_modules_possible | grep $1 >/dev/null ; then
- :
- else
- AC_MSG_ERROR([ACI Error: You called MODULES_VERIFY($1), but $1 isn't a module])
- fi
-
- dnl Check the dependencies of everyone
- for aci_module in $aci_modules_possible
- do
- aci_mod_bad=""
- ACI_D("Look module $aci_module")
- for aci_mod_dep in `eval echo '$aci_module_dep_'"$aci_module"`
- do
- ACI_D($ECHO_N " it depends on $aci_mod_dep...")
- if test `eval echo 'x$'"HAVE_$aci_mod_dep"` != xyes; then
- ACI_D("Not satisfied !")
- aci_mod_bad=`echo "$aci_mod_bad $aci_mod_dep"|sed 's/^ *//'`
- else
- ACI_D("Satisfied !")
- fi
- done
- if test -z "$aci_mod_bad"; then
- ACI_D("Module $aci_module will be builded")
- ACI_D([])
- aci_modules="$aci_modules $aci_module"
- eval "HAVE_$aci_module=\"yes\""
- else
- ACI_D("Won't build $aci_module because it depends on $aci_mod_bad.")
- ACI_D([])
- eval "aci_module_misdep_$aci_module=\"$aci_mod_bad\""
- aci_modules_broken="$aci_modules_broken $aci_module"
- eval "HAVE_$aci_module=\"no\""
- fi
- done
-
- dnl Build the list of submodules to build
- ACI_D("Build the submodules lists")
- for aci_module in $aci_modules_possible
- do
- ACI_D($ECHO_N " Look for $aci_module: ")
- for aci_mod_sub in `eval echo '$aci_module_sub_'"$aci_module"`
- do
- if test `eval echo 'x$HAVE_'"$aci_mod_sub"` = xyes; then
- ACI_D($ECHO_N "$aci_mod_sub ")
- eval "SUBMODULES_$aci_module=\"\$MODULES_$aci_module $aci_mod_sub\""
- else
- ACI_D($ECHO_N "NOT $aci_mod_sub ")
- eval "DIST_SUBMODULES_$aci_module=\"\$DIST_MODULES_$aci_module $aci_mod_sub\""
- fi
- done
- ACI_D([])
- done
-
- dnl support for external interactif configurator
- AC_SUBST([ac_configure_args])dnl which argument were passed to configure
- AC_SUBST([aci_modules_possible])dnl
- AC_SUBST([aci_modules])dnl
- AC_SUBST([aci_modules_broken])dnl
- AC_SUBST([aci_modules_disabled])dnl
- AC_SUBST([aci_packages])dnl
-])
-
-dnl ACI_MODULES_SUMMARY: give a summary of what will be build to user
-dnl 1: Name of the root of modules (can be a space separated list)
-
-AC_DEFUN([ACI_MODULES_SUMMARY],[
- if test "x$aci_modules" != "x"; then
- echo "The following modules will be builded: "
- for aci_module in $aci_modules
- do
- echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"`
- if test -n "`echo "\$MODULES_$aci_module"`" ; then
- echo " builded submodules: "`eval echo '$MODULES_'"$aci_module"`
- fi
- done
- else
- echo "No module will be build."
- fi
- echo
-
- if test "x$aci_modules_disabled" != "x"; then
- echo "The following modules are disabled, either by you or by default."
- for aci_module in $aci_modules_disabled
- do
- echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"`
- done
- echo
- fi
-
- if test "x$aci_modules_broken" != "x"; then
- echo "The following modules have BROKEN dependencies:"
- for aci_module in $aci_modules_broken
- do
- echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"`
- echo " Depends on: "`eval echo '$aci_module_misdep_'"$aci_module"`
- done
-
- echo
- echo " If you think I'm a dumb script, and these dependencies can be"
- echo " satified, please try to use the --with-PACKAGE options. See:"
- echo " ./configure --help=short"
- echo
- echo "The other modules may be build even if these ones are not."
- echo
- fi
-])
-
-
-dnl ACI_MODULES_SUMMARY_FANCY: same as ACI_MODULES_SUMMARY, in a fancy way.
-AC_DEFUN([ACI_MODULES_SUMMARY_FANCY],[
- # the file conftests.nexts is a file containing the modules we still have to
- # handle. Each line have the form "level nb module", defining at which
- # <level> <module> is defined. It is the <nb>th at this level
-
- ##
- # Sanity check
- ##
- if echo $aci_modules_disabled $aci_modules_possible | grep $1 >/dev/null ; then
- :
- else
- AC_MSG_ERROR([ACI Error: You called MODULES_SUMMARY_FANCY($1), but $1 isn't a module])
- fi
-
- ###
- # Initializations
- ###
- ACI_ECHO([])
- name="$1"
- echo "BEGIN OF ACI_SUMMARY_FANCY">&5
- ACI_ECHO(["Summary of the configuration for $name"])
- aci_sum_more="no" # If there is more modules to handle
- rm -f conftest.nexts conftest.nexts.new
-
- # initialize aci_sum_nexts and aci_sum_more from the given argument
- aci_sum_nb=9
- for aci_sum_tmp in $1
- do
- echo "0 $aci_sum_nb $aci_sum_tmp" >> conftest.nexts
- aci_sum_more="yes"
- aci_sum_nb=`expr $aci_sum_nb - 1`
- done
-
-#cat conftest.nexts
-#echo "---"
-
- ###
- # Main loop
- ###
- while test "x$aci_sum_more" = "xyes" ; do
-
- # sort the list
- sort -r -k 1,3 conftest.nexts > conftest.nexts.new
- mv conftest.nexts.new conftest.nexts
-
- changequote(<<, >>)dnl because of the regexp [[:blank:]]
-
- # get the next elem to handle and its level, and remove it from the list
- aci_sum_this=`head -n 1 conftest.nexts|\
- sed -e 's/^[0-9]*[[:blank:]]*[0-9]*[[:blank:]]*\([^[:blank:]]*$\)/\1/'`
- aci_sum_lvl=`head -n 1 conftest.nexts |\
- sed -e 's/^\([0-9]*\)[[:blank:]].*$/\1/'`
-
-# aci_sum_this=`sed -e '1~1000s/^[0-9]*[[:blank:]]*[0-9]*[[:blank:]]*\([^[:blank:]]*$\)/\1/'\
-# -e '2~1d'\
-# conftest.nexts`
-# aci_sum_lvl=`sed -e '1~1000s/^\([0-9]*\)[[:blank:]].*$/\1/'\
-# -e '2~1d'\
-# conftest.nexts`
-
- tail +2l conftest.nexts > conftest.nexts.new
- mv conftest.nexts.new conftest.nexts
-
-#echo "aci_sum_this=$aci_sum_this"
-#cat conftest.nexts
-#echo "---"
- # stop if nothing else to do
- if test "x$aci_sum_this" = x ; then
- aci_sum_more="no"
- else
- # Add the sub modules of this on to the file
- aci_sum_sub=`expr $aci_sum_lvl + 1`
- aci_sum_nb=9
- for aci_sum_tmp in `eval echo '$aci_module_child_'"$aci_sum_this"`
- do
- echo "$aci_sum_sub $aci_sum_nb $aci_sum_tmp" >> conftest.nexts
- aci_sum_nb=`expr $aci_sum_nb - 1`
- done
-
- # compute the status of this module
- if echo $aci_modules_disabled|grep $aci_sum_this >/dev/null; then
- aci_sum_status="(DISABLED)"
- else
- if test `eval echo '"x$aci_module_misdep_'"$aci_sum_this\""` = x ; then
- aci_sum_status="(OK)"
- else
- aci_sum_status="(BROKEN)"
- fi
- fi
-
- # Outputs the title of this module
- aci_sum_header=""
- while test $aci_sum_lvl -ne 0
- do
- aci_sum_header="$aci_sum_header "
- aci_sum_lvl=`expr $aci_sum_lvl - 1`
- done
-
- changequote([, ])dnl back to normality, there is no regexp afterward
- ACI_ECHO("$aci_sum_header"'>'" $aci_sum_this$aci_sum_status: "`eval echo '$aci_module_desc_'"$aci_sum_this"`)
-
- aci_sum_head_dep="$aci_sum_header "
- aci_sum_tmp=`eval echo '$'"MODULES_$aci_sum_this"|
- sed 's/[^[:blank:]] .*$//'`
- if test "x$aci_sum_tmp" != x ; then
- ACI_ECHO("$aci_sum_head_dep Optional submodules to build: "`eval echo '$'"MODULES_$aci_sum_this"`)
- fi
-
-
- # outputs the dependencies of this module
- aci_sum_deps=""
- aci_sum_dep_some="no"
- for aci_sum_dep in `eval echo '$aci_module_dep_'"$aci_sum_this"`
- do
- if echo $aci_packages|grep $aci_sum_dep>/dev/null ||\
- echo `eval echo '$aci_module_misdep_'"$aci_sum_this"`|grep $aci_sum_dep >/dev/null; then
- aci_sum_deps="$aci_sum_deps $aci_sum_dep"
- aci_sum_dep_some="yes"
- fi
- done
- if test "x$aci_sum_dep_some" = xyes ; then
- ACI_ECHO("$aci_sum_head_dep Packages and modules it depends on:")
- for aci_sum_dep in $aci_sum_deps
- do
- # compute the status of this package
- if test `eval echo 'x$'"HAVE_$aci_sum_dep"` = xyes ; then
- aci_sum_pkg_status="(FOUND)"
- else
- aci_sum_pkg_status="(NOT FOUND)"
- fi
-
- # output the status of this package
- ACI_ECHO("$aci_sum_head_dep o $aci_sum_dep$aci_sum_pkg_status: "`eval echo '$aci_module_desc_'"$aci_sum_dep"`)
- aci_sum_tmp=`eval echo '$'"LIBS_$aci_sum_dep"|
- sed 's/[^[:blank:]] .*$//'`
- if test "x$aci_sum_tmp" != x ; then
- ACI_ECHO( "$aci_sum_head_dep LIBS: "`eval echo '$'"LIBS_$aci_sum_dep"`)
- fi
- aci_sum_tmp=`eval echo '$'"CFLAGS_$aci_sum_dep"|
- sed 's/[^[:blank:]] .*$//'`
- if test "x$aci_sum_tmp" != x ; then
- ACI_ECHO("$aci_sum_head_dep CFLAGS: "`eval echo '$'"CFLAGS_$aci_sum_dep"`)
- fi
- done
- fi
- fi
- ACI_ECHO("$aci_sum_header")
- done
- if test "x$aci_modules_disabled" != "x"; then
- ACI_ECHO( " Some modules are disabled[,] either by you or by default")
- ACI_ECHO( )
- fi
- if test "x$aci_modules_broken" != "x"; then
- ACI_ECHO( " If you think I'm a dumb script[,] and these broken dependencies can")
- ACI_ECHO( " be satified[,] please try to use the --with-PACKAGE options. See:")
- ACI_ECHO( " ./configure --help=short")
- ACI_ECHO([])
- ACI_ECHO( "The other modules may be build even if these ones are not.")
- ACI_ECHO([])
- fi
- if test "x$aci_modules_disabled$aci_modules_broken" = "x"; then
- ACI_ECHO( " Everything went well.")
- fi
- echo "END OF ACI_SUMMARY_FANCY">&5
-])
+++ /dev/null
-dnl @synopsis AX_CXX_CHECK_LIB(libname, functioname, action-if, action-if-not)
-dnl
-dnl The standard AC_CHECK_LIB can not test functions in namespaces.
-dnl Therefore AC_CHECK_LIB(cgicc, cgicc::Cgicc::getVersion) will always
-dnl fail. We need to decompose the functionname into a series of namespaces
-dnl where it gets declared so that it can be used for a link test.
-dnl
-dnl In the first version I did allow namespace::functionname to be a
-dnl reference to a void-argument global functionname (just wrapped in a
-dnl namespace) like its C counterparts would be - but in reality such
-dnl thing does not exist. The only global / static functions are always
-dnl made const-functions which is an attribute mangled along into the
-dnl library function export name.
-dnl
-dnl The normal usage will ask for a test of a class-member function which
-dnl should be presented with a full function spec with arguments given in
-dnl parentheses following the function name - if the function to test for
-dnl does expect arguments then you should add default initial values in the
-dnl prototype (even if they do not exist originally, these are used only
-dnl locally to build a correct function call in the configure test script).
-dnl
-dnl In the current version if you do omit the parenthesis from the macro
-dnl argument then the macro will assume that you want to check for the
-dnl class name - which is really to check for default constructor being
-dnl exported from the given library name.
-dnl
-dnl EXAMPLE:
-dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::HTTPCookie])
-dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::Cgicc::getVersion () const],
-dnl AX_CXX_CHECK_LIB(boost_regex, [boost::RegEx::Position (int i = 0) const])
-dnl
-dnl Result:
-dnl Just as the usual AX_CXX_CHECK_LIB - defines HAVE_LIBCGICC
-dnl and adds the libraries to the default library path (and
-dnl uses internally the normal ac_check_lib cache symbol
-dnl like ac_cv_lib_cgicc_cgicc__Cgicc)
-dnl
-dnl Footnote: The C++ language is not good at creating stable library
-dnl interfaces at the binary level - a lot of functionality is usually being
-dnl given as inline functions plus there is hardly a chance to create opaque
-dnl types. Therefore most C++ library tests will only do compile tests using
-dnl the header files. Doing a check_lib is however good to check the link
-dnl dependency before hitting it as an error in the build later.
-dnl
-dnl @category C++
-dnl @author Guido U. Draheim
-dnl @vesion 2006-12-18
-
-AC_DEFUN([AX_CXX_CHECK_LIB],
-[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
-AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
- [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
-AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
-[ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$1 $5 $LIBS"
-case "$2"
-in *::*::*\(*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { class `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/" -e "s/(.*//"`
- { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
- };
- }
-],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*::*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { namespace `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/"`
- { class `echo "$2" | sed -e "s/.*:://"`
- { public: `echo "$2" | sed -e "s/.*:://"` ();
- };
- }
- }
-],[new $2()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*\(*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- class `echo "$2" | sed -e "s/\\(.*\\)::.*/\\1/" -e "s/(.*//"`
- { public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
- };
-],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *::*)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
- namespace `echo "$2" | sed -e "s/::.*//"`
- { class `echo "$2" | sed -e "s/.*:://"`
- { public: `echo "$2" | sed -e "s/.*:://"` ();
- };
- }
-],[new $2()])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; *)
-AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
- [AS_VAR_SET(ac_Lib, yes)],
- [AS_VAR_SET(ac_Lib, no)])
-;; esac
-LIBS=$ac_check_lib_save_LIBS])
-AS_IF([test AS_VAR_GET(ac_Lib) = yes],
- [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
- LIBS="-l$1 $LIBS"
-])],
- [$4])dnl
-AS_VAR_POPDEF([ac_Lib])dnl
-])# AC_CHECK_LIB
+++ /dev/null
-dnl See whether we need a declaration for a function.
-AC_DEFUN([BFD_NEED_DECLARATION],
-[AC_MSG_CHECKING([whether $1 must be declared])
-AC_CACHE_VAL(bfd_cv_decl_needed_$1,
-[AC_TRY_COMPILE([
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif],
-[char *(*pfn) = (char *(*)) $1],
-bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
-AC_MSG_RESULT($bfd_cv_decl_needed_$1)
-if test $bfd_cv_decl_needed_$1 = yes; then
- AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
- [Define if $1 is not declared in system header files.])
-fi
-])dnl
-
+++ /dev/null
-dnl SG_COMPILE_FLAGS
-dnl Turn on many useful compiler warnings
-dnl For now, only sets extra flags on GCC
-
-
-dnl Copyright (C) 2004, 2005, 2007. Martin Quinson. All rights reserved.
-
-dnl This file is part of the SimGrid project. This is free software:
-dnl You can redistribute and/or modify it under the terms of the
-dnl GNU LGPL (v2.1) licence.
-
-
-AC_DEFUN([SG_COMPILE_FLAGS],[
- AC_ARG_ENABLE(compile-warnings,
- AS_HELP_STRING([--enable-compile-warnings], [use compiler warnings (default=no, unless in maintainer mode)]),
- enable_compile_warnings=$enableval,enable_compile_warnings=no)
-
- AC_ARG_ENABLE(compile-optimizations,
- AS_HELP_STRING([--disable-compile-optimizations], [use compiler optimizations (default=yes, unless if CFLAGS is explicitly set)]),
- enable_compile_optimizations=$enableval,enable_compile_optimizations=auto)
-
- # AC PROG CC tests whether -g is accepted.
- # Cool, but it also tries to set -O2 and -g.
- # I don't want it with gcc, but -O3 and -g2, and optimization only when asked by user
- case $CC in
- *gcc)
- if test "$CFLAGS" = "-g -O2" ; then
- CFLAGS="-g3"
- fi
- if test "$CXXFLAGS" = "-g -O2" ; then
- CXXFLAGS="-g3"
- fi
- if test "$GCJFLAGS" = "-g -O2" ; then
- CXXFLAGS="-g3"
- fi;;
- esac
-
- if test "x$enable_compile_warnings" = "xyes" ||
- test "x$force_compile_warnings" = "xyes"; then
- AC_MSG_CHECKING(the warning flags for this compiler)
- warnCFLAGS=
- if test "x$CC" = "xgcc" || test "x$GCC" = "xyes" ; then
- case " $CFLAGS " in
- *-Wall*) ;;
- *) warnCFLAGS="-Wall -Wunused" ;;
- esac
-
- ## -W is not all that useful. And it cannot be controlled
- ## with individual -Wno-xxx flags, unlike -Wall
-
- ##Â -Wformat=2 chokes on the snprintf replacement because the format is passed to real sprintf
- ## -Wshadow chokes on try{ try{} } constructs
- warnCFLAGS=`echo $warnCFLAGS -Wmissing-prototypes -Wmissing-declarations \
- -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings \
- -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral \
- -Werror \
- | sed 's/ +/ /g'`
- # -Wno-unused-variable -Wno-unused-label
- fi
- AC_MSG_RESULT($warnCFLAGS)
- # placed before since gcc remembers the last one on conflict
- CFLAGS="$warnCFLAGS $CFLAGS"
- fi
-
- if test "x$enable_compile_optimizations" = "xyes" ||
- test "x$enable_compile_optimizations" = "xauto" ; then
- AC_MSG_CHECKING(the optimization flags for this compiler)
- optCFLAGS=
- if test "x$CC" = "xgcc" || test "x$GCC" = "xyes" ; then
- case " $CFLAGS " in
- *-O*) ;;
- *) optCFLAGS="$optCFLAGS -O3" ;;
- esac
- optCFLAGS="$optCFLAGS -finline-functions -funroll-loops -fno-strict-aliasing"
- # now that surf uses advanced maths in lagrangian, -ffast-math do break things
-
- GCC_VER=`gcc --version | head -n 1 | sed 's/^[^0-9]*\([^ ]*\).*$/\1/'`
- GCC_VER_MAJ=`echo $GCC_VER | sed 's/^\(.\).*$/\1/'`
- if test "x$target_cpu" = "xpowerpc" && test "x$GCC_VER_MAJ" == "x3" ; then
- # avoid gcc bug #12828, which apeared in 3.x branch and is fixed in 3.4.0
- # but the check would be too complicated to get 3.4.
- # Instead, rule out any 3.x compiler.
-
- # Note that the flag didn't exist before gcc 3.0
- optCFLAGS="$optCFLAGS -fno-loop-optimize"
- fi
- dnl A C_MSG_WARN(GCC_VER_MAJ=$GCC_VER_MAJ)
- fi
- AC_MSG_RESULT($optCFLAGS)
- # Take it only if CFLAGS not explicitly set. Unless the flag was explicitly given
- if test "x$cflags_set" != "xyes" ; then
- CFLAGS="$optCFLAGS $CFLAGS"
- fi
- else
- CFLAGS="$CFLAGS -O0"
- fi
-
- if test x$lt_cv_prog_gnu_ld = xyes ; then
- LD_DYNAMIC_FLAGS=-Wl,--export-dynamic
- else
- LD_DYNAMIC_FLAGS=
- fi
- AC_SUBST(LD_DYNAMIC_FLAGS)
-
-])
+++ /dev/null
-dnl AC_CHECK_UCONTEXT: Check whether ucontext are working
-
-dnl Most of the code is stolen from the GNU pth autoconf macros by
-dnl Ralf S. Engelschall.
-dnl # ``"Reuse an expert's code" is the right
-dnl # advice for most people. But it's a useless
-dnl # advice for the experts writing the code
-dnl # in the first place.'
-dnl # -- Dan J. Bernstein
-dnl
-dnl OK, you're definitely the expert on this point... :)
-
-dnl ##
-dnl ## Display Configuration Headers
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_MSG_PART(<text>)
-dnl ##
-
-m4_define(AC_MSG_PART,[dnl
-if test ".$enable_subdir" != .yes; then
- AC_MSG_RESULT()
- AC_MSG_RESULT(${TB}$1:${TN})
-fi
-])dnl
-
-dnl ##
-dnl ## Display a message under --verbose
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_MSG_VERBOSE(<text>)
-dnl ##
-
-m4_define(AC_MSG_VERBOSE,[dnl
-if test ".$verbose" = .yes; then
- AC_MSG_RESULT([ $1])
-fi
-])
-
-dnl ##
-dnl ## Do not display message for a command
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_MSG_SILENT(...)
-dnl ##
-
-m4_define(AC_FD_TMP, 9)
-m4_define(AC_MSG_SILENT,[dnl
-exec AC_FD_TMP>&AC_FD_MSG AC_FD_MSG>/dev/null
-$1
-exec AC_FD_MSG>&AC_FD_TMP AC_FD_TMP>&-
-])
-
-dnl ##
-dnl ## Check for direction of stack growth
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_CHECK_STACKGROWTH(<define>)
-dnl ## acconfig.h:
-dnl ## #undef <define>
-dnl ## source.c:
-dnl ## #include "config.h"
-dnl ## #if <define> < 0
-dnl ## ...stack grow down...
-dnl ## #else
-dnl ## ...stack grow up...
-dnl ## #endif
-dnl ##
-
-AC_DEFUN([AC_CHECK_STACKGROWTH],[dnl
-AC_MSG_CHECKING(for direction of stack growth)
-AC_CACHE_VAL(ac_cv_check_stackgrowth, [
-cross_compiling=no
-AC_TRY_RUN(
-changequote(<<, >>)dnl
-<<
-#include <stdio.h>
-#include <stdlib.h>
-static int iterate = 10;
-static int growsdown(int *x)
-{
- auto int y;
- y = (x > &y);
- if (--iterate > 0)
- y = growsdown(&y);
- if (y != (x > &y))
- exit(1);
- return y;
-}
-int main(int argc, char *argv[])
-{
- FILE *f;
- auto int x;
- if ((f = fopen("conftestval", "w")) == NULL)
- exit(1);
- fprintf(f, "%s\n", growsdown(&x) ? "down" : "up");;
- fclose(f);
- exit(0);
-}
->>
-changequote([, ])dnl
-,
-ac_cv_check_stackgrowth=`cat conftestval`,
-ac_cv_check_stackgrowth=down,
-ac_cv_check_stackgrowth=down
-)dnl
-])dnl
-AC_MSG_RESULT([$ac_cv_check_stackgrowth])
-if test ".$ac_cv_check_stackgrowth" = ".down"; then
- val="-1"
-else
- val="+1"
-fi
-AC_DEFINE_UNQUOTED($1, $val, [define for stack growth])
-])
-
-dnl ##
-dnl ## Check whether SVR4/SUSv2 makecontext(2), swapcontext(2) and
-dnl ## friends can be used for user-space context switching
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_CHECK_MCSC(<success-action>, <failure-action>)
-dnl ##
-
-AC_DEFUN([AC_CHECK_MCSC], [
-AC_MSG_CHECKING(for usable SVR4/SUSv2 makecontext(2)/swapcontext(2))
-AC_CACHE_VAL(ac_cv_check_mcsc, [
-AC_TRY_RUN([
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ucontext.h>
-
-ucontext_t uc_child;
-ucontext_t uc_main;
-
-void child(void)
-{
- if (swapcontext(&uc_child, &uc_main) != 0)
- exit(2);
-}
-
-int main(int argc, char *argv[])
-{
- FILE *fp;
- void *stack;
-
- /* the default is that it fails */
- if ((fp = fopen("conftestval", "w")) == NULL)
- exit(3);
- fprintf(fp, "no\n");
- fclose(fp);
-
- /* configure a child user-space context */
- if ((stack = malloc(64*1024)) == NULL)
- exit(4);
- if (getcontext(&uc_child) != 0)
- exit(5);
- uc_child.uc_link = NULL;
- uc_child.uc_stack.ss_sp = (char *)stack+(32*1024);
- uc_child.uc_stack.ss_size = 32*1024;
- uc_child.uc_stack.ss_flags = 0;
- makecontext(&uc_child, child, 0);
-
- /* switch into the user context */
- if (swapcontext(&uc_main, &uc_child) != 0)
- exit(6);
-
- /* Fine, child came home */
- if ((fp = fopen("conftestval", "w")) == NULL)
- exit(7);
- fprintf(fp, "yes\n");
- fclose(fp);
-
- /* die successfully */
- exit(0);
-}
-],
-ac_cv_check_mcsc=`cat conftestval`,
-ac_cv_check_mcsc=no,
-ac_cv_check_mcsc=no
-)dnl
-])dnl
-AC_MSG_RESULT([$ac_cv_check_mcsc])
-if test ".$ac_cv_check_mcsc" = .yes; then
- ifelse([$1], , :, [$1])
-else
- ifelse([$2], , :, [$2])
-fi
-])dnl
-
-dnl ##
-dnl ## Check how stacks have to be setup for the functions
-dnl ## sigstack(2), sigaltstack(2) and makecontext(2).
-dnl ##
-dnl ## configure.ac:
-dnl ## AC_CHECK_STACKSETUP(sigstack|sigaltstack|makecontext, <macro-addr>, <macro-size>)
-dnl ## acconfig.h:
-dnl ## #undef HAVE_{SIGSTACK|SIGALTSTACK|MAKECONTEXT}
-dnl ## #undef HAVE_STACK_T
-dnl ## header.h.in:
-dnl ## @<macro-addr>@
-dnl ## @<macro-size>@
-dnl ## source.c:
-dnl ## #include "header.h"
-dnl ## xxx.sp_ss = <macro-addr>(skaddr, sksize);
-dnl ## xxx.sp_size = <macro-size>(skaddr, sksize);
-dnl ##
-
-AC_DEFUN([AC_CHECK_STACKSETUP],[dnl
-dnl # check for consistent usage
-ifelse($1,[sigstack],,[
-ifelse($1,[sigaltstack],,[
-ifelse($1,[makecontext],,[
-errprint(__file__:__line__: [AC_CHECK_STACKSETUP: only sigstack, sigaltstack and makecontext supported
-])])])])
-dnl # we require the C compiler and the standard headers
-AC_REQUIRE([AC_HEADER_STDC])dnl
-dnl # we at least require the function to check
-AC_CHECK_FUNCS($1)
-dnl # sigaltstack on some platforms uses stack_t instead of struct sigaltstack
-ifelse($1, sigaltstack, [
- AC_ONCE(stacksetup_stack_t, [
- AC_CHECK_TYPEDEF(stack_t, signal.h)
- ])
-])
-dnl # display processing header
-AC_MSG_CHECKING(for stack setup via $1)
-dnl # but cache the whole results
-AC_CACHE_VAL(ac_cv_stacksetup_$1,[
-if test ".$ac_cv_func_$1" = .no; then
- dnl # no need to check anything when function is already missing
- ac_cv_stacksetup_$1="N.A.:/*N.A.*/,/*N.A.*/"
-else
- dnl # setup compile environment
- OCFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -DTEST_$1"
- cross_compiling=no
- dnl # compile and run the test program
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if defined(TEST_sigstack) || defined(TEST_sigaltstack)
-#include <sys/types.h>
-#include <signal.h>
-#include <unistd.h>
-#endif
-#if defined(TEST_makecontext)
-#include <ucontext.h>
-#endif
-union alltypes {
- long l;
- double d;
- void *vp;
- void (*fp)(void);
- char *cp;
-};
-static volatile char *handler_addr = (char *)0xDEAD;
-#if defined(TEST_sigstack) || defined(TEST_sigaltstack)
-static volatile int handler_done = 0;
-void handler(int sig)
-{
- char garbage[1024];
- int i;
- auto int dummy;
- for (i = 0; i < 1024; i++)
- garbage[i] = 'X';
- handler_addr = (char *)&dummy;
- handler_done = 1;
- return;
-}
-#endif
-#if defined(TEST_makecontext)
-static ucontext_t uc_handler;
-static ucontext_t uc_main;
-void handler(void)
-{
- char garbage[1024];
- int i;
- auto int dummy;
- for (i = 0; i < 1024; i++)
- garbage[i] = 'X';
- handler_addr = (char *)&dummy;
- swapcontext(&uc_handler, &uc_main);
- return;
-}
-#endif
-int main(int argc, char *argv[])
-{
- FILE *f;
- char *skaddr;
- char *skbuf;
- int sksize;
- char result[1024];
- int i;
- sksize = 32768;
- skbuf = (char *)malloc(sksize*2+2*sizeof(union alltypes));
- if (skbuf == NULL)
- exit(1);
- for (i = 0; i < sksize*2+2*sizeof(union alltypes); i++)
- skbuf[i] = 'A';
- skaddr = skbuf+sizeof(union alltypes);
-#if defined(TEST_sigstack) || defined(TEST_sigaltstack)
- {
- struct sigaction sa;
-#if defined(TEST_sigstack)
- struct sigstack ss;
-#elif defined(TEST_sigaltstack) && defined(HAVE_STACK_T)
- stack_t ss;
-#else
- struct sigaltstack ss;
-#endif
-#if defined(TEST_sigstack)
- ss.ss_sp = (void *)(skaddr + sksize);
- ss.ss_onstack = 0;
- if (sigstack(&ss, NULL) < 0)
- exit(1);
-#elif defined(TEST_sigaltstack)
- ss.ss_sp = (void *)(skaddr + sksize);
- ss.ss_size = sksize;
- ss.ss_flags = 0;
- if (sigaltstack(&ss, NULL) < 0)
- exit(1);
-#endif
- memset((void *)&sa, 0, sizeof(struct sigaction));
- sa.sa_handler = handler;
- sa.sa_flags = SA_ONSTACK;
- sigemptyset(&sa.sa_mask);
- sigaction(SIGUSR1, &sa, NULL);
- kill(getpid(), SIGUSR1);
- while (!handler_done)
- /*nop*/;
- }
-#endif
-#if defined(TEST_makecontext)
- {
- if (getcontext(&uc_handler) != 0)
- exit(1);
- uc_handler.uc_link = NULL;
- uc_handler.uc_stack.ss_sp = (void *)(skaddr + sksize);
- uc_handler.uc_stack.ss_size = sksize;
- uc_handler.uc_stack.ss_flags = 0;
- makecontext(&uc_handler, handler, 0);
- swapcontext(&uc_main, &uc_handler);
- }
-#endif
- if (handler_addr == (char *)0xDEAD)
- exit(1);
- if (handler_addr < skaddr+sksize) {
- /* stack was placed into lower area */
- if (*(skaddr+sksize) != 'A')
- sprintf(result, "(skaddr)+(sksize)-%d,(sksize)-%d",
- sizeof(union alltypes), sizeof(union alltypes));
- else
- strcpy(result, "(skaddr)+(sksize),(sksize)");
- }
- else {
- /* stack was placed into higher area */
- if (*(skaddr+sksize*2) != 'A')
- sprintf(result, "(skaddr),(sksize)-%d", sizeof(union alltypes));
- else
- strcpy(result, "(skaddr),(sksize)");
- }
- if ((f = fopen("conftestval", "w")) == NULL)
- exit(1);
- fprintf(f, "%s\n", result);
- fclose(f);
- exit(0);
-}
-],[
-dnl # test successully passed
-ac_cv_stacksetup_$1=`cat conftestval`
-ac_cv_stacksetup_$1="ok:$ac_cv_stacksetup_$1"
-],[
-dnl # test failed
-ac_cv_stacksetup_$1='guessed:(skaddr),(sksize)'
-],[
-dnl # cross-platform => failed
-ac_cv_stacksetup_$1='guessed:(skaddr),(sksize)'
-])
-dnl # restore original compile environment
-CFLAGS="$OCFLAGS"
-])dnl
-fi
-dnl # extract result ingredients of single cached result value
-type=`echo $ac_cv_stacksetup_$1 | sed -e 's;:.*$;;'`
-addr=`echo $ac_cv_stacksetup_$1 | sed -e 's;^.*:;;' -e 's;,.*$;;'`
-size=`echo $ac_cv_stacksetup_$1 | sed -e 's;^.*:;;' -e 's;^.*,;;'`
-dnl # export result ingredients
-$2="#define $2(skaddr,sksize) ($addr)"
-$3="#define $3(skaddr,sksize) ($size)"
-AC_SUBST($2)dnl
-AC_SUBST($3)dnl
-dnl # display result indicator
-AC_MSG_RESULT([$type])
-dnl # display results in detail
-AC_MSG_VERBOSE([$]$2)
-AC_MSG_VERBOSE([$]$3)
-])
+++ /dev/null
-# Makefile chunk which allows to display the files which should be included
-# into the distribution.
-
-# It is intended to be included in all Makefile.am
-
-dist-files:
- @for n in $(DISTFILES) ; do echo $(SRCFILE)$$n; done
- @echo
- @for n in $(DIST_SUBDIRS) ; do if [ x$$n != x. ] ; then $(MAKE) -C $$n dist-files SRCFILE=$(SRCFILE)$$n/ ; fi; done
+++ /dev/null
-dnl SG_CONFIGURE_PART(MESSAGE)
-dnl Idea borrowed from PHP, which borrowed it from mm
-AC_DEFUN([SG_CONFIGURE_PART],[
- AC_MSG_RESULT()
- AC_MSG_RESULT([${T_MD}$1${T_ME}])
-])
-
+++ /dev/null
-dnl AC_PROG_FLEX: Check whether the LEXer is flex, and which version it has
-dnl The first arg must be a version number with 3 parts.
-
-dnl You may want to check for version >= 2.5.31 (the one breaking posix compatibility)
-
-
-dnl Copyright (C) 2005. Martin Quinson. All rights reserved.
-
-dnl This file is part of the SimGrid project. This is free software:
-dnl You can redistribute and/or modify it under the terms of the
-dnl GNU LGPL (v2.1) licence.
-
-
-AC_DEFUN([_AC_PROG_FLEX_HELPER_TOO_OLD],[
- AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
- LEX="$SHELL $missing_dir/missing flex";
- AC_SUBST(LEXLIB, '')
-])
-
-AC_DEFUN([AC_PROG_FLEX],
- [
-AC_PREREQ(2.50)dnl
-AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
-AC_REQUIRE([AC_PROG_LEX])dnl
- if test "$LEX" != flex; then
- AC_MSG_NOTICE([Flex not found. Parsers won't get updated.])
- LEX=${am_missing_run}flex
- AC_SUBST(LEXLIB, '')
- else
- if test "x$1" != "x" ; then
- dnl
- dnl We were asked to check the version number
- dnl
- changequote(<<, >>)dnl because of the regexp [blabla]
- FLEX_VERSION=`flex --version | sed -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'`
-
- FLEX_VER_MAJ=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- FLEX_VER_MED=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- FLEX_VER_MIN=`echo "$FLEX_VERSION" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
-
- WANT_VER_MAJ=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`;
- WANT_VER_MED=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`;
- WANT_VER_MIN=`echo $1 | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`;
- changequote([, ])dnl back to normality, there is no regexp afterward
-
- if test "$FLEX_VER_MAJ" -lt "$WANT_VER_MAJ" ||
- test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -lt "$WANT_VER_MED" ||
- test "$FLEX_VER_MAJ" -eq "$WANT_VER_MAJ" -a "$FLEX_VER_MED" -eq "$WANT_VER_MED" -a "$FLEX_VER_MIN" -lt "$WANT_VER_MIN" ;
- then
- AC_MSG_NOTICE([Found flex is too old. Parsers won't get updated (Found v$FLEX_VERSION < v$1)])
- LEX=${am_missing_run}flex
- AC_SUBST(LEXLIB, '')
- else
- AC_MSG_NOTICE([Flex found. Parsers will get updated])
- fi
- fi
- fi
-])
+++ /dev/null
-dnl
-dnl GRAS_DO_CHECK_SIZEOF: Get the size of a datatype (even in cross-compile)
-dnl 1: type tested
-dnl 2: extra include lines
-dnl 3: extra sizes to test
-dnl ("adapted" from openldap)
-dnl
-
-dnl Copyright (C) 2004, 2005, 2006, 2007. Martin Quinson. All rights reserved.
-
-dnl This file is part of the SimGrid project. This is free software:
-dnl You can redistribute and/or modify it under the terms of the
-dnl GNU LGPL (v2.1) licence.
-
-
-# BEGIN OF GRAS ARCH CHECK
-AC_DEFUN([GRAS_DO_CHECK_SIZEOF],
-[changequote(<<, >>)dnl
- dnl The cache variable name (and of the result).
- define(<<GRAS_CHECK_SIZEOF_RES>>, translit(ac_cv_sizeof_$1, [ *()], [_pLR]))dnl
- changequote([, ])dnl
- AC_CACHE_VAL(GRAS_CHECK_SIZEOF_RES,
- [for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
- AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include "confdefs.h"
- #include <sys/types.h>
- $2
- ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;]), GRAS_CHECK_SIZEOF_RES=$ac_size)
- if test x$GRAS_CHECK_SIZEOF_RES != x ; then break; fi
- done
- ])
-])
-
-dnl
-dnl GRAS_CHECK_SIZEOF: Get the size of a datatype (even in cross-compile), with msg display, and define the result
-dnl 1: type tested
-dnl 2: extra include lines
-dnl 3: extra sizes to test
-dnl ("adapted" from openldap)
-dnl
-AC_DEFUN([GRAS_CHECK_SIZEOF],
-[AC_MSG_CHECKING(size of $1)
-GRAS_DO_CHECK_SIZEOF($1,$2)
-if test x$GRAS_CHECK_SIZEOF_RES = x ; then
- AC_MSG_ERROR([cannot determine a size for $1])
-fi
-AC_MSG_RESULT($GRAS_CHECK_SIZEOF_RES)
-])
-
-dnl
-dnl GRAS_TWO_COMPLEMENT([type]): Make sure the type is two-complement
-dnl warning, this does not work with char (quite logical)
-dnl
-AC_DEFUN([GRAS_TWO_COMPLEMENT],
-[
-AC_MSG_CHECKING(whether $1 is two-complement)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
-union {
- signed $1 testInt;
- unsigned char bytes[sizeof($1)];
-} intTester;
-]],[[
- intTester.testInt = -2;
- switch (0) {
- case 0:
- case (((unsigned int)intTester.bytes[0] +
- (unsigned int)intTester.bytes[sizeof($1) - 1]) - 509) == 0:
- }
-]])], dnl end of AC LANG PROGRAM
-[two_complement=yes],[two_complement=no] )dnl end of AC COMPILE IFELSE
-
-AC_MSG_RESULT($two_complement)
-if test x$two_complement != xyes ; then
- AC_MSG_ERROR([GRAS works only two-complement integers (yet)])
-fi
-])
-
-dnl
-dnl GRAS_SIGNED_SIZEOF: Get the size of the datatype, and make sure that
-dnl signed, unsigned and unspecified have the same size
-dnl
-AC_DEFUN([GRAS_SIGNED_SIZEOF],
-[AC_MSG_CHECKING(size of $1)
-GRAS_DO_CHECK_SIZEOF($1,$2)
-unspecif=$GRAS_CHECK_SIZEOF_RES
-if test x$unspecif = x ; then
- AC_MSG_ERROR([cannot determine a size for $1])
-fi
-
-GRAS_DO_CHECK_SIZEOF(signed $1,$2)
-signed=$GRAS_CHECK_SIZEOF_RES
-if test x$signed = x ; then
- AC_MSG_ERROR([cannot determine a size for signed $1])
-fi
-if test x$unspecif != x$signed ; then
- AC_MSG_ERROR(['signed $1' and '$1' have different sizes ! ($signed != $unspecif)])
-fi
-
-GRAS_DO_CHECK_SIZEOF(unsigned $1,$2)
-unsigned=$GRAS_CHECK_SIZEOF_RES
-if test x$unsigned = x ; then
- AC_MSG_ERROR([cannot determine a size for unsigned $1])
-fi
-if test x$unsigned != x$signed ; then
- AC_MSG_ERROR(['signed $1' and 'unsigned $1' have different sizes ! ($signed != $unsigned)])
-fi
-
-AC_MSG_RESULT($GRAS_CHECK_SIZEOF_RES)
-])
-
-dnl
-dnl End of CHECK_SIGNED_SIZEOF
-dnl
-
-# GRAS_STRUCT_BOUNDARY(): Check the minimal alignment boundary of $1 in structures
-# ---------------------
-# (using integer, I hope no arch let it change with the content)
-AC_DEFUN([GRAS_STRUCT_BOUNDARY],
-[changequote(<<, >>)dnl
- dnl The cache variable name (and of the result).
- define(<<GRAS_STRUCT_BOUNDARY_RES>>, translit(ac_cv_struct_boundary_$1, [ *()], [_pLR]))dnl
- changequote([, ])dnl
- AC_MSG_CHECKING(for the minimal structure boundary of $1)
-
- AC_CACHE_VAL(GRAS_STRUCT_BOUNDARY_RES,
- [for ac_size in 1 2 4 8 16 32 64 3 ; do # List sizes in rough order of prevalence.
- AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include "confdefs.h"
- #include <sys/types.h>
- struct s { char c; $1 i; };
- ],[switch (0) case 0: case (sizeof (struct s) == $ac_size+sizeof($1)):;]), GRAS_STRUCT_BOUNDARY_RES=$ac_size)
- if test x$GRAS_STRUCT_BOUNDARY_RES != x ; then break; fi
- done
- ])
- AC_MSG_RESULT($GRAS_STRUCT_BOUNDARY_RES)
- if test x$GRAS_STRUCT_BOUNDARY_RES = x ; then
- AC_MSG_ERROR([Cannot determine the minimal alignment boundary of $1 in structures])
- fi
-])
-
-# GRAS_ARCH(): check the gras_architecture of this plateform
-# -----------
-# The different cases here must be syncronized with the array in src/base/DataDesc/ddt_convert.c
-#
-AC_DEFUN([GRAS_ARCH],
-[
-# Check for the architecture
-AC_C_BIGENDIAN(endian=1,endian=0,AC_MSG_ERROR([GRAS works only for little or big endian systems (yet)]))
-dnl Make sure we don't run on a non-two-complement arch, since we dunno convert them
-dnl G RAS_TWO_COMPLEMENT(int) don't do this, it breaks cross-compile and all
-dnl archs conform to this
-AC_DEFINE_UNQUOTED(GRAS_BIGENDIAN,$endian,[define if big endian])
-
-GRAS_SIGNED_SIZEOF(char) GRAS_STRUCT_BOUNDARY(char)
-GRAS_SIGNED_SIZEOF(short int) GRAS_STRUCT_BOUNDARY(short int)
-GRAS_SIGNED_SIZEOF(int) GRAS_STRUCT_BOUNDARY(int)
-GRAS_SIGNED_SIZEOF(long int) GRAS_STRUCT_BOUNDARY(long int)
-GRAS_SIGNED_SIZEOF(long long int) GRAS_STRUCT_BOUNDARY(long long int)
-
-GRAS_STRUCT_BOUNDARY(float) GRAS_STRUCT_BOUNDARY(double)
-
-GRAS_CHECK_SIZEOF(void *) GRAS_STRUCT_BOUNDARY(void *)
-GRAS_CHECK_SIZEOF(void (*) (void))
-
-
-AC_MSG_CHECKING(the GRAS signature of this architecture)
-if test x$endian = x1 ; then
- trace_endian=B
-else
- trace_endian=l
-fi
-gras_arch=unknown
-trace="$trace_endian"
-
-trace="${trace}_C:${ac_cv_sizeof_char}/${ac_cv_struct_boundary_char}:"
-
-trace="${trace}_I:${ac_cv_sizeof_short_int}/${ac_cv_struct_boundary_short_int}"
-trace="${trace}:${ac_cv_sizeof_int}/${ac_cv_struct_boundary_int}"
-trace="${trace}:${ac_cv_sizeof_long_int}/${ac_cv_struct_boundary_long_int}"
-trace="${trace}:${ac_cv_sizeof_long_long_int}/${ac_cv_struct_boundary_long_long_int}:"
-
-trace="${trace}_P:${ac_cv_sizeof_void_p}/${ac_cv_struct_boundary_void_p}"
-trace="${trace}:${ac_cv_sizeof_void_LpR_LvoidR}/${ac_cv_struct_boundary_void_p}:"
-
-trace="${trace}_D:4/${ac_cv_struct_boundary_float}:8/${ac_cv_struct_boundary_double}:"
-
-# sizeof float/double are not tested since IEEE 754 is assumed.
-# Check README.IEEE for rational.
-
-# The numbers after the _ in the arch name are the maximal packing boundary.
-# big32_2 means that all data are aligned on a 2 bytes boundary. (ARM)
-# big32_8_4 means that some or them are aligned on 8 bytes, some are on 4 bytes (AIX)
-case $trace in
- l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1:) gras_arch=0; gras_size=32; gras_arch_name=little32_1;;
- l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:) gras_arch=1; gras_size=32; gras_arch_name=little32_2;;
- l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=2; gras_size=32; gras_arch_name=little32_4;;
- l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:) gras_arch=3; gras_size=32; gras_arch_name=little32_8;;
-
- l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:) gras_arch=4; gras_size=64; gras_arch_name=little64;;
-
- B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8:) gras_arch=5; gras_size=32; gras_arch_name=big32;;
- B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=6; gras_size=32; gras_arch_name=big32_8_4;;
- B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4:) gras_arch=7; gras_size=32; gras_arch_name=big32_4;;
- B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2:) gras_arch=8; gras_size=32; gras_arch_name=big32_2;;
-
- B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8:) gras_arch=9; gras_size=64; gras_arch_name=big64;;
- B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4:) gras_arch=10;gras_size=64; gras_arch_name=big64_8_4;;
-esac
-if test x$gras_arch = xunknown ; then
- AC_MSG_RESULT([damnit ($trace)])
- AC_MSG_ERROR([Impossible to determine the GRAS architecture signature.
-Please report this architecture trace ($trace) and what it corresponds to.])
-fi
-echo "$as_me:$LINENO: GRAS trace of this machine: $trace" >&AS_MESSAGE_LOG_FD
-AC_DEFINE_UNQUOTED(GRAS_THISARCH,$gras_arch,[defines the GRAS architecture signature of this machine])
-AC_MSG_RESULT($gras_arch ($gras_arch_name))
-
-AM_CONDITIONAL(GRAS_ARCH_32_BITS,[test "$gras_size" = 32])
-
-AC_MSG_CHECKING(the maximal size of scalar)
-ac_cv_sizeof_max=0
-for s in $ac_cv_sizeof_char \
- $ac_cv_sizeof_short_int $ac_cv_sizeof_int $ac_cv_sizeof_long_int $ac_cv_sizeof_long_long_int \
- $ac_cv_sizeof_void_p $ac_cv_sizeof_void_LpR_LvoidR \
- 4 8; do
-
- if test $ac_cv_sizeof_max -lt $s ; then
- ac_cv_sizeof_max=$s
- fi
-done
-AC_MSG_RESULT($ac_cv_sizeof_max)
-AC_DEFINE_UNQUOTED([SIZEOF_MAX],$ac_cv_sizeof_max,[The maximal size of any scalar on this arch])
-
-])
-# END OF GRAS ARCH CHECK
-
-AC_DEFUN([GRAS_CHECK_STRUCT_COMPACTION],
-[ AC_MSG_CHECKING(whether the struct gets packed)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
- #include <sys/types.h>
- #include <stddef.h> /* offsetof() */
- struct s {char c; double d;};
- ]],[[switch (0)
- case 0:
- case (sizeof(struct s) == sizeof(double)+sizeof(char)):;
- ]])],[gras_struct_packed=yes],[gras_struct_packed=no])
-
- AC_MSG_RESULT($gras_struct_packed)
- if test x$gras_struct_packed = "xyes" ; then
- AC_MSG_ERROR([GRAS does not support packed structures since it leads to nasty misalignments])
- fi
-
- AC_MSG_CHECKING(whether the struct gets compacted)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
- #include <sys/types.h>
- #include <stddef.h> /* offsetof() */
- struct s {double d; int i; char c;};
- ]],[[switch (0)
- case 0:
- case (offsetof(struct s,c) == sizeof(double)+sizeof(int)):;
- ]])],[gras_struct_compact=yes],[gras_struct_compact=no])
-
- AC_MSG_RESULT($gras_struct_compact)
-
- if test x$gras_struct_compact != xyes ; then
- AC_MSG_ERROR([GRAS works only on structure compacting architectures (yet)])
- fi
- AC_DEFINE_UNQUOTED(GRAS_STRUCT_COMPACT, 1,
- [Defined if structures are compacted when possible.
-
- Consider this structure: struct s {double d; int i; char c;};
-
- If it is allowed, the char is placed just after the int. If not,
- it has to be on the 8 bytes boundary imposed by the double.
-
- For now, GRAS requires the structures to be compacted.
- ])
- AC_MSG_CHECKING(whether arrays can straddle struct alignment boundaries)
-
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
- #include <sys/types.h>
- #include <stddef.h> /* offsetof() */
- struct s { double d; int i; char c[6]; };
- ]],[[switch (0)
- case 0:
- case (offsetof(struct s,c) == sizeof(double)+sizeof(int)):;
- ]])],[gras_array_straddle_struct=yes],[gras_array_straddle_struct=no])
-
- AC_MSG_RESULT($gras_array_straddle_struct)
-
- if test x$gras_array_straddle_struct = xyes ; then
- AC_DEFINE_UNQUOTED(GRAS_ARRAY_STRADDLE_STRUCT, 1,
- [Defined if arrays in struct can straddle struct alignment boundaries.
-
- This is like than the structure compaction above, but this time,
- the argument to be compacted is an array whom each element would be
- normally compacted. Exemple:
-
- struct s { double d; int i; char c[6]; };
-
- Arrays can straddle if c is allowed to come just after i.
-
- Note that GRAS only support architecture presenting this
- caracteristic so far.
- ])
- else
- AC_MSG_ERROR([GRAS can only work on architectures allowing array fields to straddle alignment boundaries (yet)])
- fi
-])
-# END OF GRAS CHECK STRUCT COMPACTION
-
-AC_DEFUN([GRAS_C_COMPACT_STRUCT],
-[ AC_MSG_CHECKING(whether the struct gets compacted)
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
- #include <sys/types.h>
- #include <stddef.h> /* offsetof() */
- struct s {double d; int a; int b;};
- ]],[[switch (0)
- case 0:
- case (offsetof(struct s,b) == sizeof(double)+sizeof(int)):;
- ]])],[gras_compact_struct=yes],[gras_compact_struct=no])
-
- AC_MSG_RESULT($gras_compact_struct)
-
- if test x$gras_compact_struct = xyes ; then
- AC_DEFINE_UNQUOTED(GRAS_COMPACT_STRUCT, 1,
- [Defined if structures are compacted when possible])
- fi
-])
-# END OF GRAS COMPACT STRUCT
-
+++ /dev/null
-dnl AC_CHECK_PRINTF_NULL: Check whether printf("%s",NULL) works or segfault
-dnl it uses AC_RUN and assume the worse while cross-compiling
-
-dnl Then, you can:
-dnl #ifndef PRINTF_NULL_WORKING
-dnl # define PRINTF_STR(a) (a)?:"(null)"
-dnl #else
-dnl # define PRINTF_STR(a) (a)
-dnl #endif
-
-dnl Copyright (C) 2005. Martin Quinson. All rights reserved.
-
-dnl This file is part of the SimGrid project. This is free software: You can
-dnl redistribute and/or modify it under the terms of GNU LGPL (v2.1) licence.
-
-
-
-
-AC_DEFUN([AC_CHECK_PRINTF_NULL],
- [
-AC_MSG_CHECKING([whether printf("%s",NULL) works...])
-AC_RUN_IFELSE(AC_LANG_PROGRAM([#include <stdio.h>],
- [printf("%s",NULL);]),
- AC_DEFINE(PRINTF_NULL_WORKING,
- 1,
- [Indicates whether printf("%s",NULL) works])
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no),
- AC_MSG_RESULT(assuming the worse in cross-compilation))
-])
+++ /dev/null
-dnl AC_CHECK_VA_COPY: check for C99 va_copy() implementation (and
-dnl provide fallback implementation if neccessary)
-
-dnl This code is stolen from the OSSP ex autoconf macros by
-dnl Ralf S. Engelschall.
-dnl # ``"Reuse an expert's code" is the right
-dnl # advice for most people. But it's a useless
-dnl # advice for the experts writing the code
-dnl # in the first place.'
-dnl # -- Dan J. Bernstein
-dnl
-dnl OK, you're definitely the expert on this point... :)
-
-dnl ##
-dnl ## Check for C99 va_copy() implementation
-dnl ## (and provide fallback implementation if neccessary)
-dnl ##
-dnl ## configure.in:
-dnl ## AC_CHECK_VA_COPY
-dnl ## foo.c:
-dnl ## #include "config.h"
-dnl ## [...]
-dnl ## va_copy(d,s)
-dnl ##
-dnl ## This check is rather complex: first because we really have to
-dnl ## try various possible implementations in sequence and second, we
-dnl ## cannot define a macro in config.h with parameters directly.
-dnl ##
-
-dnl # test program for va_copy() implementation
-changequote(<<,>>)
-m4_define(__va_copy_test, <<[
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#define DO_VA_COPY(d, s) $1
-void test(char *str, ...)
-{
- va_list ap, ap2;
- int i;
- va_start(ap, str);
- DO_VA_COPY(ap2, ap);
- for (i = 1; i <= 9; i++) {
- int k = (int)va_arg(ap, int);
- if (k != i)
- abort();
- }
- DO_VA_COPY(ap, ap2);
- for (i = 1; i <= 9; i++) {
- int k = (int)va_arg(ap, int);
- if (k != i)
- abort();
- }
- va_end(ap);
-}
-int main(int argc, char *argv[])
-{
- test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
- exit(0);
-}
-]>>)
-changequote([,])
-
-dnl # test driver for va_copy() implementation
-m4_define(__va_copy_check, [
- AH_VERBATIM($1,
-[/* Predefined possible va_copy() implementation (id: $1) */
-#define __VA_COPY_USE_$1(d, s) $2])
- if test ".$ac_cv_va_copy" = .; then
- AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"],,[ac_cv_va_copy="$1"])
- dnl Let's be optimistic and use C99 version when cross-compiling
- fi
-])
-
-dnl # Autoconf check for va_copy() implementation checking
-AC_DEFUN([AC_CHECK_VA_COPY],[
- dnl # provide Autoconf display check message
- AC_MSG_CHECKING(for va_copy() function)
- dnl # check for various implementations in priorized sequence
- AC_CACHE_VAL(ac_cv_va_copy, [
- ac_cv_va_copy=""
- dnl # 1. check for standardized C99 macro
- __va_copy_check(C99, [va_copy((d), (s))])
- dnl # 2. check for alternative/deprecated GCC macro
- __va_copy_check(GCM, [VA_COPY((d), (s))])
- dnl # 3. check for internal GCC macro (high-level define)
- __va_copy_check(GCH, [__va_copy((d), (s))])
- dnl # 4. check for internal GCC macro (built-in function)
- __va_copy_check(GCB, [__builtin_va_copy((d), (s))])
- dnl # 5. check for assignment approach (assuming va_list is a struct)
- __va_copy_check(ASS, [do { (d) = (s); } while (0)])
- dnl # 6. check for assignment approach (assuming va_list is a pointer)
- __va_copy_check(ASP, [do { *(d) = *(s); } while (0)])
- dnl # 7. check for memory copying approach (assuming va_list is a struct)
- __va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))])
- dnl # 8. check for memory copying approach (assuming va_list is a pointer)
- __va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))])
- if test ".$ac_cv_va_copy" = .; then
- AC_ERROR([no working implementation found])
- fi
- ])
- dnl # optionally activate the fallback implementation
- if test ".$ac_cv_va_copy" = ".C99"; then
- AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
- fi
- dnl # declare which fallback implementation to actually use
- AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy],
- [Define to id of used va_copy() implementation])
- dnl # provide activation hook for fallback implementation
- AH_VERBATIM([__VA_COPY_ACTIVATION],
-[/* Optional va_copy() implementation activation */
-#ifndef HAVE_VA_COPY
-#define va_copy(d, s) __VA_COPY_USE(d, s)
-#endif
-])
- dnl # provide Autoconf display result message
- if test ".$ac_cv_va_copy" = ".C99"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no (using fallback implementation)])
- fi
-])
-