Imported Upstream version 3.0.4
[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],[  --enable-$1  Fail build if $1 fails configuration],[],
24                   [[enable_]m4_bpatsubst($1,-,_)=$enable_all_components])
25 ])
26
27 # Conditionally build named component.
28 # $1 is component name
29 # $2 is executed if configuration passes and build is desired
30 # Use $passed=no to indicate configuration failure
31 # Any other value of $passed, including blank, assumes success 
32 AC_DEFUN([GRC_BUILD_CONDITIONAL],[
33     if test x$passed = xno; then
34         skipped_dirs="$skipped_dirs $1"
35         if test x$[enable_]m4_bpatsubst($1,-,_) = xyes; then
36             AC_MSG_ERROR([Component $1 has errors, stopping.])
37         else
38             AC_MSG_RESULT([Not building component $1.])
39         fi      
40     else
41         if test x$[enable_]m4_bpatsubst($1,-,_) != xno; then
42             $2
43             build_dirs="$build_dirs $1"
44             AC_MSG_RESULT([Component $1 passed configuration checks, building.])
45         else
46             skipped_dirs="$skipped_dirs $1"
47             AC_MSG_RESULT([Component $1 passed configuration checks, but not building.])
48         fi
49     fi
50 ])