3 dnl Copyright (C) 2004 Stefan Metzmacher
4 dnl Copyright (C) 2004-2005 Jelmer Vernooij
5 dnl Published under the GPL
7 dnl SMB_MODULE_DEFAULT(name,default_build)
9 dnl SMB_SUBSYSTEM_ENABLE(name,default_build)
11 dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems)
13 dnl SMB_EXT_LIB_ENABLE(name,default_build)
15 dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name)
17 dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
19 dnl SMB_LIBRARY_ENABLE(name,default_build)
21 dnl SMB_BINARY_ENABLE(name,default_build)
23 dnl #######################################################
24 dnl ### And now the implementation ###
25 dnl #######################################################
27 dnl SMB_MODULE_DEFAULT(name,default_build)
28 AC_DEFUN([SMB_MODULE_DEFAULT],
30 [SMB_MODULE_DEFAULT][$1]="$2"
31 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
32 \$enabled{$1} = \"$2\";"
35 dnl SMB_SUBSYSTEM_ENABLE(name,default_build)
36 AC_DEFUN([SMB_SUBSYSTEM_ENABLE],
38 [SMB_SUBSYSTEM_ENABLE_][$1]="$2"
39 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
40 \$enabled{$1} = \"$2\";"
43 dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems)
44 AC_DEFUN([SMB_SUBSYSTEM],
47 if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then
48 [SMB_SUBSYSTEM_ENABLE_][$1]="YES";
51 if test -z "$[SMB_SUBSYSTEM_NOPROTO_][$1]"; then
52 [SMB_SUBSYSTEM_NOPROTO_][$1]="NO";
55 SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
56 ###################################
61 REQUIRED_SUBSYSTEMS = $4
64 ###################################
68 dnl SMB_EXT_LIB_ENABLE(name,default_build)
69 AC_DEFUN([SMB_EXT_LIB_ENABLE],
71 [SMB_EXT_LIB_ENABLE_][$1]="$2"
72 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
73 \$enabled{EXT_LIB_$1} = \"$2\";"
76 dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name)
77 AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
79 dnl Figure out the correct variables and call SMB_EXT_LIB()
81 if test -z "$PKG_CONFIG"; then
82 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
85 if test "$PKG_CONFIG" = "no" ; then
86 echo "*** The pkg-config script could not be found. Make sure it is"
87 echo "*** in your path, or set the PKG_CONFIG environment variable"
88 echo "*** to the full path to pkg-config."
89 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
91 SMB_EXT_LIB_ENABLE($1, NO)
93 if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then
94 AC_MSG_CHECKING(for $2)
96 if test "$SMB_EXT_LIB_$1"x = "NO"x ; then
97 SMB_EXT_LIB_ENABLE($1, NO)
98 AC_MSG_RESULT(disabled)
99 elif $PKG_CONFIG --exists '$2' ; then
103 $1_CFLAGS="`$PKG_CONFIG --cflags '$2'`"
105 CFLAGS="$CFLAGS $$1_CFLAGS"
106 AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS])
107 AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
108 SMB_EXT_LIB_ENABLE($1, YES)
112 AC_MSG_WARN([cannot run when cross-compiling]))
116 [`$PKG_CONFIG --libs-only-l '$2'`],
117 [`$PKG_CONFIG --cflags-only-other '$2'`],
118 [`$PKG_CONFIG --cflags-only-I '$2'`],
119 [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`])
123 SMB_EXT_LIB_ENABLE($1, NO)
125 $PKG_CONFIG --errors-to-stdout --print-errors '$2'
128 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
129 echo "*** See http://www.freedesktop.org/software/pkgconfig"
131 SMB_EXT_LIB_ENABLE($1, NO)
136 dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
137 AC_DEFUN([SMB_EXT_LIB],
140 SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
141 ###################################
143 @<:@EXT_LIB::EXT_LIB_$1@:>@
149 ###################################
153 dnl SMB_LIBRARY_ENABLE(name,default_build)
154 AC_DEFUN([SMB_LIBRARY_ENABLE],
156 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
157 \$enabled{$1} = \"$2\";"
160 dnl SMB_BINARY_ENABLE(name,default_build)
161 AC_DEFUN([SMB_BINARY_ENABLE],
163 [SMB_BINARY_ENABLE_][$1]="$2";
165 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
166 \$enabled{$1} = \"$2\";"