autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: EXEEXT: `cc -o' (Was: AC_CYGWIN etc.)


From: Bernard Dautrevaux
Subject: RE: EXEEXT: `cc -o' (Was: AC_CYGWIN etc.)
Date: Fri, 15 Dec 2000 14:23:40 +0100

> -----Original Message-----
> From: Akim Demaille [mailto:address@hidden
> Sent: Friday, December 15, 2000 10:42 AM
> To: Alexandre Oliva
> Cc: Mo DeJong; address@hidden; APatche
> Subject: EXEEXT: `cc -o' (Was: AC_CYGWIN etc.)
> 
> 
> 
> Here is my proposal.  Mo, could you give it a try?  Thanks!
> 
> Index: ChangeLog
> from  Akim Demaille  <address@hidden>
>       * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): New.
>       (_AC_COMPILER_EXEEXT_O): Extracted from...
>       (_AC_COMPILER_EXEEXT): here.  Adjust.
> 
> Index: aclang.m4
> ===================================================================
> RCS file: /cvs/autoconf/aclang.m4,v
> retrieving revision 1.97
> diff -u -u -r1.97 aclang.m4
> --- aclang.m4 2000/12/15 07:49:13 1.97
> +++ aclang.m4 2000/12/15 09:31:15
> @@ -652,22 +652,48 @@
>  AC_DEFUN([AC_OBJEXT],   [])
>  
>  
> -# _AC_COMPILER_EXEEXT
> -# -------------------
> -# Check for the extension used for executables.  It compiles a test
> -# executable.  If this is called, the executable extensions will be
> -# automatically used by link commands run by the configure script.
> -#
> -# This macro is called by AC_LANG_COMPILER, the latter being required
> -# by the AC_LINK_IFELSE macros, so use _AC_LINK_IFELSE.
> -m4_define([_AC_COMPILER_EXEEXT],
> -[AC_CACHE_CHECK([for executable suffix], ac_cv_exeext,
> -[_AC_LINK_IFELSE([AC_LANG_PROGRAM()],
> +# _AC_COMPILER_EXEEXT_DEFAULT
> +# ---------------------------
> +# Check for the extension used for the default name for executables.
> +m4_define([_AC_COMPILER_EXEEXT_DEFAULT],
> +[# Try without -o first, disregard a.out.
> +ac_link_save=$ac_link
> +ac_link=`echo "$ac_link" | sed ['s/ -o *conftest[^ ]*//']`
> +if ls a.* >/dev/null 2>&1; then
> +  rm -rf conftestdir
> +  mkdir conftestdir
> +  mv a.* conftestdir
> +fi
> +AS_IFELSE([AC_TRY_EVAL(ac_link)],
> +          [for ac_file in `ls a.exe a.* 2>/dev/null`; do
> +  case $ac_file in
> +    *.$ac_ext | *.out | *.o | *.obj | *.xcoff | *.tds | *.d 
> | *.pdb ) ;;
> +    *) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
> +       break;;
> +  esac
> +done],
Looks fine but what about compilers, I know a few of them, that generates
and executable named after the first source or object file listed if no '-o'
option is given; for example:
        $(CC) xxx.c yyy.o
will generate xxx, or maybe xxx.exe if the host request it.

Then above one must also accept conftext.* in the 'ls' backtick and in the
case statement, like:
        for ac_file in `ls a.exe a.* conftest.* 2>/dev/null`; do
          case $ac_file in
            *.$ac_ext | *.out | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb
) ;;
            a.*) ac_cv_exeext=`expr "$ac_file" : 'a\(.*\)'`
           break;;
            conftest.*) ac_cv_exeext=`expr "$ac_file" : 'conftest\(.*\)'`
                        break;;
          esac
        done,


> +          [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
> +cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD])
> +if test -d conftestdir; then
> +  mv conftestdir/* .
> +  rm -rf conftestdir
> +fi
> +ac_link=$ac_link_save
> +])# _AC_COMPILER_EXEEXT_DEFAULT
> +

This said, although I still think EXEEXT is so much tied to the HOST
environment one way to fix it depending on $host should be fine, I agree
with this patch (with Mo's corrections of course).

Regards,

        Bernard
--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:    +33 (0) 1 47 68 80 80
Fax:    +33 (0) 1 47 88 97 85
e-mail: address@hidden
                address@hidden
-------------------------------------------- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]