1
## Process this file with autoconf to produce configure.
2
## In general, the safest way to proceed is to run ./autogen.sh
4
# make sure we're interpreted by some minimal autoconf
7
AC_INIT(ctemplate, 0.96, opensource@google.com)
8
# The argument here is just something that should be in the current directory
9
# (for sanity checking)
10
AC_CONFIG_SRCDIR(README)
11
AM_INIT_AUTOMAKE([dist-zip])
12
AM_CONFIG_HEADER(src/config.h)
14
# Checks for programs.
18
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
20
# Uncomment this if you'll be exporting libraries (.so's)
22
AC_SUBST(LIBTOOL_DEPS)
28
# Check whether some low-level functions/files are available
32
AC_COMPILER_CHARACTERISTICS
34
# Here are some examples of how to check for the existence of a fn or file
35
AC_CHECK_FUNCS(getopt_long)
36
##AC_CHECK_HEADERS(sys/resource.h)
38
# These are the types I need. We look for them in either stdint.h,
39
# sys/types.h, or inttypes.h, all of which are part of the default-includes.
40
AC_CHECK_TYPES([uint32_t])
41
AC_CHECK_TYPES([u_int32_t])
42
AC_CHECK_TYPES([__int32])
43
AC_CHECK_TYPES([uint64_t])
44
AC_CHECK_TYPES([u_int64_t])
45
AC_CHECK_TYPES([__int64])
47
AC_HEADER_DIRENT # for template_unittest.cc, template_regtest.cc
49
# We need to do byte-swapping efficiently to hash efficiently in
50
# template_string.cc. Different architectures do this differently.
51
AC_CHECK_HEADERS(byteswap.h) # Linux (GNU in general)
52
AC_CHECK_HEADERS(libkern/OSByteOrder.h) # OS X
53
AC_CHECK_HEADERS(sys/byteorder.h) # Solaris 10
54
AC_CHECK_HEADERS(endian.h) # Linux
55
AC_CHECK_HEADERS(machine/endian.h) # OS X
56
AC_CHECK_HEADERS(sys/endian.h) # FreeBSD
57
AC_CHECK_HEADERS(sys/isa_defs.h) # Solaris 10
59
# A lot of the code in this directory depends on pthreads
62
# We'd like to use read/write locks in several places in the code.
63
# See if our pthreads support extends to that. Note: for linux, it
64
# does as long as you define _XOPEN_SOURCE appropriately.
67
# Find out what namespace 'normal' STL code lives in, and also what namespace
68
# the user wants our classes to be defined in
70
AC_DEFINE_GOOGLE_NAMESPACE(ctemplate)
72
# Figures out where hash_map and hash_set live, and what namespace they use
75
# If we found tr1/unordered_map, prefer unordered_map/unordered_set to
77
if test "$ac_cv_cxx_have_unordered_map" = yes; then
78
ac_cv_cxx_hash_map_class="$ac_cv_cxx_hash_namespace::unordered_map"
79
ac_cv_cxx_hash_set_class="$ac_cv_cxx_hash_namespace::unordered_set"
81
ac_cv_cxx_hash_map_class="$ac_cv_cxx_hash_namespace::hash_map"
82
ac_cv_cxx_hash_set_class="$ac_cv_cxx_hash_namespace::hash_set"
85
AC_SUBST(ac_google_namespace)
86
AC_SUBST(ac_google_start_namespace)
87
AC_SUBST(ac_google_end_namespace)
88
AC_SUBST(ac_cv_cxx_hash_map)
89
AC_SUBST(ac_cv_cxx_hash_set)
90
AC_SUBST(ac_cv_cxx_hash_map_class)
91
AC_SUBST(ac_cv_cxx_hash_set_class)
92
if test "$ac_cv___attribute__" = "yes"; then
93
AC_SUBST(ac_google_attribute, 1)
95
AC_SUBST(ac_google_attribute, 0)
97
if test "$ac_cv_type_u_int64_t" = "yes"; then
98
AC_SUBST(ac_cv_uint64, u_int64_t)
99
elif test "$ac_cv_type_uint64_t" = "yes"; then
100
AC_SUBST(ac_cv_uint64, uint64_t)
101
elif test "$ac_cv_type___int64" = "yes"; then
102
AC_SUBST(ac_cv_uint64, unsigned __int64)
104
AC_SUBST(ac_cv_uint64, unsigned long long) # best we can do
107
# One some systems (eg gnu/linux), the linker defines _start and
108
# data_start to indicate the extent of the .text section. We can use
109
# this to know strings are immutable. In the code, we make the
110
# variables weak, just in case, but for this check, we only want to
111
# say "yes" if the linker supports the vars, *and* the compiler supports
113
AC_TRY_LINK([], [ extern char _start[];
114
extern char data_start[];
115
extern char dummy[] __attribute__((weak));
116
return (_start && data_start && dummy); ],
117
[ ac_have_attribute_weak=1 ], [ ac_have_attribute_weak=0 ])
118
AC_SUBST(ac_have_attribute_weak)
120
# In unix (that is, using this script), this dll-export stuff will always
121
# be the empty string. In windows, we'll replace it with windows-specific
123
ac_windows_dllexport_defines=
124
ac_windows_dllexport=
125
AC_SUBST(ac_windows_dllexport_defines)
126
AC_SUBST(ac_windows_dllexport)
128
# This will (should) never change, but we put it here so if we do need
129
# to change it, to avoid naming conflicts or something, it's easy to
131
ac_htmlparser_namespace=google_ctemplate_streamhtmlparser
132
AC_SUBST(ac_htmlparser_namespace)
133
AC_DEFINE_UNQUOTED(HTMLPARSER_NAMESPACE, $ac_htmlparser_namespace,
134
[The namespace to put the htmlparser code.])
136
# Write generated configuration file, and also .h files
137
AC_CONFIG_FILES([Makefile \
138
src/ctemplate/template_string.h \
139
src/ctemplate/template_enums.h \
140
src/ctemplate/template.h \
141
src/ctemplate/template_modifiers.h \
142
src/ctemplate/template_emitter.h \
143
src/ctemplate/template_annotator.h \
144
src/ctemplate/template_dictionary.h \
145
src/ctemplate/template_pathops.h \
146
src/ctemplate/template_namelist.h \
147
src/ctemplate/per_expand_data.h \
148
src/ctemplate/template_dictionary_interface.h \