summaryrefslogtreecommitdiff
path: root/source4/build/m4
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/m4')
-rw-r--r--source4/build/m4/check_cc.m489
-rw-r--r--source4/build/m4/check_ld.m49
-rw-r--r--source4/build/m4/check_path.m4195
-rw-r--r--source4/build/m4/check_perl.m415
-rw-r--r--source4/build/m4/check_shld.m46
-rw-r--r--source4/build/m4/check_types.m439
-rw-r--r--source4/build/m4/core.m467
-rw-r--r--source4/build/m4/env.m423
-rw-r--r--source4/build/m4/public.m4295
9 files changed, 738 insertions, 0 deletions
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4
new file mode 100644
index 0000000000..68e938b794
--- /dev/null
+++ b/source4/build/m4/check_cc.m4
@@ -0,0 +1,89 @@
+dnl SMB Build Environment CC Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+AC_PROG_CC
+if test x"$CC" = x""; then
+ AC_MSG_WARN([No c compiler was not found!])
+ AC_MSG_ERROR([Please Install gcc from http://gcc.gnu.org/])
+fi
+
+dnl needed before AC_TRY_COMPILE
+AC_ISC_POSIX
+
+dnl Check if C compiler understands -c and -o at the same time
+AC_PROG_CC_C_O
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
+ BROKEN_CC=
+else
+ BROKEN_CC=#
+fi
+AC_SUBST(BROKEN_CC)
+
+AC_CACHE_CHECK([that the C compiler can precompile header files],samba_cv_precompiled_headers, [
+ dnl Check whether the compiler can generate precompiled headers
+ touch conftest.h
+ if ${CC-cc} conftest.h 2> /dev/null && test -f conftest.h.gch; then
+ samba_cv_precompiled_headers=yes
+ else
+ samba_cv_precompiled_headers=no
+ fi])
+PCH_AVAILABLE="#"
+if test x"$samba_cv_precompiled_headers" = x"yes"; then
+ PCH_AVAILABLE=""
+fi
+AC_SUBST(PCH_AVAILABLE)
+
+
+dnl Check if the C compiler understands volatile (it should, being ANSI).
+AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
+ AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
+ samba_cv_volatile=yes,samba_cv_volatile=no)])
+if test x"$samba_cv_volatile" = x"yes"; then
+ AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
+fi
+
+############################################
+# check if the compiler can do immediate structures
+AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
+ AC_TRY_COMPILE([
+#include <stdio.h>],
+[
+ typedef struct {unsigned x;} FOOBAR;
+ #define X_FOOBAR(x) ((FOOBAR) { x })
+ #define FOO_ONE X_FOOBAR(1)
+ FOOBAR f = FOO_ONE;
+ static struct {
+ FOOBAR y;
+ } f2[] = {
+ {FOO_ONE}
+ };
+],
+ samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
+if test x"$samba_cv_immediate_structures" = x"yes"; then
+ AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
+fi
+
+AC_MSG_CHECKING([for test routines])
+AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
+ AC_MSG_RESULT(yes),
+ AC_MSG_ERROR([cant find test code. Aborting config]),
+ AC_MSG_WARN([cannot run when cross-compiling]))
+
+#
+# Check if the compiler can handle the options we selected by
+# --enable-*developer
+#
+if test -n "$DEVELOPER_CFLAGS"; then
+ OLD_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
+ AC_MSG_CHECKING([that the C compiler can use the DEVELOPER_CFLAGS])
+ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
+ AC_MSG_RESULT(yes),
+ DEVELOPER_CFLAGS=""; AC_MSG_RESULT(no),
+ AC_MSG_WARN([cannot run when cross-compiling]))
+ CFLAGS="${OLD_CFLAGS}"
+fi
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
new file mode 100644
index 0000000000..79a8432d11
--- /dev/null
+++ b/source4/build/m4/check_ld.m4
@@ -0,0 +1,9 @@
+dnl SMB Build Environment LD Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+dnl Check if we use GNU ld
+AC_PATH_PROG(LD, ld)
+AC_PROG_LD_GNU
diff --git a/source4/build/m4/check_path.m4 b/source4/build/m4/check_path.m4
new file mode 100644
index 0000000000..5d3c70049d
--- /dev/null
+++ b/source4/build/m4/check_path.m4
@@ -0,0 +1,195 @@
+dnl SMB Build Environment Path Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+#################################################
+# Directory handling stuff to support both the
+# legacy SAMBA directories and FHS compliant
+# ones...
+AC_PREFIX_DEFAULT(/usr/local/samba)
+
+AC_ARG_WITH(fhs,
+[ --with-fhs Use FHS-compliant paths (default=no)],
+ configdir="${sysconfdir}/samba"
+ lockdir="\${VARDIR}/cache/samba"
+ piddir="\${VARDIR}/run/samba"
+ logfilebase="\${VARDIR}/log/samba"
+ privatedir="\${CONFIGDIR}/private"
+ libdir="\${prefix}/lib/samba"
+ swatdir="\${DATADIR}/samba/swat",
+ configdir="\${LIBDIR}"
+ logfilebase="\${VARDIR}"
+ lockdir="\${VARDIR}/locks"
+ piddir="\${VARDIR}/locks"
+ privatedir="\${prefix}/private"
+ swatdir="\${prefix}/swat")
+
+#################################################
+# set private directory location
+AC_ARG_WITH(privatedir,
+[ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody calls it without argument
+ #
+ AC_MSG_WARN([--with-privatedir called without argument - will use default])
+ ;;
+ * )
+ privatedir="$withval"
+ ;;
+ esac])
+
+#################################################
+# set lock directory location
+AC_ARG_WITH(lockdir,
+[ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody calls it without argument
+ #
+ AC_MSG_WARN([--with-lockdir called without argument - will use default])
+ ;;
+ * )
+ lockdir="$withval"
+ ;;
+ esac])
+
+#################################################
+# set pid directory location
+AC_ARG_WITH(piddir,
+[ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody calls it without argument
+ #
+ AC_MSG_WARN([--with-piddir called without argument - will use default])
+ ;;
+ * )
+ piddir="$withval"
+ ;;
+ esac])
+
+#################################################
+# set configuration directory location
+AC_ARG_WITH(configdir,
+[ --with-configdir=DIR Where to put configuration files (\$libdir)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody does it
+ #
+ AC_MSG_WARN([--with-configdir called without argument - will use default])
+ ;;
+ * )
+ configdir="$withval"
+ ;;
+ esac])
+
+#################################################
+# set log directory location
+AC_ARG_WITH(logfilebase,
+[ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody does it
+ #
+ AC_MSG_WARN([--with-logfilebase called without argument - will use default])
+ ;;
+ * )
+ logfilebase="$withval"
+ ;;
+ esac])
+
+
+#################################################
+# set swat directory location
+AC_ARG_WITH(swatdir,
+[ --with-swatdir=DIR Where to put configuration files (\$swatdir)],
+[ case "$withval" in
+ yes|no)
+ AC_MSG_WARN([--with-swatdir called without argument - will use default])
+ ;;
+ * )
+ swatdir="$withval"
+ ;;
+ esac])
+
+AC_SUBST(configdir)
+AC_SUBST(lockdir)
+AC_SUBST(piddir)
+AC_SUBST(logfilebase)
+AC_SUBST(privatedir)
+AC_SUBST(bindir)
+AC_SUBST(sbindir)
+AC_SUBST(swatdir)
+
+debug=no
+AC_ARG_ENABLE(debug,
+[ --enable-debug Turn on compiler debugging information (default=no)],
+ [if eval "test x$enable_debug = xyes"; then
+ debug=yes
+ CFLAGS="${CFLAGS} -g"
+ fi])
+
+developer=no
+AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)],
+ [if eval "test x$enable_developer = xyes"; then
+ debug=yes
+ CFLAGS="${CFLAGS} -g -Wall"
+ developer=yes
+ DEVELOPER_CFLAGS="-Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Wmissing-format-attribute -Wformat=2 -Wno-format-y2k -DDEBUG_PASSWORD -DDEVELOPER"
+ fi])
+
+experimental=no
+AC_ARG_ENABLE(experimental, [ --enable-experimental Turn on experimental features (default=no)],
+ [if eval "test x$enable_experimental = xyes"; then
+ experimental=yes
+ fi])
+
+
+dnl disable these external libs
+AC_ARG_WITH(disable-ext-lib,
+[ --with-disable-ext-lib=LIB Comma-seperated list of external libraries],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval SMB_EXT_LIB_$i=NO
+ done
+fi ])
+
+dnl exclude these modules
+AC_ARG_WITH(exclude-modules,
+[ --with-exclude-modules=MODULES Comma-seperated list of names of modules to exclude from build],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval SMB_MODULE_$i=NOT
+ done
+fi ])
+
+dnl Always built these modules shared
+AC_ARG_WITH(shared-modules,
+[ --with-shared-modules=MODULES Comma-seperated list of names of modules to build shared],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval SMB_MODULE_$i=SHARED
+ done
+fi ])
+
+dnl Always built these modules static
+AC_ARG_WITH(static-modules,
+[ --with-static-modules=MODULES Comma-seperated list of names of modules to statically link in],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval SMB_MODULE_$i=STATIC
+ done
+fi ])
diff --git a/source4/build/m4/check_perl.m4 b/source4/build/m4/check_perl.m4
new file mode 100644
index 0000000000..5f5f614f84
--- /dev/null
+++ b/source4/build/m4/check_perl.m4
@@ -0,0 +1,15 @@
+dnl SMB Build Environment Perl Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+AC_PATH_PROG(PERL, perl)
+if test x"$PERL" = x""; then
+ AC_MSG_WARN([No version of perl was not found!])
+ AC_MSG_ERROR([Please Install perl from http://www.perl.com/])
+fi
+if test x"$debug" = x"yes";then
+ PERL="$PERL -W"
+fi
diff --git a/source4/build/m4/check_shld.m4 b/source4/build/m4/check_shld.m4
new file mode 100644
index 0000000000..de43aa0298
--- /dev/null
+++ b/source4/build/m4/check_shld.m4
@@ -0,0 +1,6 @@
+dnl SMB Build Environment Shared Ld Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
diff --git a/source4/build/m4/check_types.m4 b/source4/build/m4/check_types.m4
new file mode 100644
index 0000000000..b4c7b5ed1c
--- /dev/null
+++ b/source4/build/m4/check_types.m4
@@ -0,0 +1,39 @@
+dnl SMB Build Environment Types Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+dnl Add #include for broken IRIX header files
+case "$host_os" in
+ *irix6*) AC_ADD_INCLUDE(<standards.h>)
+ ;;
+esac
+
+AC_C_BIGENDIAN
+
+AC_HEADER_STDC
+
+AC_CHECK_HEADERS(stdbool.h)
+
+AC_CHECK_SIZEOF(short,cross)
+AC_CHECK_SIZEOF(int,cross)
+AC_CHECK_SIZEOF(long,cross)
+AC_CHECK_SIZEOF(long long,cross)
+if test x"$ac_cv_type_long_long" != x"yes";then
+ AC_MSG_ERROR([Sorry we need type 'long long'])
+fi
+if test $ac_cv_sizeof_long_long -lt 8;then
+ AC_MSG_ERROR([Sorry we need sizeof(long long) >= 8])
+fi
+AC_CHECK_TYPE(_Bool)
+AC_CHECK_TYPE(uint_t, unsigned int)
+AC_CHECK_TYPE(int8_t, signed char)
+AC_CHECK_TYPE(uint8_t, unsigned char)
+AC_CHECK_TYPE(int16_t, short)
+AC_CHECK_TYPE(uint16_t, unsigned short)
+AC_CHECK_TYPE(int32_t, long)
+AC_CHECK_TYPE(uint32_t, unsigned long)
+AC_CHECK_TYPE(int64_t, long long)
+AC_CHECK_TYPE(uint64_t, unsigned long long)
diff --git a/source4/build/m4/core.m4 b/source4/build/m4/core.m4
new file mode 100644
index 0000000000..215ca5195e
--- /dev/null
+++ b/source4/build/m4/core.m4
@@ -0,0 +1,67 @@
+dnl SMB Build Core System
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Copyright (C) Jelmer Vernooij 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+dnl _SMB_BUILD_CORE(
+dnl 1: outputfile
+dnl )
+
+dnl #######################################################
+dnl ### And now the implementation ###
+dnl #######################################################
+
+dnl _SMB_BUILD_CORE(
+dnl 1: outputfile
+dnl )
+AC_DEFUN([_SMB_BUILD_CORE],
+[
+
+$PERL -I$srcdir/build <<\_SMB_ACEOF
+use strict;
+
+my %INPUT;
+
+use smb_build::main;
+
+###########################################################
+### First we list all info from configure ###
+###########################################################
+#
+#########################################
+## Start Build Env
+$SMB_INFO_BUILD_ENV
+## End Build Env
+#########################################
+#########################################
+## Start Ext Libs
+$SMB_INFO_EXT_LIBS
+## End Ext Libs
+#########################################
+#########################################
+## Start Modules
+$SMB_INFO_MODULES
+## End Modules
+#########################################
+## Start Subsystems
+$SMB_INFO_SUBSYSTEMS
+## End Subsystems
+#########################################
+## Start Libraries
+$SMB_INFO_LIBRARIES
+## End Libraries
+#########################################
+## Start Binaries
+$SMB_INFO_BINARIES
+## End Binaries
+#########################################
+
+$SMB_INFO_ENABLES
+
+smb_build_main(\%INPUT);
+
+_SMB_ACEOF
+
+])
diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4
new file mode 100644
index 0000000000..c272247661
--- /dev/null
+++ b/source4/build/m4/env.m4
@@ -0,0 +1,23 @@
+dnl SMB Build Environment Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+SMB_VERSION_STRING=`cat include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
+echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
+
+SAMBA_VERSION_SVN_REVISION=`cat include/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
+if test -n "${SAMBA_VERSION_SVN_REVISION}";then
+ echo "BUILD REVISION: ${SAMBA_VERSION_SVN_REVISION}"
+fi
+
+SMB_INFO_BUILD_ENV=""
+
+sinclude(build/m4/check_path.m4)
+sinclude(build/m4/check_perl.m4)
+sinclude(build/m4/check_cc.m4)
+sinclude(build/m4/check_ld.m4)
+sinclude(build/m4/check_shld.m4)
+sinclude(build/m4/check_types.m4)
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
new file mode 100644
index 0000000000..12238bbcc8
--- /dev/null
+++ b/source4/build/m4/public.m4
@@ -0,0 +1,295 @@
+dnl SMB Build System
+dnl ----------------
+dnl Copyright (C) 2004 Stefan Metzmacher
+dnl Copyright (C) 2004 Jelmer Vernooij
+dnl Published under the GPL
+dnl
+dnl SMB_MODULE_DEFAULT(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+dnl
+dnl SMB_SUBSYSTEM_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+dnl
+dnl SMB_SUBSYSTEM(
+dnl 1:name,
+dnl 2:init_obj_files,
+dnl 3:add_obj_files,
+dnl 4:required_libraries,
+dnl 5:required_subsystems
+dnl )
+dnl
+dnl SMB_EXT_LIB_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+dnl
+dnl SMB_EXT_LIB_FROM_PKGCONFIG(
+dnl 1:name,
+dnl 2:pkg-config name
+dnl )
+dnl
+dnl SMB_EXT_LIB(
+dnl 1:name,
+dnl 2:libs,
+dnl 3:cflags,
+dnl 4:cppflags,
+dnl 5:ldflags
+dnl )
+dnl
+dnl SMB_LIBRARY_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+dnl
+dnl SMB_BINARY_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+dnl
+dnl SMB_MAKE_TARGET(
+dnl 1:name
+dnl 2:calledname
+dnl )
+dnl
+dnl SMB_INCLUDE_M4(
+dnl 1: inputfile
+dnl 2: comment
+dnl )
+dnl
+dnl SMB_ENV_CHECK(
+dnl 1:dummy
+dnl )
+dnl
+dnl SMB_AC_OUTPUT(
+dnl 1: outputfile
+dnl )
+
+dnl #######################################################
+dnl ### And now the implementation ###
+dnl #######################################################
+
+AC_DEFUN([STR2ARRAY], [@<:@ input::str2array(\"$1\") @:>@])
+
+
+dnl SMB_MODULE_DEFAULT(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+AC_DEFUN([SMB_MODULE_DEFAULT],
+[
+ [SMB_MODULE_DEFAULT][$1]="$2"
+SMB_INFO_MODULES="$SMB_INFO_MODULES
+\$INPUT{$1}{DEFAULT_BUILD} = \"$2\";"
+])
+
+dnl SMB_SUBSYSTEM_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+AC_DEFUN([SMB_SUBSYSTEM_ENABLE],
+[
+ [SMB_SUBSYSTEM_ENABLE_][$1]="$2"
+SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
+\$INPUT{$1}{ENABLE} = \"$2\";"
+])
+
+dnl SMB_SUBSYSTEM(
+dnl 1:name,
+dnl 2:init_obj_files,
+dnl 3:add_obj_files,
+dnl 4:required_libs,
+dnl 5:required_subsystems
+dnl )
+AC_DEFUN([SMB_SUBSYSTEM],
+[
+
+ if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then
+ [SMB_SUBSYSTEM_ENABLE_][$1]="YES";
+ fi
+
+ if test -z "$[SMB_SUBSYSTEM_NOPROTO_][$1]"; then
+ [SMB_SUBSYSTEM_NOPROTO_][$1]="NO";
+ fi
+
+SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
+###################################
+# Start Subsystem $1
+\$INPUT{$1} = {
+ TYPE => \"SUBSYSTEM\",
+ NAME => \"$1\",
+ INIT_OBJ_FILES => ][STR2ARRAY([$2])][,
+ ADD_OBJ_FILES => ][STR2ARRAY([$3])][,
+ REQUIRED_LIBRARIES => ][STR2ARRAY([$4])][,
+ REQUIRED_SUBSYSTEMS => ][STR2ARRAY([$5])][,
+ ENABLE => \"YES\"
+};
+# End Subsystem $1
+###################################
+"
+])
+
+dnl SMB_EXT_LIB_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+AC_DEFUN([SMB_EXT_LIB_ENABLE],
+[
+[SMB_EXT_LIB_ENABLE_][$1]="$2"
+SMB_INFO_ENABLES="$SMB_INFO_ENABLES
+\$INPUT{EXT_LIB_$1}{ENABLE} = \"$2\";"
+])
+
+dnl SMB_EXT_LIB_FROM_PKGCONFIG(
+dnl 1:name,
+dnl 2:pkg-config name
+dnl )
+AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
+[
+ dnl Figure out the correct variables and call SMB_EXT_LIB()
+
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ SMB_EXT_LIB($1)
+ SMB_EXT_LIB_ENABLE($1, NO)
+ else
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then
+ AC_MSG_CHECKING(for $2)
+
+ if test "$SMB_EXT_LIB_$1"x = "NO"x ; then
+ SMB_EXT_LIB_ENABLE($1, NO)
+ AC_MSG_RESULT(disabled)
+ elif $PKG_CONFIG --exists '$2' ; then
+ AC_MSG_RESULT(yes)
+
+
+ $1_CFLAGS="`$PKG_CONFIG --cflags '$2'`"
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $$1_CFLAGS"
+ AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS])
+ AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
+ SMB_EXT_LIB_ENABLE($1, YES)
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no),
+ CFLAGS="$OLD_CFLAGS"
+ AC_MSG_WARN([cannot run when cross-compiling]))
+
+
+ SMB_EXT_LIB($1,
+ [`$PKG_CONFIG --libs-only-l '$2'`],
+ [`$PKG_CONFIG --cflags-only-other '$2'`],
+ [`$PKG_CONFIG --cflags-only-I '$2'`],
+ [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`])
+
+ else
+ SMB_EXT_LIB($1)
+ SMB_EXT_LIB_ENABLE($1, NO)
+ AC_MSG_RESULT(no)
+ $PKG_CONFIG --errors-to-stdout --print-errors '$2'
+ fi
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ SMB_EXT_LIB($1)
+ SMB_EXT_LIB_ENABLE($1, NO)
+ fi
+ fi
+])
+
+dnl SMB_EXT_LIB(
+dnl 1:name,
+dnl 2:libs,
+dnl 3:cflags,
+dnl 4:cppflags,
+dnl 5:ldflags
+dnl )
+AC_DEFUN([SMB_EXT_LIB],
+[
+
+SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
+###################################
+# Start Ext Lib $1
+\$INPUT{EXT_LIB_$1} = {
+ TYPE => \"EXT_LIB\",
+ NAME => \"EXT_LIB_$1\",
+ LIBS => ][STR2ARRAY([$2])][,
+ CFLAGS => ][STR2ARRAY([$3])][,
+ CPPFLAGS => ][STR2ARRAY([$4])][,
+ LDFLAGS => ][STR2ARRAY([$5])][
+};
+# End Ext Lib $1
+###################################
+"
+])
+
+
+dnl SMB_LIBRARY_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+AC_DEFUN([SMB_LIBRARY_ENABLE],
+[
+SMB_INFO_ENABLES="$SMB_INFO_ENABLES
+\$INPUT{$1}{ENABLE} = \"$2\";"
+])
+
+dnl SMB_BINARY_ENABLE(
+dnl 1:name,
+dnl 2:default_build
+dnl )
+AC_DEFUN([SMB_BINARY_ENABLE],
+[
+ [SMB_BINARY_ENABLE_][$1]="$2";
+
+SMB_INFO_BINARIES="$SMB_INFO_BINARIES
+\$INPUT{$1}{ENABLE} = \"$2\";"
+])
+
+dnl SMB_MAKE_TARGET(
+dnl 1:name
+dnl 2:calledname
+dnl )
+AC_DEFUN([SMB_MAKE_TARGET],
+[
+ echo "#SMB_MAKE_TARGET TOTO"
+])
+
+dnl SMB_INCLUDE_M4(
+dnl 1: inputfile
+dnl 2: comment
+dnl )
+AC_DEFUN([SMB_INCLUDE_M4],
+[
+###################################
+# Start Include $1
+# $2
+sinclude($1)
+# End Include $1
+###################################
+])
+
+dnl SMB_ENV_CHECK(
+dnl 1:dummy
+dnl )
+AC_DEFUN([SMB_ENV_CHECK],
+[
+ _SMB_BUILD_ENV($1)
+])
+
+dnl SMB_AC_OUTPUT(
+dnl 1: outputfile
+dnl )
+AC_DEFUN([SMB_AC_OUTPUT],
+[
+ AC_OUTPUT([$1],[],[_SMB_BUILD_CORE([[$1][.in]])])
+])