2004-05-13 10:20:53 +00:00
dnl SMB Build System
dnl ----------------
2004-11-13 18:20:33 +00:00
dnl Copyright (C) 2004 Stefan Metzmacher
2005-07-28 11:51:37 +00:00
dnl Copyright (C) 2004-2005 Jelmer Vernooij
2004-11-13 18:20:33 +00:00
dnl Published under the GPL
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_MODULE_DEFAULT(name,default_build)
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_SUBSYSTEM_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems)
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name)
2004-05-13 15:37:57 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
2004-05-13 10:20:53 +00:00
dnl
2005-07-28 11:51:37 +00:00
dnl SMB_BINARY_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
dnl
dnl #######################################################
dnl ### And now the implementation ###
dnl #######################################################
2005-07-28 11:51:37 +00:00
dnl SMB_MODULE_DEFAULT(name,default_build)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_MODULE_DEFAULT],
[
2004-11-14 21:25:07 +00:00
[SMB_MODULE_DEFAULT][$1]="$2"
2005-07-28 11:51:37 +00:00
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
\$enabled{$1} = \"$2\";"
2004-05-13 10:20:53 +00:00
])
2005-07-28 11:51:37 +00:00
dnl SMB_SUBSYSTEM_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_SUBSYSTEM_ENABLE],
[
[SMB_SUBSYSTEM_ENABLE_][$1]="$2"
2005-07-28 11:51:37 +00:00
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
\$enabled{$1} = \"$2\";"
2004-05-13 10:20:53 +00:00
])
2005-07-28 11:51:37 +00:00
dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_SUBSYSTEM],
[
if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then
[SMB_SUBSYSTEM_ENABLE_][$1]="YES";
fi
2004-11-02 07:15:37 +00:00
if test -z "$[SMB_SUBSYSTEM_NOPROTO_][$1]"; then
[SMB_SUBSYSTEM_NOPROTO_][$1]="NO";
fi
2004-05-13 10:20:53 +00:00
SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
###################################
# Start Subsystem $1
2005-07-28 11:51:37 +00:00
@<:@SUBSYSTEM::$1@:>@
INIT_OBJ_FILES = $2
ADD_OBJ_FILES = $3
REQUIRED_SUBSYSTEMS = $4
ENABLE = YES
2004-05-13 10:20:53 +00:00
# End Subsystem $1
###################################
"
])
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_EXT_LIB_ENABLE],
[
2004-11-15 10:43:10 +00:00
[SMB_EXT_LIB_ENABLE_][$1]="$2"
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
2005-07-28 11:51:37 +00:00
\$enabled{EXT_LIB_$1} = \"$2\";"
2004-05-13 10:20:53 +00:00
])
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name)
2004-05-13 15:37:57 +00:00
AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
[
dnl Figure out the correct variables and call SMB_EXT_LIB()
2004-05-13 18:04:36 +00:00
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
2004-05-13 15:37:57 +00:00
2004-05-13 18:04:36 +00:00
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."
2004-11-14 21:25:07 +00:00
SMB_EXT_LIB($1)
SMB_EXT_LIB_ENABLE($1, NO)
2004-05-13 15:37:57 +00:00
else
if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then
2004-05-13 18:04:36 +00:00
AC_MSG_CHECKING(for $2)
2004-05-13 15:37:57 +00:00
2004-11-02 11:31:58 +00:00
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
2004-05-13 18:04:36 +00:00
AC_MSG_RESULT(yes)
2004-05-13 15:37:57 +00:00
2005-02-17 23:11:26 +00:00
$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),
2005-02-17 23:39:56 +00:00
CFLAGS="$OLD_CFLAGS"
2005-02-17 23:11:26 +00:00
AC_MSG_WARN([cannot run when cross-compiling]))
2004-05-13 18:04:36 +00:00
SMB_EXT_LIB($1,
2004-10-08 09:37:55 +00:00
[`$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'`])
2004-05-13 15:37:57 +00:00
2004-05-13 18:04:36 +00:00
else
2004-11-14 21:25:07 +00:00
SMB_EXT_LIB($1)
SMB_EXT_LIB_ENABLE($1, NO)
2004-05-13 15:37:57 +00:00
AC_MSG_RESULT(no)
2004-10-08 09:37:55 +00:00
$PKG_CONFIG --errors-to-stdout --print-errors '$2'
2004-05-13 18:04:36 +00:00
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
2004-11-14 21:25:07 +00:00
echo "*** See http://www.freedesktop.org/software/pkgconfig"
SMB_EXT_LIB($1)
SMB_EXT_LIB_ENABLE($1, NO)
2004-05-13 18:04:36 +00:00
fi
2004-05-13 15:37:57 +00:00
fi
])
2005-07-28 11:51:37 +00:00
dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_EXT_LIB],
[
SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
###################################
# Start Ext Lib $1
2005-07-28 11:51:37 +00:00
@<:@EXT_LIB::EXT_LIB_$1@:>@
LIBS = $2
CFLAGS = $3
CPPFLAGS = $4
LDFLAGS = $5
2004-05-13 10:20:53 +00:00
# End Ext Lib $1
###################################
"
])
2005-07-28 11:51:37 +00:00
dnl SMB_BINARY_ENABLE(name,default_build)
2004-05-13 10:20:53 +00:00
AC_DEFUN([SMB_BINARY_ENABLE],
[
[SMB_BINARY_ENABLE_][$1]="$2";
2004-11-14 21:25:07 +00:00
2005-07-28 11:51:37 +00:00
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
\$enabled{$1} = \"$2\";"
2004-05-13 10:20:53 +00:00
])