Fix package variable in AM_INIT_AUTOMAKE
[awesomized/libmemcached] / configure.ac
1 AC_INIT(clients/memcat.c)
2 AC_CONFIG_AUX_DIR(config)
3 AM_CONFIG_HEADER(libmemcached/libmemcached_config.h)
4
5 # Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
6 SAVE_CFLAGS=${CFLAGS}
7 SAVE_CXXFLAGS=${CXXFLAGS}
8 CFLAGS=
9 CXXFLAGS=
10
11 AC_CANONICAL_TARGET
12
13 CFLAGS=${SAVE_CFLAGS}
14 CXXFLAGS=${SAVE_CXXFLAGS}
15
16 MEMCACHED_LIBRARY_NAME=libmemcached
17
18 #release versioning
19 MEMCACHED_MAJOR_VERSION=0
20 MEMCACHED_MINOR_VERSION=29
21 MEMCACHED_MICRO_VERSION=0
22
23 #API version
24 MEMCACHED_API_VERSION=1.0
25 AC_SUBST(MEMCACHED_API_VERSION)
26
27 #shared library versioning
28 MEMCACHED_LIBRARY_VERSION=2:0:0
29 # | | |
30 # +------+ | +---+
31 # | | |
32 # current:revision:age
33 # | | |
34 # | | +- increment if interfaces have been added
35 # | | set to zero if interfaces have been removed or changed
36 # | +- increment if source code has changed
37 # | set to zero if current is incremented
38 # +- increment if interfaces have been added, removed or changed
39
40 AC_SUBST(MEMCACHED_LIBRARY_VERSION)
41
42 PACKAGE=$MEMCACHED_LIBRARY_NAME
43 AC_SUBST(MEMCACHED_LIBRARY_NAME)
44
45 MEMCACHED_VERSION=$MEMCACHED_MAJOR_VERSION.$MEMCACHED_MINOR_VERSION.$MEMCACHED_MICRO_VERSION
46 MEMCACHED_RELEASE=$MEMCACHED_MAJOR_VERSION.$MEMCACHED_MINOR_VERSION
47 AC_SUBST(MEMCACHED_RELEASE)
48 AC_SUBST(MEMCACHED_VERSION)
49
50 VERSION=$MEMCACHED_RELEASE
51
52 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, nostdinc no-define -Wall -Werror)
53 AC_USE_SYSTEM_EXTENSIONS
54
55 AC_PROG_CC
56 AC_PROG_CC_C99
57 AC_PROG_CXX
58 AC_PROG_LIBTOOL
59 AM_SANITY_CHECK
60 LIBTOOL="$LIBTOOL --preserve-dup-deps"
61 AC_SUBST(LIBTOOL)dnl
62
63 AC_C_CONST
64 AC_HEADER_TIME
65 AC_TYPE_SIZE_T
66 AC_SEARCH_LIBS(getopt_long, gnugetopt)
67 AC_SEARCH_LIBS(socket, socket)
68 AC_SEARCH_LIBS(gethostbyname, nsl)
69 AC_SEARCH_LIBS(floorf, m)
70
71
72 sinclude(config/pod2man.m4)
73 sinclude(config/debug.m4)
74 sinclude(config/dtrace.m4)
75 sinclude(config/byteorder.m4)
76 sinclude(config/64bit.m4)
77 sinclude(config/protocol_binary.m4)
78 sinclude(config/memcached.m4)
79 sinclude(config/setsockopt.m4)
80 sinclude(config/hsieh.m4)
81 sinclude(config/util.m4)
82
83 dnl This is likely subverted by vpath builds. How do we find the original
84 dnl source dir in the configure step of a vpath build?
85 if test -d ".hg"
86 then
87 building_from_hg=yes
88 else
89 building_from_hg=no
90 fi
91
92 # We only support GCC and Sun's forte at the moment
93 if test "$GCC" = "yes"
94 then
95 if test "$building_from_hg" = "yes"
96 then
97 CFLAGS="-Werror $CFLAGS"
98 CXXFLAGS="-Werror $CXXFLAGS"
99 fi
100
101 CFLAGS="-W -std=iso9899:1999 -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -O3 -ggdb $CFLAGS"
102 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"
103
104 if test "$ENABLE_DEBUG" = "yes"
105 then
106 CFLAGS="$CFLAGS -ggdb -DHAVE_DEBUG"
107 fi
108 else
109 CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -errfmt=error -errwarn -errshort=tags $CFLAGS"
110 CXXFLAGS="+w +w2 -xwe -mt -D_FORTEC_ $CXXFLAGS"
111 if test "$ENABLE_DEBUG" = "yes"
112 then
113 CFLAGS="$CFLAGS -DHAVE_DEBUG"
114 CXXFLAGS="$CXXFLAGS -DHAVE_DEBUG"
115 fi
116 fi
117
118
119 AM_CPPFLAGS="${CPPFLAGS}"
120 AM_CFLAGS="${CFLAGS}"
121 AM_CXXFLAGS="${CXXFLAGS}"
122
123 AC_SUBST([AM_CPPFLAGS])
124 AC_SUBST([AM_CFLAGS])
125 AC_SUBST([AM_CXXFLAGS])
126
127 dnl We've collected the flags in AM_*FLAGS now, so blank these.
128 CFLAGS=""
129 CXXFLAGS=""
130 CPPFLAGS=""
131
132 AC_OUTPUT(Makefile clients/Makefile tests/Makefile docs/Makefile libmemcached/Makefile libmemcachedutil/Makefile support/Makefile support/libmemcached.pc support/libmemcached.spec support/libmemcached-fc.spec)