I decided to test out the snapshots of GCC 4 that are available to see if 
tetex would compile... There is one failure in dvipng - and it stems from the
use of autoconf-2.13 that is used in the tree..

It appears in the dvipng directory, there is a shipped
configure.ac.orig - which is probably from the dvipng maintainers and
an configure.in - that looks like one writtern for tetex.

The failure is in the test for uint64_t. AC_CHECK_TYPE is used. In autoconf 
2.13 this essentially does includes

#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif

In newer versions of autoconf - the following is added:

#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
#  include <stdint.h>
# endif
#endif

So under linux, in which inttypes.h is present, the inttypes.h file is
not included by configure to test if uint64_t is defined... So a
define is placed in dvipng.h... This define then causes a conflict
when inttypes.h is included and we get a line that reads a "long long
long" GCC 4.0 complains that it cannot honor this width and errors out...

So, my fix is to configure.in... Instead of using AC_CHECK_TYPE, I
have written MY_CHECK_TYPE which is identical to the autoconf 2.13
code - with the extra includes added in...  With this change, tetex compiles
and runs under linux with GCC 4.0.


*** configure.in        2005/01/12 15:20:40     1.1
--- configure.in        2005/01/12 15:32:17
***************
*** 7,12 ****
--- 7,39 ----
  AC_DEFINE(PACKAGE_VERSION, ["1.4"])
  AC_DEFINE(PACKAGE_STRING, ["dvipng 1.4"])
  
+ # We need a special form of AC_CHECK_TYPE that will include inttypes.h if
+ # present.  This is done in newer acutoconfs.
+ AC_DEFUN(MY_CHECK_TYPE,
+ [AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_MSG_CHECKING(for $1)
+ AC_CACHE_VAL(ac_cv_type_$1,
+ [AC_EGREP_CPP(dnl
+ changequote(<<,>>)dnl
+ <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
+ changequote([,]), [#include <sys/types.h>
+ #if STDC_HEADERS
+ #include <stdlib.h>
+ #include <stddef.h>
+ #endif
+ #if HAVE_INTTYPES_H
+ # include <inttypes.h>
+ #else
+ # if HAVE_STDINT_H
+ #  include <stdint.h>
+ # endif
+ #endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
+ AC_MSG_RESULT($ac_cv_type_$1)
+ if test $ac_cv_type_$1 = no; then
+   AC_DEFINE($1, $2)
+ fi
+ ])
+ dnl
  # Checks for programs.
  AC_SET_MAKE
  AC_PROG_CC
***************
*** 41,49 ****
    # is present in most modern compilers. Using a #define rather than a
    # typedef can be a problem, but in dvipng int64_t only is used as
    # typecast, and there are no problems.
! 
!   AC_CHECK_TYPE(int64_t, long long)
!   AC_CHECK_TYPE(uint64_t, unsigned long long)
  fi
  
  # Checks for library functions.
--- 68,77 ----
    # is present in most modern compilers. Using a #define rather than a
    # typedef can be a problem, but in dvipng int64_t only is used as
    # typecast, and there are no problems.
!   # Note... AC_CHECK_TYPE in autoconf does not include inttypes_h if present.
!   # This is present in newer versions of autoconf, so we use our own macro
!   MY_CHECK_TYPE(int64_t, long long)
!   MY_CHECK_TYPE(uint64_t, unsigned long long)
  fi
  
  # Checks for library functions.

Reply via email to