Merge.
[awesomized/libmemcached] / m4 / pandora_platform.m4
1 dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 dnl
4 dnl pandora-build: A pedantic build system
5 dnl Copyright (C) 2009 Sun Microsystems, Inc.
6 dnl This file is free software; Sun Microsystems
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
9 dnl
10 dnl From Monty Taylor
11
12 AC_DEFUN([PANDORA_PLATFORM],[
13
14 dnl Canonicalize the configuration name.
15
16 AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"],[Vendor of Build System])
17 AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [OS of Build System])
18 AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [CPU of Build System])
19
20 AC_DEFINE_UNQUOTED([TARGET_VENDOR], ["$target_vendor"],[Vendor of Target System])
21 AC_DEFINE_UNQUOTED([TARGET_OS], ["$target_os"], [OS of Target System])
22 AC_DEFINE_UNQUOTED([TARGET_CPU], ["$target_cpu"], [CPU of Target System])
23
24
25 case "$host_os" in
26 *solaris*|*freebsd*)
27 AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[
28 CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
29 ])
30
31 AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
32 LDFLAGS="${LDFLAGS} -L/usr/local/lib"
33 ])
34 ;;
35 esac
36
37 PANDORA_OPTIMIZE_BITFIELD=1
38
39 case "$target_os" in
40 *linux*)
41 TARGET_LINUX="true"
42 AC_SUBST(TARGET_LINUX)
43 AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
44 ;;
45 *darwin*)
46 TARGET_OSX="true"
47 AC_SUBST(TARGET_OSX)
48 AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
49 ;;
50 *solaris*)
51 TARGET_SOLARIS="true"
52 PANDORA_OPTIMIZE_BITFIELD=0
53 AC_SUBST(TARGET_SOLARIS)
54 AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
55 ;;
56 *freebsd*)
57 TARGET_FREEBSD="true"
58 AC_SUBST(TARGET_FREEBSD)
59 AC_DEFINE([TARGET_OS_FREEBSD], [1], [Whether we are building for FreeBSD])
60 AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])
61 ;;
62 *)
63 ;;
64 esac
65
66 AC_SUBST(PANDORA_OPTIMIZE_BITFIELD)
67
68 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
69 AC_CHECK_DECL([__ICC], [INTELCC="yes"], [INTELCC="no"])
70
71 AS_IF([test "$INTELCC" = "yes"], [enable_rpath=no])
72
73 dnl By default, Sun Studio grabs special versions of limits.h and string.h
74 dnl when you use <cstring> and <climits>. By setting this define, we can
75 dnl disable that and cause those to wrap the standard headers instead.
76 dnl http://www.stlport.com/doc/configure.html
77 AS_IF([test "$SUNCC" = "yes"],[
78 AC_DEFINE([_STLP_NO_NEW_C_HEADERS],[1],
79 [Cause Sun Studio to not be quite so strict with standards conflicts])
80 ])
81
82 AS_IF([test "x$TARGET_OSX" = "xtrue"],[
83 AS_IF([test "x$ac_enable_fat_binaries" = "xyes"],[
84 AM_CFLAGS="-arch i386 -arch x86_64 -arch ppc"
85 AM_CXXFLAGS="-arch i386 -arch x86_64 -arch ppc"
86 AM_LDFLAGS="-arch i386 -arch x86_64 -arch ppc"
87 ])
88 ])
89
90 ])