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, soversion, fullversion, 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])
77 m4_if([$3], [], [LIBUC[_FULLVER]=$LIBUC[_SOVER]], [LIBUC[_FULLVER]=$3])
79 AC_SUBST(LIBUC[_SHARED_TARGET])
80 AC_SUBST(LIBUC[_STATIC_TARGET])
81 AC_SUBST(LIBUC[_SHARED])
82 AC_SUBST(LIBUC[_STATIC])
83 AC_SUBST(LIBUC[_LIBS])
84 AC_SUBST(LIBUC[_TARGET])
85 AC_SUBST([INSTALL_]LIBUC)
86 AC_SUBST([UNINSTALL_]LIBUC)
87 AC_SUBST(LIBUC[_SOVER])
88 AC_SUBST(LIBUC[_FULLVER])
90 AC_MSG_CHECKING([whether to build the LIBNAME shared library])
92 dnl set the default to not build the shared lib
94 AS_HELP_STRING([--with-]LIBNAME,
96 [Build the LIBNAME shared library (default=no)],
97 [Build the LIBNAME shared library (default=no ($5))])),
110 # if unspecified, default is not to build
116 dnl by default, try to build the shared lib
118 AS_HELP_STRING([--with-]LIBNAME,
119 [Build the LIBNAME shared library (default=yes if shared libs supported)]),
132 # if unspecified, default is to build it if possible.
138 if eval test x"$build_lib" = "xyes" ; then
139 # only set the install targets if the user chose the library
140 [INSTALL_]LIBUC=[install]LIBNAME
141 [UNINSTALL_]LIBUC=[uninstall]LIBNAME
142 if eval $BLDSHARED = true; then
143 LIBUC[_SHARED]=$LIBUC[_SHARED_TARGET]
144 LIBUC[_TARGET]=$LIBUC[_SHARED_TARGET]
146 if test x"$USESHARED" != x"true" -o x"$[LINK_]LIBUC" = "xSTATIC" ; then
148 LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
149 LIBUC[_LIBS]=$LIBUC[_STATIC_TARGET]
155 LIBUC[_TARGET]=$LIBUC[_STATIC_TARGET]
156 LIBUC[_LIBS]=$LIBUC[_STATIC_TARGET]
157 AC_MSG_RESULT(no shared library support -- will supply static library)
161 AC_MSG_RESULT(shared library not selected, but will supply static library)
163 if test $enable_static = yes; then
164 LIBUC[_STATIC]=$LIBUC[_STATIC_TARGET]
174 dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
175 dnl Check for a function in a library, but don't keep adding the same library
176 dnl to the LIBS variable. Check whether the function is available in the
177 dnl current LIBS before adding the library which prevents us spuriously
178 dnl adding libraries for symbols that are in libc.
180 dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
181 dnl is always added to $LIBS if it was found to be necessary. The caller
182 dnl can use SMB_REMOVE_LIB to strp this if necessary.
183 AC_DEFUN([AC_LIBTESTFUNC],
187 # $2 was found in libc or existing $LIBS
193 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
194 [Whether $2 is available])
198 # $2 was not found, try adding lib$1
206 # $2 was not found and we already had lib$1
207 # nothing to do here by default
212 # $2 was not found, try adding lib$1
221 AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
222 [Whether $2 is available])
231 # $2 was not found in lib$1
232 # nothing to do here by default
241 # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
242 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
243 # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
244 # ------------------------------------------------------
246 # Use a cache variable name containing both the library and function name,
247 # because the test really is for library $1 defining function $3, not
248 # just for library $1. Separate tests with the same $1 and different $3s
249 # may have different results.
251 # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
252 # is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
253 # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
254 # the AS_LITERAL_IF indirection.
256 # FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
257 # whatever the FUNCTION, in addition to not being a *S macro. Note
258 # that the cache does depend upon the function we are looking for.
260 # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
261 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
262 # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
263 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
265 AC_DEFUN([AC_CHECK_LIB_EXT],
267 AH_CHECK_LIB_EXT([$1])
268 ac_check_lib_ext_save_LIBS=$LIBS
269 LIBS="-l$1 $$2 $7 $LIBS"
271 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
272 [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
276 AH_CHECK_FUNC_EXT([$3])
278 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
279 [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
280 AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
281 [AC_TRY_LINK_FUNC($3,
282 [AS_VAR_SET(ac_Lib_func, yes);
283 AS_VAR_SET(ac_Lib_ext, yes)],
284 [AS_VAR_SET(ac_Lib_func, no);
285 AS_VAR_SET(ac_Lib_ext, no)])
287 AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
288 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
289 AS_VAR_POPDEF([ac_Lib_func])dnl
291 AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
292 [AC_TRY_LINK_FUNC([main],
293 [AS_VAR_SET(ac_Lib_ext, yes)],
294 [AS_VAR_SET(ac_Lib_ext, no)])
297 LIBS=$ac_check_lib_ext_save_LIBS
299 AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
301 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
312 AS_VAR_POPDEF([ac_Lib_ext])dnl
315 # AH_CHECK_LIB_EXT(LIBNAME)
316 # ---------------------
317 m4_define([AH_CHECK_LIB_EXT],
318 [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
319 [Define to 1 if you have the `]$1[' library (-l]$1[).])])
321 # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
322 # -----------------------------------------------------------------
323 dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
324 dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
325 AC_DEFUN([AC_CHECK_FUNC_EXT],
327 AH_CHECK_FUNC_EXT($1)
328 ac_check_func_ext_save_LIBS=$LIBS
330 AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
331 AC_CACHE_CHECK([for $1], ac_var,
332 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
333 [AS_VAR_SET(ac_var, yes)],
334 [AS_VAR_SET(ac_var, no)])])
335 LIBS=$ac_check_func_ext_save_LIBS
336 AS_IF([test AS_VAR_GET(ac_var) = yes],
337 [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
339 AS_VAR_POPDEF([ac_var])dnl
340 ])# AC_CHECK_FUNC_EXT
342 # AH_CHECK_FUNC_EXT(FUNCNAME)
343 # ---------------------
344 m4_define([AH_CHECK_FUNC_EXT],
345 [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
346 [Define to 1 if you have the `]$1[' function.])])
348 dnl Define an AC_DEFINE with ifndef guard.
349 dnl AC_N_DEFINE(VARIABLE [, VALUE])
351 [cat >> confdefs.h <<\EOF
353 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
359 dnl AC_ADD_INCLUDE(VARIABLE)
360 define(AC_ADD_INCLUDE,
361 [cat >> confdefs.h <<\EOF
366 dnl Copied from libtool.m4
367 AC_DEFUN(AC_PROG_LD_GNU,
368 [AC_CACHE_CHECK([if the linker used by compiler is GNU ld], ac_cv_prog_gnu_ld,
369 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
370 if $CC -Wl,-v /dev/null 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
371 ac_cv_prog_gnu_ld=yes
377 dnl Removes -I/usr/include/? from given variable
378 AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
382 -I/usr/include|-I/usr/include/) ;;
383 *) ac_new_flags="[$]ac_new_flags [$]i" ;;
389 dnl Removes '-L/usr/lib[/]', '-Wl,-rpath,/usr/lib[/]'
390 dnl and '-Wl,-rpath -Wl,/usr/lib[/]' from given variable
391 AC_DEFUN(LIB_REMOVE_USR_LIB,[
400 -Wl,-rpath,/usr/lib) l="";;
401 -Wl,-rpath,/usr/lib/) l="";;
402 -Wl,-rpath,/usr/lib64) l="";;
403 -Wl,-rpath,/usr/lib64/) l="";;
405 -Wl,-rpath-Wl,/usr/lib) l="";;
406 -Wl,-rpath-Wl,/usr/lib/) l="";;
407 -Wl,-rpath-Wl,/usr/lib64) l="";;
408 -Wl,-rpath-Wl,/usr/lib64/) l="";;
411 if test x"[$]ac_new_flags" = x""; then
414 if test x"[$]l" = x""; then
415 ac_new_flags="[$]ac_new_flags[$]s[$]i";
417 ac_new_flags="[$]ac_new_flags[$]s[$]l [$]i";
426 dnl From Bruno Haible.
430 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
431 dnl those with the standalone portable libiconv installed).
432 AC_MSG_CHECKING(for iconv in $1)
433 jm_cv_func_iconv="no"
438 dnl Check for include in giconv.h but no lib needed
439 if test "$jm_cv_func_iconv" != yes; then
440 AC_TRY_LINK([#include <stdlib.h>
441 #include <giconv.h>],
442 [iconv_t cd = iconv_open("","");
443 iconv(cd,NULL,NULL,NULL,NULL);
446 jm_cv_include="giconv.h"
450 dnl Standard iconv.h include, lib in glibc or libc ...
451 if test "$jm_cv_func_iconv" != yes; then
452 AC_TRY_LINK([#include <stdlib.h>
454 [iconv_t cd = iconv_open("","");
455 iconv(cd,NULL,NULL,NULL,NULL);
457 jm_cv_include="iconv.h"
461 dnl Include in giconv.h, libgiconv needed to link
462 if test "$jm_cv_func_iconv" != yes; then
464 LIBS="$LIBS -lgiconv"
465 AC_TRY_LINK([#include <stdlib.h>
466 #include <giconv.h>],
467 [iconv_t cd = iconv_open("","");
468 iconv(cd,NULL,NULL,NULL,NULL);
472 jm_cv_include="giconv.h"
474 jm_cv_lib_iconv="giconv")
478 dnl Include in iconv.h, libiconv needed to link
479 if test "$jm_cv_func_iconv" != yes; then
482 AC_TRY_LINK([#include <stdlib.h>
484 [iconv_t cd = iconv_open("","");
485 iconv(cd,NULL,NULL,NULL,NULL);
487 jm_cv_include="iconv.h"
489 jm_cv_lib_iconv="iconv")
492 dnl Include in biconv.h, libbiconv needed to link
493 if test "$jm_cv_func_iconv" != yes; then
495 LIBS="$LIBS -lbiconv"
496 AC_TRY_LINK([#include <stdlib.h>
497 #include <biconv.h>],
498 [iconv_t cd = iconv_open("","");
499 iconv(cd,NULL,NULL,NULL,NULL);
503 jm_cv_include="biconv.h"
505 jm_cv_lib_iconv="biconv")
513 if test "$jm_cv_func_iconv" = yes; then
514 if test "$jm_cv_giconv" = yes; then
515 AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
519 if test "$jm_cv_biconv" = yes; then
520 AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
524 AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
534 AC_DEFUN(rjs_CHARSET,[
535 dnl Find out if we can convert from $1 to UCS2-LE
536 AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
538 #include <$jm_cv_include>
540 iconv_t cd = iconv_open("$1", "UCS-2LE");
541 if (cd == 0 || cd == (iconv_t)-1) {
546 ],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
547 AC_MSG_RESULT($ICONV_CHARSET)
550 dnl AC_ENABLE_SHARED - implement the --enable-shared flag
551 dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
552 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
554 AC_DEFUN([AC_ENABLE_SHARED],
555 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
556 AC_ARG_ENABLE(shared,
557 changequote(<<, >>)dnl
558 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
560 [p=${PACKAGE-default}
562 yes) enable_shared=yes ;;
563 no) enable_shared=no ;;
566 # Look at the argument we got. We use all the common list separators.
567 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
568 for pkg in $enableval; do
569 if test "X$pkg" = "X$p"; then
577 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
580 dnl AC_ENABLE_STATIC - implement the --enable-static flag
581 dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
582 dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
584 AC_DEFUN([AC_ENABLE_STATIC],
585 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
586 AC_ARG_ENABLE(static,
587 changequote(<<, >>)dnl
588 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
590 [p=${PACKAGE-default}
592 yes) enable_static=yes ;;
593 no) enable_static=no ;;
596 # Look at the argument we got. We use all the common list separators.
597 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
598 for pkg in $enableval; do
599 if test "X$pkg" = "X$p"; then
606 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
609 dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
610 AC_DEFUN([AC_DISABLE_STATIC],
611 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
612 AC_ENABLE_STATIC(no)])
614 dnl AC_TRY_COMMAND_NO_STDERR - also fail if there is output on stderr
615 AC_DEFUN( [AC_TRY_COMMAND_NO_STDERR],
617 { OUT=`($1) 3>&AS_MESSAGE_LOG_FD 2>&1 1>&3`
619 echo "\$?=$RC" >&AS_MESSAGE_LOG_FD
620 if test x"$OUT" != x ; then
621 echo "stderr:" >&AS_MESSAGE_LOG_FD
622 echo "$OUT" >&AS_MESSAGE_LOG_FD
624 test $RC -eq 0 -a x"$OUT" = x ; }
627 dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
628 dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
629 dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
630 AC_DEFUN( [AC_TRY_RUN_STRICT],
632 old_CFLAGS="$CFLAGS";
635 old_CPPFLAGS="$CPPFLAGS";
638 old_LDFLAGS="$LDFLAGS";
641 AC_TRY_RUN([$1],[$5],[$6],[$7])
642 CFLAGS="$old_CFLAGS";
645 CPPFLAGS="$old_CPPFLAGS";
648 LDFLAGS="$old_LDFLAGS";
653 dnl SMB_CHECK_SYSCONF(varname)
654 dnl Tests whether the sysconf(3) variable "varname" is available.
655 AC_DEFUN([SMB_CHECK_SYSCONF],
657 AC_CACHE_CHECK([for sysconf($1)],
660 AC_TRY_LINK([#include <unistd.h>],
661 [ return sysconf($1) == -1 ? 1 : 0; ],
662 [ samba_cv_SYSCONF$1=yes ],
663 [ samba_cv_SYSCONF$1=no ])
666 if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
667 AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
671 dnl SMB_IS_LIBPTHREAD_LINKED([actions if true], [actions if false])
672 dnl Test whether the current LIBS results in libpthread being present.
673 dnl Execute the corresponding user action list.
674 AC_DEFUN([SMB_IS_LIBPTHREAD_LINKED],
676 AC_MSG_CHECKING(if libpthread is linked)
678 [return pthread_create(0, 0, 0, 0);],
689 dnl SMB_REMOVE_LIB(lib)
690 dnl Remove the given library from $LIBS
691 AC_DEFUN([SMB_REMOVE_LIB],
693 LIBS=`echo $LIBS | sed '-es/-l$1//g'`
696 dnl SMB_CHECK_DMAPI([actions if true], [actions if false])
697 dnl Check whether DMAPI is available and is a version that we know
698 dnl how to deal with. The default truth action is to set samba_dmapi_libs
699 dnl to the list of necessary libraries, and to define USE_DMAPI.
700 AC_DEFUN([SMB_CHECK_DMAPI],
704 if test x"$samba_dmapi_libs" = x"" ; then
705 AC_CHECK_LIB(dm, dm_get_eventlist,
706 [ samba_dmapi_libs="-ldm"], [])
709 if test x"$samba_dmapi_libs" = x"" ; then
710 AC_CHECK_LIB(jfsdm, dm_get_eventlist,
711 [samba_dmapi_libs="-ljfsdm"], [])
714 if test x"$samba_dmapi_libs" = x"" ; then
715 AC_CHECK_LIB(dmapi, dm_get_eventlist,
716 [samba_dmapi_libs="-ldmapi"], [])
719 if test x"$samba_dmapi_libs" = x"" ; then
720 AC_CHECK_LIB(xdsm, dm_get_eventlist,
721 [samba_dmapi_libs="-lxdsm"], [])
725 # Only bother to test ehaders if we have a candidate DMAPI library
726 if test x"$samba_dmapi_libs" != x"" ; then
727 AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h)
730 if test x"$samba_dmapi_libs" != x"" ; then
731 samba_dmapi_save_LIBS="$LIBS"
732 LIBS="$LIBS $samba_dmapi_libs"
735 #include <time.h> /* needed by Tru64 */
736 #include <sys/types.h> /* needed by AIX */
737 #ifdef HAVE_XFS_DMAPI_H
738 #include <xfs/dmapi.h>
739 #elif defined(HAVE_SYS_DMI_H)
741 #elif defined(HAVE_SYS_JFSDMAPI_H)
742 #include <sys/jfsdmapi.h>
743 #elif defined(HAVE_SYS_DMAPI_H)
744 #include <sys/dmapi.h>
745 #elif defined(HAVE_DMAPI_H)
750 /* This link test is designed to fail on IRI 6.4, but should
751 * succeed on Linux, IRIX 6.5 and AIX.
754 dm_eventset_t events;
755 /* This doesn't take an argument on IRIX 6.4. */
756 dm_init_service(&version);
757 /* IRIX 6.4 expects events to be a pointer. */
758 DMEV_ISSET(DM_EVENT_READ, events);
761 true # DMAPI link test succeeded
767 LIBS="$samba_dmapi_save_LIBS"
770 if test x"$samba_dmapi_libs" = x"" ; then
771 # DMAPI detection failure actions begin
774 AC_ERROR(Failed to detect a supported DMAPI implementation)
779 # DMAPI detection failure actions end
781 # DMAPI detection success actions start
784 AC_DEFINE(USE_DMAPI, 1,
785 [Whether we should build DMAPI integration components])
786 AC_MSG_NOTICE(Found DMAPI support in $samba_dmapi_libs)
791 # DMAPI detection success actions end
796 dnl SMB_IF_RTSIGNAL_BUG([actions if true],
797 dnl [actions if false],
798 dnl [actions if cross compiling])
799 dnl Test whether we can call sigaction with RT_SIGNAL_NOTIFY and
800 dnl RT_SIGNAL_LEASE (also RT_SIGNAL_AIO for good measure, though
801 dnl I don't believe that triggers any bug.
803 dnl See the samba-technical thread titled "Failed to setup
804 dnl RT_SIGNAL_NOTIFY handler" for details on the bug in question.
805 AC_DEFUN([SMB_IF_RTSIGNAL_BUG],
807 rt_signal_notify_works=yes
808 rt_signal_lease_works=yes
809 rt_signal_aio_works=yes
811 AC_MSG_CHECKING(if sigaction works with realtime signals)
814 #include <sys/types.h>
819 #define SIGRTMIN NSIG
821 /* from smbd/notify_kernel.c */
822 #ifndef RT_SIGNAL_NOTIFY
823 #define RT_SIGNAL_NOTIFY (SIGRTMIN+2)
826 /* from smbd/aio.c */
827 #ifndef RT_SIGNAL_AIO
828 #define RT_SIGNAL_AIO (SIGRTMIN+3)
831 /* from smbd/oplock_linux.c */
832 #ifndef RT_SIGNAL_LEASE
833 #define RT_SIGNAL_LEASE (SIGRTMIN+1)
836 static void signal_handler(int sig, siginfo_t *info, void *unused)
844 struct sigaction act = {0};
846 act.sa_sigaction = signal_handler;
847 act.sa_flags = SA_SIGINFO;
848 sigemptyset( &act.sa_mask );
850 if (sigaction(RT_SIGNAL_LEASE, &act, 0) != 0) {
851 /* Failed to setup RT_SIGNAL_LEASE handler */
855 if (sigaction(RT_SIGNAL_NOTIFY, &act, 0) != 0) {
856 /* Failed to setup RT_SIGNAL_NOTIFY handler */
860 if (sigaction(RT_SIGNAL_AIO, &act, 0) != 0) {
861 /* Failed to setup RT_SIGNAL_AIO handler */
865 /* zero on success */
876 1|11|101|111) rt_signal_lease_ok=no ;;
879 10|11|110|111) rt_signal_notify_ok=no ;;
882 100|110|101|111) rt_signal_aio_ok=no ;;
892 m4_include(../lib/replace/libreplace.m4)