aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-04-17 22:30:18 +0000
committerRalf Wildenhues <rwild@gcc.gnu.org>2008-04-17 22:30:18 +0000
commitefacd7487e49150be15d7d4dbe1f3bd3dcbe3005 (patch)
tree7c1e6dda7d67b020d26682ab9eb0d49d12fe5e13 /libjava
parent015cd9b1182b87eab57b92353a7b124d1b3958df (diff)
downloadgcc-efacd7487e49150be15d7d4dbe1f3bd3dcbe3005.zip
gcc-efacd7487e49150be15d7d4dbe1f3bd3dcbe3005.tar.gz
gcc-efacd7487e49150be15d7d4dbe1f3bd3dcbe3005.tar.bz2
gen-classlist.sh.in: Avoid grepping each omission...
libjava/classpath/ * lib/gen-classlist.sh.in: Avoid grepping each omission, by building an awk script with a hash for literal files, and awk regular expressions for the rest. * configure.ac: Call AC_PROG_AWK. * configure: Regenerate. From-SVN: r134414
Diffstat (limited to 'libjava')
-rw-r--r--libjava/classpath/ChangeLog6
-rwxr-xr-xlibjava/classpath/configure52
-rw-r--r--libjava/classpath/configure.ac2
-rwxr-xr-xlibjava/classpath/lib/gen-classlist.sh.in48
4 files changed, 88 insertions, 20 deletions
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index a15c502..c3f3af2 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,5 +1,11 @@
2008-04-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ * lib/gen-classlist.sh.in: Avoid grepping each omission, by
+ building an awk script with a hash for literal files, and
+ awk regular expressions for the rest.
+ * configure.ac: Call AC_PROG_AWK.
+ * configure: Regenerate.
+
* m4/gcc_attribute.m4 (GCC_ATTRIBUTE): Fix cache variable name.
* tools/Makefile.am (gappletviewer, gjarsigner, gkeytool, gjar)
(gnative2ascii, gserialver, gjavah, grmiregistry, gtnameserv)
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 7258e0b..c4031cf 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -11073,6 +11073,46 @@ CC="$lt_save_CC"
# Only expand once:
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -15239,11 +15279,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15242: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15282: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15246: \$? = $ac_status" >&5
+ echo "$as_me:15286: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -15338,11 +15378,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15341: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15381: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15345: \$? = $ac_status" >&5
+ echo "$as_me:15385: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15390,11 +15430,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15393: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15433: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15397: \$? = $ac_status" >&5
+ echo "$as_me:15437: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac
index 0a017d1..d1f34ca 100644
--- a/libjava/classpath/configure.ac
+++ b/libjava/classpath/configure.ac
@@ -375,7 +375,7 @@ dnl -----------------------------------------------------------
dnl Initialize libtool
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
-dnl AC_PROG_AWK
+AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
diff --git a/libjava/classpath/lib/gen-classlist.sh.in b/libjava/classpath/lib/gen-classlist.sh.in
index 1c70411..1768c15 100755
--- a/libjava/classpath/lib/gen-classlist.sh.in
+++ b/libjava/classpath/lib/gen-classlist.sh.in
@@ -82,26 +82,48 @@ for dir in $vm_dirlist; do
fi
done
-# FIXME: could be more efficient by constructing a series of greps.
-for filexp in `cat tmp.omit`; do
- grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
- mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
-done
+# Mangle the omit expressions into a script suitable for old awk.
+# Exploit the fact that many omissions are not regular expressions:
+# assume a single file is listed if it does not contain '*', '$',
+# and ends in '.java'.
+sed_omit_hash='
+1i\
+ BEGIN {\
+ omit[""] = 1
+$a\
+ }
+/[*$]/d
+/\.java$/!d
+s|^| omit["|
+s|$|"] = 1|'
+sed_omit_main_loop='
+1i\
+ {\
+ if (omit[$3]) next
+$a\
+ print\
+ }
+/^[^*$]*\.java$/d
+s|/|\\/|g
+s|^| if ($3 ~ /|
+s|$|/) next|'
+sed "$sed_omit_hash" <tmp.omit >tmp.awk
+sed "$sed_omit_main_loop" <tmp.omit >>tmp.awk
+@AWK@ -f tmp.awk < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
+mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
+vm_omitlist=
for dir in $vm_dirlist; do
if test -f $dir/$1.omit; then
- for filexp in `cat $dir/$1.omit`; do
- grep -v $filexp < vm.add > vm.add.1
- mv vm.add.1 vm.add
- done
+ vm_omitlist="$vm_omitlist $dir/$1.omit"
fi
done
-cat vm.add >> classes.1
+cat $vm_omitlist | sed "$sed_omit_hash" > tmp.awk
+cat $vm_omitlist | sed "$sed_omit_main_loop" >> tmp.awk
+@AWK@ -f tmp.awk < vm.add >>${top_builddir}/lib/classes.1
-rm vm.omit
-rm vm.add
-rm tmp.omit
+rm -f vm.omit vm.add tmp.omit tmp.awk
new=
if test -f ${top_builddir}/lib/classes.2; then