103c334668b60086d6658bca29623b8cc1f6f868
[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 LIBTOOL="$LIBTOOL --preserve-dup-deps"
42 AC_SUBST(LIBTOOL)dnl
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(config/pod2man.m4)
78 sinclude(config/debug.m4)
79 sinclude(config/dtrace.m4)
80 sinclude(config/byteorder.m4)
81 sinclude(config/64bit.m4)
82 sinclude(config/protocol_binary.m4)
83 sinclude(config/memcached.m4)
84 sinclude(config/setsockopt.m4)
85 sinclude(config/hsieh.m4)
86 sinclude(config/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 # We only support GCC and Sun's forte at the moment
98 if test "$GCC" = "yes"
99 then
100 if test "$building_from_hg" = "yes"
101 then
102 CFLAGS="-Werror $CFLAGS"
103 CXXFLAGS="-Werror $CXXFLAGS"
104 fi
105
106 CFLAGS="-W -std=iso9899:1999 -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -O3 -ggdb $CFLAGS"
107 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"
108
109 if test "$ENABLE_DEBUG" = "yes"
110 then
111 CFLAGS="$CFLAGS -ggdb -DHAVE_DEBUG"
112 fi
113 else
114 CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -errfmt=error -errwarn -errshort=tags $CFLAGS"
115 CXXFLAGS="+w +w2 -xwe -mt -D_FORTEC_ $CXXFLAGS"
116 if test "$ENABLE_DEBUG" = "yes"
117 then
118 CFLAGS="$CFLAGS -DHAVE_DEBUG"
119 CXXFLAGS="$CXXFLAGS -DHAVE_DEBUG"
120 fi
121 fi
122
123
124 AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
125 AM_CFLAGS="${CFLAGS}"
126 AM_CXXFLAGS="${CXXFLAGS}"
127
128 AC_SUBST([AM_CPPFLAGS])
129 AC_SUBST([AM_CFLAGS])
130 AC_SUBST([AM_CXXFLAGS])
131
132 dnl We've collected the flags in AM_*FLAGS now, so blank these.
133 CFLAGS=""
134 CXXFLAGS=""
135 CPPFLAGS=""
136
137 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])
138 AC_OUTPUT