@@ -2128,31 +2128,57 @@ AC_ARG_WITH(drivers,
21282128 MACOSX_DRIVERLIST MODBUS_DRIVERLIST LINUX_I2C_DRIVERLIST
21292129 POWERMAN_DRIVERLIST IPMI_DRIVERLIST GPIO_DRIVERLIST"
21302130
2131- get_drvlist() (
2131+ dnl Gets ONE Makefile assignment value
2132+ get_drivers_makefile_value() (
21322133 dnl Note escaped brackets - "against" m4 parser
21332134 m4_version_prereq ( 2.62 ,
21342135 [ LB="@<:@ "; RB="@:>@ "] ,
21352136 [ LB="[ [ "; RB="] ] "]
21362137 )
2138+ dnl ###DEBUG### echo "RECURSIVE SEARCH FOR: '$1 '" >&2
21372139 SPACE="`printf "$LB"' \t'"$RB"`"
21382140 SPACES="${SPACE}*"
21392141 sed -e "s/${SPACES}""$LB"'+'"$RB"'*='"${SPACES}/=/" \
21402142 -e "s/^${SPACES}//" < "$srcdir/drivers/Makefile.am" \
2141- | {
2143+ | (
21422144 C=false; V=false
21432145 while read LINE ; do
21442146 case "$LINE" in
21452147 *'\') C=true; if $V ; then echo "$LINE" ; fi ;;
2146- *) C=false; V=false ;;
2148+ *) if $C ; then exit 0; fi ; C=false; V=false ;;
21472149 esac
21482150 case "$LINE" in
21492151 "$1 "=*)
2150- echo "$LINE" | sed -e 's,^'"$LB"'^='"$RB"'*=,,' -e 's,\$,,'
2152+ echo "$LINE" | sed -e 's,^'"$LB"'^='"$RB"'*=,,'
21512153 V=$C
21522154 ;;
21532155 esac
21542156 done
2155- } | tr '\n' ' ' | sed -e "s,${SPACE}${SPACES}, ," -e "s,${SPACES}\$,,"
2157+ echo ""
2158+ ) | tr '\n' ' ' | sed -e 's,\$(EXEEXT),,g' \
2159+ | tr ' ' '\n' | while read TOKEN ; do
2160+ case x"${TOKEN}" in
2161+ x) ;;
2162+ 'x$('*')') get_drivers_makefile_value "`echo "${TOKEN}" | sed -e 's,^\$(,,' -e 's,)$,,'`" ;;
2163+ 'x${'*'}') get_drivers_makefile_value "`echo "${TOKEN}" | sed -e 's,^\${,,' -e 's,}$,,'`" ;;
2164+ *) echo "${TOKEN} " ;;
2165+ esac
2166+ done dnl ###DEBUG### | tee -a /dev/stderr
2167+ )
2168+
2169+ get_drvlist() (
2170+ m4_version_prereq ( 2.62 ,
2171+ [ LB="@<:@ "; RB="@:>@ "] ,
2172+ [ LB="[ [ "; RB="] ] "]
2173+ )
2174+ dnl ###DEBUG### echo "SEARCH FOR: '$1 '" >&2
2175+ SPACE="`printf "$LB"' \t'"$RB"`"
2176+ SPACES="${SPACE}*"
2177+
2178+ dnl Let it recurse, and only then we collect the
2179+ dnl result into one string with reduced spaces:
2180+ get_drivers_makefile_value "$1 " \
2181+ | tr '\n' ' ' | sed -e "s,${SPACE}${SPACES}, ,g" -e "s,${SPACES}\$,,"
21562182 )
21572183
21582184 for DRVLIST_NAME in $DRVLIST_NAMES; do
0 commit comments