]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/bacula-macros/os.m4
b82deed5324101b5db045b976b9cb78c15240ab8
[bacula/bacula] / bacula / autoconf / bacula-macros / os.m4
1 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
2
3 dln Author:  Nicolas Boichat
4 dnl License: BSD 2-Clause; see file LICENSE-FOSS
5
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,
10   [
11     AC_TRY_LINK([#include <signal.h>],[
12       sigset_t ss;
13       struct sigaction sa;
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",
18     [
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",
23       [
24         AC_TRY_LINK([
25           #include <signal.h>
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"
31         )]
32       )]
33     )
34   ])
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)
42   fi
43 ])
44
45 AC_DEFUN([BA_CONDITIONAL],
46 [AC_SUBST($1_TRUE)
47 AC_SUBST($1_FALSE)
48 if $2; then
49   $1_TRUE=
50   $1_FALSE='#'
51 else
52   $1_TRUE='#'
53   $1_FALSE=
54 fi])
55
56
57 AC_DEFUN([BA_CHECK_OPSYS],
58 [
59 AC_CYGWIN
60 if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
61 then
62         BA_CONDITIONAL(HAVE_SUN_OS, $TRUEPRG)
63         AC_DEFINE(HAVE_SUN_OS)
64 else
65         BA_CONDITIONAL(HAVE_SUN_OS, $FALSEPRG)
66 fi
67
68 if test $HAVE_UNAME=yes -a x`uname -s` = xGNU
69 then
70         BA_CONDITIONAL(HAVE_HURD_OS, $TRUEPRG)
71         AC_DEFINE(HAVE_HURD_OS)
72 else
73         BA_CONDITIONAL(HAVE_HURD_OS, $FALSEPRG)
74 fi
75
76 if test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
77 then
78         BA_CONDITIONAL(HAVE_OSF1_OS, $TRUEPRG)
79         AC_DEFINE(HAVE_OSF1_OS)
80 else
81         BA_CONDITIONAL(HAVE_OSF1_OS, $FALSEPRG)
82 fi
83
84 if test $HAVE_UNAME=yes -a x`uname -s` = xAIX
85 then
86         BA_CONDITIONAL(HAVE_AIX_OS, $TRUEPRG)
87         AC_DEFINE(HAVE_AIX_OS)
88 else
89         BA_CONDITIONAL(HAVE_AIX_OS, $FALSEPRG)
90 fi
91
92 if test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
93 then
94         BA_CONDITIONAL(HAVE_HPUX_OS, $TRUEPRG)
95         AC_DEFINE(HAVE_HPUX_OS)
96 else
97         BA_CONDITIONAL(HAVE_HPUX_OS, $FALSEPRG)
98 fi
99
100 if test $HAVE_UNAME=yes -a x`uname -s` = xLinux
101 then
102         BA_CONDITIONAL(HAVE_LINUX_OS, $TRUEPRG)
103         AC_DEFINE(HAVE_LINUX_OS)
104 else
105         BA_CONDITIONAL(HAVE_LINUX_OS, $FALSEPRG)
106 fi
107
108 if test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
109 then
110         BA_CONDITIONAL(HAVE_FREEBSD_OS, $TRUEPRG)
111         AC_DEFINE(HAVE_FREEBSD_OS)
112 else
113         BA_CONDITIONAL(HAVE_FREEBSD_OS, $FALSEPRG)
114 fi
115
116 if test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
117 then
118         BA_CONDITIONAL(HAVE_NETBSD_OS, $TRUEPRG)
119         AC_DEFINE(HAVE_NETBSD_OS)
120 else
121         BA_CONDITIONAL(HAVE_NETBSD_OS, $FALSEPRG)
122 fi
123
124 if test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
125 then
126         BA_CONDITIONAL(HAVE_OPENBSD_OS, $TRUEPRG)
127         AC_DEFINE(HAVE_OPENBSD_OS)
128 else
129         BA_CONDITIONAL(HAVE_OPENBSD_OS, $FALSEPRG)
130 fi
131
132 if test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
133 then
134         BA_CONDITIONAL(HAVE_BSDI_OS, $TRUEPRG)
135         AC_DEFINE(HAVE_BSDI_OS)
136 else
137         BA_CONDITIONAL(HAVE_BSDI_OS, $FALSEPRG)
138 fi
139
140 if test $HAVE_UNAME=yes -a x`uname -s` = xSGI
141 then
142         BA_CONDITIONAL(HAVE_SGI_OS, $TRUEPRG)
143         AC_DEFINE(HAVE_SGI_OS)
144 else
145         BA_CONDITIONAL(HAVE_SGI_OS, $FALSEPRG)
146 fi
147
148 if test $HAVE_UNAME=yes -a x`uname -s` = xIRIX -o x`uname -s` = xIRIX64
149 then
150         BA_CONDITIONAL(HAVE_IRIX_OS, $TRUEPRG)
151         AC_DEFINE(HAVE_IRIX_OS)
152 else
153         BA_CONDITIONAL(HAVE_IRIX_OS, $FALSEPRG)
154 fi
155
156 if test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
157 then
158     AM_CONDITIONAL(HAVE_DARWIN_OS, $TRUEPRG)
159     AC_DEFINE(HAVE_DARWIN_OS)
160 else
161     AM_CONDITIONAL(HAVE_DARWIN_OS, $FALSEPRG)
162 fi
163
164 if test $HAVE_UNAME=yes -a x`uname -s` = xGNU/kFreeBSD
165 then
166     AM_CONDITIONAL(HAVE_KFREEBSD_OS, $TRUEPRG)
167     AC_DEFINE(HAVE_KFREEBSD_OS)
168 else
169     AM_CONDITIONAL(HAVE_KFREEBSD_OS, $FALSEPRG)
170 fi
171 ])
172
173 AC_DEFUN([BA_CHECK_OPSYS_DISTNAME],
174 [AC_MSG_CHECKING(for Operating System Distribution)
175 if test "x$DISTNAME" != "x"
176 then
177         echo "distname set to $DISTNAME"
178 elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
179 then
180         DISTNAME=alpha
181 elif test $HAVE_UNAME=yes -a x`uname -s` = xAIX
182 then
183         DISTNAME=aix
184 elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
185 then
186         DISTNAME=hpux
187 elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
188 then
189         DISTNAME=solaris
190 elif test $HAVE_UNAME=yes -a x`uname -s` = xGNU
191 then
192         DISTNAME=hurd
193 elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
194 then
195         DISTNAME=freebsd
196 elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
197 then
198         DISTNAME=netbsd
199 elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
200 then
201         DISTNAME=openbsd
202 elif test $HAVE_UNAME=yes -a x`uname -s` = xIRIX
203 then
204         DISTNAME=irix
205 elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
206 then
207         DISTNAME=bsdi
208 elif test -f /etc/SuSE-release
209 then
210         DISTNAME=suse
211 elif test -d /etc/SuSEconfig
212 then
213         DISTNAME=suse5
214 elif test -f /etc/mandrake-release
215 then
216         DISTNAME=mandrake
217 elif test -f /etc/whitebox-release
218 then
219        DISTNAME=redhat
220 elif test -f /etc/redhat-release
221 then
222         DISTNAME=redhat
223 elif test -f /etc/gentoo-release
224 then
225         DISTNAME=gentoo
226 elif test -f /etc/debian_version
227 then
228         DISTNAME=debian
229 elif test -f /etc/slackware-version
230 then
231         DISTNAME=slackware
232 elif test x$host_vendor = xapple
233 then
234     DISTNAME=osx
235 elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
236 then
237     DISTNAME=darwin
238 elif test -f /etc/engarde-version
239 then
240         DISTNAME=engarde
241 elif test -f /etc/arch-release
242 then
243         DISTNAME=archlinux
244 elif test "$CYGWIN" = yes
245 then
246         DISTNAME=cygwin
247         AC_DEFINE(HAVE_CYGWIN)
248 else
249         DISTNAME=unknown
250 fi
251 AC_MSG_RESULT(done)
252 ])