-dnl ** figure out whether C compiler supports 'long long's
-dnl (Closely based on Andreas Zeller's macro for testing
-dnl for this under C++)
-dnl
-dnl If the C compiler supports `long long' types,
-dnl define `HAVE_LONG_LONG'.
-dnl
-AC_DEFUN(FPTOOLS_C_LONG_LONG,
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(whether ${CC} supports long long types)
-AC_CACHE_VAL(fptools_cv_have_long_long,
-[
-AC_LANG_SAVE
-AC_LANG_C
-AC_TRY_COMPILE(,[long long a;],
-fptools_cv_have_long_long=yes,
-fptools_cv_have_long_long=no)
-AC_LANG_RESTORE
-])
-AC_MSG_RESULT($fptools_cv_have_long_long)
-if test "$fptools_cv_have_long_long" = yes; then
-AC_DEFINE(HAVE_LONG_LONG)
-fi
-])
-
-dnl ** Obtain the value of a C constant.
-dnl The value will be `(-1)' if the constant is undefined.
-dnl
-dnl This is set up so that the argument can be a shell variable.
-dnl
-AC_DEFUN(FPTOOLS_CHECK_CCONST,
-[
-eval "def_name=CCONST_$1"
-eval "cv_name=ac_cv_cconst_$1"
-AC_MSG_CHECKING(value of $1)
-AC_CACHE_VAL($cv_name,
-[AC_TRY_RUN([#include <stdio.h>
-#include <errno.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", $1);
- exit(0);
-}],
-eval "$cv_name=`cat conftestval`",
-eval "$cv_name=-1",
-eval "$cv_name=-1")])dnl
-eval "fptools_check_cconst_result=`echo '$'{$cv_name}`"
-AC_MSG_RESULT($fptools_check_cconst_result)
-AC_DEFINE_UNQUOTED($def_name, $fptools_check_cconst_result)
-unset fptools_check_cconst_result
-])
-
-dnl ** Invoke AC_CHECK_CCONST on each argument (which have to separate with
-dnl spaces)
-dnl
-AC_DEFUN(FPTOOLS_CHECK_CCONSTS,
-[for ac_const_name in $1
-do
-FPTOOLS_CHECK_CCONST($ac_const_name)dnl
-done
-])
-
-
-dnl *** Can we open files in binary mode? ***
-dnl
-AC_DEFUN(FPTOOLS_O_BINARY,
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(whether we can open files in binary mode)
-AC_CACHE_VAL(fptools_cv_have_o_binary,
-[
-AC_LANG_SAVE
-AC_LANG_C
-AC_TRY_COMPILE(,
-[#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-int x = O_BINARY;],
-fptools_cv_have_o_binary=yes,
-fptools_cv_have_o_binary=no)
-AC_LANG_RESTORE
-])
-AC_MSG_RESULT($fptools_cv_have_o_binary)
-if test "$fptools_cv_have_o_binary" = yes; then
-AC_DEFINE(HAVE_O_BINARY)
-fi
-])
-
-dnl *** Which one comes first, .text or .data? ***
-dnl
-AC_DEFUN(FPTOOLS_CODE_BEFORE_DATA,
-[AC_CACHE_CHECK([if code section appears before data], fptools_cv_code_bef_data,
-[AC_TRY_RUN([
-int f() { return 1; }
-int i;
-int main() { return ((char*)&f > (char*)&i); }
-
-],
-fptools_cv_code_bef_data=yes, fptools_cv_code_bef_data=no,false)])
-if test "$fptools_cv_code_bef_data" = yes; then
- AC_DEFINE(CODE_BEFORE_DATA)
-fi
-])
-
-dnl *** Helper function **
-dnl
-AC_DEFUN(FPTOOLS_IN_SCOPE,
-[AC_TRY_LINK([extern char* $1;],[return (int)&$2], $3=yes, $3=no)
-])
-
-dnl *** What's the end-of-text-section marker called? ***
-dnl
-AC_DEFUN([FPTOOLS_END_TEXT_SECTION],
-[AC_CACHE_CHECK([for end of text section marker],
- [fptools_cv_end_of_text],
- [fptools_cv_end_of_text=""
- not_done=1
- for i in data_start _data_start etext _etext __etext; do
- FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_text)
- if test "$fptools_end_of_text" = yes; then
- fptools_cv_end_of_text=$i
- not_done=0
- break
- fi
- done
- if test "$not_done" = 1; then
- FPTOOLS_IN_SCOPE(etext asm("etext"),etext,fptools_end_of_text)
- if test "$fptools_end_of_text" = yes; then
- fptools_cv_end_of_text="etext"
- fi
- fi])
- if test -n "$fptools_cv_end_of_text"; then
- AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER], $fptools_cv_end_of_text)
- else
- AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER], dunno_end_of_text)
- fi
- AC_CACHE_CHECK([for end of text section marker declaration],
- [fptools_cv_end_of_text_decl],
- [fptools_cv_end_of_text_decl=""
- not_done=1
- for i in data_start _data_start etext _etext __etext; do
- FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_text_decl)
- if test "$fptools_end_of_text_decl" = yes; then
- fptools_cv_end_of_text_decl=$i
- not_done=0
- break
- fi
- done
- if test "$not_done" = 1; then
- FPTOOLS_IN_SCOPE(etext asm("etext"),etext,fptools_end_of_text_decl)
- if test "$fptools_end_of_text_decl" = yes; then
- fptools_cv_end_of_text_decl="etext asm(\"etext\")"
- fi
- fi])
- if test -n "$fptools_cv_end_of_text_decl"; then
- AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER_DECL], $fptools_cv_end_of_text_decl)
- else
- AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER_DECL], dunno_end_of_text_decl)
- fi
-])
-
-dnl *** What's the end-of-data-section marker called? ***
-dnl
-AC_DEFUN([FPTOOLS_END_DATA_SECTION],
-[AC_CACHE_CHECK([for end of data section marker],
- [fptools_cv_end_of_data],
- [fptools_cv_end_of_data=""
- not_done=1
- for i in end _end __end; do
- FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_data)
- if test "$fptools_end_of_data" = yes; then
- fptools_cv_end_of_data=$i
- not_done=0
- break
- fi
- done
- if test "$not_done" = 1; then
- FPTOOLS_IN_SCOPE(end asm("end"),end,fptools_end_of_data)
- if test "$fptools_end_of_data" = yes; then
- fptools_cv_end_of_data="end"
- fi
- fi])
- if test -n "$fptools_cv_end_of_data"; then
- AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER], $fptools_cv_end_of_data)
- else
- AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER], dunno_end_of_data)
- fi
- AC_CACHE_CHECK([for end of data section marker declaration],
- [fptools_cv_end_of_data_decl],
- [fptools_cv_end_of_data_decl=""
- not_done=1
- for i in end _end __end; do
- FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_data_decl)
- if test "$fptools_end_of_data_decl" = yes; then
- fptools_cv_end_of_data_decl=$i
- not_done=0
- break
- fi
- done
- if test "$not_done" = 1; then
- FPTOOLS_IN_SCOPE(end asm("end"),end,fptools_end_of_data_decl)
- if test "$fptools_end_of_data_decl" = yes; then
- fptools_cv_end_of_data_decl="end asm(\"end\")"
- fi
- fi])
- if test -n "$fptools_cv_end_of_data_decl"; then
- AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER_DECL], $fptools_cv_end_of_data_decl)
- else
- AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER_DECL], dunno_end_of_data_decl)
- fi
-])
-
-