blob: a71136a7e657a0fe4c5e66bc4edb19aeee1340f7 [file] [log] [blame]
openvcdiff311c7142008-08-26 19:29:25 +00001## 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
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +00007AC_INIT(open-vcdiff, 0.8, opensource@google.com)
openvcdiff311c7142008-08-26 19:29:25 +00008AC_CONFIG_SRCDIR(README)
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +00009AC_CONFIG_MACRO_DIR([m4 gflags/m4])
openvcdiff311c7142008-08-26 19:29:25 +000010AM_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
openvcdiffbaf44ea2009-04-09 19:20:49 +000020# Issue #21: Fail to test on MinGW 5.1.4
21# Disabling fast install keeps libtool from creating wrapper scripts around
22# the executables it builds. Such scripts have caused failures on MinGW.
23# Using this option means an extra link step is executed during "make install".
24AC_DISABLE_FAST_INSTALL
25
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000026LT_INIT
openvcdiff311c7142008-08-26 19:29:25 +000027AC_PROG_LIBTOOL
28AC_SUBST(LIBTOOL_DEPS)
29
30# Check whether some low-level functions/files are available
31AC_HEADER_STDC
32
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000033# Built-in memcmp can be inefficient when gcc compiles for x86 or PowerPC
34# processors. In those cases, use an alternative function instead of memcmp.
openvcdiff28db8072008-10-10 23:29:11 +000035case $host_cpu in
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000036 *86*|powerpc*)
openvcdiff28db8072008-10-10 23:29:11 +000037 if test "$GCC" = "yes"; then
38 AC_DEFINE(VCDIFF_USE_BLOCK_COMPARE_WORDS, 1,
39 Use custom compare function instead of memcmp)
40 fi
openvcdiffd4832872008-09-02 18:21:13 +000041 ;;
openvcdiff311c7142008-08-26 19:29:25 +000042esac
43
44AC_CHECK_HEADERS([ext/rope])
45AC_CHECK_HEADERS([getopt.h])
46AC_CHECK_HEADERS([malloc.h])
47AC_CHECK_HEADERS([sys/mman.h])
48AC_CHECK_HEADERS([sys/time.h])
49AC_CHECK_HEADERS([unistd.h])
50AC_CHECK_HEADERS([windows.h])
51AC_CHECK_FUNCS([gettimeofday QueryPerformanceCounter])
52AC_CHECK_FUNCS([memalign posix_memalign])
53AC_CHECK_FUNCS([mprotect])
54
55# Start of definitions needed by gflags package
56
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000057# These are tested for by AC_HEADER_STDC, but I check again to set the var
58AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
59AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
60AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
openvcdiff311c7142008-08-26 19:29:25 +000061AC_CHECK_HEADERS([fnmatch.h])
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000062
63# These are the types I need. We look for them in either stdint.h,
64# sys/types.h, or inttypes.h, all of which are part of the default-includes.
65AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
66AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
67AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0)
68
openvcdiff311c7142008-08-26 19:29:25 +000069AC_CHECK_FUNCS([strtoll strtoq])
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000070AC_CHECK_FUNCS([setenv putenv]) # MinGW has putenv but not setenv
openvcdiff311c7142008-08-26 19:29:25 +000071
72AX_C___ATTRIBUTE__
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +000073# We only care about __attribute__ ((unused))
74if test x"$ac_cv___attribute__" = x"yes"; then
75 ac_cv___attribute__unused="__attribute__ ((unused))"
76else
77 ac_cv___attribute__unused=
78fi
79
80ACX_PTHREAD
81
82# Find out what namespace 'normal' STL code lives in, and also what namespace
83# the user wants our classes to be defined in
84AC_CXX_STL_NAMESPACE
85AC_DEFINE_GOOGLE_NAMESPACE(google)
86
87# These are what's needed by gflags.h.in
88AC_SUBST(ac_google_start_namespace)
89AC_SUBST(ac_google_end_namespace)
90AC_SUBST(ac_google_namespace)
91AC_SUBST(ac_cv___attribute__unused)
92AC_SUBST(ac_cv_have_stdint_h)
93AC_SUBST(ac_cv_have_systypes_h)
94AC_SUBST(ac_cv_have_inttypes_h)
95AC_SUBST(ac_cv_have_uint16_t)
96AC_SUBST(ac_cv_have_u_int16_t)
97AC_SUBST(ac_cv_have___int16)
98
99# For windows, this has a non-trivial value (__declspec(export)), but any
100# system that uses configure wants this to be the empty string.
101AC_DEFINE(GFLAGS_DLL_DECL,,
102 [Always the empty-string on non-windows systems.
103 On windows, should be "__declspec(dllexport)".
104 This way, when we compile the dll, we export our functions/classes.
105 It's safe to define this here because config.h is only used
106 internally, to compile the DLL, and every DLL source file
107 #includes "config.h" before anything else.])
openvcdiff311c7142008-08-26 19:29:25 +0000108
openvcdiff311c7142008-08-26 19:29:25 +0000109# End of definitions needed by gflags package
110
openvcdiffd1845782009-03-20 21:56:15 +0000111# Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty.
112# If so, we replace it with our own version.
113LIBSTDCXX_LA_LINKER_FLAG=
114if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la
115then
116 LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris'
117fi
118AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG)
119
openvcdiff@gmail.com732fff22010-08-04 18:00:00 +0000120AC_CONFIG_FILES([Makefile
121 gflags/src/gflags/gflags.h
122 gflags/src/gflags/gflags_completions.h])
openvcdiff311c7142008-08-26 19:29:25 +0000123AC_OUTPUT