1 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
3 dln Author: Nicolas Boichat
4 dnl License: BSD 2-Clause; see file LICENSE-FOSS
6 AC_DEFUN([SIGNAL_CHECK],
7 [AC_REQUIRE([AC_TYPE_SIGNAL])
8 AC_MSG_CHECKING(for type of signal functions)
9 AC_CACHE_VAL(bash_cv_signal_vintage,
11 AC_TRY_LINK([#include <signal.h>],[
14 sigemptyset(&ss); sigsuspend(&ss);
15 sigaction(SIGINT, &sa, (struct sigaction *) 0);
16 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
17 ], bash_cv_signal_vintage="posix",
19 AC_TRY_LINK([#include <signal.h>], [
20 int mask = sigmask(SIGINT);
21 sigsetmask(mask); sigblock(mask); sigpause(mask);
22 ], bash_cv_signal_vintage="4.2bsd",
26 RETSIGTYPE foo() { }], [
27 int mask = sigmask(SIGINT);
28 sigset(SIGINT, foo); sigrelse(SIGINT);
29 sighold(SIGINT); sigpause(SIGINT);
30 ], bash_cv_signal_vintage="svr3", bash_cv_signal_vintage="v7"
35 AC_MSG_RESULT($bash_cv_signal_vintage)
36 if test "$bash_cv_signal_vintage" = "posix"; then
37 AC_DEFINE(HAVE_POSIX_SIGNALS)
38 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
39 AC_DEFINE(HAVE_BSD_SIGNALS)
40 elif test "$bash_cv_signal_vintage" = "svr3"; then
41 AC_DEFINE(HAVE_USG_SIGHOLD)
45 AC_DEFUN([BA_CONDITIONAL],
57 AC_DEFUN([BA_CHECK_OPSYS],
60 if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
62 BA_CONDITIONAL(HAVE_SUN_OS, $TRUEPRG)
63 AC_DEFINE(HAVE_SUN_OS)
65 BA_CONDITIONAL(HAVE_SUN_OS, $FALSEPRG)
68 if test $HAVE_UNAME=yes -a x`uname -s` = xGNU
70 BA_CONDITIONAL(HAVE_HURD_OS, $TRUEPRG)
71 AC_DEFINE(HAVE_HURD_OS)
73 BA_CONDITIONAL(HAVE_HURD_OS, $FALSEPRG)
76 if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
78 BA_CONDITIONAL(HAVE_OSF1_OS, $TRUEPRG)
79 AC_DEFINE(HAVE_OSF1_OS)
81 BA_CONDITIONAL(HAVE_OSF1_OS, $FALSEPRG)
84 if test $HAVE_UNAME=yes -a x`uname -s` = xAIX
86 BA_CONDITIONAL(HAVE_AIX_OS, $TRUEPRG)
87 AC_DEFINE(HAVE_AIX_OS)
89 BA_CONDITIONAL(HAVE_AIX_OS, $FALSEPRG)
92 if test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
94 BA_CONDITIONAL(HAVE_HPUX_OS, $TRUEPRG)
95 AC_DEFINE(HAVE_HPUX_OS)
97 BA_CONDITIONAL(HAVE_HPUX_OS, $FALSEPRG)
100 if test $HAVE_UNAME=yes -a x`uname -s` = xLinux
102 BA_CONDITIONAL(HAVE_LINUX_OS, $TRUEPRG)
103 AC_DEFINE(HAVE_LINUX_OS)
105 BA_CONDITIONAL(HAVE_LINUX_OS, $FALSEPRG)
108 if test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
110 BA_CONDITIONAL(HAVE_FREEBSD_OS, $TRUEPRG)
111 AC_DEFINE(HAVE_FREEBSD_OS)
113 BA_CONDITIONAL(HAVE_FREEBSD_OS, $FALSEPRG)
116 if test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
118 BA_CONDITIONAL(HAVE_NETBSD_OS, $TRUEPRG)
119 AC_DEFINE(HAVE_NETBSD_OS)
121 BA_CONDITIONAL(HAVE_NETBSD_OS, $FALSEPRG)
124 if test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
126 BA_CONDITIONAL(HAVE_OPENBSD_OS, $TRUEPRG)
127 AC_DEFINE(HAVE_OPENBSD_OS)
129 BA_CONDITIONAL(HAVE_OPENBSD_OS, $FALSEPRG)
132 if test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
134 BA_CONDITIONAL(HAVE_BSDI_OS, $TRUEPRG)
135 AC_DEFINE(HAVE_BSDI_OS)
137 BA_CONDITIONAL(HAVE_BSDI_OS, $FALSEPRG)
140 if test $HAVE_UNAME=yes -a x`uname -s` = xSGI
142 BA_CONDITIONAL(HAVE_SGI_OS, $TRUEPRG)
143 AC_DEFINE(HAVE_SGI_OS)
145 BA_CONDITIONAL(HAVE_SGI_OS, $FALSEPRG)
148 if test $HAVE_UNAME=yes -a x`uname -s` = xIRIX -o x`uname -s` = xIRIX64
150 BA_CONDITIONAL(HAVE_IRIX_OS, $TRUEPRG)
151 AC_DEFINE(HAVE_IRIX_OS)
153 BA_CONDITIONAL(HAVE_IRIX_OS, $FALSEPRG)
156 if test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
158 AM_CONDITIONAL(HAVE_DARWIN_OS, $TRUEPRG)
159 AC_DEFINE(HAVE_DARWIN_OS)
161 AM_CONDITIONAL(HAVE_DARWIN_OS, $FALSEPRG)
164 if test $HAVE_UNAME=yes -a x`uname -s` = xGNU/kFreeBSD
166 AM_CONDITIONAL(HAVE_KFREEBSD_OS, $TRUEPRG)
167 AC_DEFINE(HAVE_KFREEBSD_OS)
169 AM_CONDITIONAL(HAVE_KFREEBSD_OS, $FALSEPRG)
173 AC_DEFUN([BA_CHECK_OPSYS_DISTNAME],
174 [AC_MSG_CHECKING(for Operating System Distribution)
175 if test "x$DISTNAME" != "x"
177 echo "distname set to $DISTNAME"
178 elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
181 elif test $HAVE_UNAME=yes -a x`uname -s` = xAIX
184 elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
187 elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
190 elif test $HAVE_UNAME=yes -a x`uname -s` = xGNU
193 elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
196 elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
199 elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
202 elif test $HAVE_UNAME=yes -a x`uname -s` = xIRIX
205 elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
208 elif test -f /etc/SuSE-release
211 elif test -d /etc/SuSEconfig
214 elif test -f /etc/mandrake-release
217 elif test -f /etc/whitebox-release
220 elif test -f /etc/redhat-release
223 elif test -f /etc/gentoo-release
226 elif test -f /etc/debian_version
229 elif test -f /etc/slackware-version
232 elif test x$host_vendor = xapple
235 elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
238 elif test -f /etc/engarde-version
241 elif test -f /etc/arch-release
244 elif test "$CYGWIN" = yes
247 AC_DEFINE(HAVE_CYGWIN)