1899
|
1 dnl Process this file with autoconf to produce a configure script.
|
|
2
|
|
3 AC_INIT([ccache-swig], [0.0]) # Get version from SWIG in ccache_swig_config.h.in
|
|
4 AC_PREREQ(2.52)
|
|
5 AC_CONFIG_SRCDIR([ccache.h])
|
|
6
|
|
7 AC_MSG_NOTICE([Configuring ccache])
|
|
8
|
|
9 AC_CONFIG_HEADER(config.h)
|
|
10
|
|
11 dnl Checks for programs.
|
|
12 AC_PROG_CC
|
|
13 AC_PROG_CPP
|
|
14 AC_PROG_INSTALL
|
|
15 AC_ARG_PROGRAM # for program_transform_name
|
|
16
|
|
17 AC_DEFINE([_GNU_SOURCE], 1,
|
|
18 [Define _GNU_SOURCE so that we get all necessary prototypes])
|
|
19
|
|
20 # If GCC, turn on warnings.
|
|
21 if test "x$GCC" = "xyes"
|
|
22 then
|
|
23 CFLAGS="$CFLAGS -Wall -W"
|
|
24 else
|
|
25 CFLAGS="$CFLAGS -O"
|
|
26 fi
|
|
27
|
|
28 AC_HEADER_DIRENT
|
|
29 AC_HEADER_TIME
|
|
30 AC_HEADER_SYS_WAIT
|
|
31
|
|
32 AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h)
|
|
33
|
|
34 AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp)
|
|
35 AC_CHECK_FUNCS(gethostname getpwuid)
|
|
36 AC_CHECK_FUNCS(utimes)
|
|
37
|
|
38 AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
|
|
39 AC_TRY_COMPILE(
|
|
40 [#include <stdlib.h>],
|
|
41 [
|
|
42 void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }
|
|
43 ],
|
|
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, [ ])
|
|
47 fi
|
|
48
|
|
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,[
|
|
51 AC_TRY_RUN([
|
|
52 #include <sys/types.h>
|
|
53 #include <stdarg.h>
|
|
54 void foo(const char *format, ...) {
|
|
55 va_list ap;
|
|
56 int len;
|
|
57 char buf[5];
|
|
58
|
|
59 va_start(ap, format);
|
|
60 len = vsnprintf(0, 0, format, ap);
|
|
61 va_end(ap);
|
|
62 if (len != 5) exit(1);
|
|
63
|
|
64 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
|
|
65
|
|
66 exit(0);
|
|
67 }
|
|
68 main() { foo("hello"); }
|
|
69 ],
|
|
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, [ ])
|
|
73 fi
|
|
74
|
|
75 dnl Check for zlib.
|
|
76 dnl Note: This could be replaced by CHECK_ZLIB() in the autoconf macro archive
|
|
77 AC_ARG_ENABLE([zlib],
|
|
78 AS_HELP_STRING([--enable-zlib], [enable zlib support for ccache compression]),,
|
|
79 [enable_zlib=yes])
|
|
80
|
|
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.]) ] ))
|
|
84 fi
|
|
85
|
|
86 AC_CONFIG_FILES([Makefile])
|
|
87 AC_OUTPUT
|