diff options
Diffstat (limited to 'config/grc_build.m4')
-rw-r--r-- | config/grc_build.m4 | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/config/grc_build.m4 b/config/grc_build.m4 index 7c060c2be..a43988f29 100644 --- a/config/grc_build.m4 +++ b/config/grc_build.m4 @@ -1,4 +1,4 @@ -dnl 2006 Free Software Foundation, Inc. +dnl Copyright 2006,2008 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -27,27 +27,75 @@ AC_DEFUN([GRC_ENABLE],[ [[enable_]m4_bpatsubst($1,-,_)=$enable_all_components]) ]) +# Create --with-foo argument for named compoment, create variables as needed +# $1 is component name +AC_DEFUN([GRC_WITH],[ + AC_ARG_WITH([$1], + AC_HELP_STRING([--with-$1], + [Use package $1 if installed in $prefix/lib/pkgconfig; otherwise revert back to --enable-$1]), + [], + []) +]) + +# Add the specified "with" list; clear the provided variable +# $1 is the component name +# $2 is the path list name suffix +# $3 is the separator (for paths, ":"; for includes " ") +AC_DEFUN([GRC_ADD_TO_LIST],[ + if test "x${$1_$2}" != "x"; then + if test "x$with_$2" = "x"; then + with_$2="${$1_$2}" + else + with_$2="${$1_$2}"$3"$with_$2" + fi + $1_$2= + fi +]) + # Conditionally build named component. # $1 is component name # $2 is executed if configuration passes and build is desired +AC_DEFUN([GRC_BUILD_CONDITIONAL],[ + _GRC_BUILD_CONDITIONAL($1, m4_bpatsubst($1,-,_), $2) +]) + +# $1 is the component name +# $2=m4_bpatsubst($1,-,_) +# $3 is executed if configuration passes and build is desired # Use $passed=no to indicate configuration failure +# Use $passed=with to indicate the use of pre-installed libraries and headers # Any other value of $passed, including blank, assumes success -AC_DEFUN([GRC_BUILD_CONDITIONAL],[ +AC_DEFUN([_GRC_BUILD_CONDITIONAL],[ if test x$passed = xno; then - skipped_dirs="$skipped_dirs $1" - if test x$[enable_]m4_bpatsubst($1,-,_) = xyes; then + if test x$enable_$2 = xyes; then AC_MSG_ERROR([Component $1 has errors, stopping.]) else AC_MSG_RESULT([Not building component $1.]) - fi + fi else - if test x$[enable_]m4_bpatsubst($1,-,_) != xno; then - $2 - build_dirs="$build_dirs $1" - AC_MSG_RESULT([Component $1 passed configuration checks, building.]) + if test x$passed = xwith; then + with_dirs="$with_dirs $1" + GRC_ADD_TO_LIST($2, INCLUDES, " ") + GRC_ADD_TO_LIST($2, SWIG_INCLUDES, " ") + GRC_ADD_TO_LIST($2, PYDIRPATH, ":") + GRC_ADD_TO_LIST($2, SWIGDIRPATH, ":") + GRC_ADD_TO_LIST($2, LIBDIRPATH, ":") + AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes, and will not be built.]) else - skipped_dirs="$skipped_dirs $1" - AC_MSG_RESULT([Component $1 passed configuration checks, but not building.]) + if test x$enable_$2 != xno; then + $3 + build_dirs="$build_dirs $1" + AC_MSG_RESULT([Component $1 passed configuration checks, building.]) + else + passed=no + AC_MSG_RESULT([Component $1 passed configuration checks, but not building.]) + fi fi fi + if test x$passed = xno; then + skipped_dirs="$skipped_dirs $1" + $2_skipped=yes + else + $2_skipped=no + fi ]) |