1# Define a warning for the user, so they don't edit clamav-types.h 2AC_SUBST(GENERATE_WARNING, ["Warning: This file is generated with ./configure. Do not edit!"]) 3 4# Initialize definitions to empty strings, in case they're not needed. 5AC_SUBST(INT8_DEF, [""]) 6AC_SUBST(UINT8_DEF, [""]) 7AC_SUBST(INT16_DEF, [""]) 8AC_SUBST(UINT16_DEF, [""]) 9AC_SUBST(INT32_DEF, [""]) 10AC_SUBST(UINT32_DEF, [""]) 11AC_SUBST(INT64_DEF, [""]) 12AC_SUBST(UINT64_DEF, [""]) 13 14# Check sys/int_types.h first, to give it higher priority on Solaris 15AC_CHECK_HEADER( 16 [sys/int_types.h], 17 [ dnl Found 18 AC_SUBST(INT_TYPES_HEADER, ["#include <sys/int_types.h>"]) 19 ], 20 [ dnl Not-found 21 AC_CHECK_HEADER( 22 [inttypes.h], 23 [ dnl Found; C99: inttypes.h should include stdint.h; more universal because some older platforms don't provide stdint.h 24 AC_SUBST(INT_TYPES_HEADER, ["#include <inttypes.h>"]) 25 ], 26 [ dnl Not-found 27 AC_CHECK_HEADER( 28 [stdint.h], 29 [ dnl Found 30 AC_SUBST(INT_TYPES_HEADER, ["#include <stdint.h>"]) 31 ], 32 [ dnl Not-found 33 AC_COMPILE_IFELSE( 34 [ dnl Check if Windows (Cygwin), using auto-defined _MSC_VER 35 AC_LANG_PROGRAM([ 36 [ 37 #ifndef _MSC_VER 38 error: _MSC_VER not found! 39 #endif] 40 ] 41 ) 42 ], 43 [ dnl It's Windows, stdint.h should exist. 44 AC_SUBST(INT_TYPES_HEADER, ["#include <stdint.h>"]) 45 ], 46 [ dnl No int types header available. We'll define the types manually. 47 AC_SUBST(INT8_DEF, ["typedef signed char int8_t;"]) 48 AC_SUBST(UINT8_DEF, ["typedef unsigned char uint8_t;"]) 49 50 if test $ac_cv_sizeof_int = 2; then 51 AC_SUBST(INT16_DEF, ["typedef signed int int16_t;"]) 52 AC_SUBST(UINT16_DEF, ["typedef unsigned int uint16_t;"]) 53 elif test $ac_cv_sizeof_short = 2; then 54 AC_SUBST(INT16_DEF, ["typedef signed short int16_t;"]) 55 AC_SUBST(UINT16_DEF, ["typedef unsigned short uint16_t;"]) 56 fi 57 58 if test $ac_cv_sizeof_int = 4; then 59 AC_SUBST(INT32_DEF, ["typedef signed int int32_t;"]) 60 AC_SUBST(UINT32_DEF, ["typedef unsigned int uint32_t;"]) 61 elif test $ac_cv_sizeof_long = 4; then 62 AC_SUBST(INT32_DEF, ["typedef signed long int32_t;"]) 63 AC_SUBST(UINT32_DEF, ["typedef unsigned long uint32_t;"]) 64 fi 65 66 if test $ac_cv_sizeof_long = 8; then 67 AC_SUBST(INT64_DEF, ["typedef signed long int64_t;"]) 68 AC_SUBST(UINT64_DEF, ["typedef unsigned long uint64_t;"]) 69 elif test $ac_cv_sizeof_long_long = 8; then 70 AC_SUBST(INT64_DEF, ["typedef signed long long int64_t;"]) 71 AC_SUBST(UINT64_DEF, ["typedef unsigned long long uint64_t;"]) 72 fi 73 ] 74 ) 75 ], 76 ) 77 ], 78 ) 79 ], 80) 81 82# If _SF64_PREFIX isn't defined, this may be used. 83if test $ac_cv_sizeof_int = 4; then 84 AC_SUBST(DEFINE_SF32_PREFIX, ["#define _SF32_PREFIX \"\""]) 85elif test $ac_cv_sizeof_long = 4; then 86 AC_SUBST(DEFINE_SF32_PREFIX, ["#define _SF32_PREFIX \"l\""]) 87fi 88 89# If _SF32_PREFIX isn't defined, this may be used. 90if test $ac_cv_sizeof_long = 8; then 91 AC_SUBST(DEFINE_SF64_PREFIX, ["#define _SF64_PREFIX \"l\""]) 92elif test $ac_cv_sizeof_long_long = 8; then 93 AC_SUBST(DEFINE_SF64_PREFIX, ["#define _SF64_PREFIX \"ll\""]) 94fi 95