~avsej/libmemcached/touch-command

« back to all changes in this revision

Viewing changes to m4/pandora_canonical.m4

  • Committer: Brian Aker
  • Date: 2011-01-11 19:55:33 UTC
  • mfrom: (901.1.4 fix-systemtap)
  • Revision ID: brian@tangent.org-20110111195533-z1rpmuiqh0gfwyi2
Merge in changes from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl  Copyright (C) 2009 Sun Microsystems
2
 
dnl This file is free software; Sun Microsystems
 
1
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
 
2
dnl This file is free software; Sun Microsystems, Inc.
3
3
dnl gives unlimited permission to copy and/or distribute it,
4
4
dnl with or without modifications, as long as this notice is preserved.
5
5
 
6
6
dnl Which version of the canonical setup we're using
7
 
AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.134])
 
7
AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.171])
8
8
 
9
9
AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
10
10
  AC_ARG_ENABLE([fat-binaries],
23
23
  ])
24
24
])
25
25
 
 
26
AC_DEFUN([PANDORA_BLOCK_BAD_OPTIONS],[
 
27
  AS_IF([test "x${prefix}" = "x"],[
 
28
    AC_MSG_ERROR([--prefix requires an argument])
 
29
  ])
 
30
])
 
31
 
26
32
dnl The standard setup for how we build Pandora projects
27
33
AC_DEFUN([PANDORA_CANONICAL_TARGET],[
28
34
  AC_REQUIRE([PANDORA_FORCE_DEPEND_TRACKING])
32
38
  m4_define([PCT_REQUIRE_CXX],[no])
33
39
  m4_define([PCT_FORCE_GCC42],[no])
34
40
  m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no])
 
41
  m4_define([PCT_NO_VC_CHANGELOG],[no])
35
42
  m4_define([PCT_VERSION_FROM_VC],[no])
36
43
  m4_define([PCT_USE_VISIBILITY],[yes])
37
44
  m4_foreach([pct_arg],[$*],[
52
59
        m4_undefine([PCT_DONT_SUPPRESS_INCLUDE])
53
60
        m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes])
54
61
      ],
 
62
      [no-vc-changelog], [
 
63
        m4_undefine([PCT_NO_VC_CHANGELOG])
 
64
        m4_define([PCT_NO_VC_CHANGELOG],[yes])
 
65
      ],
55
66
      [version-from-vc], [
56
67
        m4_undefine([PCT_VERSION_FROM_VC])
57
68
        m4_define([PCT_VERSION_FROM_VC],[yes])
66
77
    AC_CONFIG_HEADERS([config.h])
67
78
  ])
68
79
 
 
80
  PANDORA_BLOCK_BAD_OPTIONS
 
81
 
69
82
  # We need to prevent canonical target
70
83
  # from injecting -O2 into CFLAGS - but we won't modify anything if we have
71
84
  # set CFLAGS on the command line, since that should take ultimate precedence
77
90
  AC_CANONICAL_TARGET
78
91
  
79
92
  m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[
80
 
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign)
 
93
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar)
81
94
  ],[
82
 
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability nostdinc subdir-objects foreign)
 
95
    AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability nostdinc subdir-objects foreign tar-ustar)
83
96
  ])
84
97
 
85
98
  m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
86
99
 
87
100
  m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
88
101
    gl_EARLY
 
102
  ],[
 
103
    PANDORA_EXTENSIONS 
89
104
  ])
90
105
  
91
106
  AC_REQUIRE([AC_PROG_CC])
94
109
  ])
95
110
  AC_REQUIRE([PANDORA_64BIT])
96
111
 
 
112
  m4_if(PCT_NO_VC_CHANGELOG,yes,[
 
113
    vc_changelog=no
 
114
  ],[
 
115
    vc_changelog=yes
 
116
  ])
97
117
  m4_if(PCT_VERSION_FROM_VC,yes,[
98
118
    PANDORA_VC_VERSION
99
119
  ],[
100
120
    PANDORA_TEST_VC_DIR
 
121
 
 
122
    changequote(<<, >>)dnl
 
123
    PANDORA_RELEASE_ID=`echo $VERSION | sed 's/[^0-9]//g'`
 
124
    changequote([, ])dnl
 
125
 
 
126
    PANDORA_RELEASE_COMMENT=""
 
127
    AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["$VERSION"],
 
128
                       [Version of the software])
 
129
 
 
130
    AC_SUBST(PANDORA_RELEASE_COMMENT)
 
131
    AC_SUBST(PANDORA_RELEASE_VERSION)
 
132
    AC_SUBST(PANDORA_RELEASE_ID)
101
133
  ])
102
134
  PANDORA_VERSION
103
135
 
121
153
    AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
122
154
      AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
123
155
    ])
124
 
 
125
156
  ])
 
157
  PANDORA_CXX_CSTDINT
 
158
  PANDORA_CXX_CINTTYPES
126
159
  
127
160
  m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
128
161
    gl_INIT
144
177
  AC_SYS_LARGEFILE
145
178
  PANDORA_CLOCK_GETTIME
146
179
 
 
180
  AC_CHECK_HEADERS(sys/socket.h)
 
181
 
147
182
  # off_t is not a builtin type
148
183
  AC_CHECK_SIZEOF(off_t, 4)
149
184
  AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[
176
211
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
177
212
  ])
178
213
 
 
214
  AC_CACHE_CHECK([if system defines RUSAGE_THREAD], [ac_cv_rusage_thread],[
 
215
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
216
      [[
 
217
#include <sys/time.h>
 
218
#include <sys/resource.h>
 
219
      ]],[[
 
220
      int x= RUSAGE_THREAD;
 
221
      ]])
 
222
    ],[
 
223
      ac_cv_rusage_thread=yes
 
224
    ],[
 
225
      ac_cv_rusage_thread=no
 
226
    ])
 
227
  ])
 
228
  AS_IF([test "$ac_cv_rusage_thread" = "no"],[
 
229
    AC_DEFINE([RUSAGE_THREAD], [RUSAGE_SELF],
 
230
      [Define if system doesn't define])
 
231
  ])
 
232
 
179
233
  AC_CHECK_LIBM
180
234
  dnl Bug on FreeBSD - LIBM check doesn't set the damn variable
181
235
  AC_SUBST([LIBM])
201
255
  PANDORA_HAVE_GCC_ATOMICS
202
256
 
203
257
  m4_if(PCT_USE_VISIBILITY,[yes],[
204
 
    dnl We need to inject error into the cflags to test if visibility works or not
205
 
    save_CFLAGS="${CFLAGS}"
206
 
    CFLAGS="${CFLAGS} -Werror"
207
 
    PANDORA_VISIBILITY
208
 
    CFLAGS="${save_CFLAGS}"
 
258
    PANDORA_ENABLE_VISIBILITY
 
259
    ],[
 
260
    PANDORA_CHECK_VISIBILITY
209
261
  ])
210
262
 
211
263
  PANDORA_HEADER_ASSERT
220
272
  AC_CHECK_PROGS([DOXYGEN], [doxygen])
221
273
  AC_CHECK_PROGS([PERL], [perl])
222
274
  AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:])
 
275
  AC_CHECK_PROGS([LCOV], [lcov], [echo lcov not found])
 
276
  AC_CHECK_PROGS([LCOV_GENHTML], [genhtml], [echo genhtml not found])
 
277
 
 
278
  AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build], [:])
 
279
  AS_IF([test "x${SPHINXBUILD}" != "x:"],[
 
280
    AC_CACHE_CHECK([if sphinx is new enough],[ac_cv_recent_sphinx],[
 
281
    
 
282
    ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1
 
283
    AS_IF([test $? -eq 0],[ac_cv_recent_sphinx=yes],
 
284
          [ac_cv_recent_sphinx=no])
 
285
    rm -rf conftest.d
 
286
    ])
 
287
  ])
223
288
 
224
289
  AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"])
 
290
  AM_CONDITIONAL(HAVE_SPHINX,[test "x${SPHINXBUILD}" != "x:"])
 
291
  AM_CONDITIONAL(HAVE_RECENT_SPHINX,[test "x${ac_cv_recent_sphinx}" = "xyes"])
225
292
 
226
 
  PANDORA_WITH_GETTEXT
 
293
  m4_if(m4_substr(m4_esyscmd(test -d po && echo 0),0,1),0, [
 
294
    AM_PO_SUBDIRS
 
295
    IT_PROG_INTLTOOL([0.35],[no-xml])
 
296
    
 
297
    GETTEXT_PACKAGE=$PACKAGE
 
298
    AC_CHECK_LIB(intl, libintl_gettext)
 
299
    AC_SUBST([GETTEXT_PACKAGE])
 
300
    AS_IF([test "x${USE_NLS}" = "xyes" -a "x${pandora_have_intltool}" = "xyes"],
 
301
          [AC_DEFINE([ENABLE_NLS],[1],[Turn on language support])
 
302
           AC_CONFIG_FILES([po/Makefile.in])
 
303
      ])
 
304
  ])
 
305
  AM_CONDITIONAL(BUILD_PO,[test "x${USE_NLS}" = "xyes" -a "x${pandora_have_intltool}" = "xyes"])
227
306
 
228
307
  AS_IF([test "x${gl_LIBOBJS}" != "x"],[
229
308
    AS_IF([test "$GCC" = "yes"],[
240
319
 
241
320
  PANDORA_USE_PIPE
242
321
 
 
322
  AH_TOP([
 
323
#ifndef __CONFIG_H__
 
324
#define __CONFIG_H__
 
325
 
 
326
/* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */
 
327
#if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H)
 
328
#error "You should include config.h as your first include file"
 
329
#endif
 
330
 
 
331
#include "config/top.h"
 
332
])
 
333
  mkdir -p config
 
334
  cat > config/top.h.stamp <<EOF_CONFIG_TOP
 
335
 
 
336
#if defined(i386) && !defined(__i386__)
 
337
#define __i386__
 
338
#endif
 
339
 
 
340
#if defined(_FILE_OFFSET_BITS)
 
341
# undef _FILE_OFFSET_BITS
 
342
#endif
 
343
EOF_CONFIG_TOP
 
344
 
 
345
  diff config/top.h.stamp config/top.h >/dev/null 2>&1 || mv config/top.h.stamp config/top.h
 
346
  rm -f config/top.h.stamp
 
347
 
 
348
  AH_BOTTOM([
 
349
#if defined(__cplusplus)
 
350
# include CSTDINT_H
 
351
# include CINTTYPES_H
 
352
#else
 
353
# include <stdint.h>
 
354
# include <inttypes.h>
 
355
#endif
 
356
 
 
357
#if !defined(HAVE_ULONG) && !defined(__USE_MISC)
 
358
# define HAVE_ULONG 1
 
359
typedef unsigned long int ulong;
 
360
#endif
 
361
 
 
362
/* To hide the platform differences between MS Windows and Unix, I am
 
363
 * going to use the Microsoft way and #define the Microsoft-specific
 
364
 * functions to the unix way. Microsoft use a separate subsystem for sockets,
 
365
 * but Unix normally just use a filedescriptor on the same functions. It is
 
366
 * a lot easier to map back to the unix way with macros than going the other
 
367
 * way without side effect ;-)
 
368
 */
 
369
#ifdef TARGET_OS_WINDOWS
 
370
#define random() rand()
 
371
#define srandom(a) srand(a)
 
372
#define get_socket_errno() WSAGetLastError()
 
373
#else
 
374
#define INVALID_SOCKET -1
 
375
#define SOCKET_ERROR -1
 
376
#define closesocket(a) close(a)
 
377
#define get_socket_errno() errno
 
378
#endif
 
379
 
 
380
#if defined(__cplusplus)
 
381
# if defined(DEBUG)
 
382
#  include <cassert>
 
383
#  include <cstddef>
 
384
# endif
 
385
template<typename To, typename From>
 
386
inline To implicit_cast(From const &f) {
 
387
  return f;
 
388
}
 
389
template<typename To, typename From>     // use like this: down_cast<T*>(foo);
 
390
inline To down_cast(From* f) {                   // so we only accept pointers
 
391
  // Ensures that To is a sub-type of From *.  This test is here only
 
392
  // for compile-time type checking, and has no overhead in an
 
393
  // optimized build at run-time, as it will be optimized away
 
394
  // completely.
 
395
  if (false) {
 
396
    implicit_cast<From*, To>(0);
 
397
  }
 
398
 
 
399
#if defined(DEBUG)
 
400
  assert(f == NULL || dynamic_cast<To>(f) != NULL);  // RTTI: debug mode only!
 
401
#endif
 
402
  return static_cast<To>(f);
 
403
}
 
404
#endif /* defined(__cplusplus) */
 
405
 
 
406
#endif /* __CONFIG_H__ */
 
407
  ])
243
408
 
244
409
  AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
245
410
  AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"