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, version, default, reason)
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
76 m4_if([$2], [], [LIBUC[_SOVER]=0], [LIBUC[_SOVER]=$2])
78 AC_SUBST(LIBUC[_SHARED_TARGET])
79 AC_SUBST(LIBUC[_STATIC_TARGET])
80 AC_SUBST(LIBUC[_SHARED])
81 AC_SUBST(LIBUC[_STATIC])
82 AC_SUBST(LIBUC[_LIBS])
83 AC_SUBST(LIBUC[_TARGET])
84 AC_SUBST([INSTALL_]LIBUC)
85 AC_SUBST([UNINSTALL_]LIBUC)
86 AC_SUBST(LIBUC[_SOVER])
88 AC_MSG_CHECKING([whether to build the LIBNAME shared library])
90 dnl set the default to not build the shared lib
92 AS_HELP_STRING([--with-]LIBNAME,
94 [Build the LIBNAME shared library (default=no)],
95 [Build the LIBNAME shared library (default=no ($4))])),
108 # if unspecified, default is not to build
114 dnl by default, try to build the shared lib
116 AS_HELP_STRING([--with-]LIBNAME,
117 [Build the LIBNAME shared library (default=yes if shared libs supported)]),
130 # if unspecified, default is to build it if possible.
136 if eval test x"$build_lib" = "xyes" ; then
137 # only set the install targets if the user chose the library
138 [INSTALL_]LIBUC=[install]LIBNAME
139 [UNINSTALL_]LIBUC=[uninstall]LIBNAME
140 if eval $BLDSHARED = true; then
141 LIBUC[_SHARED]=$LIBUC[_SHARED_TARGET]
142 LIBUC[_TARGET]=$LIBUC[_SHARED_TARGET]
144 if test x"$USESHARED" != x"true" -o x"$[LINK_]LIBUC" = "xSTATIC" ; then
146 LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
147 LIBUC[_LIBS]=$LIBUC[_STATIC_TARGET]
153 LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
154 LIBUC[_LIBS]=$LIBUC[_STATIC_TARGET]
155 AC_MSG_RESULT(no shared library support -- will supply static library)
159 AC_MSG_RESULT(shared library not selected, but will supply static library)
161 if test $enable_static = yes; then
162 LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET]
172 dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
173 dnl Check for a function in a library, but don't keep adding the same library
174 dnl to the LIBS variable. Check whether the function is available in the
175 dnl current LIBS before adding the library which prevents us spuriously
176 dnl adding libraries for symbols that are in libc.
178 dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
179 dnl is always added to $LIBS if it was found to be necessary. The caller
180 dnl can use SMB_REMOVE_LIB to strp this if necessary.
181 AC_DEFUN([AC_LIBTESTFUNC],
185 # $2 was found in libc or existing $LIBS
191 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
192 [Whether $2 is available])
196 # $2 was not found, try adding lib$1
204 # $2 was not found and we already had lib$1
205 # nothing to do here by default
210 # $2 was not found, try adding lib$1
219 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
220 [Whether $2 is available])
229 # $2 was not found in lib$1
230 # nothing to do here by default
239 # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
240 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
241 # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
242 # ------------------------------------------------------
244 # Use a cache variable name containing both the library and function name,
245 # because the test really is for library $1 defining function $3, not
246 # just for library $1. Separate tests with the same $1 and different $3s
247 # may have different results.
249 # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
250 # is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
251 # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
252 # the AS_LITERAL_IF indirection.
254 # FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
255 # whatever the FUNCTION, in addition to not being a *S macro. Note
256 # that the cache does depend upon the function we are looking for.
258 # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
259 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
260 # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
261 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
263 AC_DEFUN([AC_CHECK_LIB_EXT],
265 AH_CHECK_LIB_EXT([$1])
266 ac_check_lib_ext_save_LIBS=$LIBS
267 LIBS="-l$1 $$2 $7 $LIBS"
269 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
270 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
274 AH_CHECK_FUNC_EXT([$3])
276 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
277 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
278 AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
279 [AC_TRY_LINK_FUNC($3,
280 [AS_VAR_SET(ac_Lib_func, yes);
281 AS_VAR_SET(ac_Lib_ext, yes)],
282 [AS_VAR_SET(ac_Lib_func, no);
283 AS_VAR_SET(ac_Lib_ext, no)])
285 AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
286 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
287 AS_VAR_POPDEF([ac_Lib_func])dnl
289 AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
290 [AC_TRY_LINK_FUNC([main],
291 [AS_VAR_SET(ac_Lib_ext, yes)],
292 [AS_VAR_SET(ac_Lib_ext, no)])
295 LIBS=$ac_check_lib_ext_save_LIBS
297 AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
299 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
310 AS_VAR_POPDEF([ac_Lib_ext])dnl
313 # AH_CHECK_LIB_EXT(LIBNAME)
314 # ---------------------
315 m4_define([AH_CHECK_LIB_EXT],
316 [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
317 [Define to 1 if you have the `]$1[' library (-l]$1[).])])
319 # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
320 # -----------------------------------------------------------------
321 dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
322 dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
323 AC_DEFUN([AC_CHECK_FUNC_EXT],
325 AH_CHECK_FUNC_EXT($1)
326 ac_check_func_ext_save_LIBS=$LIBS
328 AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
329 AC_CACHE_CHECK([for $1], ac_var,
330 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
331 [AS_VAR_SET(ac_var, yes)],
332 [AS_VAR_SET(ac_var, no)])])
333 LIBS=$ac_check_func_ext_save_LIBS
334 AS_IF([test AS_VAR_GET(ac_var) = yes],
335 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
337 AS_VAR_POPDEF([ac_var])dnl
340 # AH_CHECK_FUNC_EXT(FUNCNAME)
341 # ---------------------
342 m4_define([AH_CHECK_FUNC_EXT],
343 [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
344 [Define to 1 if you have the `]$1[' function.])])
346 dnl Define an AC_DEFINE with ifndef guard.
347 dnl AC_N_DEFINE(VARIABLE [, VALUE])
349 [cat >> confdefs.h <<\EOF
351 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
357 dnl AC_ADD_INCLUDE(VARIABLE)
358 define(AC_ADD_INCLUDE,
359 [cat >> confdefs.h <<\EOF
364 dnl Copied from libtool.m4
365 AC_DEFUN(AC_PROG_LD_GNU,
366 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
367 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
368 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
369 ac_cv_prog_gnu_ld=yes
375 dnl Removes -I/usr/include/? from given variable
376 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
380 -I/usr/include|-I/usr/include/) ;;
381 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
387 dnl Removes '-L/usr/lib[/]', '-Wl,-rpath,/usr/lib[/]'
388 dnl and '-Wl,-rpath -Wl,/usr/lib[/]' from given variable
389 AC_DEFUN(LIB_REMOVE_USR_LIB,[
398 -Wl,-rpath,/usr/lib) l="";;
399 -Wl,-rpath,/usr/lib/) l="";;
400 -Wl,-rpath,/usr/lib64) l="";;
401 -Wl,-rpath,/usr/lib64/) l="";;
403 -Wl,-rpath-Wl,/usr/lib) l="";;
404 -Wl,-rpath-Wl,/usr/lib/) l="";;
405 -Wl,-rpath-Wl,/usr/lib64) l="";;
406 -Wl,-rpath-Wl,/usr/lib64/) l="";;
409 if test x"[$]ac_new_flags" = x""; then
412 if test x"[$]l" = x""; then
413 ac_new_flags="[$]ac_new_flags[$]s[$]i";
415 ac_new_flags="[$]ac_new_flags[$]s[$]l [$]i";
424 dnl From Bruno Haible.
428 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
429 dnl those with the standalone portable libiconv installed).
430 AC_MSG_CHECKING(for iconv in $1)
431 jm_cv_func_iconv="no"
436 dnl Check for include in funny place but no lib needed
437 if test "$jm_cv_func_iconv" != yes; then
438 AC_TRY_LINK([#include <stdlib.h>
439 #include <giconv.h>],
440 [iconv_t cd = iconv_open("","");
441 iconv(cd,NULL,NULL,NULL,NULL);
444 jm_cv_include="giconv.h"
448 dnl Standard iconv.h include, lib in glibc or libc ...
449 if test "$jm_cv_func_iconv" != yes; then
450 AC_TRY_LINK([#include <stdlib.h>
452 [iconv_t cd = iconv_open("","");
453 iconv(cd,NULL,NULL,NULL,NULL);
455 jm_cv_include="iconv.h"
459 if test "$jm_cv_lib_iconv" != yes; then
461 LIBS="$LIBS -lgiconv"
462 AC_TRY_LINK([#include <stdlib.h>
463 #include <giconv.h>],
464 [iconv_t cd = iconv_open("","");
465 iconv(cd,NULL,NULL,NULL,NULL);
469 jm_cv_include="giconv.h"
471 jm_cv_lib_iconv="giconv")
475 if test "$jm_cv_func_iconv" != yes; then
478 AC_TRY_LINK([#include <stdlib.h>
480 [iconv_t cd = iconv_open("","");
481 iconv(cd,NULL,NULL,NULL,NULL);
483 jm_cv_include="iconv.h"
485 jm_cv_lib_iconv="iconv")
488 if test "$jm_cv_lib_iconv" != yes; then
490 LIBS="$LIBS -lbiconv"
491 AC_TRY_LINK([#include <stdlib.h>
492 #include <biconv.h>],
493 [iconv_t cd = iconv_open("","");
494 iconv(cd,NULL,NULL,NULL,NULL);
498 jm_cv_include="biconv.h"
500 jm_cv_lib_iconv="biconv")
508 if test "$jm_cv_func_iconv" = yes; then
509 if test "$jm_cv_giconv" = yes; then
510 AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
514 if test "$jm_cv_biconv" = yes; then
515 AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
519 AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
529 AC_DEFUN(rjs_CHARSET,[
530 dnl Find out if we can convert from $1 to UCS2-LE
531 AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
533 #include <$jm_cv_include>
535 iconv_t cd = iconv_open("$1", "UCS-2LE");
536 if (cd == 0 || cd == (iconv_t)-1) {
541 ],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
542 AC_MSG_RESULT($ICONV_CHARSET)
545 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
546 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
547 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
549 AC_DEFUN([AC_ENABLE_SHARED],
550 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
551 AC_ARG_ENABLE(shared,
552 changequote(<<, >>)dnl
553 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
555 [p=${PACKAGE-default}
557 yes) enable_shared=yes ;;
558 no) enable_shared=no ;;
561 # Look at the argument we got. We use all the common list separators.
562 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
563 for pkg in $enableval; do
564 if test "X$pkg" = "X$p"; then
572 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
575 dnl AC_ENABLE_STATIC - implement the --enable-static flag
576 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
577 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
579 AC_DEFUN([AC_ENABLE_STATIC],
580 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
581 AC_ARG_ENABLE(static,
582 changequote(<<, >>)dnl
583 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
585 [p=${PACKAGE-default}
587 yes) enable_static=yes ;;
588 no) enable_static=no ;;
591 # Look at the argument we got. We use all the common list separators.
592 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
593 for pkg in $enableval; do
594 if test "X$pkg" = "X$p"; then
601 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
604 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
605 AC_DEFUN([AC_DISABLE_STATIC],
606 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
607 AC_ENABLE_STATIC(no)])
609 dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
610 dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
611 dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
612 AC_DEFUN( [AC_TRY_RUN_STRICT],
614 old_CFLAGS="$CFLAGS";
617 old_CPPFLAGS="$CPPFLAGS";
620 old_LDFLAGS="$LDFLAGS";
623 AC_TRY_RUN([$1],[$5],[$6],[$7])
624 CFLAGS="$old_CFLAGS";
627 CPPFLAGS="$old_CPPFLAGS";
630 LDFLAGS="$old_LDFLAGS";
635 dnl SMB_CHECK_SYSCONF(varname)
636 dnl Tests whether the sysconf(3) variable "varname" is available.
637 AC_DEFUN([SMB_CHECK_SYSCONF],
639 AC_CACHE_CHECK([for sysconf($1)],
642 AC_TRY_LINK([#include <unistd.h>],
643 [ return sysconf($1) == -1 ? 1 : 0; ],
644 [ samba_cv_SYSCONF$1=yes ],
645 [ samba_cv_SYSCONF$1=no ])
648 if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
649 AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
653 dnl SMB_IS_LIBPTHREAD_LINKED([actions if true], [actions if false])
654 dnl Test whether the current LIBS results in libpthread being present.
655 dnl Execute the corresponding user action list.
656 AC_DEFUN([SMB_IS_LIBPTHREAD_LINKED],
658 AC_MSG_CHECKING(if libpthread is linked)
660 [return pthread_create(0, 0, 0, 0);],
671 dnl SMB_REMOVE_LIB(lib)
672 dnl Remove the given library from $LIBS
673 AC_DEFUN([SMB_REMOVE_LIB],
675 LIBS=`echo $LIBS | sed '-es/-l$1//g'`
678 dnl SMB_CHECK_DMAPI([actions if true], [actions if false])
679 dnl Check whether DMAPI is available and is a version that we know
680 dnl how to deal with. The default truth action is to set samba_dmapi_libs
681 dnl to the list of necessary libraries, and to define USE_DMAPI.
682 AC_DEFUN([SMB_CHECK_DMAPI],
686 if test x"$samba_dmapi_libs" = x"" ; then
687 AC_CHECK_LIB(dm, dm_get_eventlist,
688 [ samba_dmapi_libs="-ldm"], [])
691 if test x"$samba_dmapi_libs" = x"" ; then
692 AC_CHECK_LIB(jfsdm, dm_get_eventlist,
693 [samba_dmapi_libs="-ljfsdm"], [])
696 if test x"$samba_dmapi_libs" = x"" ; then
697 AC_CHECK_LIB(xdsm, dm_get_eventlist,
698 [samba_dmapi_libs="-lxdsm"], [])
701 if test x"$samba_dmapi_libs" = x"" ; then
702 AC_CHECK_LIB(dmapi, dm_get_eventlist,
703 [samba_dmapi_libs="-ldmapi"], [])
707 # Only bother to test ehaders if we have a candidate DMAPI library
708 if test x"$samba_dmapi_libs" != x"" ; then
709 AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h)
712 if test x"$samba_dmapi_libs" != x"" ; then
713 samba_dmapi_save_LIBS="$LIBS"
714 LIBS="$LIBS $samba_dmapi_libs"
717 #include <time.h> /* needed by Tru64 */
718 #include <sys/types.h> /* needed by AIX */
719 #ifdef HAVE_XFS_DMAPI_H
720 #include <xfs/dmapi.h>
721 #elif defined(HAVE_SYS_DMI_H)
723 #elif defined(HAVE_SYS_JFSDMAPI_H)
724 #include <sys/jfsdmapi.h>
725 #elif defined(HAVE_SYS_DMAPI_H)
726 #include <sys/dmapi.h>
727 #elif defined(HAVE_DMAPI_H)
732 /* This link test is designed to fail on IRI 6.4, but should
733 * succeed on Linux, IRIX 6.5 and AIX.
736 dm_eventset_t events;
737 /* This doesn't take an argument on IRIX 6.4. */
738 dm_init_service(&version);
739 /* IRIX 6.4 expects events to be a pointer. */
740 DMEV_ISSET(DM_EVENT_READ, events);
743 true # DMAPI link test succeeded
749 LIBS="$samba_dmapi_save_LIBS"
752 if test x"$samba_dmapi_libs" = x"" ; then
753 # DMAPI detection failure actions begin
756 AC_ERROR(Failed to detect a supported DMAPI implementation)
761 # DMAPI detection failure actions end
763 # DMAPI detection success actions start
766 AC_DEFINE(USE_DMAPI, 1,
767 [Whether we should build DMAPI integration components])
768 AC_MSG_NOTICE(Found DMAPI support in $samba_dmapi_libs)
773 # DMAPI detection success actions end
778 dnl SMB_CHECK_CLOCK_ID(clockid)
779 dnl Test whether the specified clock_gettime clock ID is available. If it
780 dnl is, we define HAVE_clockid
781 AC_DEFUN([SMB_CHECK_CLOCK_ID],
783 AC_MSG_CHECKING(for $1)
785 #if TIME_WITH_SYS_TIME
786 # include <sys/time.h>
790 # include <sys/time.h>
801 AC_DEFINE(HAVE_$1, 1,
802 [Whether the clock_gettime clock ID $1 is available])
809 dnl SMB_IF_RTSIGNAL_BUG([actions if true],
810 dnl [actions if false],
811 dnl [actions if cross compiling])
812 dnl Test whether we can call sigaction with RT_SIGNAL_NOTIFY and
813 dnl RT_SIGNAL_LEASE (also RT_SIGNAL_AIO for good measure, though
814 dnl I don't believe that triggers any bug.
816 dnl See the samba-technical thread titled "Failed to setup
817 dnl RT_SIGNAL_NOTIFY handler" for details on the bug in question.
818 AC_DEFUN([SMB_IF_RTSIGNAL_BUG],
820 rt_signal_notify_works=yes
821 rt_signal_lease_works=yes
822 rt_signal_aio_works=yes
824 AC_MSG_CHECKING(if sigaction works with realtime signals)
827 #include <sys/types.h>
831 /* from smbd/notify_kernel.c */
832 #ifndef RT_SIGNAL_NOTIFY
833 #define RT_SIGNAL_NOTIFY (SIGRTMIN+2)
836 /* from smbd/aio.c */
837 #ifndef RT_SIGNAL_AIO
838 #define RT_SIGNAL_AIO (SIGRTMIN+3)
841 /* from smbd/oplock_linux.c */
842 #ifndef RT_SIGNAL_LEASE
843 #define RT_SIGNAL_LEASE (SIGRTMIN+1)
846 static void signal_handler(int sig, siginfo_t *info, void *unused)
854 struct sigaction act = {0};
856 act.sa_sigaction = signal_handler;
857 act.sa_flags = SA_SIGINFO;
858 sigemptyset( &act.sa_mask );
860 if (sigaction(RT_SIGNAL_LEASE, &act, 0) != 0) {
861 /* Failed to setup RT_SIGNAL_LEASE handler */
865 if (sigaction(RT_SIGNAL_NOTIFY, &act, 0) != 0) {
866 /* Failed to setup RT_SIGNAL_NOTIFY handler */
870 if (sigaction(RT_SIGNAL_AIO, &act, 0) != 0) {
871 /* Failed to setup RT_SIGNAL_AIO handler */
875 /* zero on success */
886 1|11|101|111) rt_signal_lease_ok=no ;;
889 10|11|110|111) rt_signal_notify_ok=no ;;
892 100|110|101|111) rt_signal_aio_ok=no ;;
902 m4_include(../lib/replace/libreplace.m4)