[m-rev.] for review: extend configure to support an hlc source distribution

Peter Wang novalazy at gmail.com
Tue Mar 2 12:33:19 AEDT 2010


On 2010-03-02, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> configure.in:
> 	If we don't have a (working) Mercury compiler from which to
> 	bootstrap, but do have some pre-generated C files, then check
> 	whether those files were generated with --highlevel-code
> 	enabled.
> 
> 	Force the bootstrap grade to be hlc.gc if we are compiling
> 	the source distribution and the pre-generated C files were
> 	created with --highlevel-code enabled.
> 
> 	Abort early and emit an error message if we do not have
> 	any pre-generated C files and we also do not have a bootstrap
> 	Mercury compiler -- currently this situation is not checked
> 	for, and compilation proceeds as far as the standard library.
> 	(XXX Is this behaviour intended?)

I can't see why.

> @@ -399,6 +401,9 @@
>              test -f $PREFIX/bin/mercury_compile ||
>              test -f $PREFIX/bin/mercury_compile.exe
>          then
> +            # This variable is used to let the tests in the following section know
> +            # that we are going to attempt to bootstrap with the compiler $PREFIX/bin.
> +            bootstrap_from_prefix="yes"
>              AC_MSG_WARN(
>  [using $PREFIX/bin/mercury_compile to bootstrap])
>          else

the compiler in $PREFIX/bin

> +#-----------------------------------------------------------------------------#
> +
> +if test "$BOOTSTRAP_MC" = ""
> +then
> +    # If we do not have a working boostrap Mercury compiler, then work out
> +    # whether any .c files we do have were compiled with --highlevel code or
> +    # not.  At this point we only check a single file -- this is enough to
> +    # allow us to determine a value for BOOTSTRAP_GRADE below -- we check
> +    # any other pre-generated .c files as part of the call to
> +    # mercury_check_c_files() later on.
> +    #
> +    if test -f compiler/top_level.c
> +    then
> +        highlevel_code=`grep "HIGHLEVEL_CODE\=.*" compiler/top_level.c`
> +    else
> +        if test -f compiler/Mercury/cs/top_level.c
> +        then
> +            highlevel_code=`grep "HIGHLEVEL_CODE\=.*" compiler/Mercury/cs/top_level.c`

The regex can be simplified to "HIGHLEVEL_CODE="

> +        else
> +            # If we are going to attempt to bootstrap from a compiler in
> +            # $PREFIX/bin (see the above section), the it is ok if we don't
> +            # have any pre-generated .c files; if not, then we cannot continue.

then it is

> +            if test "$bootstrap_from_prefix" != "yes"
> +            then
> +                AC_MSG_ERROR(
> +[You need a working Mercury compiler to bootstrap with])
> +            fi
> +        fi
> +    fi

Looks okay.

Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list