Remove unused m4
[awesomized/libmemcached] / m4 / pandora_canonical.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl Which version of the canonical setup we're using
7 AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.175])
8
9 AC_DEFUN([PANDORA_BLOCK_BAD_OPTIONS],[
10 AS_IF([test "x${prefix}" = "x"],[
11 AC_MSG_ERROR([--prefix requires an argument])
12 ])
13 ])
14
15 dnl The standard setup for how we build Pandora projects
16 AC_DEFUN([PANDORA_CANONICAL_TARGET],[
17 ifdef([m4_define],,[define([m4_define], defn([define]))])
18 ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))])
19 m4_define([PCT_ALL_ARGS],[$*])
20 m4_define([PCT_REQUIRE_CXX],[no])
21 m4_define([PCT_FORCE_GCC42],[no])
22 m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no])
23 m4_define([PCT_NO_VC_CHANGELOG],[no])
24 m4_define([PCT_USE_VISIBILITY],[yes])
25 m4_foreach([pct_arg],[$*],[
26 m4_case(pct_arg,
27 [require-cxx], [
28 m4_undefine([PCT_REQUIRE_CXX])
29 m4_define([PCT_REQUIRE_CXX],[yes])
30 ],
31 [force-gcc42], [
32 m4_undefine([PCT_FORCE_GCC42])
33 m4_define([PCT_FORCE_GCC42],[yes])
34 ],
35 [skip-visibility], [
36 m4_undefine([PCT_USE_VISIBILITY])
37 m4_define([PCT_USE_VISIBILITY],[no])
38 ],
39 [dont-suppress-include], [
40 m4_undefine([PCT_DONT_SUPPRESS_INCLUDE])
41 m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes])
42 ])
43 ])
44
45 PANDORA_BLOCK_BAD_OPTIONS
46
47 # We need to prevent canonical target
48 # from injecting -O2 into CFLAGS - but we won't modify anything if we have
49 # set CFLAGS on the command line, since that should take ultimate precedence
50 AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
51 [CFLAGS=""])
52 AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
53 [CXXFLAGS=""])
54
55 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar])
56
57 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
58
59 m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
60 gl_EARLY
61 ],[
62 PANDORA_EXTENSIONS
63 ])
64
65 AC_REQUIRE([AC_PROG_CC])
66 m4_if(PCT_FORCE_GCC42, [yes], [
67 AC_REQUIRE([PANDORA_ENSURE_GCC_VERSION])
68 ])
69 AC_REQUIRE([PANDORA_64BIT])
70
71 m4_if(PCT_NO_VC_CHANGELOG,yes,[
72 vc_changelog=no
73 ],[
74 vc_changelog=yes
75 ])
76
77 dnl Once we can use a modern autoconf, we can use this
78 dnl AC_PROG_CC_C99
79 AC_REQUIRE([AC_PROG_CXX])
80 PANDORA_EXTENSIONS
81 AM_PROG_CC_C_O
82
83
84
85 PANDORA_PLATFORM
86
87 dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
88 dnl so we check c++98 features and fail if we don't have them, mainly
89 dnl for that reason
90 m4_if(PCT_REQUIRE_CXX, [yes], [
91 AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
92 AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
93 ])
94 ])
95
96 m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
97 gl_INIT
98 AC_CONFIG_LIBOBJ_DIR([gnulib])
99 ])
100
101 PANDORA_CHECK_CXX_VERSION
102
103 AC_HEADER_TIME
104 AC_STRUCT_TM
105 AC_TYPE_SIZE_T
106 AC_SYS_LARGEFILE
107 PANDORA_CLOCK_GETTIME
108
109 AC_CHECK_HEADERS(sys/socket.h)
110
111 # off_t is not a builtin type
112 AC_CHECK_SIZEOF(off_t, 4)
113 AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[
114 AC_MSG_ERROR("${PACKAGE} needs an off_t type.")
115 ])
116
117 AC_CHECK_SIZEOF(size_t)
118 AS_IF([test "$ac_cv_sizeof_size_t" -eq 0],[
119 AC_MSG_ERROR("${PACKAGE} needs an size_t type.")
120 ])
121
122 AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
123 AC_CHECK_SIZEOF(long long)
124 AC_DEFINE_UNQUOTED([SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
125 AC_CACHE_CHECK([if time_t is unsigned], [ac_cv_time_t_unsigned],[
126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
127 [[
128 #include <time.h>
129 ]],
130 [[
131 int array[(((time_t)-1) > 0) ? 1 : -1];
132 ]])
133 ],[
134 ac_cv_time_t_unsigned=yes
135 ],[
136 ac_cv_time_t_unsigned=no
137 ])
138 ])
139 AS_IF([test "$ac_cv_time_t_unsigned" = "yes"],[
140 AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
141 ])
142
143 AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
144 AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
145
146
147
148 PANDORA_OPTIMIZE
149
150 PANDORA_HAVE_GCC_ATOMICS
151
152 PANDORA_WARNINGS(PCT_ALL_ARGS)
153
154 PANDORA_ENABLE_DTRACE
155
156 AC_LIB_PREFIX
157 PANDORA_HAVE_BETTER_MALLOC
158
159 m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[
160 AM_CPPFLAGS="-I\$(top_srcdir)/src -I\$(top_builddir)/src ${AM_CPPFLAGS}"
161 ],[
162 AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${AM_CPPFLAGS}"
163 ])
164
165 PANDORA_USE_PIPE
166
167 AM_CFLAGS="-std=c99 ${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
168 AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
169
170 AC_SUBST([AM_CFLAGS])
171 AC_SUBST([AM_CXXFLAGS])
172 AC_SUBST([AM_CPPFLAGS])
173 AC_SUBST([AM_LDFLAGS])
174
175 ])