1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(src/game.hh) 3AM_INIT_AUTOMAKE(xmahjongg, 3.7) 4AM_CONFIG_HEADER(config.h) 5 6AC_PROG_CC 7AC_C_CONST 8AC_C_INLINE 9AC_PROG_CPP 10AC_PROG_CXX 11AC_PROG_CXXCPP 12AC_PROG_RANLIB 13if test -n "$GCC" ; then CC="$CC -Wall"; CXX="$CXX -Wall"; fi 14 15AC_PATH_XTRA 16 17 18dnl 19dnl strerror()? 20dnl 21 22AC_REPLACE_FUNCS(strerror) 23 24 25dnl 26dnl gettimeofday() 27dnl 28 29AC_CACHE_CHECK(for gettimeofday prototype, ac_cv_gettimeofday, 30[AC_TRY_COMPILE([#include <time.h> 31#include <sys/time.h>], 32[gettimeofday((void *)0, (void *)0);], 33[AC_TRY_COMPILE([#include <time.h> 34#include <sys/time.h>], 35[gettimeofday((void *)0);], 36ac_cv_gettimeofday=0, 37ac_cv_gettimeofday=2)], 38ac_cv_gettimeofday=1)]) 39AC_DEFINE_UNQUOTED(GETTIMEOFDAY_PROTO, $ac_cv_gettimeofday, [Define to the number of arguments taken by gettimeofday().]) 40 41 42dnl 43dnl integer types 44dnl 45 46AC_CHECK_HEADERS(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no) 47AC_CHECK_HEADERS(sys/types.h, have_sys_types_h=yes, have_sys_types_h=no) 48 49if test $have_inttypes_h = no -a $have_sys_types_h = yes; then 50 AC_CACHE_CHECK([for uintXX_t typedefs], ac_cv_uint_t, 51 [AC_EGREP_HEADER(dnl 52changequote(<<,>>)<<(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]>>changequote([,]), 53 sys/types.h, ac_cv_uint_t=yes, ac_cv_uint_t=no)]) 54fi 55if test $have_inttypes_h = no -a $have_sys_types_h = yes -a "$ac_cv_uint_t" = no; then 56 AC_CACHE_CHECK([for u_intXX_t typedefs], ac_cv_u_int_t, 57 [AC_EGREP_HEADER(dnl 58changequote(<<,>>)<<(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]>>changequote([,]), 59 sys/types.h, ac_cv_u_int_t=yes, ac_cv_u_int_t=no)]) 60fi 61if test $have_inttypes_h = yes -o "$ac_cv_uint_t" = yes; then 62 : 63elif test "$ac_cv_u_int_t" = yes; then 64 AC_DEFINE(HAVE_U_INT_TYPES, 1, [Define if you have u_intXX_t types but not uintXX_t types.]) 65else 66 AC_MSG_WARN([ 67========================================= 68 69Neither uint32_t nor u_int32_t defined by <inttypes.h> or <sys/types.h>! 70Assuming "short" has 16 bits and "int" has 32 bits. 71 72=========================================]) 73 AC_DEFINE(HAVE_FAKE_INT_TYPES, 1, [Define if intXX_t types are not available.]) 74fi 75 76AC_CHECK_TYPES(uintptr_t, [], [], 77[#if HAVE_INTTYPES_H 78# include <inttypes.h> 79#endif 80#if HAVE_SYS_TYPES_H 81# include <sys/types.h> 82#endif 83]) 84 85AC_CHECK_SIZEOF(void *) 86AC_CHECK_SIZEOF(unsigned long) 87AC_CHECK_SIZEOF(unsigned int) 88 89 90dnl 91dnl <new> and/or <new.h> 92dnl 93 94AC_LANG_CPLUSPLUS 95AC_CACHE_CHECK(whether <new> works, ac_cv_good_new_hdr, 96AC_TRY_LINK([#include <new>], [ 97 int a; 98 int *b = new(&a) int; 99 return 0; 100], ac_cv_good_new_hdr=yes, ac_cv_good_new_hdr=no)) 101if test "$ac_cv_good_new_hdr" = yes; then 102 AC_DEFINE(HAVE_NEW_HDR, 1, [Define if <new> exists and works.]) 103fi 104AC_CHECK_HEADERS(new.h) 105 106 107dnl 108dnl Set PKGDATADIR -- must expand it to get rid of a possible `${prefix}' 109dnl 110 111test "x$prefix" = xNONE && prefix=$ac_default_prefix 112pkgdatadir=$datadir/$PACKAGE 113eval pkgdatadir=$pkgdatadir 114AC_DEFINE_UNQUOTED(PKGDATADIR, "$pkgdatadir", [Define to the pathname of the --pkgdatadir directory.]) 115 116 117dnl 118dnl verbatim portions of the header 119dnl 120 121AH_TOP([#ifndef XMAHJONGG_CONFIG_H 122#define XMAHJONGG_CONFIG_H]) 123 124AH_BOTTOM([#include <stddef.h> 125 126#ifdef __cplusplus 127extern "C" { 128#endif 129 130/* Use the clean-failing malloc library in fmalloc.c */ 131#define xmalloc(s) fail_die_malloc((s),__FILE__,__LINE__) 132#define xrealloc(p,s) fail_die_realloc((p),(s),__FILE__,__LINE__) 133#define xfree free 134void *fail_die_malloc(size_t, const char *, int); 135void *fail_die_realloc(void *, size_t, const char *, int); 136 137/* Prototype strerror() if we don't have it. */ 138#if !HAVE_STRERROR 139char *strerror(int errno); 140#endif 141 142#ifdef __cplusplus 143} 144/* Get rid of a possible inline macro under C++. */ 145# define inline inline 146#endif 147 148#endif /* XMAHJONGG_CONFIG_H */]) 149 150 151dnl 152dnl Output 153dnl 154 155AC_OUTPUT(Makefile src/Makefile liblcdf/Makefile) 156