~ubuntu-branches/ubuntu/oneiric/ctemplate/oneiric

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Florian Reinhard
  • Date: 2010-01-14 22:31:32 UTC
  • Revision ID: james.westby@ubuntu.com-20100114223132-w9ritwjg2av4rfb3
Tags: upstream-0.96
ImportĀ upstreamĀ versionĀ 0.96

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
AC_PREREQ(2.57)
 
6
 
 
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)
 
13
 
 
14
# Checks for programs.
 
15
AC_PROG_CC
 
16
AC_PROG_CPP
 
17
AC_PROG_CXX
 
18
AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
 
19
 
 
20
# Uncomment this if you'll be exporting libraries (.so's)
 
21
AC_PROG_LIBTOOL
 
22
AC_SUBST(LIBTOOL_DEPS)
 
23
 
 
24
AC_PROG_LN_S
 
25
 
 
26
AX_C___ATTRIBUTE__
 
27
 
 
28
# Check whether some low-level functions/files are available
 
29
AC_HEADER_STDC
 
30
 
 
31
# Defines PRIuS
 
32
AC_COMPILER_CHARACTERISTICS
 
33
 
 
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)
 
37
 
 
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])
 
46
 
 
47
AC_HEADER_DIRENT               # for template_unittest.cc, template_regtest.cc
 
48
 
 
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
 
58
 
 
59
# A lot of the code in this directory depends on pthreads
 
60
ACX_PTHREAD
 
61
 
 
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.
 
65
AC_RWLOCK
 
66
 
 
67
# Find out what namespace 'normal' STL code lives in, and also what namespace
 
68
# the user wants our classes to be defined in
 
69
AC_CXX_STL_NAMESPACE
 
70
AC_DEFINE_GOOGLE_NAMESPACE(ctemplate)
 
71
 
 
72
# Figures out where hash_map and hash_set live, and what namespace they use
 
73
AC_CXX_STL_HASH
 
74
 
 
75
# If we found tr1/unordered_map, prefer unordered_map/unordered_set to
 
76
# hash_map/hash_set.
 
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"
 
80
else
 
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"
 
83
fi
 
84
 
 
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)
 
94
else
 
95
   AC_SUBST(ac_google_attribute, 0)
 
96
fi
 
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)
 
103
else
 
104
   AC_SUBST(ac_cv_uint64, unsigned long long)   # best we can do
 
105
fi
 
106
 
 
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
 
112
# attribute-weak.
 
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)
 
119
 
 
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
 
122
# text.
 
123
ac_windows_dllexport_defines=
 
124
ac_windows_dllexport=
 
125
AC_SUBST(ac_windows_dllexport_defines)
 
126
AC_SUBST(ac_windows_dllexport)
 
127
 
 
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
 
130
# do in one place.
 
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.])
 
135
 
 
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 \
 
149
                 ])
 
150
AC_OUTPUT