X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=m4%2Fsigrok.m4;h=2d0d70fc0af83da629ec5f21e3dc7a9a85e6dee6;hb=e5d953b5592c1ca2af9a0f64f2dfc817a931e59a;hp=875bd1633cf4998c329d2695a135b21dedb00b3a;hpb=b84a733105eea68cbc568850eba20bd571debad7;p=libsigrok.git diff --git a/m4/sigrok.m4 b/m4/sigrok.m4 index 875bd163..2d0d70fc 100644 --- a/m4/sigrok.m4 +++ b/m4/sigrok.m4 @@ -1,22 +1,24 @@ -## Copyright (c) 2009 Openismus GmbH -## Copyright (c) 2015 Daniel Elstner ## ## This file is part of the sigrok project. ## -## sigrok is free software: you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by +## Copyright (C) 2009 Openismus GmbH +## Copyright (C) 2015 Daniel Elstner +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## -## sigrok is distributed in the hope that it will be useful, +## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with sigrok. If not, see . +## along with this program. If not, see . +## -#serial 20150823 +#serial 20150825 ## SR_APPEND(var-name, [list-sep,] element) ## @@ -31,6 +33,19 @@ m4_assert([$# >= 2])[]dnl $1=[$]{$1[}]m4_if([$#], [2], [[$]{$1:+' '}$2], [[$]{$1:+$2}$3])[]dnl ]) +## SR_PREPEND(var-name, [list-sep,] element) +## +## Prepend the shell word to the shell variable named , +## suffixed by unless the list was empty before prepending. If +## only two arguments are supplied, defaults to a single space +## character. +## +AC_DEFUN([SR_PREPEND], +[dnl +m4_assert([$# >= 2])[]dnl +$1=m4_if([$#], [2], [$2[$]{$1:+' '}], [$3[$]{$1:+$2}])[$]$1[]dnl +]) + ## _SR_PKG_VERSION_SET(var-prefix, pkg-name, tag-prefix, base-version, major, minor, [micro]) ## m4_define([_SR_PKG_VERSION_SET], @@ -115,6 +130,24 @@ _SR_LIB_VERSION_SET([$1], [$2], m4_unquote(m4_split([$2], [:]))) ]) +## SR_SEARCH_LIBS(libs-var, function, search-libs, +## [action-if-found], [action-if-not-found], [other-libs]) +## +## Same as AC_SEARCH_LIBS, except that the result is prepended +## to instead of LIBS. Calls AC_SUBST on . +## +AC_DEFUN([SR_SEARCH_LIBS], +[dnl +m4_assert([$# >= 3])[]dnl +sr_sl_save_LIBS=$LIBS +AC_SEARCH_LIBS([$2], [$3],,, m4_join([$6], [[$]$1])) +LIBS=$sr_sl_save_LIBS +AS_CASE([$ac_cv_search_$2], [no*],, + [SR_PREPEND([$1], [$ac_cv_search_$2])]) +m4_ifvaln([$4$5], [AS_IF([test "x$ac_cv_search_$2" = xno], [$5], [$4])])[]dnl +AC_SUBST([$1])[]dnl +]) + ## _SR_VAR_SUMMARY(tag, var-name, line-leader, align-columns, align-char) ## m4_define([_SR_VAR_SUMMARY], [dnl @@ -257,7 +290,8 @@ do test "x$sr_ccf_result" = xno || break done CPPFLAGS=$sr_ccf_save_CPPFLAGS -SR_APPEND([$1], [$sr_ccf_result]) +AS_IF([test "x$sr_ccf_result" != xno], + [SR_APPEND([$1], [$sr_ccf_result])]) AC_MSG_RESULT([$sr_ccf_result]) AC_SUBST([$1]) ])