Subject: Re: C++ program handling in bsd.prog.mk
To: None <thorpej@wasabisystems.com>
From: Oleg Polyanski <Oleg.Polianski@clear.co.nz>
List: tech-toolchain
Date: 01/03/2002 17:09:56
Jason R Thorpe <thorpej@wasabisystems.com> writes:

 One more question regarding the GCC 3.x and NetBSD. Do the
 exceptions work in programs compiled with gcc-current? I have just
 checked against gcc-current and it seems that they are still broken.
 If you are interested in details, please have a look at the PR#4356
 on `http://gcc.gnu.org/'.

> C++ programs, especially if compiled with GCC 3.x, require different
> handling from C programs in <bsd.prog.mk>.  Specifically, the ${CC}
> command used to link the program really should be ${CXX}, as this may
> pull in additional support libraries provided by the compiler that make
> C++ programs function properly.
> 
> For DESTDIR builds, these support programs also must be specified
> explicitly, much like -lgcc is specified explicitly.  For GCC 3.x,
> the support libraries pull in implicitly if !-nostdlib are "-lstdc++
> -lm"
> (-lstdc++ includes routines that make C++ exception handling work, and
> programs won't link without it (or -lsupc++, but since "c++" by itself
> would use -lstdc++, that is also what I used)).
> 
> The patch below adds support for C++ programs to <bsd.prog.mk> by
> checking
> to see if the program's Makefile has set PROG_CXX, adds support for
> pulling
> in the additional support libraries for GCC 3.x (by testing to see that
> HAVE_GCC3 is defined), and includes all the necessary changes to make
> our
> in-tree groff build with GCC 3.1 (gcc-current).

O