1 dnl Copyright 2006,2008 Free Software Foundation, Inc.
3 dnl This file is part of GNU Radio
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)
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.
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.
20 # Create --enable-foo argument for named component, create variables as needed
21 # $1 is component name
22 AC_DEFUN([GRC_ENABLE],[
24 AC_HELP_STRING([--enable-$1],
25 [Fail build if $1 fails configuration]),
27 [[enable_]m4_bpatsubst($1,-,_)=$enable_all_components])
30 # Create --with-foo argument for named compoment, create variables as needed
31 # $1 is component name
34 AC_HELP_STRING([--with-$1],
35 [Use package $1 if installed in $prefix/lib/pkgconfig; otherwise revert back to --enable-$1]),
40 # Add the specified "with" list; clear the provided variable
41 # $1 is the component name
42 # $2 is the path list name suffix
43 # $3 is the separator (for paths, ":"; for includes " ")
44 AC_DEFUN([GRC_ADD_TO_LIST],[
45 if test "x${$1_$2}" != "x"; then
46 if test "x$with_$2" = "x"; then
49 with_$2="${$1_$2}"$3"$with_$2"
55 # Conditionally build named component.
56 # $1 is component name
57 # $2 is executed if configuration passes and build is desired
58 AC_DEFUN([GRC_BUILD_CONDITIONAL],[
59 _GRC_BUILD_CONDITIONAL($1, m4_bpatsubst($1,-,_), $2)
62 # $1 is the component name
63 # $2=m4_bpatsubst($1,-,_)
64 # $3 is executed if configuration passes and build is desired
65 # Use $passed=no to indicate configuration failure
66 # Use $passed=with to indicate the use of pre-installed libraries and headers
67 # Any other value of $passed, including blank, assumes success
68 AC_DEFUN([_GRC_BUILD_CONDITIONAL],[
69 if test x$passed = xno; then
70 if test x$enable_$2 = xyes; then
71 AC_MSG_ERROR([Component $1 has errors, stopping.])
73 AC_MSG_RESULT([Not building component $1.])
76 if test x$passed = xwith; then
77 with_dirs="$with_dirs $1"
78 GRC_ADD_TO_LIST($2, INCLUDES, " ")
79 GRC_ADD_TO_LIST($2, SWIG_INCLUDES, " ")
80 GRC_ADD_TO_LIST($2, PYDIRPATH, ":")
81 GRC_ADD_TO_LIST($2, SWIGDIRPATH, ":")
82 GRC_ADD_TO_LIST($2, LIBDIRPATH, ":")
83 AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes, and will not be built.])
85 if test x$enable_$2 != xno; then
87 build_dirs="$build_dirs $1"
88 AC_MSG_RESULT([Component $1 passed configuration checks, building.])
91 AC_MSG_RESULT([Component $1 passed configuration checks, but not building.])
95 if test x$passed = xno; then
96 skipped_dirs="$skipped_dirs $1"