libgeda: Remove some exit() calls and assertions.
[geda-gaf/peter-b.git] / m4 / geda-host.m4
blob5e065414ebd6aa15f72240c71a59d51eff2a56e2
1 # geda-host.m4                                          -*-Autoconf-*-
2 # serial 1
4 dnl Checks for host platform and features
5 dnl Copyright (C) 2011  Peter TB Brett <peter@peter-b.co.uk>
6 dnl
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
11 dnl
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl GNU General Public License for more details.
16 dnl
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 AC_DEFUN([AX_HOST],
23   AC_PREREQ([2.60])dnl
24   AC_REQUIRE([AC_CANONICAL_HOST])dnl
26   # Need to distinguish between native Windows (via MinGW) and Unix
27   # compat. layer on Windows (Cygwin).
28   OS_WIN32_NATIVE=no
29   OS_CYGWIN=no
30   OS_LINUX=no
31   case "$host" in
32     *-*-linux*)
33       OS_LINUX=yes
34       AC_DEFINE([OS_LINUX], [1],
35                 [Define to 1 if on Linux.])
36       ;;
37     *-*-mingw*)
38       OS_WIN32_NATIVE=yes
39       AC_DEFINE([OS_WIN32_NATIVE], [1],
40                 [Define to 1 if on native Windows.])
41       ;;
42     *-*-cygwin*)
43       OS_CYGWIN=yes
44       AC_DEFINE([OS_CYGWIN], [1],
45                 [Define to 1 if on Cygwin.])
46       ;;
47     *)
48       ;;
49   esac
51   AC_MSG_CHECKING([for Linux host])
52   AC_MSG_RESULT([$OS_LINUX])
54   AC_MSG_CHECKING([for Windows host])
55   OS_WIN32=no
56   if test "$OS_WIN32_NATIVE" = "yes" ||
57      test "$OS_CYGWIN" = "yes" ; then
58     OS_WIN32=yes
59     AC_DEFINE([OS_WIN32], [1],
60               [Define to 1 if on Windows.])
61   fi
62   AC_MSG_RESULT([$OS_WIN32])
64   AC_MSG_CHECKING([for Cygwin host])
65   AC_MSG_RESULT([$OS_CYGWIN])
67   # Carbon is the best way to check for OSX.  There are some non-OSX
68   # Darwin platforms out there!
69   AC_MSG_CHECKING([for Mac OS X Carbon host])
70   OS_CARBON=no
71   AC_TRY_CPP([
72   #include <Carbon/Carbon.h>
73   #include <CoreServices/CoreServices.h>
74   ],[
75     OS_CARBON=yes
76     AC_DEFINE([OS_CARBON], [1],
77               [Define to 1 if on Mac OS X Carbon.])])
78   AC_MSG_RESULT([$OS_CARBON])