From 38698adf29a3c0fda165641fdcbde58568dc1811 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 1 Jun 2007 02:31:15 +0000 Subject: [PATCH] Use the AC_PROG_GREP available in AC 2.60 and later. This works around an issue on Solaris where /usr/bin/grep doesn't understand -q. The grep that AC_PROG_GREP finds (/usr/xpg4/bin/grep), which is POSIX compliant and understands -q. Also fix one instance where egrep was used instead of $EGREP. This commit was SVN r14829. --- config/cxx_find_template_repository.m4 | 4 +++- config/f77_find_ext_symbol_convention.m4 | 13 +++++++------ config/ompi_check_attributes.m4 | 4 ++-- config/ompi_check_visibility.m4 | 4 +++- config/ompi_config_asm.m4 | 16 +++++++++++----- config/ompi_config_pthreads.m4 | 22 ++++++++++++---------- config/ompi_mca.m4 | 14 +++++++++----- config/ompi_setup_f90.m4 | 3 ++- configure.ac | 7 +++++-- 9 files changed, 54 insertions(+), 33 deletions(-) diff --git a/config/cxx_find_template_repository.m4 b/config/cxx_find_template_repository.m4 index cc17bb3428..3693c16855 100644 --- a/config/cxx_find_template_repository.m4 +++ b/config/cxx_find_template_repository.m4 @@ -18,6 +18,8 @@ dnl $HEADER$ dnl AC_DEFUN([OMPI_CXX_FIND_TEMPLATE_REPOSITORY],[ + AC_REQUIRE([AC_PROG_GREP]) + # # Arguments: None # @@ -139,7 +141,7 @@ else temp_mask="`echo $ompi_file | cut -d. -f2`" if test "$ompi_template_filemask" = ""; then ompi_template_filemask="$temp_mask"; - elif test "`echo $ompi_template_filemask | grep $temp_mask`" = ""; then + elif test "`echo $ompi_template_filemask | EGREP $temp_mask`" = ""; then ompi_template_filemask="$ompi_template_filemask $temp_mask" fi fi diff --git a/config/f77_find_ext_symbol_convention.m4 b/config/f77_find_ext_symbol_convention.m4 index 14f3e715dc..3412f07ebd 100644 --- a/config/f77_find_ext_symbol_convention.m4 +++ b/config/f77_find_ext_symbol_convention.m4 @@ -20,6 +20,7 @@ dnl AC_DEFUN([OMPI_F77_FIND_EXT_SYMBOL_CONVENTION], [ AC_REQUIRE([AC_PROG_NM]) + AC_REQUIRE([AC_PROG_GREP]) # invalidate cache if result came from a run where F77 was disabled if test "$ompi_cv_f77_external_symbol" = "skipped" ; then @@ -39,15 +40,15 @@ AC_DEFUN([OMPI_F77_FIND_EXT_SYMBOL_CONVENTION], [ end EOF OMPI_LOG_COMMAND([$F77 $FFLAGS -c conftest.f $LDFLAGS $LIBS], - [if $NM conftest.o | grep foo_bar__ >/dev/null 2>&1 ; then + [if $NM conftest.o | $GREP foo_bar__ >/dev/null 2>&1 ; then ompi_cv_f77_external_symbol="double underscore" - elif $NM conftest.o | grep foo_bar_ >/dev/null 2>&1 ; then + elif $NM conftest.o | $GREP foo_bar_ >/dev/null 2>&1 ; then ompi_cv_f77_external_symbol="single underscore" - elif $NM conftest.o | grep FOO_bar >/dev/null 2>&1 ; then + elif $NM conftest.o | $GREP FOO_bar >/dev/null 2>&1 ; then ompi_cv_f77_external_symbol="mixed case" - elif $NM conftest.o | grep foo_bar >/dev/null 2>&1 ; then + elif $NM conftest.o | $GREP foo_bar >/dev/null 2>&1 ; then ompi_cv_f77_external_symbol="no underscore" - elif $NM conftest.o | grep FOO_BAR >/dev/null 2>&1 ; then + elif $NM conftest.o | $GREP FOO_BAR >/dev/null 2>&1 ; then ompi_cv_f77_external_symbol="upper case" else $NM conftest.o >conftest.out 2>&1 @@ -100,7 +101,7 @@ AC_DEFUN([OMPI_F77_MAKE_C_FUNCTION], [ # name, then there are two trailing underscores. Otherwise, # there is only one trailing underscore. Any idea how to do # that with m4_translit? - if echo $2 | grep _ >/dev/null 2>&1 ; then + if echo $2 | $GREP _ >/dev/null 2>&1 ; then $1[=]m4_translit([$2], [A-Z], [a-z])[__] else $1[=]m4_translit([$2], [A-Z], [a-z])[_] diff --git a/config/ompi_check_attributes.m4 b/config/ompi_check_attributes.m4 index 17456324ce..a50d22cc3d 100644 --- a/config/ompi_check_attributes.m4 +++ b/config/ompi_check_attributes.m4 @@ -24,10 +24,10 @@ # Sun C++: skip # AC_DEFUN([_OMPI_ATTRIBUTE_FAIL_SEARCH],[ - # AC_REQUIRE([AC_PROG_GREP]) # Requires autoconf-2.61 + AC_REQUIRE([AC_PROG_GREP]) if test -s conftest.err ; then for i in ignore skip ; do - grep -iq $i conftest.err + $GREP -iq $i conftest.err if test "$?" = "0" ; then ompi_cv___attribute__[$1]=0 break; diff --git a/config/ompi_check_visibility.m4 b/config/ompi_check_visibility.m4 index c0b1744831..07a154d859 100644 --- a/config/ompi_check_visibility.m4 +++ b/config/ompi_check_visibility.m4 @@ -22,6 +22,8 @@ # OMPI_CHECK_VISIBILITY # -------------------------------------------------------- AC_DEFUN([OMPI_CHECK_VISIBILITY],[ + AC_REQUIRE([AC_PROG_GREP]) + # Check if the compiler has support for visibilty, like some versions of gcc, icc. AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], @@ -38,7 +40,7 @@ AC_DEFUN([OMPI_CHECK_VISIBILITY],[ void bar(void) { fprintf(stderr, "bar\n"); }; ],[], [if test -s conftest.err ; then - grep -iq "visibility" conftest.err + $GREP -iq "visibility" conftest.err if test "$?" = "0" ; then ompi_vc_cc_fvisibility="no" else diff --git a/config/ompi_config_asm.m4 b/config/ompi_config_asm.m4 index dd78558275..ba0a446d18 100644 --- a/config/ompi_config_asm.m4 +++ b/config/ompi_config_asm.m4 @@ -95,6 +95,8 @@ dnl ################################################################# # _OMPI_CHECK_ASM_LSYM([variable-to-set]) # --------------------------------------- AC_DEFUN([_OMPI_CHECK_ASM_LSYM],[ + AC_REQUIRE([AC_PROG_GREP]) + $1="L" for sym in L .L $ L$ ; do @@ -105,11 +107,11 @@ ${sym}mytestlabel$ompi_cv_asm_label_suffix], [# ok, we succeeded at assembling. see if we can nm, # throwing the results in a file if $NM conftest.$OBJEXT > conftest.out 2>&AC_FD_CC ; then - if test "`grep mytestlabel conftest.out`" = "" ; then + if test "`$GREP mytestlabel conftest.out`" = "" ; then # there was no symbol... looks promising to me $1="$sym" asm_result=1 - elif test ["`grep ' [Nt] .*mytestlabel' conftest.out`"] = "" ; then + elif test ["`$GREP ' [Nt] .*mytestlabel' conftest.out`"] = "" ; then # see if we have a non-global-ish symbol # but we should see if we can do better. $1="$sym" @@ -294,6 +296,7 @@ dnl dnl ################################################################# AC_DEFUN([OMPI_CHECK_ASM_ALIGN_LOG],[ AC_REQUIRE([AC_PROG_NM]) + AC_REQUIRE([AC_PROG_GREP]) AC_CACHE_CHECK([if .align directive takes logarithmic value], [ompi_cv_asm_align_log], @@ -304,7 +307,7 @@ AC_DEFUN([OMPI_CHECK_ASM_ALIGN_LOG],[ .align 4 foo$ompi_cv_asm_label_suffix .byte 2], - [ompi_asm_addr=[`$NM conftest.$OBJEXT | grep foo | sed -e 's/.*\([0-9a-fA-F][0-9a-fA-F]\).*foo.*/\1/'`]], + [ompi_asm_addr=[`$NM conftest.$OBJEXT | $GREP foo | sed -e 's/.*\([0-9a-fA-F][0-9a-fA-F]\).*foo.*/\1/'`]], [ompi_asm_addr=""]) # test for both 16 and 10 (decimal and hex notations) echo "configure: .align test address offset is $ompi_asm_addr" >&AC_FD_CC @@ -416,6 +419,8 @@ AC_DEFUN([OMPI_CHECK_ASM_SIZE],[ # sets shell variable var to the things necessary to # disable execable stacks with GAS AC_DEFUN([OMPI_CHECK_ASM_GNU_STACKEXEC], [ + AC_REQUIRE([AC_PROG_GREP]) + AC_CHECK_PROG([OBJDUMP], [objdump], [objdump]) AC_CACHE_CHECK([if .note.GNU-stack is needed], [ompi_cv_asm_gnu_stack_result], @@ -425,7 +430,7 @@ AC_DEFUN([OMPI_CHECK_ASM_GNU_STACKEXEC], [ int testfunc() {return 0; } EOF OMPI_LOG_COMMAND([$CC $CFLAGS -c conftest.c -o conftest.$OBJEXT], - [$OBJDUMP -x conftest.$OBJEXT | grep '\.note\.GNU-stack' > /dev/null && ompi_cv_asm_gnu_stack_result=yes], + [$OBJDUMP -x conftest.$OBJEXT | $GREP '\.note\.GNU-stack' > /dev/null && ompi_cv_asm_gnu_stack_result=yes], [OMPI_LOG_MSG([the failed program was:], 1) OMPI_LOG_FILE([conftest.c]) ompi_cv_asm_gnu_stack_result=no]) @@ -991,6 +996,7 @@ dnl do all the evil mojo to provide a working assembly file dnl dnl ################################################################# AC_DEFUN([OMPI_ASM_FIND_FILE], [ + AC_REQUIRE([AC_PROG_GREP]) AC_REQUIRE([AC_PROG_FGREP]) if test "$ompi_cv_asm_arch" != "WINDOWS" ; then @@ -999,7 +1005,7 @@ if test "$ompi_cv_asm_arch" != "WINDOWS" ; then # see if we have a pre-built one already AC_MSG_CHECKING([for pre-built assembly file]) ompi_cv_asm_file="" - if grep "$ompi_cv_asm_arch" "${top_ompi_srcdir}/opal/asm/asm-data.txt" | $FGREP "$ompi_cv_asm_format" >conftest.out 2>&1 ; then + if $GREP "$ompi_cv_asm_arch" "${top_ompi_srcdir}/opal/asm/asm-data.txt" | $FGREP "$ompi_cv_asm_format" >conftest.out 2>&1 ; then ompi_cv_asm_file="`cut -f3 conftest.out`" if test ! "$ompi_cv_asm_file" = "" ; then ompi_cv_asm_file="atomic-${ompi_cv_asm_file}.s" diff --git a/config/ompi_config_pthreads.m4 b/config/ompi_config_pthreads.m4 index 9c2265978e..68647abcf2 100644 --- a/config/ompi_config_pthreads.m4 +++ b/config/ompi_config_pthreads.m4 @@ -139,14 +139,14 @@ if test "$ompi_pthread_c_success" = "0"; then run_this_test=0 ;; *-aix* | *-freebsd*) - if test "`echo $CPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then + if test "`echo $CPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then PTRHEAD_CPPFLAGS="-D_THREAD_SAFE" CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" fi run_this_test=1 ;; *) - if test "`echo $CPPFLAGS | grep 'D_REENTRANT'`" = ""; then + if test "`echo $CPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then PTHREAD_CPPFLAGS="-D_REENTRANT" CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" fi @@ -187,14 +187,14 @@ if test "$ompi_pthread_cxx_success" = "0"; then run_this_test=0 ;; *-aix* | *-freebsd*) - if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi run_this_test=1 ;; *) - if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then PTHREAD_CXXCPPFLAGS="-D_REENTRANT" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi @@ -422,13 +422,13 @@ if test "$ompi_pthread_c_success" = "0"; then AC_MSG_CHECKING([if C compiler and POSIX threads work with $pl]) case "${host_cpu}-${host-_os}" in *-aix* | *-freebsd*) - if test "`echo $CPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then + if test "`echo $CPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then PTRHEAD_CPPFLAGS="-D_THREAD_SAFE" CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" fi ;; *) - if test "`echo $CPPFLAGS | grep 'D_REENTRANT'`" = ""; then + if test "`echo $CPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then PTHREAD_CPPFLAGS="-D_REENTRANT" CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS" fi @@ -462,13 +462,13 @@ if test "$ompi_pthread_cxx_success" = "0"; then AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $PTHREAD_LIBS]) case "${host_cpu}-${host-_os}" in *-aix* | *-freebsd*) - if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi ;; *) - if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then PTHREAD_CXXCPPFLAGS="-D_REENTRANT" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi @@ -491,13 +491,13 @@ if test "$ompi_pthread_cxx_success" = "0"; then AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pl]) case "${host_cpu}-${host-_os}" in *-aix* | *-freebsd*) - if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi ;; *) - if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then + if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then PTHREAD_CXXCPPFLAGS="-D_REENTRANT" CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" fi @@ -599,6 +599,8 @@ AC_PROVIDE_IFELSE([AC_PROG_F77], # #******************************************************************** AC_DEFUN([OMPI_CONFIG_POSIX_THREADS],[ + AC_REQUIRE([AC_PROG_GREP]) + ompi_pthread_c_success=0 ompi_pthread_f77_success=0 ompi_pthread_cxx_success=0 diff --git a/config/ompi_mca.m4 b/config/ompi_mca.m4 index daf3798ab2..ff1dd0ba2e 100644 --- a/config/ompi_mca.m4 +++ b/config/ompi_mca.m4 @@ -678,6 +678,8 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[ # ###################################################################### AC_DEFUN([MCA_PROCESS_COMPONENT],[ + AC_REQUIRE([AC_PROG_GREP]) + project=$1 framework=$2 component=$3 @@ -707,7 +709,7 @@ AC_DEFUN([MCA_PROCESS_COMPONENT],[ if test -f $infile; then # First check for the ABORT tag - line="`grep ABORT= $infile | cut -d= -f2-`" + line="`$GREP ABORT= $infile | cut -d= -f2-`" if test -n "$line" -a "$line" != "no"; then AC_MSG_WARN([MCA component configure script told me to abort]) AC_MSG_ERROR([cannot continue]) @@ -718,7 +720,7 @@ AC_DEFUN([MCA_PROCESS_COMPONENT],[ # component. if test "$8" = "static"; then m4_foreach(flags, [LDFLAGS, LIBS], - [[line="`grep WRAPPER_EXTRA_]flags[= $infile | cut -d= -f2-`"] + [[line="`$GREP WRAPPER_EXTRA_]flags[= $infile | cut -d= -f2-`"] eval "line=$line" if test -n "$line"; then $1[_WRAPPER_EXTRA_]flags[="$]$1[_WRAPPER_EXTRA_]flags[ $line"] @@ -729,8 +731,8 @@ AC_DEFUN([MCA_PROCESS_COMPONENT],[ dnl check for direct call header to include. This will be dnl AC_SUBSTed later. if test "$DIRECT_$2" = "$component" ; then - if test "`grep DIRECT_CALL_HEADER $infile`" != "" ; then - line="`grep DIRECT_CALL_HEADER $infile | cut -d= -f2-`" + if test "`$GREP DIRECT_CALL_HEADER $infile`" != "" ; then + line="`$GREP DIRECT_CALL_HEADER $infile | cut -d= -f2-`" str="MCA_${framework}_DIRECT_CALL_HEADER=$line" eval $str else @@ -820,6 +822,8 @@ AC_DEFUN([MCA_PROCESS_DEAD_COMPONENT],[ # ###################################################################### AC_DEFUN([MCA_COMPONENT_BUILD_CHECK],[ + AC_REQUIRE([AC_PROG_GREP]) + project=$1 framework=$2 component=$3 @@ -849,7 +853,7 @@ AC_DEFUN([MCA_COMPONENT_BUILD_CHECK],[ # If userid is in the file, unignore the ignore file. if test ! -s $component_path/.ompi_unignore ; then want_component=1 - elif test ! -z "`grep $OMPI_CONFIGURE_USER $component_path/.ompi_unignore`" ; then + elif test ! -z "`$GREP $OMPI_CONFIGURE_USER $component_path/.ompi_unignore`" ; then want_component=1 fi fi diff --git a/config/ompi_setup_f90.m4 b/config/ompi_setup_f90.m4 index 4466a88660..3ff0e4589c 100644 --- a/config/ompi_setup_f90.m4 +++ b/config/ompi_setup_f90.m4 @@ -32,6 +32,7 @@ dnl am_conditional: dnl OMPI_WANT_F90_BINDINGS : AC_DEFUN([OMPI_SETUP_F90],[ + AC_REQUIRE([AC_PROG_GREP]) # Modularize this setup so that sub-configure.in scripts can use this # same setup code. @@ -118,7 +119,7 @@ AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1], # AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1], [if test $BASEF77 != $BASEF90; then - lt_ver=`grep '^VERSION' $srcdir/config/ltmain.sh | cut -f2 -d= | cut -f1 -d'.'` + lt_ver=`$GREP '^VERSION' $srcdir/config/ltmain.sh | cut -f2 -d= | cut -f1 -d'.'` if test $lt_ver -lt 2 ; then AC_MSG_ERROR([You appear to be trying to build the Fortran 90 layer with Libtool 1.5.x or earlier and a Fortran 77 / Fortran 90 compiler diff --git a/configure.ac b/configure.ac index efe2462a34..ef166dc97e 100644 --- a/configure.ac +++ b/configure.ac @@ -876,6 +876,9 @@ WRAPPER_EXTRA_LDFLAGS="$WRAPPER_EXTRA_LDFLAGS $THREAD_LDFLAGS" AC_PROG_LN_S +AC_PROG_GREP +AC_PROG_EGREP + # # We need as and lex # @@ -889,7 +892,7 @@ AM_PROG_LEX # is *only* required for developers, we decided that it really was not # worth it to be portable between different versions of lex ;-). -if test -z "$LEX" -o -n "`echo $LEX | grep missing`" -o \ +if test -z "$LEX" -o -n "`echo $LEX | $GREP missing`" -o \ "`basename $LEX`" != "flex"; then if test ! -f "$srcdir/opal/util/show_help_lex.c"; then AC_MSG_WARN([*** Could not find GNU Flex on your system.]) @@ -1022,7 +1025,7 @@ if test "$OMPI_ENABLE_DLOPEN_SUPPORT" = "1" ; then # Arrgh. This is gross. But I can't think of any other way to do # it. :-( - flags="`egrep ^LIBADD_DL opal/libltdl/Makefile | cut -d= -f2-`" + flags=`$EGREP ^LIBADD_DL opal/libltdl/Makefile | cut -d= -f2-` OMPI_CHECK_LINKER_FLAGS([opal/libltdl/libtool], [-export-dynamic $flags]) WRAPPER_EXTRA_LIBS="$WRAPPER_EXTRA_LIBS $extra_ldflags"