1## Process this file with autoconf to produce configure.
2## In general, the safest way to proceed is to run ./autogen.sh
3
4# make sure we're interpreted by some minimal autoconf
5AC_PREREQ(2.57)
6
7AC_INIT(open-vcdiff, 0.8.3, opensource@google.com)
8AC_CONFIG_SRCDIR(README)
9AC_CONFIG_MACRO_DIR(m4)
10AM_INIT_AUTOMAKE
11AM_CONFIG_HEADER(src/config.h)
12
13# Checks for programs.
14AC_PROG_CC
15AC_PROG_CPP
16AC_PROG_CXX
17AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
18AC_CANONICAL_HOST
19
20LT_INIT
21AC_PROG_LIBTOOL
22AC_SUBST(LIBTOOL_DEPS)
23
24# Check whether some low-level functions/files are available
25AC_HEADER_STDC
26
27# Built-in memcmp can be inefficient when gcc compiles for x86 or PowerPC
28# processors.  In those cases, use an alternative function instead of memcmp.
29case $host_cpu in
30  *86*|powerpc*)
31    if test "$GCC" = "yes"; then
32      AC_DEFINE(VCDIFF_USE_BLOCK_COMPARE_WORDS, 1,
33                Use custom compare function instead of memcmp)
34    fi
35    ;;
36esac
37
38AC_CHECK_HEADERS([ext/rope])
39AC_CHECK_HEADERS([getopt.h])
40AC_CHECK_HEADERS([malloc.h])
41AC_CHECK_HEADERS([sys/mman.h])
42AC_CHECK_HEADERS([sys/time.h])
43AC_CHECK_HEADERS([unistd.h])
44AC_CHECK_HEADERS([windows.h])
45AC_CHECK_FUNCS([gettimeofday QueryPerformanceCounter])
46AC_CHECK_FUNCS([memalign posix_memalign])
47AC_CHECK_FUNCS([mprotect])
48
49# Start of definitions needed by gflags package
50
51# These are tested for by AC_HEADER_STDC, but I check again to set the var
52AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
53AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
54AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
55AC_CHECK_HEADERS([fnmatch.h])
56
57# These are the types I need.  We look for them in either stdint.h,
58# sys/types.h, or inttypes.h, all of which are part of the default-includes.
59AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
60AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
61AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0)
62
63AC_CHECK_FUNCS([strtoll strtoq])
64AC_CHECK_FUNCS([setenv putenv])    # MinGW has putenv but not setenv
65
66AX_C___ATTRIBUTE__
67# We only care about __attribute__ ((unused))
68if test x"$ac_cv___attribute__" = x"yes"; then
69  ac_cv___attribute__unused="__attribute__ ((unused))"
70else
71  ac_cv___attribute__unused=
72fi
73
74ACX_PTHREAD
75
76# Find out what namespace 'normal' STL code lives in, and also what namespace
77# the user wants our classes to be defined in
78AC_CXX_STL_NAMESPACE
79AC_DEFINE_GOOGLE_NAMESPACE(google)
80
81# These are what's needed by gflags.h.in
82AC_SUBST(ac_google_start_namespace)
83AC_SUBST(ac_google_end_namespace)
84AC_SUBST(ac_google_namespace)
85AC_SUBST(ac_cv___attribute__unused)
86AC_SUBST(ac_cv_have_stdint_h)
87AC_SUBST(ac_cv_have_systypes_h)
88AC_SUBST(ac_cv_have_inttypes_h)
89AC_SUBST(ac_cv_have_uint16_t)
90AC_SUBST(ac_cv_have_u_int16_t)
91AC_SUBST(ac_cv_have___int16)
92
93# For windows, this has a non-trivial value (__declspec(export)), but any
94# system that uses configure wants this to be the empty string.
95AC_DEFINE(GFLAGS_DLL_DECL,,
96          [Always the empty-string on non-windows systems.
97           On windows, should be "__declspec(dllexport)".
98           This way, when we compile the dll, we export our functions/classes.
99           It's safe to define this here because config.h is only used
100           internally, to compile the DLL, and every DLL source file
101           #includes "config.h" before anything else.])
102
103# End of definitions needed by gflags package
104
105# Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty.
106# If so, we replace it with our own version.
107LIBSTDCXX_LA_LINKER_FLAG=
108if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la
109then
110  LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris'
111fi
112AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG)
113
114AC_CONFIG_FILES([Makefile
115                 gflags/src/gflags/gflags.h
116                 gflags/src/gflags/gflags_completions.h])
117AC_OUTPUT
118