Annotation of gforth/acinclude.m4, revision 1.3

1.1       anton       1: dnl AC_CHECK_INT_TYPE macro
                      2: 
1.2       anton       3: dnl Copyright (C) 1996,1997,1998 Free Software Foundation, Inc.
1.1       anton       4: 
                      5: dnl This file is part of Gforth.
                      6: 
                      7: dnl Gforth is free software; you can redistribute it and/or
                      8: dnl modify it under the terms of the GNU General Public License
                      9: dnl as published by the Free Software Foundation; either version 2
                     10: dnl of the License, or (at your option) any later version.
                     11: 
                     12: dnl This program is distributed in the hope that it will be useful,
                     13: dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.dnl See the
                     15: dnl GNU General Public License for more details.
                     16: 
                     17: dnl You should have received a copy of the GNU General Public License
                     18: dnl along with this program; if not, write to the Free Software
1.3     ! anton      19: dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.1       anton      20: 
                     21: dnl AC_CHECK_INT_TYPE(SIZE, DESCRIPTION [, CROSS-SIZE])
                     22: AC_DEFUN(AC_CHECK_INT_TYPE,
                     23: [changequote(<<, >>)dnl
                     24: dnl The name to #define.
                     25: define(<<AC_TYPE_NAME>>, translit($2_TYPE, [a-z *], [A-Z_P]))dnl
                     26: dnl The cache variable name.
                     27: define(<<AC_CV_NAME>>, translit(ac_cv_int_type_$2, [ *], [_p]))dnl
                     28: changequote([, ])dnl
                     29: AC_MSG_CHECKING(integer type for $2)
                     30: AC_CACHE_VAL(AC_CV_NAME,
                     31: [AC_TRY_RUN([#include <stdio.h>
                     32: main()
                     33: {
                     34:   FILE *f=fopen("conftestval", "w");
                     35:   if (!f) exit(1);
                     36: #define check_size(type) if (sizeof(type)==($1)) fputs(#type, f), exit(0)
                     37:   check_size(int);
                     38:   check_size(short);
                     39:   check_size(char);
                     40:   check_size(long);
                     41:   check_size(long long);
                     42:   fputs("none",f), exit(0);
                     43: }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3], , , AC_CV_NAME=$3))])dnl
                     44: AC_MSG_RESULT($AC_CV_NAME)
                     45: AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
                     46: undefine([AC_TYPE_NAME])dnl
                     47: undefine([AC_CV_NAME])dnl
                     48: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>