ax_platform.m4 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # ===========================================================================
  2. # http://
  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-2013 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. #serial 4
  22. #
  23. AC_DEFUN([AX_PLATFORM],
  24. [AC_REQUIRE([AC_CANONICAL_HOST])
  25. AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System])
  26. AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System])
  27. AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System])
  28. AS_CASE([$host_os],
  29. [*mingw*],
  30. [HOST_WINDOWS="true"
  31. AC_DEFINE([HOST_OS_WINDOWS], [1], [Whether we are building for Windows])
  32. AC_DEFINE([EAI_SYSTEM], [11], [Another magical number])
  33. AH_BOTTOM([
  34. #ifndef HAVE_SYS_SOCKET_H
  35. # define SHUT_RD SD_RECEIVE
  36. # define SHUT_WR SD_SEND
  37. # define SHUT_RDWR SD_BOTH
  38. #endif
  39. ])],
  40. [*freebsd*],[AC_DEFINE([HOST_OS_FREEBSD],[1],[Whether we are building for FreeBSD])
  41. AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
  42. [*solaris*],[AC_DEFINE([HOST_OS_SOLARIS],[1],[Whether we are building for Solaris])],
  43. [*darwin*],
  44. [HOST_OSX="true"],
  45. [*linux*],
  46. [HOST_LINUX="true"
  47. AC_DEFINE([HOST_OS_LINUX],[1],[Whether we build for Linux])])
  48. AM_CONDITIONAL([BUILD_WIN32],[test "x${HOST_WINDOWS}" = "xtrue"])
  49. AM_CONDITIONAL([HOST_OSX],[test "x${HOST_OSX}" = "xtrue"])
  50. AM_CONDITIONAL([HOST_LINUX],[test "x${HOST_LINUX}" = "xtrue"])
  51. AM_CONDITIONAL([HOST_FREEBSD],[test "x${HOST_OS_FREEBSD}" = "xtrue"])
  52. ])