| [de061d] | 1 | # Copyright (C) 2011 The ScaFaCoS project
 | 
|---|
 | 2 | #  
 | 
|---|
 | 3 | # This file is part of ScaFaCoS.
 | 
|---|
 | 4 | #  
 | 
|---|
 | 5 | # ScaFaCoS is free software: you can redistribute it and/or modify it
 | 
|---|
 | 6 | # under the terms of the GNU General Public License as published by
 | 
|---|
 | 7 | # the Free Software Foundation, either version 3 of the License, or
 | 
|---|
 | 8 | # (at your option) any later version.
 | 
|---|
 | 9 | #  
 | 
|---|
 | 10 | #  ScaFaCoS is distributed in the hope that it will be useful,
 | 
|---|
 | 11 | #  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 12 | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 13 | #  GNU Lesser Public License for more details.
 | 
|---|
 | 14 | #  
 | 
|---|
 | 15 | #  You should have received a copy of the GNU Lesser Public License
 | 
|---|
 | 16 | #  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 | 
|---|
 | 17 | #
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | AC_DEFUN([AX_FCS_PACKAGE_RESET],[
 | 
|---|
 | 20 |   ax_fcs_package_file="fcs-package.info"
 | 
|---|
 | 21 |   test -n "$1" && ax_fcs_package_file="$1/${ax_fcs_package_file}"
 | 
|---|
 | 22 |   rm -f ${ax_fcs_package_file}
 | 
|---|
 | 23 | ])
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 | AC_DEFUN([AX_FCS_PACKAGE_ADD],[
 | 
|---|
 | 27 |   ax_fcs_package_file="fcs-package.info"
 | 
|---|
 | 28 |   test -n "$3" && ax_fcs_package_file="$3/${ax_fcs_package_file}"
 | 
|---|
 | 29 |   echo "$1=$2" >> ${ax_fcs_package_file}
 | 
|---|
 | 30 | ])
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | AC_DEFUN([AX_FCS_PACKAGE_PROCESS],[
 | 
|---|
 | 34 |   ax_fcs_topdir="$1"
 | 
|---|
 | 35 |   ax_fcs_pkgdirs="$2"
 | 
|---|
 | 36 |   ax_fcs_package_file="fcs-package.info"
 | 
|---|
 | 37 |   ax_nl="
 | 
|---|
 | 38 | "
 | 
|---|
 | 39 |   test "x${ax_fcs_topdir}" != x && ax_fcs_topdir="${ax_fcs_topdir%/}/"
 | 
|---|
 | 40 |   while test -n "${ax_fcs_pkgdirs}" ; do
 | 
|---|
 | 41 | #    echo "packages: ${ax_fcs_pkgdirs}"
 | 
|---|
 | 42 |     ax_p="${ax_fcs_pkgdirs%% *}"
 | 
|---|
 | 43 |     if test "${ax_p}" = "${ax_fcs_pkgdirs}" ; then
 | 
|---|
 | 44 |       ax_fcs_pkgdirs=
 | 
|---|
 | 45 |     else
 | 
|---|
 | 46 |       ax_fcs_pkgdirs="${ax_fcs_pkgdirs#* }"
 | 
|---|
 | 47 |     fi
 | 
|---|
 | 48 |     ax_p="${ax_p%/}/"
 | 
|---|
 | 49 |     ax_p="${ax_p%./}"
 | 
|---|
 | 50 | #    echo "ax_p: $ax_p"
 | 
|---|
 | 51 |     ax_f="${ax_fcs_topdir}${ax_p}${ax_fcs_package_file}"
 | 
|---|
 | 52 | #    echo "ax_f: ${ax_f}"
 | 
|---|
 | 53 |     if test -f "${ax_f}" ; then
 | 
|---|
 | 54 |       ax_cfg=`cat ${ax_f}`
 | 
|---|
 | 55 | #      echo "$ax_cfg"
 | 
|---|
 | 56 |       _ifs="${IFS}"
 | 
|---|
 | 57 |       IFS="${ax_nl}"
 | 
|---|
 | 58 |       for ax_l in $ax_cfg ; do
 | 
|---|
 | 59 |         IFS="${_ifs}"
 | 
|---|
 | 60 | #        echo "ax_l: ${ax_l}"
 | 
|---|
 | 61 |         ax_var="${ax_l%%=*}"
 | 
|---|
 | 62 |         ax_val="${ax_l#*=}"
 | 
|---|
 | 63 | #        echo "-> $ax_var / $ax_val"
 | 
|---|
 | 64 |         test "x${ax_var}" = x -o "x${ax_val}" = x && continue
 | 
|---|
 | 65 |         if test "x${ax_var}" = xSUB_PACKAGES ; then
 | 
|---|
 | 66 |           for ax_x in ${ax_val} ; do
 | 
|---|
 | 67 |             ax_fcs_pkgdirs="${ax_p}${ax_x} ${ax_fcs_pkgdirs}"
 | 
|---|
 | 68 |           done
 | 
|---|
 | 69 |           continue
 | 
|---|
 | 70 |         fi
 | 
|---|
 | 71 |         if test "x${ax_var%LIBS_A}" != "x${ax_var}" ; then
 | 
|---|
 | 72 |           ax_val_new=
 | 
|---|
 | 73 |           for ax_x in ${ax_val} ; do
 | 
|---|
 | 74 |             if test "x${ax_x#/}" = "x${ax_x}" ; then
 | 
|---|
 | 75 |               ax_x="${ax_p}${ax_x}"
 | 
|---|
 | 76 |             fi
 | 
|---|
 | 77 |             ax_val_new="${ax_val_new} ${ax_x}"
 | 
|---|
 | 78 |           done
 | 
|---|
 | 79 |           ax_val="${ax_val_new# }"
 | 
|---|
 | 80 |         fi
 | 
|---|
 | 81 |         eval ax_old=\"\$ax_fcs_package_${ax_var}\"
 | 
|---|
 | 82 | #        echo "-> old: ${ax_old}"
 | 
|---|
 | 83 |         if test "x${ax_old}" = x ; then
 | 
|---|
 | 84 |           eval ax_fcs_package_${ax_var}=\"${ax_val}\"
 | 
|---|
 | 85 |         else
 | 
|---|
 | 86 |           eval ax_fcs_package_${ax_var}=\"\$ax_fcs_package_${ax_var} ${ax_val}\"
 | 
|---|
 | 87 |         fi
 | 
|---|
 | 88 | #        eval ax_new=\"\$ax_fcs_package_${ax_var}\"
 | 
|---|
 | 89 | #        echo "-> new: ${ax_new}"
 | 
|---|
 | 90 |         IFS="${ax_nl}"
 | 
|---|
 | 91 |       done
 | 
|---|
 | 92 |       IFS="${_ifs}"
 | 
|---|
 | 93 |     fi
 | 
|---|
 | 94 |   done
 | 
|---|
 | 95 | ])
 | 
|---|