]> git.sur5r.net Git - bacula/bacula/blob - bacula/autoconf/bacula-macros/os.m4
Merge branch 'master' of ssh://ricozz@bacula.git.sourceforge.net/gitroot/bacula/bacula
[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` = xOSF1
66 then
67         BA_CONDITIONAL(HAVE_OSF1_OS, $TRUEPRG)
68         AC_DEFINE(HAVE_OSF1_OS)
69 else
70         BA_CONDITIONAL(HAVE_OSF1_OS, $FALSEPRG)
71 fi
72
73 if test $HAVE_UNAME=yes -a x`uname -s` = xAIX
74 then
75         BA_CONDITIONAL(HAVE_AIX_OS, $TRUEPRG)
76         AC_DEFINE(HAVE_AIX_OS)
77 else
78         BA_CONDITIONAL(HAVE_AIX_OS, $FALSEPRG)
79 fi
80
81 if test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
82 then
83         BA_CONDITIONAL(HAVE_HPUX_OS, $TRUEPRG)
84         AC_DEFINE(HAVE_HPUX_OS)
85 else
86         BA_CONDITIONAL(HAVE_HPUX_OS, $FALSEPRG)
87 fi
88
89 if test $HAVE_UNAME=yes -a x`uname -s` = xLinux
90 then
91         BA_CONDITIONAL(HAVE_LINUX_OS, $TRUEPRG)
92         AC_DEFINE(HAVE_LINUX_OS)
93 else
94         BA_CONDITIONAL(HAVE_LINUX_OS, $FALSEPRG)
95 fi
96
97 if test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
98 then
99         BA_CONDITIONAL(HAVE_FREEBSD_OS, $TRUEPRG)
100         AC_DEFINE(HAVE_FREEBSD_OS)
101 else
102         BA_CONDITIONAL(HAVE_FREEBSD_OS, $FALSEPRG)
103 fi
104
105 if test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
106 then
107         BA_CONDITIONAL(HAVE_NETBSD_OS, $TRUEPRG)
108         AC_DEFINE(HAVE_NETBSD_OS)
109 else
110         BA_CONDITIONAL(HAVE_NETBSD_OS, $FALSEPRG)
111 fi
112
113 if test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
114 then
115         BA_CONDITIONAL(HAVE_OPENBSD_OS, $TRUEPRG)
116         AC_DEFINE(HAVE_OPENBSD_OS)
117 else
118         BA_CONDITIONAL(HAVE_OPENBSD_OS, $FALSEPRG)
119 fi
120
121 if test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
122 then
123         BA_CONDITIONAL(HAVE_BSDI_OS, $TRUEPRG)
124         AC_DEFINE(HAVE_BSDI_OS)
125 else
126         BA_CONDITIONAL(HAVE_BSDI_OS, $FALSEPRG)
127 fi
128
129 if test $HAVE_UNAME=yes -a x`uname -s` = xSGI
130 then
131         BA_CONDITIONAL(HAVE_SGI_OS, $TRUEPRG)
132         AC_DEFINE(HAVE_SGI_OS)
133 else
134         BA_CONDITIONAL(HAVE_SGI_OS, $FALSEPRG)
135 fi
136
137 if test $HAVE_UNAME=yes -a x`uname -s` = xIRIX -o x`uname -s` = xIRIX64
138 then
139         BA_CONDITIONAL(HAVE_IRIX_OS, $TRUEPRG)
140         AC_DEFINE(HAVE_IRIX_OS)
141 else
142         BA_CONDITIONAL(HAVE_IRIX_OS, $FALSEPRG)
143 fi
144
145 if test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
146 then
147     AM_CONDITIONAL(HAVE_DARWIN_OS, $TRUEPRG)
148     AC_DEFINE(HAVE_DARWIN_OS)
149 else
150     AM_CONDITIONAL(HAVE_DARWIN_OS, $FALSEPRG)
151 fi
152 ])
153
154 AC_DEFUN([BA_CHECK_OPSYS_DISTNAME],
155 [AC_MSG_CHECKING(for Operating System Distribution)
156 if test "x$DISTNAME" != "x"
157 then
158         echo "distname set to $DISTNAME"
159 elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1
160 then
161         DISTNAME=alpha
162 elif test $HAVE_UNAME=yes -a x`uname -s` = xAIX
163 then
164         DISTNAME=aix
165 elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX
166 then
167         DISTNAME=hpux
168 elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS
169 then
170         DISTNAME=solaris
171 elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD
172 then
173         DISTNAME=freebsd
174 elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD
175 then
176         DISTNAME=netbsd
177 elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD
178 then
179         DISTNAME=openbsd
180 elif test $HAVE_UNAME=yes -a x`uname -s` = xIRIX
181 then
182         DISTNAME=irix
183 elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS
184 then
185         DISTNAME=bsdi
186 elif test -f /etc/SuSE-release
187 then
188         DISTNAME=suse
189 elif test -d /etc/SuSEconfig
190 then
191         DISTNAME=suse5
192 elif test -f /etc/mandrake-release
193 then
194         DISTNAME=mandrake
195 elif test -f /etc/whitebox-release
196 then
197        DISTNAME=redhat
198 elif test -f /etc/redhat-release
199 then
200         DISTNAME=redhat
201 elif test -f /etc/gentoo-release
202 then
203         DISTNAME=gentoo
204 elif test -f /etc/debian_version
205 then
206         DISTNAME=debian
207 elif test -f /etc/slackware-version
208 then
209         DISTNAME=slackware
210 elif test x$host_vendor = xapple
211 then
212     DISTNAME=osx
213 elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin
214 then
215     DISTNAME=darwin
216 elif test -f /etc/engarde-version
217 then
218         DISTNAME=engarde
219 elif test "$CYGWIN" = yes
220 then
221         DISTNAME=cygwin
222         AC_DEFINE(HAVE_CYGWIN)
223 else
224         DISTNAME=unknown
225 fi
226 AC_MSG_RESULT(done)
227 ])