| 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,
|
|---|
| 4 | [AC_TRY_COMPILE([
|
|---|
| 5 | #include <unistd.h>
|
|---|
| 6 | #include <sys/types.h>
|
|---|
| 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])
|
|---|
| 11 | fi
|
|---|
| 12 | ])
|
|---|
| 13 |
|
|---|
| 14 | dnl Mark specified module as shared
|
|---|
| 15 | dnl SMB_MODULE(name,static_files,shared_files,subsystem,whatif-static,whatif-shared)
|
|---|
| 16 | AC_DEFUN(SMB_MODULE,
|
|---|
| 17 | [
|
|---|
| 18 | AC_MSG_CHECKING([how to build $1])
|
|---|
| 19 | if test "$[MODULE_][$1]"; then
|
|---|
| 20 | DEST=$[MODULE_][$1]
|
|---|
| 21 | elif test "$[MODULE_]translit([$4], [A-Z], [a-z])" -a "$[MODULE_DEFAULT_][$1]"; then
|
|---|
| 22 | DEST=$[MODULE_]translit([$4], [A-Z], [a-z])
|
|---|
| 23 | else
|
|---|
| 24 | DEST=$[MODULE_DEFAULT_][$1]
|
|---|
| 25 | fi
|
|---|
| 26 |
|
|---|
| 27 | if test x"$DEST" = xSHARED; then
|
|---|
| 28 | AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
|
|---|
| 29 | $4_MODULES="$$4_MODULES $3"
|
|---|
| 30 | AC_MSG_RESULT([shared])
|
|---|
| 31 | [$6]
|
|---|
| 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"
|
|---|
| 38 | AC_SUBST($4_STATIC)
|
|---|
| 39 | [$5]
|
|---|
| 40 | AC_MSG_RESULT([static])
|
|---|
| 41 | else
|
|---|
| 42 | string_ignored_modules="$string_ignored_modules $1"
|
|---|
| 43 | AC_MSG_RESULT([not])
|
|---|
| 44 | fi
|
|---|
| 45 | ])
|
|---|
| 46 |
|
|---|
| 47 | AC_DEFUN(SMB_SUBSYSTEM,
|
|---|
| 48 | [
|
|---|
| 49 | AC_SUBST($1_STATIC)
|
|---|
| 50 | AC_SUBST($1_MODULES)
|
|---|
| 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])
|
|---|
| 54 | ])
|
|---|
| 55 |
|
|---|
| 56 | dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
|
|---|
| 57 | dnl Check for a function in a library, but don't keep adding the same library
|
|---|
| 58 | dnl to the LIBS variable. Check whether the function is available in the
|
|---|
| 59 | dnl current LIBS before adding the library which prevents us spuriously
|
|---|
| 60 | dnl adding libraries for symbols that are in libc.
|
|---|
| 61 | dnl
|
|---|
| 62 | dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
|
|---|
| 63 | dnl is always added to $LIBS if it was found to be necessary. The caller
|
|---|
| 64 | dnl can use SMB_REMOVE_LIB to strp this if necessary.
|
|---|
| 65 | AC_DEFUN([AC_LIBTESTFUNC],
|
|---|
| 66 | [
|
|---|
| 67 | AC_CHECK_FUNCS($2,
|
|---|
| 68 | [
|
|---|
| 69 | # $2 was found in libc or existing $LIBS
|
|---|
| 70 | m4_ifval([$3],
|
|---|
| 71 | [
|
|---|
| 72 | $3
|
|---|
| 73 | ],
|
|---|
| 74 | [
|
|---|
| 75 | AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
|
|---|
| 76 | [Whether $2 is available])
|
|---|
| 77 | ])
|
|---|
| 78 | ],
|
|---|
| 79 | [
|
|---|
| 80 | # $2 was not found, try adding lib$1
|
|---|
| 81 | case " $LIBS " in
|
|---|
| 82 | *\ -l$1\ *)
|
|---|
| 83 | m4_ifval([$4],
|
|---|
| 84 | [
|
|---|
| 85 | $4
|
|---|
| 86 | ],
|
|---|
| 87 | [
|
|---|
| 88 | # $2 was not found and we already had lib$1
|
|---|
| 89 | # nothing to do here by default
|
|---|
| 90 | true
|
|---|
| 91 | ])
|
|---|
| 92 | ;;
|
|---|
| 93 | *)
|
|---|
| 94 | # $2 was not found, try adding lib$1
|
|---|
| 95 | AC_CHECK_LIB($1, $2,
|
|---|
| 96 | [
|
|---|
| 97 | LIBS="-l$1 $LIBS"
|
|---|
| 98 | m4_ifval([$3],
|
|---|
| 99 | [
|
|---|
| 100 | $3
|
|---|
| 101 | ],
|
|---|
| 102 | [
|
|---|
| 103 | AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
|
|---|
| 104 | [Whether $2 is available])
|
|---|
| 105 | ])
|
|---|
| 106 | ],
|
|---|
| 107 | [
|
|---|
| 108 | m4_ifval([$4],
|
|---|
| 109 | [
|
|---|
| 110 | $4
|
|---|
| 111 | ],
|
|---|
| 112 | [
|
|---|
| 113 | # $2 was not found in lib$1
|
|---|
| 114 | # nothing to do here by default
|
|---|
| 115 | true
|
|---|
| 116 | ])
|
|---|
| 117 | ])
|
|---|
| 118 | ;;
|
|---|
| 119 | esac
|
|---|
| 120 | ])
|
|---|
| 121 | ])
|
|---|
| 122 |
|
|---|
| 123 | # AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
|
|---|
| 124 | # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
|
|---|
| 125 | # [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
|
|---|
| 126 | # ------------------------------------------------------
|
|---|
| 127 | #
|
|---|
| 128 | # Use a cache variable name containing both the library and function name,
|
|---|
| 129 | # because the test really is for library $1 defining function $3, not
|
|---|
| 130 | # just for library $1. Separate tests with the same $1 and different $3s
|
|---|
| 131 | # may have different results.
|
|---|
| 132 | #
|
|---|
| 133 | # Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
|
|---|
| 134 | # is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
|
|---|
| 135 | # ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
|
|---|
| 136 | # the AS_LITERAL_IF indirection.
|
|---|
| 137 | #
|
|---|
| 138 | # FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
|
|---|
| 139 | # whatever the FUNCTION, in addition to not being a *S macro. Note
|
|---|
| 140 | # that the cache does depend upon the function we are looking for.
|
|---|
| 141 | #
|
|---|
| 142 | # It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
|
|---|
| 143 | # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
|
|---|
| 144 | # changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
|
|---|
| 145 | # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
|
|---|
| 146 | # freedom.
|
|---|
| 147 | AC_DEFUN([AC_CHECK_LIB_EXT],
|
|---|
| 148 | [
|
|---|
| 149 | AH_CHECK_LIB_EXT([$1])
|
|---|
| 150 | ac_check_lib_ext_save_LIBS=$LIBS
|
|---|
| 151 | LIBS="-l$1 $$2 $7 $LIBS"
|
|---|
| 152 | AS_LITERAL_IF([$1],
|
|---|
| 153 | [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
|
|---|
| 154 | [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
|
|---|
| 155 |
|
|---|
| 156 | m4_ifval([$3],
|
|---|
| 157 | [
|
|---|
| 158 | AH_CHECK_FUNC_EXT([$3])
|
|---|
| 159 | AS_LITERAL_IF([$1],
|
|---|
| 160 | [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
|
|---|
| 161 | [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
|
|---|
| 162 | AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
|
|---|
| 163 | [AC_TRY_LINK_FUNC($3,
|
|---|
| 164 | [AS_VAR_SET(ac_Lib_func, yes);
|
|---|
| 165 | AS_VAR_SET(ac_Lib_ext, yes)],
|
|---|
| 166 | [AS_VAR_SET(ac_Lib_func, no);
|
|---|
| 167 | AS_VAR_SET(ac_Lib_ext, no)])
|
|---|
| 168 | ])
|
|---|
| 169 | AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
|
|---|
| 170 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
|
|---|
| 171 | AS_VAR_POPDEF([ac_Lib_func])dnl
|
|---|
| 172 | ],[
|
|---|
| 173 | AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
|
|---|
| 174 | [AC_TRY_LINK_FUNC([main],
|
|---|
| 175 | [AS_VAR_SET(ac_Lib_ext, yes)],
|
|---|
| 176 | [AS_VAR_SET(ac_Lib_ext, no)])
|
|---|
| 177 | ])
|
|---|
| 178 | ])
|
|---|
| 179 | LIBS=$ac_check_lib_ext_save_LIBS
|
|---|
| 180 |
|
|---|
| 181 | AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
|
|---|
| 182 | [m4_default([$4],
|
|---|
| 183 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
|
|---|
| 184 | case "$$2" in
|
|---|
| 185 | *-l$1*)
|
|---|
| 186 | ;;
|
|---|
| 187 | *)
|
|---|
| 188 | $2="-l$1 $$2"
|
|---|
| 189 | ;;
|
|---|
| 190 | esac])
|
|---|
| 191 | [$6]
|
|---|
| 192 | ],
|
|---|
| 193 | [$5])dnl
|
|---|
| 194 | AS_VAR_POPDEF([ac_Lib_ext])dnl
|
|---|
| 195 | ])# AC_CHECK_LIB_EXT
|
|---|
| 196 |
|
|---|
| 197 | # AH_CHECK_LIB_EXT(LIBNAME)
|
|---|
| 198 | # ---------------------
|
|---|
| 199 | m4_define([AH_CHECK_LIB_EXT],
|
|---|
| 200 | [AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
|
|---|
| 201 | [Define to 1 if you have the `]$1[' library (-l]$1[).])])
|
|---|
| 202 |
|
|---|
| 203 | # AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|---|
| 204 | # -----------------------------------------------------------------
|
|---|
| 205 | dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
|
|---|
| 206 | dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
|
|---|
| 207 | AC_DEFUN([AC_CHECK_FUNC_EXT],
|
|---|
| 208 | [
|
|---|
| 209 | AH_CHECK_FUNC_EXT($1)
|
|---|
| 210 | ac_check_func_ext_save_LIBS=$LIBS
|
|---|
| 211 | LIBS="$2 $LIBS"
|
|---|
| 212 | AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
|
|---|
| 213 | AC_CACHE_CHECK([for $1], ac_var,
|
|---|
| 214 | [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
|
|---|
| 215 | [AS_VAR_SET(ac_var, yes)],
|
|---|
| 216 | [AS_VAR_SET(ac_var, no)])])
|
|---|
| 217 | LIBS=$ac_check_func_ext_save_LIBS
|
|---|
| 218 | AS_IF([test AS_VAR_GET(ac_var) = yes],
|
|---|
| 219 | [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
|
|---|
| 220 | [$4])dnl
|
|---|
| 221 | AS_VAR_POPDEF([ac_var])dnl
|
|---|
| 222 | ])# AC_CHECK_FUNC
|
|---|
| 223 |
|
|---|
| 224 | # AH_CHECK_FUNC_EXT(FUNCNAME)
|
|---|
| 225 | # ---------------------
|
|---|
| 226 | m4_define([AH_CHECK_FUNC_EXT],
|
|---|
| 227 | [AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
|
|---|
| 228 | [Define to 1 if you have the `]$1[' function.])])
|
|---|
| 229 |
|
|---|
| 230 | dnl Define an AC_DEFINE with ifndef guard.
|
|---|
| 231 | dnl AC_N_DEFINE(VARIABLE [, VALUE])
|
|---|
| 232 | define(AC_N_DEFINE,
|
|---|
| 233 | [cat >> confdefs.h <<\EOF
|
|---|
| 234 | [#ifndef] $1
|
|---|
| 235 | [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
|
|---|
| 236 | [#endif]
|
|---|
| 237 | EOF
|
|---|
| 238 | ])
|
|---|
| 239 |
|
|---|
| 240 | dnl Add an #include
|
|---|
| 241 | dnl AC_ADD_INCLUDE(VARIABLE)
|
|---|
| 242 | define(AC_ADD_INCLUDE,
|
|---|
| 243 | [cat >> confdefs.h <<\EOF
|
|---|
| 244 | [#include] $1
|
|---|
| 245 | EOF
|
|---|
| 246 | ])
|
|---|
| 247 |
|
|---|
| 248 | dnl Copied from libtool.m4
|
|---|
| 249 | AC_DEFUN(AC_PROG_LD_GNU,
|
|---|
| 250 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
|---|
| 251 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
|---|
| 252 | if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
|---|
| 253 | ac_cv_prog_gnu_ld=yes
|
|---|
| 254 | else
|
|---|
| 255 | ac_cv_prog_gnu_ld=no
|
|---|
| 256 | fi])
|
|---|
| 257 | ])
|
|---|
| 258 |
|
|---|
| 259 | dnl Removes -I/usr/include/? from given variable
|
|---|
| 260 | AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
|
|---|
| 261 | ac_new_flags=""
|
|---|
| 262 | for i in [$]$1; do
|
|---|
| 263 | case [$]i in
|
|---|
| 264 | -I/usr/include|-I/usr/include/) ;;
|
|---|
| 265 | *) ac_new_flags="[$]ac_new_flags [$]i" ;;
|
|---|
| 266 | esac
|
|---|
| 267 | done
|
|---|
| 268 | $1=[$]ac_new_flags
|
|---|
| 269 | ])
|
|---|
| 270 |
|
|---|
| 271 | dnl Removes '-L/usr/lib[/]', '-Wl,-rpath,/usr/lib[/]'
|
|---|
| 272 | dnl and '-Wl,-rpath -Wl,/usr/lib[/]' from given variable
|
|---|
| 273 | AC_DEFUN(LIB_REMOVE_USR_LIB,[
|
|---|
| 274 | ac_new_flags=""
|
|---|
| 275 | l=""
|
|---|
| 276 | for i in [$]$1; do
|
|---|
| 277 | case [$]l[$]i in
|
|---|
| 278 | -L/usr/lib) ;;
|
|---|
| 279 | -L/usr/lib/) ;;
|
|---|
| 280 | -Wl,-rpath,/usr/lib) ;;
|
|---|
| 281 | -Wl,-rpath,/usr/lib/) ;;
|
|---|
| 282 | -Wl,-rpath) l=[$]i;;
|
|---|
| 283 | -Wl,-rpath-Wl,/usr/lib) l="";;
|
|---|
| 284 | -Wl,-rpath-Wl,/usr/lib/) l="";;
|
|---|
| 285 | *)
|
|---|
| 286 | s=" "
|
|---|
| 287 | if test x"[$]ac_new_flags" = x""; then
|
|---|
| 288 | s="";
|
|---|
| 289 | fi
|
|---|
| 290 | if test x"[$]l" = x""; then
|
|---|
| 291 | ac_new_flags="[$]ac_new_flags[$]s[$]i";
|
|---|
| 292 | else
|
|---|
| 293 | ac_new_flags="[$]ac_new_flags[$]s[$]l [$]i";
|
|---|
| 294 | fi
|
|---|
| 295 | l=""
|
|---|
| 296 | ;;
|
|---|
| 297 | esac
|
|---|
| 298 | done
|
|---|
| 299 | $1=[$]ac_new_flags
|
|---|
| 300 | ])
|
|---|
| 301 |
|
|---|
| 302 | dnl From Bruno Haible.
|
|---|
| 303 |
|
|---|
| 304 | AC_DEFUN(jm_ICONV,
|
|---|
| 305 | [
|
|---|
| 306 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
|---|
| 307 | dnl those with the standalone portable libiconv installed).
|
|---|
| 308 | AC_MSG_CHECKING(for iconv in $1)
|
|---|
| 309 | jm_cv_func_iconv="no"
|
|---|
| 310 | jm_cv_lib_iconv=""
|
|---|
| 311 | jm_cv_giconv=no
|
|---|
| 312 | jm_save_LIBS="$LIBS"
|
|---|
| 313 |
|
|---|
| 314 | dnl Check for include in funny place but no lib needed
|
|---|
| 315 | if test "$jm_cv_func_iconv" != yes; then
|
|---|
| 316 | AC_TRY_LINK([#include <stdlib.h>
|
|---|
| 317 | #include <giconv.h>],
|
|---|
| 318 | [iconv_t cd = iconv_open("","");
|
|---|
| 319 | iconv(cd,NULL,NULL,NULL,NULL);
|
|---|
| 320 | iconv_close(cd);],
|
|---|
| 321 | jm_cv_func_iconv=yes
|
|---|
| 322 | jm_cv_include="giconv.h"
|
|---|
| 323 | jm_cv_giconv="yes"
|
|---|
| 324 | jm_cv_lib_iconv="")
|
|---|
| 325 |
|
|---|
| 326 | dnl Standard iconv.h include, lib in glibc or libc ...
|
|---|
| 327 | if test "$jm_cv_func_iconv" != yes; then
|
|---|
| 328 | AC_TRY_LINK([#include <stdlib.h>
|
|---|
| 329 | #include <iconv.h>],
|
|---|
| 330 | [iconv_t cd = iconv_open("","");
|
|---|
| 331 | iconv(cd,NULL,NULL,NULL,NULL);
|
|---|
| 332 | iconv_close(cd);],
|
|---|
| 333 | jm_cv_include="iconv.h"
|
|---|
| 334 | jm_cv_func_iconv=yes
|
|---|
| 335 | jm_cv_lib_iconv="")
|
|---|
| 336 |
|
|---|
| 337 | if test "$jm_cv_lib_iconv" != yes; then
|
|---|
| 338 | jm_save_LIBS="$LIBS"
|
|---|
| 339 | LIBS="$LIBS -lgiconv"
|
|---|
| 340 | AC_TRY_LINK([#include <stdlib.h>
|
|---|
| 341 | #include <giconv.h>],
|
|---|
| 342 | [iconv_t cd = iconv_open("","");
|
|---|
| 343 | iconv(cd,NULL,NULL,NULL,NULL);
|
|---|
| 344 | iconv_close(cd);],
|
|---|
| 345 | jm_cv_lib_iconv=yes
|
|---|
| 346 | jm_cv_func_iconv=yes
|
|---|
| 347 | jm_cv_include="giconv.h"
|
|---|
| 348 | jm_cv_giconv=yes
|
|---|
| 349 | jm_cv_lib_iconv="giconv")
|
|---|
| 350 |
|
|---|
| 351 | LIBS="$jm_save_LIBS"
|
|---|
| 352 |
|
|---|
| 353 | if test "$jm_cv_func_iconv" != yes; then
|
|---|
| 354 | jm_save_LIBS="$LIBS"
|
|---|
| 355 | LIBS="$LIBS -liconv"
|
|---|
| 356 | AC_TRY_LINK([#include <stdlib.h>
|
|---|
| 357 | #include <iconv.h>],
|
|---|
| 358 | [iconv_t cd = iconv_open("","");
|
|---|
| 359 | iconv(cd,NULL,NULL,NULL,NULL);
|
|---|
| 360 | iconv_close(cd);],
|
|---|
| 361 | jm_cv_include="iconv.h"
|
|---|
| 362 | jm_cv_func_iconv=yes
|
|---|
| 363 | jm_cv_lib_iconv="iconv")
|
|---|
| 364 | LIBS="$jm_save_LIBS"
|
|---|
| 365 | fi
|
|---|
| 366 | fi
|
|---|
| 367 | fi
|
|---|
| 368 | fi
|
|---|
| 369 | if test "$jm_cv_func_iconv" = yes; then
|
|---|
| 370 | if test "$jm_cv_giconv" = yes; then
|
|---|
| 371 | AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
|
|---|
| 372 | AC_MSG_RESULT(yes)
|
|---|
| 373 | ICONV_FOUND=yes
|
|---|
| 374 | else
|
|---|
| 375 | if test "$jm_cv_biconv" = yes; then
|
|---|
| 376 | AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
|
|---|
| 377 | AC_MSG_RESULT(yes)
|
|---|
| 378 | ICONV_FOUND=yes
|
|---|
| 379 | else
|
|---|
| 380 | AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
|
|---|
| 381 | AC_MSG_RESULT(yes)
|
|---|
| 382 | ICONV_FOUND=yes
|
|---|
| 383 | fi
|
|---|
| 384 | fi
|
|---|
| 385 | else
|
|---|
| 386 | AC_MSG_RESULT(no)
|
|---|
| 387 | fi
|
|---|
| 388 | ])
|
|---|
| 389 |
|
|---|
| 390 | AC_DEFUN(rjs_CHARSET,[
|
|---|
| 391 | dnl Find out if we can convert from $1 to UCS2-LE
|
|---|
| 392 | AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
|
|---|
| 393 | AC_TRY_RUN([
|
|---|
| 394 | #include <$jm_cv_include>
|
|---|
| 395 | main(){
|
|---|
| 396 | iconv_t cd = iconv_open("$1", "UCS-2LE");
|
|---|
| 397 | if (cd == 0 || cd == (iconv_t)-1) {
|
|---|
| 398 | return -1;
|
|---|
| 399 | }
|
|---|
| 400 | return 0;
|
|---|
| 401 | }
|
|---|
| 402 | ],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
|
|---|
| 403 | AC_MSG_RESULT($ICONV_CHARSET)
|
|---|
| 404 | ])
|
|---|
| 405 |
|
|---|
| 406 | dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR)
|
|---|
| 407 | dnl This function doesn't add -I/usr/include into CFLAGS
|
|---|
| 408 | AC_DEFUN(CFLAGS_ADD_DIR,[
|
|---|
| 409 | if test "$2" != "/usr/include" ; then
|
|---|
| 410 | $1="$$1 -I$2"
|
|---|
| 411 | fi
|
|---|
| 412 | ])
|
|---|
| 413 |
|
|---|
| 414 | dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR)
|
|---|
| 415 | dnl This function doesn't add -L/usr/lib into LDFLAGS
|
|---|
| 416 | AC_DEFUN(LIB_ADD_DIR,[
|
|---|
| 417 | if test "$2" != "/usr/lib" ; then
|
|---|
| 418 | $1="$$1 -L$2"
|
|---|
| 419 | fi
|
|---|
| 420 | ])
|
|---|
| 421 |
|
|---|
| 422 | dnl AC_ENABLE_SHARED - implement the --enable-shared flag
|
|---|
| 423 | dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
|---|
| 424 | dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|---|
| 425 | dnl `yes'.
|
|---|
| 426 | AC_DEFUN([AC_ENABLE_SHARED],
|
|---|
| 427 | [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
|---|
| 428 | AC_ARG_ENABLE(shared,
|
|---|
| 429 | changequote(<<, >>)dnl
|
|---|
| 430 | << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
|---|
| 431 | changequote([, ])dnl
|
|---|
| 432 | [p=${PACKAGE-default}
|
|---|
| 433 | case $enableval in
|
|---|
| 434 | yes) enable_shared=yes ;;
|
|---|
| 435 | no) enable_shared=no ;;
|
|---|
| 436 | *)
|
|---|
| 437 | enable_shared=no
|
|---|
| 438 | # Look at the argument we got. We use all the common list separators.
|
|---|
| 439 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|---|
| 440 | for pkg in $enableval; do
|
|---|
| 441 | if test "X$pkg" = "X$p"; then
|
|---|
| 442 | enable_shared=yes
|
|---|
| 443 | fi
|
|---|
| 444 |
|
|---|
| 445 | done
|
|---|
| 446 | IFS="$ac_save_ifs"
|
|---|
| 447 | ;;
|
|---|
| 448 | esac],
|
|---|
| 449 | enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
|---|
| 450 | ])
|
|---|
| 451 |
|
|---|
| 452 | dnl AC_ENABLE_STATIC - implement the --enable-static flag
|
|---|
| 453 | dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
|---|
| 454 | dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
|---|
| 455 | dnl `yes'.
|
|---|
| 456 | AC_DEFUN([AC_ENABLE_STATIC],
|
|---|
| 457 | [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
|---|
| 458 | AC_ARG_ENABLE(static,
|
|---|
| 459 | changequote(<<, >>)dnl
|
|---|
| 460 | << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
|---|
| 461 | changequote([, ])dnl
|
|---|
| 462 | [p=${PACKAGE-default}
|
|---|
| 463 | case $enableval in
|
|---|
| 464 | yes) enable_static=yes ;;
|
|---|
| 465 | no) enable_static=no ;;
|
|---|
| 466 | *)
|
|---|
| 467 | enable_static=no
|
|---|
| 468 | # Look at the argument we got. We use all the common list separators.
|
|---|
| 469 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
|---|
| 470 | for pkg in $enableval; do
|
|---|
| 471 | if test "X$pkg" = "X$p"; then
|
|---|
| 472 | enable_static=yes
|
|---|
| 473 | fi
|
|---|
| 474 | done
|
|---|
| 475 | IFS="$ac_save_ifs"
|
|---|
| 476 | ;;
|
|---|
| 477 | esac],
|
|---|
| 478 | enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
|---|
| 479 | ])
|
|---|
| 480 |
|
|---|
| 481 | dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
|
|---|
| 482 | AC_DEFUN([AC_DISABLE_STATIC],
|
|---|
| 483 | [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
|---|
| 484 | AC_ENABLE_STATIC(no)])
|
|---|
| 485 |
|
|---|
| 486 | dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
|
|---|
| 487 | dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
|
|---|
| 488 | dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
|
|---|
| 489 | AC_DEFUN( [AC_TRY_RUN_STRICT],
|
|---|
| 490 | [
|
|---|
| 491 | old_CFLAGS="$CFLAGS";
|
|---|
| 492 | CFLAGS="$2";
|
|---|
| 493 | export CFLAGS;
|
|---|
| 494 | old_CPPFLAGS="$CPPFLAGS";
|
|---|
| 495 | CPPFLAGS="$3";
|
|---|
| 496 | export CPPFLAGS;
|
|---|
| 497 | old_LDFLAGS="$LDFLAGS";
|
|---|
| 498 | LDFLAGS="$4";
|
|---|
| 499 | export LDFLAGS;
|
|---|
| 500 | AC_TRY_RUN([$1],[$5],[$6],[$7])
|
|---|
| 501 | CFLAGS="$old_CFLAGS";
|
|---|
| 502 | old_CFLAGS="";
|
|---|
| 503 | export CFLAGS;
|
|---|
| 504 | CPPFLAGS="$old_CPPFLAGS";
|
|---|
| 505 | old_CPPFLAGS="";
|
|---|
| 506 | export CPPFLAGS;
|
|---|
| 507 | LDFLAGS="$old_LDFLAGS";
|
|---|
| 508 | old_LDFLAGS="";
|
|---|
| 509 | export LDFLAGS;
|
|---|
| 510 | ])
|
|---|
| 511 |
|
|---|
| 512 | dnl SMB_CHECK_SYSCONF(varname)
|
|---|
| 513 | dnl Tests whether the sysconf(3) variable "varname" is available.
|
|---|
| 514 | AC_DEFUN([SMB_CHECK_SYSCONF],
|
|---|
| 515 | [
|
|---|
| 516 | AC_CACHE_CHECK([for sysconf($1)],
|
|---|
| 517 | samba_cv_SYSCONF$1,
|
|---|
| 518 | [
|
|---|
| 519 | AC_TRY_LINK([#include <unistd.h>],
|
|---|
| 520 | [ return sysconf($1) == -1 ? 1 : 0; ],
|
|---|
| 521 | [ samba_cv_SYSCONF$1=yes ],
|
|---|
| 522 | [ samba_cv_SYSCONF$1=no ])
|
|---|
| 523 | ])
|
|---|
| 524 |
|
|---|
| 525 | if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
|
|---|
| 526 | AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
|
|---|
| 527 | fi
|
|---|
| 528 | ])
|
|---|
| 529 |
|
|---|
| 530 | dnl SMB_IS_LIBPTHREAD_LINKED([actions if true], [actions if false])
|
|---|
| 531 | dnl Test whether the current LIBS results in libpthread being present.
|
|---|
| 532 | dnl Execute the corresponding user action list.
|
|---|
| 533 | AC_DEFUN([SMB_IS_LIBPTHREAD_LINKED],
|
|---|
| 534 | [
|
|---|
| 535 | AC_MSG_CHECKING(if libpthread is linked)
|
|---|
| 536 | AC_TRY_LINK([],
|
|---|
| 537 | [return pthread_create(0, 0, 0, 0);],
|
|---|
| 538 | [
|
|---|
| 539 | AC_MSG_RESULT(yes)
|
|---|
| 540 | $1
|
|---|
| 541 | ],
|
|---|
| 542 | [
|
|---|
| 543 | AC_MSG_RESULT(no)
|
|---|
| 544 | $2
|
|---|
| 545 | ])
|
|---|
| 546 | ])
|
|---|
| 547 |
|
|---|
| 548 | dnl SMB_REMOVE_LIB(lib)
|
|---|
| 549 | dnl Remove the given library from $LIBS
|
|---|
| 550 | AC_DEFUN([SMB_REMOVE_LIB],
|
|---|
| 551 | [
|
|---|
| 552 | LIBS=`echo $LIBS | sed '-es/-l$1//g'`
|
|---|
| 553 | ])
|
|---|
| 554 |
|
|---|
| 555 | dnl SMB_CHECK_DMAPI([actions if true], [actions if false])
|
|---|
| 556 | dnl Check whether DMAPI is available and is a version that we know
|
|---|
| 557 | dnl how to deal with. The default truth action is to set samba_dmapi_libs
|
|---|
| 558 | dnl to the list of necessary libraries, and to define USE_DMAPI.
|
|---|
| 559 | AC_DEFUN([SMB_CHECK_DMAPI],
|
|---|
| 560 | [
|
|---|
| 561 | samba_dmapi_libs=""
|
|---|
| 562 |
|
|---|
| 563 | if test x"$samba_dmapi_libs" = x"" ; then
|
|---|
| 564 | AC_CHECK_LIB(dm, dm_get_eventlist,
|
|---|
| 565 | [ samba_dmapi_libs="-ldm"], [])
|
|---|
| 566 | fi
|
|---|
| 567 |
|
|---|
| 568 | if test x"$samba_dmapi_libs" = x"" ; then
|
|---|
| 569 | AC_CHECK_LIB(jfsdm, dm_get_eventlist,
|
|---|
| 570 | [samba_dmapi_libs="-ljfsdm"], [])
|
|---|
| 571 | fi
|
|---|
| 572 |
|
|---|
| 573 | if test x"$samba_dmapi_libs" = x"" ; then
|
|---|
| 574 | AC_CHECK_LIB(xdsm, dm_get_eventlist,
|
|---|
| 575 | [samba_dmapi_libs="-lxdsm"], [])
|
|---|
| 576 | fi
|
|---|
| 577 |
|
|---|
| 578 | if test x"$samba_dmapi_libs" = x"" ; then
|
|---|
| 579 | AC_CHECK_LIB(dmapi, dm_get_eventlist,
|
|---|
| 580 | [samba_dmapi_libs="-ldmapi"], [])
|
|---|
| 581 | fi
|
|---|
| 582 |
|
|---|
| 583 |
|
|---|
| 584 | # Only bother to test ehaders if we have a candidate DMAPI library
|
|---|
| 585 | if test x"$samba_dmapi_libs" != x"" ; then
|
|---|
| 586 | AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h)
|
|---|
| 587 | fi
|
|---|
| 588 |
|
|---|
| 589 | if test x"$samba_dmapi_libs" != x"" ; then
|
|---|
| 590 | samba_dmapi_save_LIBS="$LIBS"
|
|---|
| 591 | LIBS="$LIBS $samba_dmapi_libs"
|
|---|
| 592 | AC_TRY_LINK(
|
|---|
| 593 | [
|
|---|
| 594 | #include <time.h> /* needed by Tru64 */
|
|---|
| 595 | #include <sys/types.h> /* needed by AIX */
|
|---|
| 596 | #ifdef HAVE_XFS_DMAPI_H
|
|---|
| 597 | #include <xfs/dmapi.h>
|
|---|
| 598 | #elif defined(HAVE_SYS_DMI_H)
|
|---|
| 599 | #include <sys/dmi.h>
|
|---|
| 600 | #elif defined(HAVE_SYS_JFSDMAPI_H)
|
|---|
| 601 | #include <sys/jfsdmapi.h>
|
|---|
| 602 | #elif defined(HAVE_SYS_DMAPI_H)
|
|---|
| 603 | #include <sys/dmapi.h>
|
|---|
| 604 | #elif defined(HAVE_DMAPI_H)
|
|---|
| 605 | #include <dmapi.h>
|
|---|
| 606 | #endif
|
|---|
| 607 | ],
|
|---|
| 608 | [
|
|---|
| 609 | /* This link test is designed to fail on IRI 6.4, but should
|
|---|
| 610 | * succeed on Linux, IRIX 6.5 and AIX.
|
|---|
| 611 | */
|
|---|
| 612 | char * version;
|
|---|
| 613 | dm_eventset_t events;
|
|---|
| 614 | /* This doesn't take an argument on IRIX 6.4. */
|
|---|
| 615 | dm_init_service(&version);
|
|---|
| 616 | /* IRIX 6.4 expects events to be a pointer. */
|
|---|
| 617 | DMEV_ISSET(DM_EVENT_READ, events);
|
|---|
| 618 | ],
|
|---|
| 619 | [
|
|---|
| 620 | true # DMAPI link test succeeded
|
|---|
| 621 | ],
|
|---|
| 622 | [
|
|---|
| 623 | # DMAPI link failure
|
|---|
| 624 | samba_dmapi_libs=
|
|---|
| 625 | ])
|
|---|
| 626 | LIBS="$samba_dmapi_save_LIBS"
|
|---|
| 627 | fi
|
|---|
| 628 |
|
|---|
| 629 | if test x"$samba_dmapi_libs" = x"" ; then
|
|---|
| 630 | # DMAPI detection failure actions begin
|
|---|
| 631 | ifelse($2, [],
|
|---|
| 632 | [
|
|---|
| 633 | AC_ERROR(Failed to detect a supported DMAPI implementation)
|
|---|
| 634 | ],
|
|---|
| 635 | [
|
|---|
| 636 | $2
|
|---|
| 637 | ])
|
|---|
| 638 | # DMAPI detection failure actions end
|
|---|
| 639 | else
|
|---|
| 640 | # DMAPI detection success actions start
|
|---|
| 641 | ifelse($1, [],
|
|---|
| 642 | [
|
|---|
| 643 | AC_DEFINE(USE_DMAPI, 1,
|
|---|
| 644 | [Whether we should build DMAPI integration components])
|
|---|
| 645 | AC_MSG_NOTICE(Found DMAPI support in $samba_dmapi_libs)
|
|---|
| 646 | ],
|
|---|
| 647 | [
|
|---|
| 648 | $1
|
|---|
| 649 | ])
|
|---|
| 650 | # DMAPI detection success actions end
|
|---|
| 651 | fi
|
|---|
| 652 |
|
|---|
| 653 | ])
|
|---|
| 654 |
|
|---|
| 655 | dnl SMB_CHECK_CLOCK_ID(clockid)
|
|---|
| 656 | dnl Test whether the specified clock_gettime clock ID is available. If it
|
|---|
| 657 | dnl is, we define HAVE_clockid
|
|---|
| 658 | AC_DEFUN([SMB_CHECK_CLOCK_ID],
|
|---|
| 659 | [
|
|---|
| 660 | AC_MSG_CHECKING(for $1)
|
|---|
| 661 | AC_TRY_LINK([
|
|---|
| 662 | #if TIME_WITH_SYS_TIME
|
|---|
| 663 | # include <sys/time.h>
|
|---|
| 664 | # include <time.h>
|
|---|
| 665 | #else
|
|---|
| 666 | # if HAVE_SYS_TIME_H
|
|---|
| 667 | # include <sys/time.h>
|
|---|
| 668 | # else
|
|---|
| 669 | # include <time.h>
|
|---|
| 670 | # endif
|
|---|
| 671 | #endif
|
|---|
| 672 | ],
|
|---|
| 673 | [
|
|---|
| 674 | clockid_t clk = $1;
|
|---|
| 675 | ],
|
|---|
| 676 | [
|
|---|
| 677 | AC_MSG_RESULT(yes)
|
|---|
| 678 | AC_DEFINE(HAVE_$1, 1,
|
|---|
| 679 | [Whether the clock_gettime clock ID $1 is available])
|
|---|
| 680 | ],
|
|---|
| 681 | [
|
|---|
| 682 | AC_MSG_RESULT(no)
|
|---|
| 683 | ])
|
|---|
| 684 | ])
|
|---|
| 685 |
|
|---|
| 686 | dnl SMB_IF_RTSIGNAL_BUG([actions if true],
|
|---|
| 687 | dnl [actions if false],
|
|---|
| 688 | dnl [actions if cross compiling])
|
|---|
| 689 | dnl Test whether we can call sigaction with RT_SIGNAL_NOTIFY and
|
|---|
| 690 | dnl RT_SIGNAL_LEASE (also RT_SIGNAL_AIO for good measure, though
|
|---|
| 691 | dnl I don't believe that triggers any bug.
|
|---|
| 692 | dnl
|
|---|
| 693 | dnl See the samba-technical thread titled "Failed to setup
|
|---|
| 694 | dnl RT_SIGNAL_NOTIFY handler" for details on the bug in question.
|
|---|
| 695 | AC_DEFUN([SMB_IF_RTSIGNAL_BUG],
|
|---|
| 696 | [
|
|---|
| 697 | rt_signal_notify_works=yes
|
|---|
| 698 | rt_signal_lease_works=yes
|
|---|
| 699 | rt_signal_aio_works=yes
|
|---|
| 700 |
|
|---|
| 701 | AC_MSG_CHECKING(if sigaction works with realtime signals)
|
|---|
| 702 | AC_TRY_RUN(
|
|---|
| 703 | [
|
|---|
| 704 | #include <sys/types.h>
|
|---|
| 705 | #include <fcntl.h>
|
|---|
| 706 | #include <signal.h>
|
|---|
| 707 |
|
|---|
| 708 | /* from smbd/notify_kernel.c */
|
|---|
| 709 | #ifndef RT_SIGNAL_NOTIFY
|
|---|
| 710 | #define RT_SIGNAL_NOTIFY (SIGRTMIN+2)
|
|---|
| 711 | #endif
|
|---|
| 712 |
|
|---|
| 713 | /* from smbd/aio.c */
|
|---|
| 714 | #ifndef RT_SIGNAL_AIO
|
|---|
| 715 | #define RT_SIGNAL_AIO (SIGRTMIN+3)
|
|---|
| 716 | #endif
|
|---|
| 717 |
|
|---|
| 718 | /* from smbd/oplock_linux.c */
|
|---|
| 719 | #ifndef RT_SIGNAL_LEASE
|
|---|
| 720 | #define RT_SIGNAL_LEASE (SIGRTMIN+1)
|
|---|
| 721 | #endif
|
|---|
| 722 |
|
|---|
| 723 | static void signal_handler(int sig, siginfo_t *info, void *unused)
|
|---|
| 724 | {
|
|---|
| 725 | int do_nothing = 0;
|
|---|
| 726 | }
|
|---|
| 727 |
|
|---|
| 728 | int main(void)
|
|---|
| 729 | {
|
|---|
| 730 | int result = 0;
|
|---|
| 731 | struct sigaction act = {0};
|
|---|
| 732 |
|
|---|
| 733 | act.sa_sigaction = signal_handler;
|
|---|
| 734 | act.sa_flags = SA_SIGINFO;
|
|---|
| 735 | sigemptyset( &act.sa_mask );
|
|---|
| 736 |
|
|---|
| 737 | if (sigaction(RT_SIGNAL_LEASE, &act, 0) != 0) {
|
|---|
| 738 | /* Failed to setup RT_SIGNAL_LEASE handler */
|
|---|
| 739 | result += 1;
|
|---|
| 740 | }
|
|---|
| 741 |
|
|---|
| 742 | if (sigaction(RT_SIGNAL_NOTIFY, &act, 0) != 0) {
|
|---|
| 743 | /* Failed to setup RT_SIGNAL_NOTIFY handler */
|
|---|
| 744 | result += 10;
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 | if (sigaction(RT_SIGNAL_AIO, &act, 0) != 0) {
|
|---|
| 748 | /* Failed to setup RT_SIGNAL_AIO handler */
|
|---|
| 749 | result += 100;
|
|---|
| 750 | }
|
|---|
| 751 |
|
|---|
| 752 | /* zero on success */
|
|---|
| 753 | return result;
|
|---|
| 754 | }
|
|---|
| 755 | ],
|
|---|
| 756 | [
|
|---|
| 757 | AC_MSG_RESULT(yes)
|
|---|
| 758 | $2
|
|---|
| 759 | ],
|
|---|
| 760 | [
|
|---|
| 761 | AC_MSG_RESULT(no)
|
|---|
| 762 | case "$ac_status" in
|
|---|
| 763 | 1|11|101|111) rt_signal_lease_ok=no ;;
|
|---|
| 764 | esac
|
|---|
| 765 | case "$ac_status" in
|
|---|
| 766 | 10|11|110|111) rt_signal_notify_ok=no ;;
|
|---|
| 767 | esac
|
|---|
| 768 | case "$ac_status" in
|
|---|
| 769 | 100|110|101|111) rt_signal_aio_ok=no ;;
|
|---|
| 770 | esac
|
|---|
| 771 | $2
|
|---|
| 772 | ],
|
|---|
| 773 | [
|
|---|
| 774 | AC_MSG_RESULT(cross)
|
|---|
| 775 | $3
|
|---|
| 776 | ])
|
|---|
| 777 | ])
|
|---|
| 778 |
|
|---|
| 779 | m4_include(lib/replace/libreplace.m4)
|
|---|