Clone should also preserve calloc
[m6w6/libmemcached] / configure.ac
1 AC_INIT([libmemcached],[0.30],[http://tangent.org/552/libmemcached.html])
2 AC_CONFIG_SRCDIR([clients/memcat.c])
3 AC_CONFIG_AUX_DIR(config)
4 AM_CONFIG_HEADER(libmemcached/libmemcached_config.h)
5
6 # Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
7 SAVE_CFLAGS=${CFLAGS}
8 SAVE_CXXFLAGS=${CXXFLAGS}
9 CFLAGS=
10 CXXFLAGS=
11
12 AC_CANONICAL_TARGET
13
14 CFLAGS=${SAVE_CFLAGS}
15 CXXFLAGS=${SAVE_CXXFLAGS}
16
17 #shared library versioning
18 MEMCACHED_LIBRARY_VERSION=2:0:0
19 # | | |
20 # +------+ | +---+
21 # | | |
22 # current:revision:age
23 # | | |
24 # | | +- increment if interfaces have been added
25 # | | set to zero if interfaces have been removed or changed
26 # | +- increment if source code has changed
27 # | set to zero if current is incremented
28 # +- increment if interfaces have been added, removed or changed
29 AC_SUBST(MEMCACHED_LIBRARY_VERSION)
30 MEMCACHEDUTIL_LIBRARY_VERSION=0:0:0
31 AC_SUBST(MEMCACHEDUTIL_LIBRARY_VERSION)
32
33 AM_INIT_AUTOMAKE(nostdinc no-define -Wall -Werror)
34 AC_USE_SYSTEM_EXTENSIONS
35
36 AC_PROG_CC
37 AC_PROG_CC_C99
38 AC_PROG_CXX
39 AC_PROG_LIBTOOL
40 AM_SANITY_CHECK
41
42 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
43
44
45 # libmemcached versioning when linked with GNU ld.
46 if test "$lt_cv_prog_gnu_ld" = "yes"
47 then
48 LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmemcached/libmemcached.ver"
49 LD_UTIL_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmemcachedutil/libmemcachedutil.ver"
50 fi
51 AC_SUBST(LD_VERSION_SCRIPT)
52 AC_SUBST(LD_UTIL_VERSION_SCRIPT)
53
54 AC_C_CONST
55 AC_HEADER_TIME
56 AC_TYPE_SIZE_T
57 AC_SEARCH_LIBS(getopt_long, gnugetopt)
58 AC_SEARCH_LIBS(socket, socket)
59 AC_SEARCH_LIBS(gethostbyname, nsl)
60
61 save_LIBS="$LIBS"
62 LIBS="$LIBS -lm"
63 AC_LINK_IFELSE(
64 [AC_LANG_PROGRAM(
65 [[
66 #include <stdlib.h>
67 ]],[[
68 float f= floorf((float) 1.0);
69 ]],
70 [LIBM="-lm"],[LIBM=""])])
71
72 AC_SUBST(LIBM)
73 LIBS="$save_LIBS"
74 AC_SEARCH_LIBS(floorf, m)
75
76
77 sinclude(m4/pod2man.m4)
78 sinclude(m4/debug.m4)
79 sinclude(m4/dtrace.m4)
80 sinclude(m4/byteorder.m4)
81 sinclude(m4/64bit.m4)
82 sinclude(m4/protocol_binary.m4)
83 sinclude(m4/memcached.m4)
84 sinclude(m4/setsockopt.m4)
85 sinclude(m4/hsieh.m4)
86 sinclude(m4/util.m4)
87
88 dnl This is likely subverted by vpath builds. How do we find the original
89 dnl source dir in the configure step of a vpath build?
90 if test -d ".hg"
91 then
92 building_from_hg=yes
93 else
94 building_from_hg=no
95 fi
96
97
98 # We only support GCC and Sun's forte at the moment
99 if test "$GCC" = "yes"
100 then
101 if test "$ENABLE_DEBUG" = "yes"
102 then
103 CFLAGS="-O0 -DHAVE_DEBUG $CFLAGS"
104 CXXFLAGS="-O0 -DHAVE_DEBUG $CXXFLAGS"
105 else
106 CFLAGS="-O3 $CFLAGS"
107 CXXFLAGS="-O3 $CXXFLAGS"
108 fi
109 if test "$building_from_hg" = "yes"
110 then
111 CFLAGS="-Werror $CFLAGS"
112 CXXFLAGS="-Werror $CXXFLAGS"
113 fi
114
115 CFLAGS="-W -std=iso9899:1999 -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -ggdb3 $CFLAGS"
116 CXXFLAGS="-W -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Weffc++ -Wconversion -Wmissing-declarations -Wredundant-decls -ggdb3 $CXXFLAGS"
117
118
119 fi
120
121 if test "$SUNCC" = "yes"
122 then
123
124 if test "$ENABLE_DEBUG" = "yes"
125 then
126 CFLAGS="-xO0 -DHAVE_DEBUG $CFLAGS"
127 CXXFLAGS="-xO0 -DHAVE_DEBUG $CXXFLAGS"
128 else
129 CFLAGS="-xO4 -xlibmil -xdepend $CFLAGS"
130 CXXFLAGS="-xO4 -xlibmil -xdepend $CXXFLAGS"
131 fi
132 if test "$building_from_hg" = "yes"
133 then
134 CFLAGS="-errwarn $CFLAGS"
135 CXXFLAGS="-errwarn $CXXFLAGS"
136 fi
137 CFLAGS="-Xa -xstrconst -mt -errfmt=error -errshort=tags ${CFLAGS}"
138 CXXFLAGS="+w +w2 -xwe -mt ${CXXFLAGS}"
139 fi
140
141
142 AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
143 AM_CFLAGS="${CFLAGS}"
144 AM_CXXFLAGS="${CXXFLAGS}"
145
146 AC_SUBST([AM_CPPFLAGS])
147 AC_SUBST([AM_CFLAGS])
148 AC_SUBST([AM_CXXFLAGS])
149
150 dnl We've collected the flags in AM_*FLAGS now, so blank these.
151 CFLAGS=""
152 CXXFLAGS=""
153 CPPFLAGS=""
154
155 AC_CONFIG_FILES([
156 Makefile
157 clients/Makefile
158 tests/Makefile
159 docs/Makefile
160 libmemcached/Makefile
161 libmemcachedutil/Makefile
162 support/Makefile
163 support/libmemcached.pc
164 support/libmemcached.spec
165 support/libmemcached-fc.spec
166 ])
167 AC_OUTPUT