PATCH (libstdc++-v3): Re: Cross compile with FreeBSD target

Loren James Rittle rittle@latour.rsch.comm.mot.com
Wed Oct 16 22:30:00 GMT 2002


In article <87it02giik.fsf@merlin.xternal.fadata.bg>,
Momchil Velikov<velco@fadata.bg> writes:

>>> The following patch is needed to enable the build of cross-compiler
>>> targeted at FreeBSD. The patch basically copies the configuration
>>> stuff from NetBSD, so, someone with FreeBSD installation better check
>>> it.

>>> The patch is against the mainline.

Loren> I will commit an updated patch for you (I can synth a ChangeLog
Loren> entry), if I know it was at least successfully built for one cross.

>     I've built it with --enable-languages=c,c++ and compiled and
>     linked a "Hello, World!".

OK, I have confirmed that crosses to *-freebsd* don't work without any
patch.  I added your patch to my mainline tree, made the adjustments I
posted about earlier, then studied and made additional adjustments
until the cross config.h was identical to the one generated natively
(save testing harness-related defines and HAVE___BUILTIN_ABS etc);
generated a ChangeLog and committed it.  BTW, I tested with this
method:

Add recently built g++ to head of PATH.
Move to fresh $objdir.
$srcdir/gcc/libstdc++-v3/configure --target\=i386-x-freebsd \
--with-cross-host\=i386-x-freebsd
gmake

I verified that built shared library (in cross configuration) was
byte-for-byte match to native build with same paths thus I'm fairly
satisfied that this patch is correct.

Final patch as applied to mainline:

2002-10-17  Momchil Velikov  <velco@fadata.bg>
	    Loren J. Rittle  <ljrittle@acm.org>

	* configure.in: Add *-freebsd* to cross list.
	* configure: Rebuilt.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.105
diff -c -r1.105 configure.in
*** configure.in	26 Sep 2002 05:25:05 -0000	1.105
--- configure.in	17 Oct 2002 05:21:10 -0000
***************
*** 186,191 ****
--- 186,224 ----
          AC_DEFINE(HAVE_ISNANL)
        fi
        ;;
+     *-freebsd*)
+       # Check for available headers.
+       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
+         machine/endian.h machine/param.h sys/machine.h sys/types.h \
+         fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
+         sys/time.h unistd.h])
+       SECTION_FLAGS='-ffunction-sections -fdata-sections'
+       AC_SUBST(SECTION_FLAGS) 
+       GLIBCPP_CHECK_LINKER_FEATURES
+       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
+       GLIBCPP_CHECK_WCHAR_T_SUPPORT
+       os_include_dir="os/bsd/freebsd"
+       AC_DEFINE(HAVE_LC_MESSAGES)
+       AC_DEFINE(HAVE_DRAND48)
+       AC_DEFINE(HAVE_GETPAGESIZE)
+       AC_DEFINE(HAVE_SETENV)
+       AC_DEFINE(HAVE_SIGSETJMP)
+       AC_DEFINE(HAVE_COPYSIGN)
+       AC_DEFINE(HAVE_COPYSIGNF)
+       AC_DEFINE(HAVE_FINITEF)
+       AC_DEFINE(HAVE_FINITE)
+       AC_DEFINE(HAVE_FREXPF)
+       AC_DEFINE(HAVE_HYPOT)
+       AC_DEFINE(HAVE_HYPOTF)
+       AC_DEFINE(HAVE_ISINF)
+       AC_DEFINE(HAVE_ISNAN)
+       AC_DEFINE(HAVE_ISNANF)
+       if test x"long_double_math_on_this_cpu" = x"yes"; then
+         AC_DEFINE(HAVE_FINITEL)
+         AC_DEFINE(HAVE_ISINFL)
+         AC_DEFINE(HAVE_ISNANL)
+       fi
+       ;;
      *-mingw32*)
        AC_CHECK_HEADERS([sys/types.h locale.h float.h])
        GLIBCPP_CHECK_LINKER_FEATURES
***************
*** 228,233 ****
--- 261,294 ----
      *-mingw32*)
        ;;
      *-windiss*)
+       AC_DEFINE(HAVE_ACOSF)
+       AC_DEFINE(HAVE_ASINF)
+       AC_DEFINE(HAVE_ATAN2F)
+       AC_DEFINE(HAVE_ATANF)
+       AC_DEFINE(HAVE_CEILF)
+       AC_DEFINE(HAVE_COPYSIGN)
+       AC_DEFINE(HAVE_COPYSIGNF)
+       AC_DEFINE(HAVE_COSF)
+       AC_DEFINE(HAVE_COSHF)
+       AC_DEFINE(HAVE_EXPF)
+       AC_DEFINE(HAVE_FABSF)
+       AC_DEFINE(HAVE_FLOORF)
+       AC_DEFINE(HAVE_FMODF)
+       AC_DEFINE(HAVE_FREXPF)
+       AC_DEFINE(HAVE_LDEXPF)
+       AC_DEFINE(HAVE_LOG10F)
+       AC_DEFINE(HAVE_LOGF)
+       AC_DEFINE(HAVE_MODFF)
+       AC_DEFINE(HAVE_POWF)
+       AC_DEFINE(HAVE_SINF)
+       AC_DEFINE(HAVE_SINHF)
+       AC_DEFINE(HAVE_SQRTF)
+       AC_DEFINE(HAVE_TANF)
+       AC_DEFINE(HAVE_TANHF)
+       ;;
+     *-freebsd*)
+       # Must replicate generic section since we don't have strtof or strtold.
+       AC_DEFINE(HAVE_MMAP)
        AC_DEFINE(HAVE_ACOSF)
        AC_DEFINE(HAVE_ASINF)
        AC_DEFINE(HAVE_ATAN2F)



More information about the Libstdc++ mailing list