1 dnl Process this file with autoconf to produce a configure script.
6 AC_MSG_NOTICE([Configuring ccache])
8 AC_CONFIG_HEADER(config.h)
13 *mingw32* | *cygwin* | *wince* | *mingwce*)
14 AC_DEFINE(_WIN32_WINNT,0x0600, Windows Vista or newer is required)
18 AC_SUBST(extra_cppflags)
19 AC_SUBST(extra_ldflags)
21 AC_SUBST(include_dev_mk)
24 dnl Checks for programs.
30 if test -z "$AR"; then
31 AC_MSG_ERROR(cannot find ar)
34 m4_include(m4/feature_macros.m4)
36 # If GCC, turn on warnings.
37 if test "x$GCC" = "xyes"; then
38 CFLAGS="$CFLAGS -Wall -W"
48 AC_CHECK_TYPES(long long)
50 AC_CHECK_HEADERS(ctype.h pwd.h stdlib.h string.h strings.h sys/time.h sys/mman.h)
51 AC_CHECK_HEADERS(termios.h)
53 AC_CHECK_FUNCS(gethostname)
54 AC_CHECK_FUNCS(getopt_long)
55 AC_CHECK_FUNCS(getpwuid)
56 AC_CHECK_FUNCS(gettimeofday)
57 AC_CHECK_FUNCS(mkstemp)
58 AC_CHECK_FUNCS(realpath)
59 AC_CHECK_FUNCS(strndup)
60 AC_CHECK_FUNCS(strtok_r)
61 AC_CHECK_FUNCS(unsetenv)
62 AC_CHECK_FUNCS(utimes)
64 AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
66 [#include <stdlib.h>],
67 [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
68 ccache_cv_COMPAR_FN_T=yes,
69 ccache_cv_COMPAR_FN_T=no)])
70 if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
71 AC_DEFINE(HAVE_COMPAR_FN_T, 1,
72 Define to 1 if you have the `__compar_fn_t' typedef.)
75 dnl Replacements of snprintf and friends.
76 m4_include(m4/snprintf.m4)
82 dnl Check if -lm is needed.
83 AC_SEARCH_LIBS(cos, m)
87 AC_ARG_WITH(bundled-zlib,
88 [AS_HELP_STRING([--with-bundled-zlib],
89 [use bundled zlib instead of the system's default zlib])])
90 if test x${with_bundled_zlib} = x; then
93 [ccache_cv_zlib_1_2_3],
97 #if (ZLIB_VERNUM >= 0x1230)
99 #error "ZLIB_VERNUM < 0x1230"
102 [ccache_cv_zlib_1_2_3=yes],
103 [ccache_cv_zlib_1_2_3=no]))
104 AC_CHECK_LIB(z, gzdopen, true)
105 if test $ccache_cv_zlib_1_2_3 = yes && test $ac_cv_lib_z_gzdopen = yes; then
108 AC_MSG_WARN(using bundled zlib)
112 AC_MSG_NOTICE(using bundled zlib as requested)
116 if test x${use_bundled_zlib} = xyes; then
117 extra_cppflags="-I\$(srcdir)/zlib"
118 extra_ldflags="-Lzlib"
119 extra_libs="zlib/libz.a"
129 dnl Check for "extern inline".
132 ac_cv_c_extern_inline,
134 ac_cv_c_extern_inline=no
137 extern $ac_cv_c_inline double foo(double x);
138 extern $ac_cv_c_inline double foo(double x) { return x+1.0; };
139 double foo (double x) { return x + 1.0; };
142 [ac_cv_c_extern_inline="yes"])])
143 if test "$ac_cv_c_extern_inline" != no ; then
144 AC_DEFINE(HAVE_EXTERN_INLINE, 1,
145 Define to 1 if your compiler supports extern inline)
148 dnl Enable developer mode if dev.mk.in exists.
149 if test ! -f $srcdir/dev_mode_disabled && test "$RUN_FROM_BUILD_FARM" != yes; then
150 AC_MSG_NOTICE(Developer mode enabled)
151 AC_CONFIG_FILES([dev.mk])
152 include_dev_mk='include dev.mk'
153 version=`(git --git-dir=$srcdir/.git describe --dirty 2>/dev/null || echo vunknown) | sed -e 's/v//' -e 's/-/+/' -e 's/-/_/g'`
154 echo "const char CCACHE_VERSION@<:@@:>@ = \"$version\";" >version.c
156 AC_MSG_NOTICE(Developer mode disabled)
159 if test ! -f $srcdir/version.c; then
160 AC_MSG_WARN(unable to determine ccache version)
161 echo "const char CCACHE_VERSION@<:@@:>@ = \"unknown\";" >version.c
164 dnl Find test suite files.
165 test_suites=`ls $srcdir/test/test_*.c | egrep -v 'BASE|BACKUP|LOCAL|REMOTE' | xargs echo`
167 AC_CONFIG_FILES([Makefile])
170 cat <<EOF >config.h.tmp
171 #ifndef CCACHE_CONFIG_H
172 #define CCACHE_CONFIG_H
174 cat config.h >>config.h.tmp
175 echo '#endif' >>config.h.tmp
176 mv config.h.tmp config.h
181 AC_MSG_NOTICE(now build ccache by running make)