[PATCH] support for mingw-w64

Torbjorn Granlund tg at gmplib.org
Fri Sep 11 15:17:28 CEST 2009


Ozkan Sezer <sezeroz at gmail.com> writes:

  On Fri, Sep 11, 2009 at 3:17 PM, Torbjorn Granlund <tg at gmplib.org> wrote:
  > Ozkan Sezer <sezeroz at gmail.com> writes:
  >
  >  Or, how about doing a AC_CHECK_TYPE(intptr_t, size_t)
  >  in configure.in?  (I didn't test this one bit, though..)
  >
  > That usage of AC_CHECK_TYPE is, I think, obsoleted.  See e.g.,
  > http://www.gnu.org/software/autoconf/manual/html_node/Obsolete-Macros.html
  > for how to do this now.  We uise the new methid already in GMP, I think.
  >
  > --
  > Torbjörn
  >
  
  Well, one can add
  
  AC_CHECK_SIZEOF(long long)
  AC_CHECK_SIZEOF(void*)
  AC_CHECK_TYPES([intptr_t])
  
  and then manually do something like
  
  if test "$ac_cv_type_intptr_t" = "yes"
  
    intptr_fallback="intptr_t"
  
  else
  
    if test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_voidp";then
      intptr_fallback="long"
    else
      if test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_voidp";then
        intptr_fallback="long long"
      else
      # crappy fallback
        intptr_fallback="size_t"
      fi
    fi
  
  fi
  
  Then, how do we add that to gmp-in.h / gmp.h ? that's
  where I'm not sure..
  
gmp.h (as configure) are generated files.

AC_CHECK_* #defines stuff that goes into config.h, which gmp-impl.h then
should #ifdef/#if and DTRT.  There are several examples if this in GMP
already, I think.

Note that it is pointless to check intptr_t without stdint.h, so a
AC_CHECK_TYPES needs to be conditional on the exitence of that.

I'd be lazy and just typedef size_t intptr_t, since I cannot see that
giving any problems.  perhaps somebody thinks this is not kosher enough.
But avoiding complexity in GMP is important.

-- 
Torbjörn


More information about the gmp-devel mailing list