a11f7dfe00f565618b5847f466b8f76aaa4d5fdd
[awesomized/libmemcached] / configure.ac
1 AC_INIT([libmemcached],[0.29],[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 # libmemcached versioning when linked with GNU ld.
43 if test "$lt_cv_prog_gnu_ld" = "yes"
44 then
45 LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmemcached/libmemcached.ver"
46 LD_UTIL_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmemcachedutil/libmemcachedutil.ver"
47 fi
48 AC_SUBST(LD_VERSION_SCRIPT)
49 AC_SUBST(LD_UTIL_VERSION_SCRIPT)
50
51 AC_C_CONST
52 AC_HEADER_TIME
53 AC_TYPE_SIZE_T
54 AC_SEARCH_LIBS(getopt_long, gnugetopt)
55 AC_SEARCH_LIBS(socket, socket)
56 AC_SEARCH_LIBS(gethostbyname, nsl)
57
58 save_LIBS="$LIBS"
59 LIBS="$LIBS -lm"
60 AC_LINK_IFELSE(
61 [AC_LANG_PROGRAM(
62 [[
63 #include <stdlib.h>
64 ]],[[
65 float f= floorf((float) 1.0);
66 ]],
67 [LIBM="-lm"],[LIBM=""])])
68
69 AC_SUBST(LIBM)
70 LIBS="$save_LIBS"
71 AC_SEARCH_LIBS(floorf, m)
72
73
74 sinclude(m4/pod2man.m4)
75 sinclude(m4/debug.m4)
76 sinclude(m4/dtrace.m4)
77 sinclude(m4/byteorder.m4)
78 sinclude(m4/64bit.m4)
79 sinclude(m4/protocol_binary.m4)
80 sinclude(m4/memcached.m4)
81 sinclude(m4/setsockopt.m4)
82 sinclude(m4/hsieh.m4)
83 sinclude(m4/util.m4)
84
85 dnl This is likely subverted by vpath builds. How do we find the original
86 dnl source dir in the configure step of a vpath build?
87 if test -d ".hg"
88 then
89 building_from_hg=yes
90 else
91 building_from_hg=no
92 fi
93
94 # We only support GCC and Sun's forte at the moment
95 if test "$GCC" = "yes"
96 then
97 if test "$building_from_hg" = "yes"
98 then
99 CFLAGS="-Werror $CFLAGS"
100 CXXFLAGS="-Werror $CXXFLAGS"
101 fi
102
103 CFLAGS="-W -std=iso9899:1999 -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -O3 -ggdb $CFLAGS"
104 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 -O3 -ggdb $CXXFLAGS"
105
106 if test "$ENABLE_DEBUG" = "yes"
107 then
108 CFLAGS="$CFLAGS -ggdb -DHAVE_DEBUG"
109 fi
110 else
111 CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -errfmt=error -errwarn -errshort=tags $CFLAGS"
112 CXXFLAGS="+w +w2 -xwe -mt -D_FORTEC_ $CXXFLAGS"
113 if test "$ENABLE_DEBUG" = "yes"
114 then
115 CFLAGS="$CFLAGS -DHAVE_DEBUG"
116 CXXFLAGS="$CXXFLAGS -DHAVE_DEBUG"
117 fi
118 fi
119
120
121 AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
122 AM_CFLAGS="${CFLAGS}"
123 AM_CXXFLAGS="${CXXFLAGS}"
124
125 AC_SUBST([AM_CPPFLAGS])
126 AC_SUBST([AM_CFLAGS])
127 AC_SUBST([AM_CXXFLAGS])
128
129 dnl We've collected the flags in AM_*FLAGS now, so blank these.
130 CFLAGS=""
131 CXXFLAGS=""
132 CPPFLAGS=""
133
134 AC_CONFIG_FILES([Makefile clients/Makefile tests/Makefile docs/Makefile libmemcached/Makefile libmemcachedutil/Makefile support/Makefile support/libmemcached.pc support/libmemcached.spec support/libmemcached-fc.spec])
135 AC_OUTPUT