Add error check in configure

Tim Josling tej@melbpc.org.au
Sat Jun 8 05:59:00 GMT 2002


Currently the configure fails silently if the user specifies a wrong language name eg 'f' instead of 'f77'. The patch issues an error message saying which languages were not found and then terminates configure. 

I found this when trying to build Fortran to work out how the new garbage collection works. It took me a while to work out why Fortran would not build. If it happened to me I suppose it has happened to others as well and anything that makes the build more user friendly is a good thing I believe.

It will also issue an error if the user specifies 'c' as a language because it is assumed and therefore specifying it is redundant. An explanation is provided for this. This may cause some people's configure commands to fail.

I ran the configure against numerous scenarios such as configure-langauges=all, =xxx,f77,yyy,treelang etc.

Bootstrapped c treelang and f77 OK.

OK to apply?

Tim Josling
-------------- next part --------------
diff -c -p -N -X treelang.diff.excl cvs.copy/gcc/gcc/ChangeLog cvs/gcc/gcc/ChangeLog
*** cvs.copy/gcc/gcc/ChangeLog	Sat Jun  8 06:58:25 2002
--- cvs/gcc/gcc/ChangeLog	Sat Jun  8 17:07:16 2002
***************
*** 1,3 ****
--- 1,11 ----
+ 
+ 2002-06-08  Tim Josling  <tej@melbpc.org.au>
+ 
+ 	* configure.in (remaining_languages_check): 
+ 	Added check that all languages specified were found. 
+ 	Exit if not found. Previous behaviour was silent failure.
+ 	* configure: Regenerated.
+ 
  2002-06-07  Akim Demaille  <akim@epita.fr>
  
  	* gengtype-yacc.y (optionseqopt): Add the ending `;' to the action.
diff -c -p -N -X treelang.diff.excl cvs.copy/gcc/gcc/configure.in cvs/gcc/gcc/configure.in
*** cvs.copy/gcc/gcc/configure.in	Sat Jun  8 06:58:34 2002
--- cvs/gcc/gcc/configure.in	Sat Jun  8 16:43:57 2002
*************** if test x"${enable_languages+set}" != xs
*** 2169,2176 ****
  		enable_languages=all
  	fi
  else
! 	if test x"${enable_languages}" = x ||
! 	   test x"${enable_languages}" = xyes;
  	then
  		AC_MSG_ERROR([--enable-languages needs at least one language argument])
  	fi
--- 2169,2175 ----
  		enable_languages=all
  	fi
  else
! 	if test x"${enable_languages}" = x;
  	then
  		AC_MSG_ERROR([--enable-languages needs at least one language argument])
  	fi
*************** changequote([,])dnl
*** 2210,2215 ****
--- 2209,2215 ----
     esac
  done
  
+ remaining_languages=${enable_languages}
  subdirs=
  for lang in ${srcdir}/*/config-lang.in ..
  do
*************** changequote(,)dnl
*** 2235,2240 ****
--- 2235,2241 ----
  	  *) add_this_lang=no ;;
  	  esac
  	  if test x"${add_this_lang}" = xyes; then
+                 remaining_languages=`echo $remaining_languages | sed -e s/${lang_alias}//g`
  		case $lang in
  		    ${srcdir}/ada/config-lang.in)
  			if test x$have_gnat = xyes ; then
*************** changequote([,])dnl
*** 2251,2256 ****
--- 2252,2267 ----
  	esac
  done
  
+ remaining_languages_check=`echo $remaining_languages | sed -e 's/,//g' -e 's/^c$//'g`
+ if test "xxx$remaining_languages_check" != "xxx" -a "xxx$remaining_languages_check" != "xxxall"  ; then
+     remaining_languages_clean=`echo $remaining_languages | sed -e 's/,,*/,/g' -e 's/^,//g' | sed -e 's/,$//g' `
+     echo "Language alias(es) not found: $remaining_languages_clean" 
+     echo "Check file config_lang.in language= in language directory for correct alias name"
+     echo "Or, specify 'all' or omit enable-languages to build default languages"
+     echo "There is no need to specify 'c' and if you specify it you will get a not found message"
+     exit 1
+ fi
+ 
  # Make gthr-default.h if we have a thread file.
  gthread_flags=
  if test $thread_file != single; then
diff -c -p -N -X treelang.diff.excl cvs.copy/gcc/gcc/configure cvs/gcc/gcc/configure
*** cvs.copy/gcc/gcc/configure	Sat Jun  8 06:58:34 2002
--- cvs/gcc/gcc/configure	Sat Jun  8 16:45:58 2002
*************** if test x"${enable_languages+set}" != xs
*** 7913,7920 ****
  		enable_languages=all
  	fi
  else
! 	if test x"${enable_languages}" = x ||
! 	   test x"${enable_languages}" = xyes;
  	then
  		{ echo "configure: error: --enable-languages needs at least one language argument" 1>&2; exit 1; }
  	fi
--- 7913,7919 ----
  		enable_languages=all
  	fi
  else
! 	if test x"${enable_languages}" = x;
  	then
  		{ echo "configure: error: --enable-languages needs at least one language argument" 1>&2; exit 1; }
  	fi
*************** do
*** 7952,7957 ****
--- 7951,7957 ----
     esac
  done
  
+ remaining_languages=${enable_languages}
  subdirs=
  for lang in ${srcdir}/*/config-lang.in ..
  do
*************** do
*** 7976,7981 ****
--- 7976,7982 ----
  	  *) add_this_lang=no ;;
  	  esac
  	  if test x"${add_this_lang}" = xyes; then
+                 remaining_languages=`echo $remaining_languages | sed -e s/${lang_alias}//g`
  		case $lang in
  		    ${srcdir}/ada/config-lang.in)
  			if test x$have_gnat = xyes ; then
*************** do
*** 7991,7996 ****
--- 7992,8007 ----
  	esac
  done
  
+ remaining_languages_check=`echo $remaining_languages | sed -e 's/,//g' -e 's/^c$//'g`
+ if test "xxx$remaining_languages_check" != "xxx" -a "xxx$remaining_languages_check" != "xxxall"  ; then
+     remaining_languages_clean=`echo $remaining_languages | sed -e 's/,,*/,/g' -e 's/^,//g' | sed -e 's/,$//g' `
+     echo "Language alias(es) not found: $remaining_languages_clean" 
+     echo "Check file config_lang.in language= in language directory for correct alias name"
+     echo "Or, specify 'all' or omit enable-languages to build default languages"
+     echo "There is no need to specify 'c' and if you specify it you will get a not found message"
+     exit 1
+ fi
+ 
  # Make gthr-default.h if we have a thread file.
  gthread_flags=
  if test $thread_file != single; then
*************** fi
*** 8035,8041 ****
  
  
  echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
! echo "configure:8039: checking whether to enable maintainer-specific portions of Makefiles" >&5
      # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
  if test "${enable_maintainer_mode+set}" = set; then
    enableval="$enable_maintainer_mode"
--- 8046,8052 ----
  
  
  echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
! echo "configure:8050: checking whether to enable maintainer-specific portions of Makefiles" >&5
      # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
  if test "${enable_maintainer_mode+set}" = set; then
    enableval="$enable_maintainer_mode"



More information about the Gcc-patches mailing list