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