1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT(t1ascii.c)
AM_INIT_AUTOMAKE(t1utils, 1.25)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_C_CONST
AC_ARG_ENABLE(warnings,
[ --enable-warnings compile with -Wall],
if test "$enableval" = yes ; then
CFLAGS="$CFLAGS -W -Wall"
fi)
dnl
dnl strerror()? inttypes.h?
dnl
AC_REPLACE_FUNCS(strerror)
AC_CHECK_HEADERS(inttypes.h)
dnl
dnl Integer typedefs
dnl
AC_CACHE_CHECK(for integer typedefs, ac_cv_int_types,
[AC_EGREP_HEADER(uint32_t, sys/types.h, ac_cv_int_types=yes,
AC_EGREP_HEADER(u_int32_t, sys/types.h, ac_cv_int_types=close,
ac_cv_int_types=no))])
if test "$ac_cv_int_types" = no ;
then
# Define our own versions
AC_CACHE_CHECK(for a 16-bit value, ac_cv_int16,
[AC_TRY_RUN([#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
FILE *f = fopen("conftestval", "w");
if (!f) exit(1);
if (sizeof(short) == 2) fprintf(f, "short\n");
else exit(1);
fclose(f);
exit(0);
}], ac_cv_int16=`cat conftestval`,
AC_MSG_ERROR(no 16-bit value found),
ac_cv_int16=short)])
AC_CACHE_CHECK(for a 32-bit value, ac_cv_int32,
[AC_TRY_RUN([#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
FILE *f = fopen("conftestval", "w");
if (!f) exit(1);
if (sizeof(int) == 4) fprintf(f, "int\n");
else if (sizeof(long) == 4) fprintf(f, "long\n");
else exit(1);
fclose(f);
exit(0);
}], ac_cv_int32=`cat conftestval`,
AC_MSG_ERROR(no 32-bit value found),
ac_cv_int32=int)])
fi
if test "$ac_cv_header_inttypes_h" = yes; then
:
elif test "$ac_cv_int_types" = no; then
AC_DEFINE_UNQUOTED(uint16_t, unsigned $ac_cv_int16)
AC_DEFINE_UNQUOTED(uint32_t, unsigned $ac_cv_int32)
AC_DEFINE_UNQUOTED(int32_t, $ac_cv_int32)
elif test "$ac_cv_int_types" = close; then
AC_DEFINE(NEED_SYS_TYPES_H)
AC_DEFINE(uint16_t, u_int16_t)
AC_DEFINE(uint32_t, u_int32_t)
else
AC_DEFINE(NEED_SYS_TYPES_H)
fi
dnl
dnl Output
dnl
AC_OUTPUT(Makefile)
|