| 2. configure uses the following in a failed attempt to determine the
| default compiler output file name:
|
| # Be careful to initialize this variable, since it used to be cached.
| # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
| ac_cv_exeext=
| for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null;
| ls a.out conftest 2>/dev/null;
| ls a.* conftest.* 2>/dev/null`; do
| case $ac_file in
| *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;;
| a.out ) # We found the default executable, but exeext='' is most
| # certainly right.
| break;;
| *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
| # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
| export ac_cv_exeext
| break;;
| * ) break;;
| esac
| done
|
| That's:
| a: non-portable (in some cases, ls reports something like
| a_out.exe not found
| on stdout, which configure misinterprets as an indication that
| a_out.exe exists...)
Great! Please, show where you observed this, so that we can document
this problem (an `ls' that reports errors on stdout).
| and
| b: inefficient
|
| It should be something like:
|
| # Be careful to initialize this variable, since it used to be cached.
| # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
| ac_cv_exeext=
| for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* ; do
| if test -x $ac_file ; then
| case $ac_file in
| *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;;
| a.out ) # We found the default executable, but exeext='' is most
| # certainly right.
| break;;
| *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
| # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
| export ac_cv_exeext
| break;;
| * ) break;;
| esac
| break
| fi
| done
|
| There are similar tests throughout the configure script.
That's better, indeed. Just -f instead of -x.