1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([ccache-swig], [0.0]) # Get version from SWIG in ccache_swig_config.h.in
5 AC_CONFIG_SRCDIR([ccache.h])
7 AC_MSG_NOTICE([Configuring ccache])
9 AC_CONFIG_HEADER(config.h)
11 dnl Checks for programs.
15 AC_ARG_PROGRAM # for program_transform_name
17 AC_DEFINE([_GNU_SOURCE], 1,
18 [Define _GNU_SOURCE so that we get all necessary prototypes])
20 # If GCC, turn on warnings.
21 if test "x$GCC" = "xyes"
23 CFLAGS="$CFLAGS -Wall -W"
32 AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h)
34 AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp)
35 AC_CHECK_FUNCS(gethostname getpwuid)
36 AC_CHECK_FUNCS(utimes)
38 AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
40 [#include <stdlib.h>],
42 void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
44 ccache_cv_COMPAR_FN_T=yes,ccache_cv_COMPAR_FN_T=no)])
45 if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
46 AC_DEFINE(HAVE_COMPAR_FN_T, 1, [ ])
49 dnl Note: This could be replaced by AC_FUNC_SNPRINTF() in the autoconf macro archive
50 AC_CACHE_CHECK([for C99 vsnprintf],ccache_cv_HAVE_C99_VSNPRINTF,[
52 #include <sys/types.h>
54 void foo(const char *format, ...) {
60 len = vsnprintf(0, 0, format, ap);
62 if (len != 5) exit(1);
64 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
68 main() { foo("hello"); }
70 ccache_cv_HAVE_C99_VSNPRINTF=yes,ccache_cv_HAVE_C99_VSNPRINTF=no,ccache_cv_HAVE_C99_VSNPRINTF=cross)])
71 if test x"$ccache_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
72 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ])
76 dnl Note: This could be replaced by CHECK_ZLIB() in the autoconf macro archive
78 AS_HELP_STRING([--enable-zlib], [enable zlib support for ccache compression]),,
81 if test x"$enable_zlib" = x"yes"; then
82 AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, gzdopen, [LIBS="-lz $LIBS"
83 AC_DEFINE([ENABLE_ZLIB], 1, [Define to 1 if you would like to have zlib compression for ccache.]) ] ))
86 AC_CONFIG_FILES([Makefile])