autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

uint64_t fails with C++ (again)


From: Werner LEMBERG
Subject: uint64_t fails with C++ (again)
Date: Fri, 07 Feb 2014 00:28:56 +0100 (CET)

In 2011, there was the following thread started by me:

  http://lists.gnu.org/archive/html/autoconf/2011-12/msg00002.html

The solution that worked eventually was to put

  AC_PROG_CC
  AC_PROG_CPP

  AC_TYPE_UINT64_T

into my configure.ac file, and

  #include <config.h>

  /* make `stdint.h' define `uintXX_t' for C++ */
  #undef __STDC_LIMIT_MACROS
  #define __STDC_LIMIT_MACROS

  #if HAVE_STDINT_H
  #  include <stdint.h>
  #endif

  #if defined UINT64_MAX || defined uint64_t
  typedef uint64_t TA_ULongLong
  #else
  #  error "No unsigned 64bit wide data type found."
  #endif

into my C file.

However, this no longer works with g++ 4.7.2.  As before, the test in
the `configure' script successfully gives

  checking for uint64_t
  g++ -c ... conftest.c >&5
  configure:12694: $? = 0
  configure:12694: result: yes

but neither `UINT64_MAX' nor `uint64_t' gets defined, causing

  error: #error "No unsigned 64bit wide data type found."

during compilation.

If I have understood the issue correctly, `uint64_t' is no longer a
macro in the latest C++ standard, and UINT64_MAX isn't defined
either...

My solution was to add

  if test x"$ac_cv_c_uint64_t" = x"yes"; then
    AC_DEFINE([HAVE_UINT64_T], [1],
      [Define if compiler accepts uint64_t data type.])
  fi

to `configure.ac' (immediately after the call to `AC_TYPE_UINT64_T');
the new test in my C file is now

  #if defined UINT64_MAX || defined uint64_t || defined HAVE_UINT64_T
  typedef uint64_t TA_ULongLong;
  ...

Please comment.  Is there a better solution?


    Werner
    



reply via email to

[Prev in Thread] Current Thread [Next in Thread]