Merged -r6847:6850 from eb/trial-merge into trunk. This changeset
[debian/gnuradio] / config / grc_build.m4
1 dnl 2006 Free Software Foundation, Inc.
2 dnl 
3 dnl This file is part of GNU Radio
4 dnl 
5 dnl GNU Radio is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3, or (at your option)
8 dnl any later version.
9 dnl 
10 dnl GNU Radio is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl 
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with GNU Radio; see the file COPYING.  If not, write to
17 dnl the Free Software Foundation, Inc., 51 Franklin Street,
18 dnl Boston, MA 02110-1301, USA.
19
20 # Create --enable-foo argument for named component, create variables as needed
21 # $1 is component name
22 AC_DEFUN([GRC_ENABLE],[
23     AC_ARG_ENABLE([$1],
24                   AC_HELP_STRING([--enable-$1],
25                                  [Fail build if $1 fails configuration]),
26                   [],
27                   [[enable_]m4_bpatsubst($1,-,_)=$enable_all_components])
28 ])
29
30 # Conditionally build named component.
31 # $1 is component name
32 # $2 is executed if configuration passes and build is desired
33 # Use $passed=no to indicate configuration failure
34 # Any other value of $passed, including blank, assumes success 
35 AC_DEFUN([GRC_BUILD_CONDITIONAL],[
36     if test x$passed = xno; then
37         skipped_dirs="$skipped_dirs $1"
38         if test x$[enable_]m4_bpatsubst($1,-,_) = xyes; then
39             AC_MSG_ERROR([Component $1 has errors, stopping.])
40         else
41             AC_MSG_RESULT([Not building component $1.])
42         fi      
43     else
44         if test x$[enable_]m4_bpatsubst($1,-,_) != xno; then
45             $2
46             build_dirs="$build_dirs $1"
47             AC_MSG_RESULT([Component $1 passed configuration checks, building.])
48         else
49             skipped_dirs="$skipped_dirs $1"
50             AC_MSG_RESULT([Component $1 passed configuration checks, but not building.])
51         fi
52     fi
53 ])