egcs 1.1a problem and solution

Don Badrak dbadrak@geo.census.gov
Wed Sep 9 05:51:00 GMT 1998


Jeff,

Thanks for your response.  I have some comments.

On Wed, 9 Sep 1998, Jeffrey A Law wrote:

> 
>   In message < Pine.SGI.3.96.980903200934.12294X-100000@gesg34.geo.census.gov >you write:
>   > configure:
>   > [IRIX]
>   >    configure --prefix=/opt/gnu --exec-prefix=/opt/gnu-irix \
>   > 	     --enable-threads
>   > [Solaris]
>   >    configure --prefix=/opt/gnu --exec-prefix=/opt/gnu-solaris \
>   > 	     --enable-threads --with-stabs
> I think you should avoid such configurations.

Then what is the purpose of the --exec-prefix?

Do you have any other suggestions?  I've been building GNU software for
many years this way because I support (as most do) multiple enviroments.
My environment is pretty engrained in this setup.

I want to be able to distribute from a common tree on a per operating system
basis from one place, rather than one machine per platform.

	/opt/gnu
	/opt/gnu-irix
	/opt/gnu-solaris
	/opt/gnu-ultrix
	/opt/gnu-linux
	/opt/gnu-sunos
	/opt/gnu-hpux
	/opt/gnu-(os)

Where all of the non-platform files are in /opt/gnu (man, info, scripts),
and all of the binaries and libraries are in /opt/gnu-(os).

My problem with this release of egcs (and the same was in gcc 2.8.1) is
that the software installs in /opt/gnu-(os), but the compiler refuses to
look there by default.

> The problem with your patch is that it assumes that prefix specifies
> a directory name.  It does not, it merely specifies a prefix.

  if ( strncmp (path, std_prefix, strlen (std_prefix)) == 0 &&
       ( path[strlen (std_prefix)] == 0 || path[strlen (std_prefix)] == '/'
#ifdef DIR_SEPARATOR
         || path[strlen (std_prefix)] == DIR_SEPARATOR
#endif
       ) && key != 0)

If the prefix is /opt/gnu and the passed in prefix is /opt/gnuuu, this piece
of code will cause the prefix not to be rewritten because (a) the string does
not end ("/opt/gnuuu"[8]!=0), and (b) the next character after the original
prefix is not a directory.  Should /opt/gnuuu be replaced with /opt/gnu?

Like I said, my patch could be rewritten as necessary.  I'm not clear on
the intended purpose of the prefix.c code.  What is it supposed to do?
What is its purpose?

> So I believe the code is actually behaving in the expected manner
> when presented with a builtin prefix of /opt/gnu and a passed in
> path of /opt/gnu-solaris.

I did some tests on the replacements the code generated (with my patch):

before=/opt/gnu, after=/opt/gnu
before=/opt/gnu/, after=/opt/gnu/
before=/opt/gnucifer, after=/opt/gnucifer
before=/opt/gnu-irix, after=/opt/gnu-irix
before=/opt/gnu-solaris, after=/opt/gnu-solaris
before=/opt/gnu-solaris/, after=/opt/gnu-solaris/
before=/opt/GNU-solaris, after=/opt/GNU-solaris

I also tested without my patch:

before=/opt/gnu, after=/opt/gnu
before=/opt/gnu/, after=/opt/gnu/
before=/opt/gnucifer, after=/opt/gnu
before=/opt/gnu-irix, after=/opt/gnu
before=/opt/gnu-solaris, after=/opt/gnu
before=/opt/gnu-solaris/, after=/opt/gnu/
before=/opt/GNU-solaris, after=/opt/GNU-solaris

I'm looking for the right solution to this problem. 

Don
--
Don Badrak <dbadrak@census.gov>              301.457.1125 work MWThF
Geography Division                           301.457.2157 work Tu
U.S. Bureau of the Census                    301.457.4710 fax
Upper Marlboro MD, USA




More information about the Gcc-bugs mailing list