1 dnl test whether dirent has a d_off member
2 AC_DEFUN(AC_DIRENT_D_OFF,
3 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
7 #include <dirent.h>], [struct dirent d; d.d_off;],
8 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
9 if test $ac_cv_dirent_d_off = yes; then
10 AC_DEFINE(HAVE_DIRENT_D_OFF,1,[Whether dirent has a d_off member])
14 dnl Mark specified module as shared
15 dnl SMB_MODULE(name,static_files,shared_files,subsystem,whatif-static,whatif-shared)
18 AC_MSG_CHECKING([how to build $1])
19 if test "$[MODULE_][$1]"; then
21 elif test "$[MODULE_]translit([$4], [A-Z], [a-z])" -a "$[MODULE_DEFAULT_][$1]"; then
22 DEST=$[MODULE_]translit([$4], [A-Z], [a-z])
24 DEST=$[MODULE_DEFAULT_][$1]
27 if test x"$DEST" = xSHARED; then
28 AC_DEFINE([$1][_init], [init_samba_module], [Whether to build $1 as shared module])
29 $4_MODULES="$$4_MODULES $3"
30 AC_MSG_RESULT([shared])
32 string_shared_modules="$string_shared_modules $1"
33 elif test x"$DEST" = xSTATIC; then
34 [init_static_modules_]translit([$4], [A-Z], [a-z])="$[init_static_modules_]translit([$4], [A-Z], [a-z]) $1_init();"
35 [decl_static_modules_]translit([$4], [A-Z], [a-z])="$[decl_static_modules_]translit([$4], [A-Z], [a-z]) extern NTSTATUS $1_init(void);"
36 string_static_modules="$string_static_modules $1"
37 $4_STATIC="$$4_STATIC $2"
40 AC_MSG_RESULT([static])
42 string_ignored_modules="$string_ignored_modules $1"
47 AC_DEFUN(SMB_SUBSYSTEM,
51 AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
52 AC_DEFINE_UNQUOTED([static_decl_]translit([$1], [A-Z], [a-z]), [$decl_static_modules_]translit([$1], [A-Z], [a-z]), [Decl of Static init functions])
53 ifelse([$2], , :, [rm -f $2])
57 dnl SMB_LIBRARY(name, default)
59 dnl configure build and use of an (internal) shared library
61 AC_DEFUN([SMB_LIBRARY],
63 m4_pushdef([LIBNAME], [lib$1])
64 m4_pushdef([LIBUC], [m4_toupper(LIBNAME)])
65 m4_pushdef([LIBLIBS], [-l$1])
67 LIBUC[_SHARED_TARGET]=bin/LIBNAME.$SHLIBEXT
68 LIBUC[_STATIC_TARGET]=bin/LIBNAME.a
75 AC_SUBST(LIBUC[_SHARED_TARGET])
76 AC_SUBST(LIBUC[_STATIC_TARGET])
77 AC_SUBST(LIBUC[_SHARED])
78 AC_SUBST(LIBUC[_STATIC])
79 AC_SUBST(LIBUC[_LIBS])
80 AC_SUBST([INSTALL_]LIBUC)
81 AC_SUBST([UNINSTALL_]LIBUC)
83 AC_MSG_CHECKING([whether to build the LIBNAME shared library])
85 dnl set the default to not build the shared lib
87 AS_HELP_STRING([--with-]LIBNAME,
89 [Build the LIBNAME shared library (default=no)],
90 [Build the LIBNAME shared library (default=no ($3))])),
103 # if unspecified, default is not to build
109 dnl by default, try to build the shared lib
111 AS_HELP_STRING([--with-]LIBNAME,
112 [Build the LIBNAME shared library (default=yes if shared libs supported)]),
125 # if unspecified, default is to build it if possible.
131 if eval test x"$build_lib" = "xyes" ; then
132 # only set the install targets if the user chose the library
133 [INSTALL_]LIBUC=[install]LIBNAME
134 [UNINSTALL_]LIBUC=[uninstall]LIBNAME
135 if eval $BLDSHARED = true; then
136 LIBUC[_SHARED]=$LIBUC[_SHARED_TARGET]
138 if test x"$USESHARED" != x"true" -o x"$[LINK_]LIBUC" = "xSTATIC" ; then
139 LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET]
145 AC_MSG_RESULT(no shared library support -- will supply static library)
149 AC_MSG_RESULT(shared library not selected, but will supply static library)
151 if test $enable_static = yes; then
152 LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET]
162 dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
163 dnl Check for a function in a library, but don't keep adding the same library
164 dnl to the LIBS variable. Check whether the function is available in the
165 dnl current LIBS before adding the library which prevents us spuriously
166 dnl adding libraries for symbols that are in libc.
168 dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
169 dnl is always added to $LIBS if it was found to be necessary. The caller
170 dnl can use SMB_REMOVE_LIB to strp this if necessary.
171 AC_DEFUN([AC_LIBTESTFUNC],
175 # $2 was found in libc or existing $LIBS
181 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
182 [Whether $2 is available])
186 # $2 was not found, try adding lib$1
194 # $2 was not found and we already had lib$1
195 # nothing to do here by default
200 # $2 was not found, try adding lib$1
209 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
210 [Whether $2 is available])
219 # $2 was not found in lib$1
220 # nothing to do here by default
229 # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
230 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
231 # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
232 # ------------------------------------------------------
234 # Use a cache variable name containing both the library and function name,
235 # because the test really is for library $1 defining function $3, not
236 # just for library $1. Separate tests with the same $1 and different $3s
237 # may have different results.
239 # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
240 # is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
241 # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
242 # the AS_LITERAL_IF indirection.
244 # FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
245 # whatever the FUNCTION, in addition to not being a *S macro. Note
246 # that the cache does depend upon the function we are looking for.
248 # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
249 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
250 # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
251 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
253 AC_DEFUN([AC_CHECK_LIB_EXT],
255 AH_CHECK_LIB_EXT([$1])
256 ac_check_lib_ext_save_LIBS=$LIBS
257 LIBS="-l$1 $$2 $7 $LIBS"
259 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
260 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
264 AH_CHECK_FUNC_EXT([$3])
266 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
267 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
268 AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
269 [AC_TRY_LINK_FUNC($3,
270 [AS_VAR_SET(ac_Lib_func, yes);
271 AS_VAR_SET(ac_Lib_ext, yes)],
272 [AS_VAR_SET(ac_Lib_func, no);
273 AS_VAR_SET(ac_Lib_ext, no)])
275 AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
276 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
277 AS_VAR_POPDEF([ac_Lib_func])dnl
279 AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
280 [AC_TRY_LINK_FUNC([main],
281 [AS_VAR_SET(ac_Lib_ext, yes)],
282 [AS_VAR_SET(ac_Lib_ext, no)])
285 LIBS=$ac_check_lib_ext_save_LIBS
287 AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
289 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
300 AS_VAR_POPDEF([ac_Lib_ext])dnl
303 # AH_CHECK_LIB_EXT(LIBNAME)
304 # ---------------------
305 m4_define([AH_CHECK_LIB_EXT],
306 [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
307 [Define to 1 if you have the `]$1[' library (-l]$1[).])])
309 # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
310 # -----------------------------------------------------------------
311 dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
312 dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
313 AC_DEFUN([AC_CHECK_FUNC_EXT],
315 AH_CHECK_FUNC_EXT($1)
316 ac_check_func_ext_save_LIBS=$LIBS
318 AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
319 AC_CACHE_CHECK([for $1], ac_var,
320 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
321 [AS_VAR_SET(ac_var, yes)],
322 [AS_VAR_SET(ac_var, no)])])
323 LIBS=$ac_check_func_ext_save_LIBS
324 AS_IF([test AS_VAR_GET(ac_var) = yes],
325 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
327 AS_VAR_POPDEF([ac_var])dnl
330 # AH_CHECK_FUNC_EXT(FUNCNAME)
331 # ---------------------
332 m4_define([AH_CHECK_FUNC_EXT],
333 [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
334 [Define to 1 if you have the `]$1[' function.])])
336 dnl Define an AC_DEFINE with ifndef guard.
337 dnl AC_N_DEFINE(VARIABLE [, VALUE])
339 [cat >> confdefs.h <<\EOF
341 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
347 dnl AC_ADD_INCLUDE(VARIABLE)
348 define(AC_ADD_INCLUDE,
349 [cat >> confdefs.h <<\EOF
354 dnl Copied from libtool.m4
355 AC_DEFUN(AC_PROG_LD_GNU,
356 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
357 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
358 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
359 ac_cv_prog_gnu_ld=yes
365 dnl Removes -I/usr/include/? from given variable
366 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
370 -I/usr/include|-I/usr/include/) ;;
371 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
377 dnl Removes '-L/usr/lib[/]', '-Wl,-rpath,/usr/lib[/]'
378 dnl and '-Wl,-rpath -Wl,/usr/lib[/]' from given variable
379 AC_DEFUN(LIB_REMOVE_USR_LIB,[
386 -Wl,-rpath,/usr/lib) ;;
387 -Wl,-rpath,/usr/lib/) ;;
389 -Wl,-rpath-Wl,/usr/lib) l="";;
390 -Wl,-rpath-Wl,/usr/lib/) l="";;
393 if test x"[$]ac_new_flags" = x""; then
396 if test x"[$]l" = x""; then
397 ac_new_flags="[$]ac_new_flags[$]s[$]i";
399 ac_new_flags="[$]ac_new_flags[$]s[$]l [$]i";
408 dnl From Bruno Haible.
412 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
413 dnl those with the standalone portable libiconv installed).
414 AC_MSG_CHECKING(for iconv in $1)
415 jm_cv_func_iconv="no"
420 dnl Check for include in funny place but no lib needed
421 if test "$jm_cv_func_iconv" != yes; then
422 AC_TRY_LINK([#include <stdlib.h>
423 #include <giconv.h>],
424 [iconv_t cd = iconv_open("","");
425 iconv(cd,NULL,NULL,NULL,NULL);
428 jm_cv_include="giconv.h"
432 dnl Standard iconv.h include, lib in glibc or libc ...
433 if test "$jm_cv_func_iconv" != yes; then
434 AC_TRY_LINK([#include <stdlib.h>
436 [iconv_t cd = iconv_open("","");
437 iconv(cd,NULL,NULL,NULL,NULL);
439 jm_cv_include="iconv.h"
443 if test "$jm_cv_lib_iconv" != yes; then
445 LIBS="$LIBS -lgiconv"
446 AC_TRY_LINK([#include <stdlib.h>
447 #include <giconv.h>],
448 [iconv_t cd = iconv_open("","");
449 iconv(cd,NULL,NULL,NULL,NULL);
453 jm_cv_include="giconv.h"
455 jm_cv_lib_iconv="giconv")
459 if test "$jm_cv_func_iconv" != yes; then
462 AC_TRY_LINK([#include <stdlib.h>
464 [iconv_t cd = iconv_open("","");
465 iconv(cd,NULL,NULL,NULL,NULL);
467 jm_cv_include="iconv.h"
469 jm_cv_lib_iconv="iconv")
472 if test "$jm_cv_lib_iconv" != yes; then
474 LIBS="$LIBS -lbiconv"
475 AC_TRY_LINK([#include <stdlib.h>
476 #include <biconv.h>],
477 [iconv_t cd = iconv_open("","");
478 iconv(cd,NULL,NULL,NULL,NULL);
482 jm_cv_include="biconv.h"
484 jm_cv_lib_iconv="biconv")
492 if test "$jm_cv_func_iconv" = yes; then
493 if test "$jm_cv_giconv" = yes; then
494 AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
498 if test "$jm_cv_biconv" = yes; then
499 AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
503 AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
513 AC_DEFUN(rjs_CHARSET,[
514 dnl Find out if we can convert from $1 to UCS2-LE
515 AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
517 #include <$jm_cv_include>
519 iconv_t cd = iconv_open("$1", "UCS-2LE");
520 if (cd == 0 || cd == (iconv_t)-1) {
525 ],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
526 AC_MSG_RESULT($ICONV_CHARSET)
529 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
530 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
531 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
533 AC_DEFUN([AC_ENABLE_SHARED],
534 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
535 AC_ARG_ENABLE(shared,
536 changequote(<<, >>)dnl
537 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
539 [p=${PACKAGE-default}
541 yes) enable_shared=yes ;;
542 no) enable_shared=no ;;
545 # Look at the argument we got. We use all the common list separators.
546 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
547 for pkg in $enableval; do
548 if test "X$pkg" = "X$p"; then
556 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
559 dnl AC_ENABLE_STATIC - implement the --enable-static flag
560 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
561 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
563 AC_DEFUN([AC_ENABLE_STATIC],
564 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
565 AC_ARG_ENABLE(static,
566 changequote(<<, >>)dnl
567 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
569 [p=${PACKAGE-default}
571 yes) enable_static=yes ;;
572 no) enable_static=no ;;
575 # Look at the argument we got. We use all the common list separators.
576 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
577 for pkg in $enableval; do
578 if test "X$pkg" = "X$p"; then
585 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
588 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
589 AC_DEFUN([AC_DISABLE_STATIC],
590 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
591 AC_ENABLE_STATIC(no)])
593 dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
594 dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
595 dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
596 AC_DEFUN( [AC_TRY_RUN_STRICT],
598 old_CFLAGS="$CFLAGS";
601 old_CPPFLAGS="$CPPFLAGS";
604 old_LDFLAGS="$LDFLAGS";
607 AC_TRY_RUN([$1],[$5],[$6],[$7])
608 CFLAGS="$old_CFLAGS";
611 CPPFLAGS="$old_CPPFLAGS";
614 LDFLAGS="$old_LDFLAGS";
619 dnl SMB_CHECK_SYSCONF(varname)
620 dnl Tests whether the sysconf(3) variable "varname" is available.
621 AC_DEFUN([SMB_CHECK_SYSCONF],
623 AC_CACHE_CHECK([for sysconf($1)],
626 AC_TRY_LINK([#include <unistd.h>],
627 [ return sysconf($1) == -1 ? 1 : 0; ],
628 [ samba_cv_SYSCONF$1=yes ],
629 [ samba_cv_SYSCONF$1=no ])
632 if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
633 AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
637 dnl SMB_IS_LIBPTHREAD_LINKED([actions if true], [actions if false])
638 dnl Test whether the current LIBS results in libpthread being present.
639 dnl Execute the corresponding user action list.
640 AC_DEFUN([SMB_IS_LIBPTHREAD_LINKED],
642 AC_MSG_CHECKING(if libpthread is linked)
644 [return pthread_create(0, 0, 0, 0);],
655 dnl SMB_REMOVE_LIB(lib)
656 dnl Remove the given library from $LIBS
657 AC_DEFUN([SMB_REMOVE_LIB],
659 LIBS=`echo $LIBS | sed '-es/-l$1//g'`
662 dnl SMB_CHECK_DMAPI([actions if true], [actions if false])
663 dnl Check whether DMAPI is available and is a version that we know
664 dnl how to deal with. The default truth action is to set samba_dmapi_libs
665 dnl to the list of necessary libraries, and to define USE_DMAPI.
666 AC_DEFUN([SMB_CHECK_DMAPI],
670 if test x"$samba_dmapi_libs" = x"" ; then
671 AC_CHECK_LIB(dm, dm_get_eventlist,
672 [ samba_dmapi_libs="-ldm"], [])
675 if test x"$samba_dmapi_libs" = x"" ; then
676 AC_CHECK_LIB(jfsdm, dm_get_eventlist,
677 [samba_dmapi_libs="-ljfsdm"], [])
680 if test x"$samba_dmapi_libs" = x"" ; then
681 AC_CHECK_LIB(xdsm, dm_get_eventlist,
682 [samba_dmapi_libs="-lxdsm"], [])
685 if test x"$samba_dmapi_libs" = x"" ; then
686 AC_CHECK_LIB(dmapi, dm_get_eventlist,
687 [samba_dmapi_libs="-ldmapi"], [])
691 # Only bother to test ehaders if we have a candidate DMAPI library
692 if test x"$samba_dmapi_libs" != x"" ; then
693 AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h)
696 if test x"$samba_dmapi_libs" != x"" ; then
697 samba_dmapi_save_LIBS="$LIBS"
698 LIBS="$LIBS $samba_dmapi_libs"
701 #include <time.h> /* needed by Tru64 */
702 #include <sys/types.h> /* needed by AIX */
703 #ifdef HAVE_XFS_DMAPI_H
704 #include <xfs/dmapi.h>
705 #elif defined(HAVE_SYS_DMI_H)
707 #elif defined(HAVE_SYS_JFSDMAPI_H)
708 #include <sys/jfsdmapi.h>
709 #elif defined(HAVE_SYS_DMAPI_H)
710 #include <sys/dmapi.h>
711 #elif defined(HAVE_DMAPI_H)
716 /* This link test is designed to fail on IRI 6.4, but should
717 * succeed on Linux, IRIX 6.5 and AIX.
720 dm_eventset_t events;
721 /* This doesn't take an argument on IRIX 6.4. */
722 dm_init_service(&version);
723 /* IRIX 6.4 expects events to be a pointer. */
724 DMEV_ISSET(DM_EVENT_READ, events);
727 true # DMAPI link test succeeded
733 LIBS="$samba_dmapi_save_LIBS"
736 if test x"$samba_dmapi_libs" = x"" ; then
737 # DMAPI detection failure actions begin
740 AC_ERROR(Failed to detect a supported DMAPI implementation)
745 # DMAPI detection failure actions end
747 # DMAPI detection success actions start
750 AC_DEFINE(USE_DMAPI, 1,
751 [Whether we should build DMAPI integration components])
752 AC_MSG_NOTICE(Found DMAPI support in $samba_dmapi_libs)
757 # DMAPI detection success actions end
762 dnl SMB_CHECK_CLOCK_ID(clockid)
763 dnl Test whether the specified clock_gettime clock ID is available. If it
764 dnl is, we define HAVE_clockid
765 AC_DEFUN([SMB_CHECK_CLOCK_ID],
767 AC_MSG_CHECKING(for $1)
769 #if TIME_WITH_SYS_TIME
770 # include <sys/time.h>
774 # include <sys/time.h>
785 AC_DEFINE(HAVE_$1, 1,
786 [Whether the clock_gettime clock ID $1 is available])
793 dnl SMB_IF_RTSIGNAL_BUG([actions if true],
794 dnl [actions if false],
795 dnl [actions if cross compiling])
796 dnl Test whether we can call sigaction with RT_SIGNAL_NOTIFY and
797 dnl RT_SIGNAL_LEASE (also RT_SIGNAL_AIO for good measure, though
798 dnl I don't believe that triggers any bug.
800 dnl See the samba-technical thread titled "Failed to setup
801 dnl RT_SIGNAL_NOTIFY handler" for details on the bug in question.
802 AC_DEFUN([SMB_IF_RTSIGNAL_BUG],
804 rt_signal_notify_works=yes
805 rt_signal_lease_works=yes
806 rt_signal_aio_works=yes
808 AC_MSG_CHECKING(if sigaction works with realtime signals)
811 #include <sys/types.h>
815 /* from smbd/notify_kernel.c */
816 #ifndef RT_SIGNAL_NOTIFY
817 #define RT_SIGNAL_NOTIFY (SIGRTMIN+2)
820 /* from smbd/aio.c */
821 #ifndef RT_SIGNAL_AIO
822 #define RT_SIGNAL_AIO (SIGRTMIN+3)
825 /* from smbd/oplock_linux.c */
826 #ifndef RT_SIGNAL_LEASE
827 #define RT_SIGNAL_LEASE (SIGRTMIN+1)
830 static void signal_handler(int sig, siginfo_t *info, void *unused)
838 struct sigaction act = {0};
840 act.sa_sigaction = signal_handler;
841 act.sa_flags = SA_SIGINFO;
842 sigemptyset( &act.sa_mask );
844 if (sigaction(RT_SIGNAL_LEASE, &act, 0) != 0) {
845 /* Failed to setup RT_SIGNAL_LEASE handler */
849 if (sigaction(RT_SIGNAL_NOTIFY, &act, 0) != 0) {
850 /* Failed to setup RT_SIGNAL_NOTIFY handler */
854 if (sigaction(RT_SIGNAL_AIO, &act, 0) != 0) {
855 /* Failed to setup RT_SIGNAL_AIO handler */
859 /* zero on success */
870 1|11|101|111) rt_signal_lease_ok=no ;;
873 10|11|110|111) rt_signal_notify_ok=no ;;
876 100|110|101|111) rt_signal_aio_ok=no ;;
886 m4_include(lib/replace/libreplace.m4)