1
dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2
dnl if the cache file is inconsistent with the current host,
3
dnl target and build system types, execute CMD or print a default
5
AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6
AC_REQUIRE([AC_CANONICAL_SYSTEM])
7
AC_MSG_CHECKING([config.cache system type])
8
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9
test x"$ac_cv_host_system_type" != x"$host"; } ||
10
{ test x"${ac_cv_build_system_type+set}" = x"set" &&
11
test x"$ac_cv_build_system_type" != x"$build"; } ||
12
{ test x"${ac_cv_target_system_type+set}" = x"set" &&
13
test x"$ac_cv_target_system_type" != x"$target"; }; then
14
AC_MSG_RESULT([different])
16
[AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
20
ac_cv_host_system_type="$host"
21
ac_cv_build_system_type="$build"
22
ac_cv_target_system_type="$target"
26
dnl test whether dirent has a d_off member
27
AC_DEFUN(AC_DIRENT_D_OFF,
28
[AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
31
#include <sys/types.h>
32
#include <dirent.h>], [struct dirent d; d.d_off;],
33
ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
34
if test $ac_cv_dirent_d_off = yes; then
35
AC_DEFINE(HAVE_DIRENT_D_OFF,1,[Whether dirent has a d_off member])
39
dnl Mark specified module as shared
40
dnl SMB_MODULE(name,static_files,shared_files,subsystem,whatif-static,whatif-shared)
43
AC_MSG_CHECKING([how to build $1])
44
if test "$[MODULE_][$1]"; then
46
elif test "$[MODULE_]translit([$4], [A-Z], [a-z])" -a "$[MODULE_DEFAULT_][$1]"; then
47
DEST=$[MODULE_]translit([$4], [A-Z], [a-z])
49
DEST=$[MODULE_DEFAULT_][$1]
52
if test x"$DEST" = xSHARED; then
53
AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module])
54
$4_MODULES="$$4_MODULES $3"
55
AC_MSG_RESULT([shared])
57
string_shared_modules="$string_shared_modules $1"
58
elif test x"$DEST" = xSTATIC; then
59
[init_static_modules_]translit([$4], [A-Z], [a-z])="$[init_static_modules_]translit([$4], [A-Z], [a-z]) $1_init();"
60
[decl_static_modules_]translit([$4], [A-Z], [a-z])="$[decl_static_modules_]translit([$4], [A-Z], [a-z]) extern NTSTATUS $1_init(void);"
61
string_static_modules="$string_static_modules $1"
62
$4_STATIC="$$4_STATIC $2"
65
AC_MSG_RESULT([static])
67
string_ignored_modules="$string_ignored_modules $1"
72
AC_DEFUN(SMB_SUBSYSTEM,
76
AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
77
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])
78
ifelse([$2], , :, [rm -f $2])
81
dnl AC_PROG_CC_FLAG(flag)
82
AC_DEFUN(AC_PROG_CC_FLAG,
83
[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
84
[echo 'void f(){}' > conftest.c
85
if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
93
dnl see if a declaration exists for a function or variable
94
dnl defines HAVE_function_DECL if it exists
95
dnl AC_HAVE_DECL(var, includes)
96
AC_DEFUN(AC_HAVE_DECL,
98
AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
99
AC_TRY_COMPILE([$2],[int i = (int)$1],
100
ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
101
if test x"$ac_cv_have_$1_decl" = x"yes"; then
102
AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
107
dnl AC_LIBTESTFUNC(lib, function, [actions if found], [actions if not found])
108
dnl Check for a function in a library, but don't keep adding the same library
109
dnl to the LIBS variable. Check whether the function is available in the
110
dnl current LIBS before adding the library which prevents us spuriously
111
dnl adding libraries for symbols that are in libc.
113
dnl On success, the default actions ensure that HAVE_FOO is defined. The lib
114
dnl is always added to $LIBS if it was found to be necessary. The caller
115
dnl can use SMB_LIB_REMOVE to strp this if necessary.
116
AC_DEFUN([AC_LIBTESTFUNC],
120
# $2 was found in libc or existing $LIBS
123
AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
124
[Whether $2 is available])
131
# $2 was not found, try adding lib$1
136
# $2 was not found and we already had lib$1
137
# nothing to do here by default
143
# $2 was not found, try adding lib$1
149
AC_DEFINE(translit([HAVE_$2], [a-z], [A-Z]), 1,
150
[Whether $2 is available])
159
# $2 was not found in lib$1
160
# nothing to do here by default
170
# AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
171
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
172
# [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
173
# ------------------------------------------------------
175
# Use a cache variable name containing both the library and function name,
176
# because the test really is for library $1 defining function $3, not
177
# just for library $1. Separate tests with the same $1 and different $3s
178
# may have different results.
180
# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
181
# is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
182
# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
183
# the AS_LITERAL_IF indirection.
185
# FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
186
# whatever the FUNCTION, in addition to not being a *S macro. Note
187
# that the cache does depend upon the function we are looking for.
189
# It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
190
# `ac_save_LIBS': there are many macros which don't want to see `LIBS'
191
# changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
192
# And ``ac_save_LIBS' is too tempting a name, so let's leave them some
194
AC_DEFUN([AC_CHECK_LIB_EXT],
196
AH_CHECK_LIB_EXT([$1])
197
ac_check_lib_ext_save_LIBS=$LIBS
198
LIBS="-l$1 $$2 $7 $LIBS"
200
[AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
201
[AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
205
AH_CHECK_FUNC_EXT([$3])
207
[AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
208
[AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
209
AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
210
[AC_TRY_LINK_FUNC($3,
211
[AS_VAR_SET(ac_Lib_func, yes);
212
AS_VAR_SET(ac_Lib_ext, yes)],
213
[AS_VAR_SET(ac_Lib_func, no);
214
AS_VAR_SET(ac_Lib_ext, no)])
216
AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
217
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
218
AS_VAR_POPDEF([ac_Lib_func])dnl
220
AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
221
[AC_TRY_LINK_FUNC([main],
222
[AS_VAR_SET(ac_Lib_ext, yes)],
223
[AS_VAR_SET(ac_Lib_ext, no)])
226
LIBS=$ac_check_lib_ext_save_LIBS
228
AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
230
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
241
AS_VAR_POPDEF([ac_Lib_ext])dnl
244
# AH_CHECK_LIB_EXT(LIBNAME)
245
# ---------------------
246
m4_define([AH_CHECK_LIB_EXT],
247
[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
248
[Define to 1 if you have the `]$1[' library (-l]$1[).])])
250
# AC_CHECK_FUNCS_EXT(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
251
# -----------------------------------------------------------------
252
dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
253
dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
254
AC_DEFUN([AC_CHECK_FUNC_EXT],
256
AH_CHECK_FUNC_EXT($1)
257
ac_check_func_ext_save_LIBS=$LIBS
259
AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
260
AC_CACHE_CHECK([for $1], ac_var,
261
[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
262
[AS_VAR_SET(ac_var, yes)],
263
[AS_VAR_SET(ac_var, no)])])
264
LIBS=$ac_check_func_ext_save_LIBS
265
AS_IF([test AS_VAR_GET(ac_var) = yes],
266
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
268
AS_VAR_POPDEF([ac_var])dnl
271
# AH_CHECK_FUNC_EXT(FUNCNAME)
272
# ---------------------
273
m4_define([AH_CHECK_FUNC_EXT],
274
[AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
275
[Define to 1 if you have the `]$1[' function.])])
277
dnl Define an AC_DEFINE with ifndef guard.
278
dnl AC_N_DEFINE(VARIABLE [, VALUE])
280
[cat >> confdefs.h <<\EOF
282
[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
288
dnl AC_ADD_INCLUDE(VARIABLE)
289
define(AC_ADD_INCLUDE,
290
[cat >> confdefs.h <<\EOF
295
dnl Copied from libtool.m4
296
AC_DEFUN(AC_PROG_LD_GNU,
297
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
298
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
299
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
300
ac_cv_prog_gnu_ld=yes
306
# Configure paths for LIBXML2
307
# Toshio Kuratomi 2001-04-21
309
# Configure paths for GLIB
310
# Owen Taylor 97-11-3
312
dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
313
dnl Test for XML, and define XML_CFLAGS and XML_LIBS
315
AC_DEFUN(AM_PATH_XML2,[
316
AC_ARG_WITH(xml-prefix,
317
[ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
318
xml_config_prefix="$withval", xml_config_prefix="")
319
AC_ARG_WITH(xml-exec-prefix,
320
[ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
321
xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
322
AC_ARG_ENABLE(xmltest,
323
[ --disable-xmltest Do not try to compile and run a test LIBXML program],,
326
if test x$xml_config_exec_prefix != x ; then
327
xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix"
328
if test x${XML2_CONFIG+set} != xset ; then
329
XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
332
if test x$xml_config_prefix != x ; then
333
xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
334
if test x${XML2_CONFIG+set} != xset ; then
335
XML2_CONFIG=$xml_config_prefix/bin/xml2-config
339
AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
340
min_xml_version=ifelse([$1], ,2.0.0,[$1])
341
AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
343
if test "$XML2_CONFIG" = "no" ; then
346
XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
347
XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
348
xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
349
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
350
xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
351
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
352
xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
353
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
354
if test "x$enable_xmltest" = "xyes" ; then
355
ac_save_CFLAGS="$CFLAGS"
357
CFLAGS="$CFLAGS $XML_CFLAGS"
358
LIBS="$XML_LIBS $LIBS"
360
dnl Now check if the installed libxml is sufficiently new.
361
dnl (Also sanity checks the results of xml2-config to some extent)
368
#include <libxml/xmlversion.h>
373
int xml_major_version, xml_minor_version, xml_micro_version;
374
int major, minor, micro;
377
system("touch conf.xmltest");
379
/* Capture xml2-config output via autoconf/configure variables */
380
/* HP/UX 9 (%@#!) writes to sscanf strings */
381
tmp_version = (char *)strdup("$min_xml_version");
382
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
383
printf("%s, bad version string from xml2-config\n", "$min_xml_version");
388
/* Capture the version information from the header files */
389
tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
390
if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
391
printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
396
/* Compare xml2-config output to the libxml headers */
397
if ((xml_major_version != $xml_config_major_version) ||
398
(xml_minor_version != $xml_config_minor_version) ||
399
(xml_micro_version != $xml_config_micro_version))
401
printf("*** libxml header files (version %d.%d.%d) do not match\n",
402
xml_major_version, xml_minor_version, xml_micro_version);
403
printf("*** xml2-config (version %d.%d.%d)\n",
404
$xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
407
/* Compare the headers to the library to make sure we match */
408
/* Less than ideal -- doesn't provide us with return value feedback,
409
* only exits if there's a serious mismatch between header and library.
413
/* Test that the library is greater than our minimum version */
414
if ((xml_major_version > major) ||
415
((xml_major_version == major) && (xml_minor_version > minor)) ||
416
((xml_major_version == major) && (xml_minor_version == minor) &&
417
(xml_micro_version >= micro)))
423
printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
424
xml_major_version, xml_minor_version, xml_micro_version);
425
printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
426
major, minor, micro);
427
printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
429
printf("*** If you have already installed a sufficiently new version, this error\n");
430
printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
431
printf("*** being found. The easiest way to fix this is to remove the old version\n");
432
printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
433
printf("*** correct copy of xml2-config. (In this case, you will have to\n");
434
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
435
printf("*** so that the correct libraries are found at run-time))\n");
439
],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
440
CFLAGS="$ac_save_CFLAGS"
445
if test "x$no_xml" = x ; then
446
AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
447
ifelse([$2], , :, [$2])
450
if test "$XML2_CONFIG" = "no" ; then
451
echo "*** The xml2-config script installed by LIBXML could not be found"
452
echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
453
echo "*** your path, or set the XML2_CONFIG environment variable to the"
454
echo "*** full path to xml2-config."
456
if test -f conf.xmltest ; then
459
echo "*** Could not run libxml test program, checking why..."
460
CFLAGS="$CFLAGS $XML_CFLAGS"
461
LIBS="$LIBS $XML_LIBS"
463
#include <libxml/xmlversion.h>
465
], [ LIBXML_TEST_VERSION; return 0;],
466
[ echo "*** The test program compiled, but did not run. This usually means"
467
echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
468
echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
469
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
470
echo "*** to the installed location Also, make sure you have run ldconfig if that"
471
echo "*** is required on your system"
473
echo "*** If you have an old version installed, it is best to remove it, although"
474
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
475
[ echo "*** The test program failed to compile or link. See the file config.log for the"
476
echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
477
echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
478
echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
479
CFLAGS="$ac_save_CFLAGS"
486
ifelse([$3], , :, [$3])
493
# =========================================================================
494
# AM_PATH_MYSQL : MySQL library
496
dnl AM_PATH_MYSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
497
dnl Test for MYSQL, and define MYSQL_CFLAGS and MYSQL_LIBS
499
AC_DEFUN(AM_PATH_MYSQL,
501
dnl Get the cflags and libraries from the mysql_config script
503
AC_ARG_WITH(mysql-prefix,[ --with-mysql-prefix=PFX Prefix where MYSQL is installed (optional)],
504
mysql_prefix="$withval", mysql_prefix="")
505
AC_ARG_WITH(mysql-exec-prefix,[ --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional)],
506
mysql_exec_prefix="$withval", mysql_exec_prefix="")
508
if test x$mysql_exec_prefix != x ; then
509
mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
510
if test x${MYSQL_CONFIG+set} != xset ; then
511
MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
514
if test x$mysql_prefix != x ; then
515
mysql_args="$mysql_args --prefix=$mysql_prefix"
516
if test x${MYSQL_CONFIG+set} != xset ; then
517
MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
521
AC_REQUIRE([AC_CANONICAL_TARGET])
522
AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
523
AC_MSG_CHECKING(for MYSQL)
525
if test "$MYSQL_CONFIG" = "no" ; then
529
ifelse([$2], , :, [$2])
531
MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"`
532
MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"`
534
ifelse([$1], , :, [$1])
536
AC_SUBST(MYSQL_CFLAGS)
540
# =========================================================================
541
# AM_PATH_PGSQL : pgSQL library
543
dnl AM_PATH_PGSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
544
dnl Test for PGSQL, and define PGSQL_CFLAGS and PGSQL_LIBS
546
AC_DEFUN(AM_PATH_PGSQL,
548
dnl Get the cflags and libraries from the pg_config script
550
AC_ARG_WITH(pgsql-prefix,[ --with-pgsql-prefix=PFX Prefix where PostgreSQL is installed (optional)],
551
pgsql_prefix="$withval", pgsql_prefix="")
552
AC_ARG_WITH(pgsql-exec-prefix,[ --with-pgsql-exec-prefix=PFX Exec prefix where PostgreSQL is installed (optional)],
553
pgsql_exec_prefix="$withval", pgsql_exec_prefix="")
555
if test x$pgsql_exec_prefix != x ; then
556
if test x${PGSQL_CONFIG+set} != xset ; then
557
PGSQL_CONFIG=$pgsql_exec_prefix/bin/pg_config
560
if test x$pgsql_prefix != x ; then
561
if test x${PGSQL_CONFIG+set} != xset ; then
562
PGSQL_CONFIG=$pgsql_prefix/bin/pg_config
566
AC_REQUIRE([AC_CANONICAL_TARGET])
567
AC_PATH_PROG(PGSQL_CONFIG, pg_config, no, [$PATH:/usr/lib/postgresql/bin])
568
AC_MSG_CHECKING(for PGSQL)
570
if test "$PGSQL_CONFIG" = "no" ; then
574
ifelse([$2], , :, [$2])
576
PGSQL_CFLAGS=-I`$PGSQL_CONFIG --includedir`
577
PGSQL_LIBS="-lpq -L`$PGSQL_CONFIG --libdir`"
579
ifelse([$1], , :, [$1])
581
AC_SUBST(PGSQL_CFLAGS)
585
dnl Removes -I/usr/include/? from given variable
586
AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
590
-I/usr/include|-I/usr/include/) ;;
591
*) ac_new_flags="[$]ac_new_flags [$]i" ;;
597
dnl Removes -L/usr/lib/? from given variable
598
AC_DEFUN(LIB_REMOVE_USR_LIB,[
602
-L/usr/lib|-L/usr/lib/) ;;
603
*) ac_new_flags="[$]ac_new_flags [$]i" ;;
609
dnl From Bruno Haible.
613
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
614
dnl those with the standalone portable libiconv installed).
615
AC_MSG_CHECKING(for iconv in $1)
616
jm_cv_func_iconv="no"
621
dnl Check for include in funny place but no lib needed
622
if test "$jm_cv_func_iconv" != yes; then
623
AC_TRY_LINK([#include <stdlib.h>
624
#include <giconv.h>],
625
[iconv_t cd = iconv_open("","");
626
iconv(cd,NULL,NULL,NULL,NULL);
629
jm_cv_include="giconv.h"
633
dnl Standard iconv.h include, lib in glibc or libc ...
634
if test "$jm_cv_func_iconv" != yes; then
635
AC_TRY_LINK([#include <stdlib.h>
637
[iconv_t cd = iconv_open("","");
638
iconv(cd,NULL,NULL,NULL,NULL);
640
jm_cv_include="iconv.h"
644
if test "$jm_cv_lib_iconv" != yes; then
646
LIBS="$LIBS -lgiconv"
647
AC_TRY_LINK([#include <stdlib.h>
648
#include <giconv.h>],
649
[iconv_t cd = iconv_open("","");
650
iconv(cd,NULL,NULL,NULL,NULL);
654
jm_cv_include="giconv.h"
656
jm_cv_lib_iconv="giconv")
660
if test "$jm_cv_func_iconv" != yes; then
663
AC_TRY_LINK([#include <stdlib.h>
665
[iconv_t cd = iconv_open("","");
666
iconv(cd,NULL,NULL,NULL,NULL);
668
jm_cv_include="iconv.h"
670
jm_cv_lib_iconv="iconv")
676
if test "$jm_cv_func_iconv" = yes; then
677
if test "$jm_cv_giconv" = yes; then
678
AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h])
682
if test "$jm_cv_biconv" = yes; then
683
AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h])
687
AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h])
697
AC_DEFUN(rjs_CHARSET,[
698
dnl Find out if we can convert from $1 to UCS2-LE
699
AC_MSG_CHECKING([can we convert from $1 to UCS2-LE?])
701
#include <$jm_cv_include>
703
iconv_t cd = iconv_open("$1", "UCS-2LE");
704
if (cd == 0 || cd == (iconv_t)-1) {
709
],ICONV_CHARSET=$1,ICONV_CHARSET=no,ICONV_CHARSET=cross)
710
AC_MSG_RESULT($ICONV_CHARSET)
713
dnl CFLAGS_ADD_DIR(CFLAGS, $INCDIR)
714
dnl This function doesn't add -I/usr/include into CFLAGS
715
AC_DEFUN(CFLAGS_ADD_DIR,[
716
if test "$2" != "/usr/include" ; then
721
dnl LIB_ADD_DIR(LDFLAGS, $LIBDIR)
722
dnl This function doesn't add -L/usr/lib into LDFLAGS
723
AC_DEFUN(LIB_ADD_DIR,[
724
if test "$2" != "/usr/lib" ; then
729
dnl AC_ENABLE_SHARED - implement the --enable-shared flag
730
dnl Usage: AC_ENABLE_SHARED[(DEFAULT)]
731
dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
733
AC_DEFUN([AC_ENABLE_SHARED],
734
[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
735
AC_ARG_ENABLE(shared,
736
changequote(<<, >>)dnl
737
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
739
[p=${PACKAGE-default}
741
yes) enable_shared=yes ;;
742
no) enable_shared=no ;;
745
# Look at the argument we got. We use all the common list separators.
746
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
747
for pkg in $enableval; do
748
if test "X$pkg" = "X$p"; then
756
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
759
dnl AC_ENABLE_STATIC - implement the --enable-static flag
760
dnl Usage: AC_ENABLE_STATIC[(DEFAULT)]
761
dnl Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
763
AC_DEFUN([AC_ENABLE_STATIC],
764
[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
765
AC_ARG_ENABLE(static,
766
changequote(<<, >>)dnl
767
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
769
[p=${PACKAGE-default}
771
yes) enable_static=yes ;;
772
no) enable_static=no ;;
775
# Look at the argument we got. We use all the common list separators.
776
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
777
for pkg in $enableval; do
778
if test "X$pkg" = "X$p"; then
785
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
788
dnl AC_DISABLE_STATIC - set the default static flag to --disable-static
789
AC_DEFUN([AC_DISABLE_STATIC],
790
[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
791
AC_ENABLE_STATIC(no)])
793
dnl AC_TRY_RUN_STRICT(PROGRAM,CFLAGS,CPPFLAGS,LDFLAGS,
794
dnl [ACTION-IF-TRUE],[ACTION-IF-FALSE],
795
dnl [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
796
AC_DEFUN( [AC_TRY_RUN_STRICT],
798
old_CFLAGS="$CFLAGS";
801
old_CPPFLAGS="$CPPFLAGS";
804
old_LDFLAGS="$LDFLAGS";
807
AC_TRY_RUN([$1],[$5],[$6],[$7])
808
CFLAGS="$old_CFLAGS";
811
CPPFLAGS="$old_CPPFLAGS";
814
LDFLAGS="$old_LDFLAGS";
819
dnl SMB_CHECK_SYSCONF(varname)
820
dnl Tests whether the sysconf(3) variable "varname" is available.
821
AC_DEFUN([SMB_CHECK_SYSCONF],
823
AC_CACHE_CHECK([for sysconf($1)],
826
AC_TRY_LINK([#include <unistd.h>],
827
[ return sysconf($1) == -1 ? 1 : 0; ],
828
[ samba_cv_SYSCONF$1=yes ],
829
[ samba_cv_SYSCONF$1=no ])
832
if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
833
AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
837
dnl SMB_IS_LIBPTHREAD_LINKED([actions if true], [actions if false])
838
dnl Test whether the current LIBS results in libpthread being present.
839
dnl Execute the corresponding user action list.
840
AC_DEFUN([SMB_IS_LIBPTHREAD_LINKED],
842
AC_MSG_CHECKING(if libpthread is linked)
844
[return pthread_create(0, 0, 0, 0);],
855
dnl SMB_REMOVE_LIB(lib)
856
dnl Remove the given library from $LIBS
857
AC_DEFUN([SMB_REMOVELIB],
859
LIBS=`echo $LIBS | sed -es/-l$1//g`
862
dnl SMB_CHECK_DMAPI([actions if true], [actions if false])
863
dnl Check whether DMAPI is available and is a version that we know
864
dnl how to deal with. The default truth action is to set samba_dmapi_libs
865
dnl to the list of necessary libraries, and to define USE_DMAPI.
866
AC_DEFUN([SMB_CHECK_DMAPI],
870
if test x"$samba_dmapi_libs" = x"" ; then
871
AC_CHECK_LIB(dm, dm_get_eventlist,
872
[ samba_dmapi_libs="-ldm"], [])
875
if test x"$samba_dmapi_libs" = x"" ; then
876
AC_CHECK_LIB(jfsdm, dm_get_eventlist,
877
[samba_dmapi_libs="-ljfsdm"], [])
880
if test x"$samba_dmapi_libs" = x"" ; then
881
AC_CHECK_LIB(xdsm, dm_get_eventlist,
882
[samba_dmapi_libs="-lxdsm"], [])
885
# Only bother to test ehaders if we have a candidate DMAPI library
886
if test x"$samba_dmapi_libs" != x"" ; then
887
AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h)
890
if test x"$samba_dmapi_libs" != x"" ; then
891
samba_dmapi_save_LIBS="$LIBS"
892
LIBS="$LIBS $samba_dmapi_libs"
895
#include <time.h> /* needed by Tru64 */
896
#include <sys/types.h> /* needed by AIX */
897
#ifdef HAVE_XFS_DMAPI_H
898
#include <xfs/dmapi.h>
899
#elif defined(HAVE_SYS_DMI_H)
901
#elif defined(HAVE_SYS_JFSDMAPI_H)
902
#include <sys/jfsdmapi.h>
903
#elif defined(HAVE_SYS_DMAPI_H)
904
#include <sys/dmapi.h>
908
/* This link test is designed to fail on IRI 6.4, but should
909
* succeed on Linux, IRIX 6.5 and AIX.
912
dm_eventset_t events;
913
/* This doesn't take an argument on IRIX 6.4. */
914
dm_init_service(&version);
915
/* IRIX 6.4 expects events to be a pointer. */
916
DMEV_ISSET(DM_EVENT_READ, events);
919
true # DMAPI link test succeeded
925
LIBS="$samba_dmapi_save_LIBS"
928
if test x"$samba_dmapi_libs" = x"" ; then
929
# DMAPI detection failure actions begin
932
AC_ERROR(Failed to detect a supported DMAPI implementation)
937
# DMAPI detection failure actions end
939
# DMAPI detection success actions start
942
AC_DEFINE(USE_DMAPI, 1,
943
[Whether we should build DMAPI integration components])
944
AC_MSG_NOTICE(Found DMAPI support in $samba_dmapi_libs)
949
# DMAPI detection success actions end
954
dnl SMB_CHECK_CLOCK_ID(clockid)
955
dnl Test whether the specified clock_gettime clock ID is available. If it
956
dnl is, we define HAVE_clockid
957
AC_DEFUN([SMB_CHECK_CLOCK_ID],
959
AC_MSG_CHECKING(for $1)
961
#if TIME_WITH_SYS_TIME
962
# include <sys/time.h>
966
# include <sys/time.h>
977
AC_DEFINE(HAVE_$1, 1,
978
[Whether the clock_gettime clock ID $1 is available])
985
dnl SMB_IF_RTSIGNAL_BUG([actions if true],
986
dnl [actions if false],
987
dnl [actions if cross compiling])
988
dnl Test whether we can call sigaction with RT_SIGNAL_NOTIFY and
989
dnl RT_SIGNAL_LEASE (also RT_SIGNAL_AIO for good measure, though
990
dnl I don't believe that triggers any bug.
992
dnl See the samba-technical thread titled "Failed to setup
993
dnl RT_SIGNAL_NOTIFY handler" for details on the bug in question.
994
AC_DEFUN([SMB_IF_RTSIGNAL_BUG],
996
rt_signal_notify_works=yes
997
rt_signal_lease_works=yes
998
rt_signal_aio_works=yes
1000
AC_MSG_CHECKING(if sigaction works with realtime signals)
1003
#include <sys/types.h>
1007
/* from smbd/notify_kernel.c */
1008
#ifndef RT_SIGNAL_NOTIFY
1009
#define RT_SIGNAL_NOTIFY (SIGRTMIN+2)
1012
/* from smbd/aio.c */
1013
#ifndef RT_SIGNAL_AIO
1014
#define RT_SIGNAL_AIO (SIGRTMIN+3)
1017
/* from smbd/oplock_linux.c */
1018
#ifndef RT_SIGNAL_LEASE
1019
#define RT_SIGNAL_LEASE (SIGRTMIN+1)
1022
static void signal_handler(int sig, siginfo_t *info, void *unused)
1030
struct sigaction act = {0};
1032
act.sa_sigaction = signal_handler;
1033
act.sa_flags = SA_SIGINFO;
1034
sigemptyset( &act.sa_mask );
1036
if (sigaction(RT_SIGNAL_LEASE, &act, 0) != 0) {
1037
/* Failed to setup RT_SIGNAL_LEASE handler */
1041
if (sigaction(RT_SIGNAL_NOTIFY, &act, 0) != 0) {
1042
/* Failed to setup RT_SIGNAL_NOTIFY handler */
1046
if (sigaction(RT_SIGNAL_AIO, &act, 0) != 0) {
1047
/* Failed to setup RT_SIGNAL_AIO handler */
1051
/* zero on success */
1061
case "$ac_status" in
1062
1|11|101|111) rt_signal_lease_ok=no ;;
1064
case "$ac_status" in
1065
10|11|110|111) rt_signal_notify_ok=no ;;
1067
case "$ac_status" in
1068
100|110|101|111) rt_signal_aio_ok=no ;;
1073
AC_MSG_RESULT(cross)