Hi!
Thanks for your contribution, but it is a bit too soon for such a
macro to integrate the core Autoconf. Rather, you should submit it to
| dnl @synopsis AC_caolan_FUNC_SNPRINTF
| dnl
| dnl Provides a test for a fully C9x complient snprintf
| dnl function.
| dnl
| dnl defines HAVE_SNPRINTF if it is found, and
| dnl sets ac_cv_func_snprintf to yes, otherwise to no
| dnl
| dnl @version $Id$
| dnl @author Caolan McNamara <[EMAIL PROTECTED]>
| dnl
We no longer use `dnl' for comments, but just `#'. Now you can use
M-q :)
| AC_DEFUN(AC_caolan_FUNC_SNPRINTF,
| [AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf,
| [AC_TRY_RUN([#include <stdio.h>
| int main () { exit (!(3 <= snprintf(NULL,0,"%d",100))); }
I saw your comment, but don't understand well why you don't check for
equality.
| ], ac_cv_func_snprintf=yes, ac_cv_func_snprintf=no,
| ac_cv_func_snprintf=no)])
| if test $ac_cv_func_snprintf = yes; then
| AC_DEFINE(HAVE_SNPRINTF)
You should document this AC_DEFINE, so that your users don't have to.
Also, maybe HAVE_WORKING_SNPRINTF would be better. I don't know, the
conventions about this in Autoconf are not clear to me.
| fi
| ])
| dnl @synopsis AC_caolan_C_LONG_LONG
| dnl
| dnl Provides a test for the existance of the long long int type
| dnl
| dnl defines HAVE_LONG_LONG if it is found
| dnl
| dnl @version $Id$
| dnl @author Caolan McNamara <[EMAIL PROTECTED]>
| dnl
| AC_DEFUN(AC_caolan_C_LONG_LONG,
| [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
| [if test "$GCC" = yes; then
| ac_cv_c_long_long=yes
| else
| AC_TRY_COMPILE(,[long long int i;],
| ac_cv_c_long_long=yes,
| ac_cv_c_long_long=no)
| fi])
| if test $ac_cv_c_long_long = yes; then
| AC_DEFINE(HAVE_LONG_LONG)
| fi
| ])
This is just
AC_CHECK_TYPES(long long)
with CVS Autoconf (well, today it is AC_CHECK_TYPES((long long)), but
we will soon get rid of one pair of parens).
Also, personally I don't like making an exception for GCC, it has to
pass the tests just like any other candidate.
Beware that your indentation first gives the impression that the
AC_DEFINE is part of AC_CACHE_CHECK.
Thanks for the proposals!
Akim