Merge lp:~tangent-org/libmemcached/1.0-build/ Build: jenkins-Libmemcached-187
[m6w6/libmemcached] / m4 / ax_platform.m4
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_count_cpus.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_PLATFORM
8 #
9 # DESCRIPTION
10 #
11 # Provide target and host defines.
12 #
13 # LICENSE
14 #
15 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
16 #
17 # Copying and distribution of this file, with or without modification, are
18 # permitted in any medium without royalty provided the copyright notice
19 # and this notice are preserved. This file is offered as-is, without any
20 # warranty.
21
22 #serial 1
23 AC_DEFUN([AX_PLATFORM],
24 [AC_REQUIRE([AC_CANONICAL_HOST])
25 AC_REQUIRE([AC_CANONICAL_TARGET])
26
27 AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System])
28 AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System])
29 AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System])
30
31 AC_DEFINE_UNQUOTED([TARGET_VENDOR],["$target_vendor"],[Vendor of Target System])
32 AC_DEFINE_UNQUOTED([TARGET_OS],["$target_os"], [OS of Target System])
33 AC_DEFINE_UNQUOTED([TARGET_CPU],["$target_cpu"], [CPU of Target System])
34
35 AS_CASE([$target_os],
36 [*mingw32*],
37 [AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows])
38 AC_DEFINE([WINVER], [WindowsXP], [Version of Windows])
39 AC_DEFINE([_WIN32_WINNT], [0x0501], [Magical number to make things work])
40 AC_DEFINE([EAI_SYSTEM], [11], [Another magical number])
41 AH_BOTTOM([
42 #ifndef HAVE_SYS_SOCKET_H
43 # define SHUT_RD SD_RECEIVE
44 # define SHUT_WR SD_SEND
45 # define SHUT_RDWR SD_BOTH
46 #endif
47 ])],
48 [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])
49 AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
50 [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])],
51 [*darwin*],[AC_DEFINE([TARGET_OS_OSX],[1],[Whether we build for OSX])],
52 [*linux*],[AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])])
53
54 AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"])
55 AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"])
56 AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"])
57 ])