1# $Id$ 2# (c) 2002 Martin Preuss<martin@libchipcard.de> 3# These functions guess your operation system 4 5AC_DEFUN([AQ_CHECK_OS],[ 6dnl IN: 7dnl - AC_CANONICAL_SYSTEM muste be called before 8dnl OUT: 9dnl Variables: 10dnl OSYSTEM: Short name of your system (subst) 11dnl OS_TYPE: either "posix" or "windows" (subst) 12dnl MAKE_DLL_TARGET: under windows this is set to "dll" (subst) 13dnl INSTALL_DLL_TARGET: under Windows this is set to "dll-install" (subst) 14dnl Defines: 15dnl OS_NAME: full name of your system 16dnl OS_SHORTNAME: short name of your system 17dnl Depending on your system one of the following is defined in addition: 18dnl OS_LINUX, OS_OPENBSD, OS_FREEBSD, OS_BEOS, OS_WIN32 19 20# check for OS 21AC_MSG_CHECKING([host system type]) 22OSYSTEM="" 23OS_TYPE="" 24MAKE_DLL_TARGET="" 25INSTALL_DLL_TARGET="" 26AC_DEFINE_UNQUOTED(OS_NAME,"$host", [host system]) 27case "$host" in 28 *-linux*) 29 OSYSTEM="linux" 30 AC_DEFINE(OS_LINUX,1,[if linux is used]) 31 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 32 OS_TYPE="posix" 33 ;; 34 *-solaris*) 35 OSYSTEM="solaris" 36 AC_DEFINE(OS_SOLARIS,1,[if Solaris is used]) 37 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 38 OS_TYPE="posix" 39 ;; 40 *-darwin*) 41 OSYSTEM="osx" 42 AC_DEFINE(OS_DARWIN,1,[if Apple Darwin is used]) 43 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 44 OS_TYPE="posix" 45 ;; 46 *-openbsd*) 47 OSYSTEM="openbsd" 48 AC_DEFINE(OS_OPENBSD,1,[if OpenBSD is used]) 49 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 50 OS_TYPE="posix" 51 ;; 52 *-freebsd* | *-kfreebsd*) 53 OSYSTEM="freebsd" 54 AC_DEFINE(OS_FREEBSD,1,[if FreeBSD is used]) 55 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 56 OS_TYPE="posix" 57 ;; 58 *-netbsd*) 59 OSYSTEM="netbsd" 60 AC_DEFINE(OS_NETBSD,1,[if NetBSD is used]) 61 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 62 OS_TYPE="posix" 63 ;; 64 *-beos*) 65 OSYSTEM="beos" 66 AC_DEFINE(OS_BEOS,1,[if BeOS is used]) 67 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 68 OS_TYPE="posix" 69 ;; 70 *-win32*) 71 OSYSTEM="windows" 72 AC_DEFINE(OS_WIN32,1,[if WIN32 is used]) 73 OS_TYPE="windows" 74 AC_DEFINE_UNQUOTED(BUILDING_DLL,1,[if DLL is to be built]) 75 MAKE_DLL_TARGET="dll" 76 INSTALL_DLL_TARGET="dll-install" 77 ;; 78 *-mingw32*) 79 OSYSTEM="windows" 80 AC_DEFINE(OS_WIN32,1,[if WIN32 is used]) 81 OS_TYPE="windows" 82 AC_DEFINE_UNQUOTED(BUILDING_DLL,1,[if DLL is to be built]) 83 MAKE_DLL_TARGET="dll" 84 INSTALL_DLL_TARGET="dll-install" 85 ;; 86 *-palmos*) 87 OSYSTEM="palmos" 88 AC_DEFINE(OS_PALMOS,1,[if PalmOS is used]) 89 OS_TYPE="palmos" 90 ;; 91 *) 92 AC_MSG_WARN([Sorry, but host $host is not supported. 93 Please report if it works anyway. We will assume that your system 94 is a posix system and continue.]) 95 OSYSTEM="unknown" 96 OS_TYPE="posix" 97 AC_DEFINE(OS_POSIX,1,[if this is a POSIX system]) 98 ;; 99esac 100 101AC_SUBST(OSYSTEM) 102AC_DEFINE_UNQUOTED(OS_SHORTNAME,"$OSYSTEM",[host system]) 103AC_SUBST(OS_TYPE) 104AC_DEFINE_UNQUOTED(OS_TYPE,"$OS_TYPE",[system type]) 105AC_SUBST(MAKE_DLL_TARGET) 106AC_SUBST(INSTALL_DLL_TARGET) 107 108AC_MSG_RESULT($OS_TYPE) 109]) 110 111 112