[omniORB-dev] patch to allow disabling the long double support

Mika Laitio lamikr at pilppa.org
Thu Oct 14 04:20:20 BST 2010


Hi

Attached is a new version of patch. First version had problems when 
building on platforms that supported long double and this fixes it.
This version is build tested with 4 different sets against the omniorb svn 
revision 5982.
- crosscompile for mips/uclibc linux (with --disable-longdouble)
- crosscompile for i386/uclibs linux (with --disable-longdouble)
- i586/glibc linux build
- i586/glibc linux build with --disable-longdouble configure option

Remember that once patch is applied, you still need to regenerate the 
configure by running autoreconf. (And that needs at least on my linux the 
one line "m4_pattern_allow(PKG_CONFIG_LIBDIR)" fix to configure.ac at 
least on my linux)

Mika

On Wed, 13 Oct 2010, Mika Laitio wrote:

> In some systems like mips or arm the gcc toolchain fails to build long double 
> code that is generated from the corbaidl.idl
> If we are in addition building in the cross compile environment, we must also 
> call external omniidl instead of the just build one. Therfore the disabling 
> of long double support from the just generated omniidl version would not work 
> on crosscompile environment.
>
> include/omniORB4/CORBA_sysdep_trad.h:
> -#  define HAS_LongDouble
> +#if defined(_GLIBCXX_USE_C99)
> +	#  define HAS_LongDouble
> +#endif
>
> Therefore I created attached patch which adds "--disbale-longdouble" option 
> to configure. (once
> regenerated with autoreconf command) If --disable-longdouble is given, then 
> -DDISABLE_LONGDOUBLE option is passed to omniidl when it is reguested to 
> generate stups from corbaidl.idl. corbaidl.idl instead have new "ifndef 
> DISABLE_LONGDOUBLE" check which surrounds the part of the idl which defines 
> the long double sequence.
>
> In addition of this patch, when crosscompiling for example to mips, I need to 
> remove the $(TOOLBINDIR) from the omniidl path definition in 
> mk/beforeauto.mk.in file so that my build systems omniidl will get called 
> instead of this target system crosscompiled one.
>
> Maybe another configure option for allowing to define the path to omniidl 
> version used, would be a good idea? At the moment I do not have that 
> available, but if that approach is good, I can try to create something.
>
> Mika
>
-------------- next part --------------
diff -Naur omniorb_41x_orig/acinclude.m4 omniorb_41x_new/acinclude.m4
--- omniorb_41x_orig/acinclude.m4	2010-10-11 19:46:36.664508034 +0300
+++ omniorb_41x_new/acinclude.m4	2010-10-14 02:41:32.982777763 +0300
@@ -420,6 +420,18 @@
 fi
 ])
 
+dnl Disable support for long double even if the toolchain claims to support it. (does really not work on mipsel or arm)
+AC_DEFUN([OMNI_DISABLE_LONGDOUBLE],
+[AC_CACHE_CHECK(whether to disable long double support even if toolchain supports it,
+omni_cv_enable_longdouble,
+[AC_ARG_ENABLE(longdouble,
+               AC_HELP_STRING([--disable-longdouble],
+                  [disable long double suppor (default enable-longdouble)]),
+               omni_cv_enable_longdouble=$enableval,
+               omni_cv_enable_longdouble=yes)
+])
+AC_SUBST(ENABLE_LONGDOUBLE, $omni_cv_enable_longdouble)
+])
 
 dnl
 dnl Tests from http://www.gnu.org/software/ac-archive/
diff -Naur omniorb_41x_orig/configure.ac omniorb_41x_new/configure.ac
--- omniorb_41x_orig/configure.ac	2010-10-11 19:46:36.657258664 +0300
+++ omniorb_41x_new/configure.ac	2010-10-14 02:41:32.983775105 +0300
@@ -134,7 +134,7 @@
 OMNI_DISABLE_THREAD_TRACING
 OMNI_DISABLE_IPV6_CHECK
 OMNI_DISABLE_ALLOCA
-
+OMNI_DISABLE_LONGDOUBLE
 
 dnl ** Compiler name
 
diff -Naur omniorb_41x_orig/idl/corbaidl.idl omniorb_41x_new/idl/corbaidl.idl
--- omniorb_41x_orig/idl/corbaidl.idl	2010-10-11 19:46:35.250512100 +0300
+++ omniorb_41x_new/idl/corbaidl.idl	2010-10-14 02:41:32.983775105 +0300
@@ -73,9 +73,11 @@
 #endif
   typedef sequence<float>              FloatSeq;
   typedef sequence<double>             DoubleSeq;
+#ifndef DISABLE_LONGDOUBLE
 #ifdef HAS_LongDouble
   typedef sequence<long double>        LongDoubleSeq;
 #endif
+#endif
   typedef sequence<string>             StringSeq;
   typedef sequence<wstring>            WStringSeq;
 
diff -Naur omniorb_41x_orig/include/omniORB4/CORBA_sysdep_auto.h omniorb_41x_new/include/omniORB4/CORBA_sysdep_auto.h
--- omniorb_41x_orig/include/omniORB4/CORBA_sysdep_auto.h	2010-10-11 19:46:33.487261174 +0300
+++ omniorb_41x_new/include/omniORB4/CORBA_sysdep_auto.h	2010-10-14 02:41:32.984758969 +0300
@@ -83,13 +83,17 @@
 
 
 #if defined(SIZEOF_LONG_DOUBLE) && (SIZEOF_LONG_DOUBLE == 16)
-#  define HAS_LongDouble
-#  define _CORBA_LONGDOUBLE_DECL long double
+#  ifndef DISABLE_LONGDOUBLE
+#    define HAS_LongDouble
+#    define _CORBA_LONGDOUBLE_DECL long double
+#  endif
 #endif
 
 #if defined(SIZEOF_LONG_DOUBLE) && (SIZEOF_LONG_DOUBLE == 12) && defined(__i386__)
-#  define HAS_LongDouble
-#  define _CORBA_LONGDOUBLE_DECL long double
+#  ifndef DISABLE_LONGDOUBLE
+#    define HAS_LongDouble
+#    define _CORBA_LONGDOUBLE_DECL long double
+#  endif
 #endif
 
 
diff -Naur omniorb_41x_orig/include/omniORB4/CORBA_sysdep_trad.h omniorb_41x_new/include/omniORB4/CORBA_sysdep_trad.h
--- omniorb_41x_orig/include/omniORB4/CORBA_sysdep_trad.h	2010-10-11 19:46:33.523258689 +0300
+++ omniorb_41x_new/include/omniORB4/CORBA_sysdep_trad.h	2010-10-14 02:41:32.985761061 +0300
@@ -202,7 +202,9 @@
 
 // GCC claims to support long long on all platforms
 #  define HAS_LongLong
-#  define HAS_LongDouble
+#  ifndef DISABLE_LONGDOUBLE
+#    define HAS_LongDouble
+#  endif
 #  define _CORBA_LONGLONG_DECL   long long
 #  define _CORBA_ULONGLONG_DECL  unsigned long long
 #  define _CORBA_LONGDOUBLE_DECL long double 
@@ -254,7 +256,9 @@
 #  define _CORBA_LONGDOUBLE_DECL long double 
 #  define _CORBA_LONGLONG_CONST(x) (x##LL)
 
-#  define HAS_LongDouble
+#  ifndef DISABLE_LONGDOUBLE
+#    define HAS_LongDouble
+#  endif
 
 
 #elif defined(_MSC_VER)
@@ -287,7 +291,9 @@
 
 #  define HAVE_STRTOULL
 
-#  define HAS_LongDouble
+#  ifndef DISABLE_LONGDOUBLE
+#    define HAS_LongDouble
+#  endif
 #  define HAS_LongLong
 #  define _CORBA_LONGDOUBLE_DECL long double
 #  define _CORBA_LONGLONG_DECL   long long
@@ -322,7 +328,9 @@
 #    define HAS_Cplusplus_const_cast
 #    define OMNI_REQUIRES_FQ_BASE_CTOR
 #    define HAS_LongLong
-#    define HAS_LongDouble
+#    ifndef DISABLE_LONGDOUBLE
+#      define HAS_LongDouble
+#    endif
 #    define _CORBA_LONGLONG_DECL long long
 #    define _CORBA_ULONGLONG_DECL unsigned long long
 #    define _CORBA_LONGDOUBLE_DECL long double
@@ -347,7 +355,9 @@
 #    define HAS_Cplusplus_Namespace
 #    define HAS_Std_Namespace
 #    define HAS_LongLong
-#    define HAS_LongDouble
+#    ifndef DISABLE_LONGDOUBLE
+#      define HAS_LongDouble
+#    endif
 #    define _CORBA_LONGLONG_DECL long long
 #    define _CORBA_ULONGLONG_DECL unsigned long long
 #    define _CORBA_LONGDOUBLE_DECL long double
@@ -367,8 +377,10 @@
 #    define _CORBA_ULONGLONG_DECL  unsigned long long
 #    define _CORBA_LONGLONG_CONST(x) (x##LL)
 #    if defined(_FPWIDETYPES)
-#      define HAS_LongDouble
-#      define _CORBA_LONGDOUBLE_DECL long double
+#      ifndef DISABLE_LONGDOUBLE
+#        define HAS_LongDouble
+#        define _CORBA_LONGDOUBLE_DECL long double
+#      endif
 #    endif
 #    ifndef HAVE_STD
 #        define HAVE_STD 1
diff -Naur omniorb_41x_orig/mk/beforeauto.mk.in omniorb_41x_new/mk/beforeauto.mk.in
--- omniorb_41x_orig/mk/beforeauto.mk.in	2010-10-11 19:46:34.751508729 +0300
+++ omniorb_41x_new/mk/beforeauto.mk.in	2010-10-14 02:41:32.986999289 +0300
@@ -718,6 +718,10 @@
 NoStaticLibrary = 1
 endif
 
+ifeq (@ENABLE_LONGDOUBLE@,no)
+NoLongDouble = 1
+endif
+
 
 ###########################################################################
 #
diff -Naur omniorb_41x_orig/src/appl/omniMapper/dir.mk omniorb_41x_new/src/appl/omniMapper/dir.mk
--- omniorb_41x_orig/src/appl/omniMapper/dir.mk	2010-10-11 19:46:20.504268610 +0300
+++ omniorb_41x_new/src/appl/omniMapper/dir.mk	2010-10-14 02:41:32.986999289 +0300
@@ -15,6 +15,14 @@
                -DCONFIG_FILE_ENV_VAR=$(CONFIG_FILE_ENV_VAR) \
                -DCONFIG_FILE_DEFAULT=$(CONFIG_FILE_DEFAULT)
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
 omniMapper = $(patsubst %,$(BinPattern),omniMapper)
 
 all:: $(omniMapper)
diff -Naur omniorb_41x_orig/src/appl/omniNames/dir.mk omniorb_41x_new/src/appl/omniNames/dir.mk
--- omniorb_41x_orig/src/appl/omniNames/dir.mk	2010-10-11 19:46:20.478258332 +0300
+++ omniorb_41x_new/src/appl/omniNames/dir.mk	2010-10-14 02:41:32.987999426 +0300
@@ -23,7 +23,13 @@
 
 endif
 
+##########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
 
+#########################################################################
 
 CXXSRCS = omniNames.cc NamingContext_i.cc log.cc omniNamesWin.cc
 
diff -Naur omniorb_41x_orig/src/appl/utils/catior/dir.mk omniorb_41x_new/src/appl/utils/catior/dir.mk
--- omniorb_41x_orig/src/appl/utils/catior/dir.mk	2010-10-11 19:46:20.162509109 +0300
+++ omniorb_41x_new/src/appl/utils/catior/dir.mk	2010-10-14 02:41:32.987999426 +0300
@@ -5,6 +5,15 @@
 
 DIR_CPPFLAGS = $(CORBA_CPPFLAGS)
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
+
 CATIOR = $(patsubst %,$(BinPattern),catior)
 
 
diff -Naur omniorb_41x_orig/src/appl/utils/convertior/dir.mk omniorb_41x_new/src/appl/utils/convertior/dir.mk
--- omniorb_41x_orig/src/appl/utils/convertior/dir.mk	2010-10-11 19:46:20.285260835 +0300
+++ omniorb_41x_new/src/appl/utils/convertior/dir.mk	2010-10-14 02:41:32.988999632 +0300
@@ -3,6 +3,14 @@
 CorbaImplementation = OMNIORB
 DIR_CPPFLAGS = $(CORBA_CPPFLAGS)
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
 CONVERTIOR = $(patsubst %,$(BinPattern),convertior)
 
 all:: $(CONVERTIOR)
diff -Naur omniorb_41x_orig/src/appl/utils/genior/dir.mk omniorb_41x_new/src/appl/utils/genior/dir.mk
--- omniorb_41x_orig/src/appl/utils/genior/dir.mk	2010-10-11 19:46:20.194260870 +0300
+++ omniorb_41x_new/src/appl/utils/genior/dir.mk	2010-10-14 02:41:32.988999632 +0300
@@ -3,6 +3,14 @@
 CorbaImplementation = OMNIORB
 DIR_CPPFLAGS = $(CORBA_CPPFLAGS)
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
 GENIOR = $(patsubst %,$(BinPattern),genior)
 
 all:: $(GENIOR)
diff -Naur omniorb_41x_orig/src/appl/utils/nameclt/dir.mk omniorb_41x_new/src/appl/utils/nameclt/dir.mk
--- omniorb_41x_orig/src/appl/utils/nameclt/dir.mk	2010-10-11 19:46:20.245511136 +0300
+++ omniorb_41x_new/src/appl/utils/nameclt/dir.mk	2010-10-14 02:41:32.989999560 +0300
@@ -1,5 +1,13 @@
 DIR_CPPFLAGS = $(CORBA_CPPFLAGS)
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
 CXXSRCS = nameclt.cc
 
 nameclt = $(patsubst %,$(BinPattern),nameclt)
diff -Naur omniorb_41x_orig/src/lib/omniORB/codesets/dir.mk omniorb_41x_new/src/lib/omniORB/codesets/dir.mk
--- omniorb_41x_orig/src/lib/omniORB/codesets/dir.mk	2010-10-11 19:46:16.900258691 +0300
+++ omniorb_41x_new/src/lib/omniORB/codesets/dir.mk	2010-10-14 02:41:32.989999560 +0300
@@ -53,6 +53,12 @@
 endif
 
 #########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
 
 ORB_OBJS      = $(ORB_SRCS:.cc=.o)
 CXXSRCS       = $(ORB_SRCS)
diff -Naur omniorb_41x_orig/src/lib/omniORB/connections/dir.mk omniorb_41x_new/src/lib/omniORB/connections/dir.mk
--- omniorb_41x_orig/src/lib/omniORB/connections/dir.mk	2010-10-11 19:46:14.847260925 +0300
+++ omniorb_41x_new/src/lib/omniORB/connections/dir.mk	2010-10-14 02:41:32.989999560 +0300
@@ -23,6 +23,12 @@
 endif
 
 #########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
 
 ORB_OBJS      = $(ORB_SRCS:.cc=.o)
 CXXSRCS       = $(ORB_SRCS)
diff -Naur omniorb_41x_orig/src/lib/omniORB/dir.mk omniorb_41x_new/src/lib/omniORB/dir.mk
--- omniorb_41x_orig/src/lib/omniORB/dir.mk	2010-10-11 19:46:19.958508452 +0300
+++ omniorb_41x_new/src/lib/omniORB/dir.mk	2010-10-14 02:42:45.446754535 +0300
@@ -11,6 +11,12 @@
 SUBDIRS += dynamic codesets connections
 endif
 
+ifdef NoLongDouble
+OPT_DISABLE_LONGDOUBLE="-DDISABLE_LONGDOUBLE"
+else
+OPT_DISABLE_LONGDOUBLE=
+endif
+
 EXPORTHEADERS = omniORB4/distdate.hh \
                 omniORB4/Naming.hh \
                 omniORB4/corbaidl_defs.hh \
@@ -89,7 +95,7 @@
 
 omniORB4/corbaidl_defs.hh omniORB4/corbaidl_operators.hh omniORB4/corbaidl_poa.hh: corbaidl.idl
 	@(dir=omniORB4; $(CreateDir))
-	$(OMNIORB_IDL) -v -nf -P -WbF -ComniORB4 $<
+	$(OMNIORB_IDL) -v -nf -P -WbF -ComniORB4 $(OPT_DISABLE_LONGDOUBLE) $<
 
 omniORB4/boxes_defs.hh omniORB4/boxes_operators.hh omniORB4/boxes_poa.hh: boxes.idl
 	@(dir=omniORB4; $(CreateDir))
diff -Naur omniorb_41x_orig/src/lib/omniORB/dynamic/dir.mk omniorb_41x_new/src/lib/omniORB/dynamic/dir.mk
--- omniorb_41x_orig/src/lib/omniORB/dynamic/dir.mk	2010-10-11 19:46:15.804259004 +0300
+++ omniorb_41x_new/src/lib/omniORB/dynamic/dir.mk	2010-10-14 02:41:32.990999557 +0300
@@ -65,6 +65,12 @@
 endif
 
 #########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif   
+
+#########################################################################
 
 ORB_OBJS      = $(ORB_SRCS:.cc=.o)
 CXXSRCS       = $(ORB_SRCS)
diff -Naur omniorb_41x_orig/src/lib/omniORB/orbcore/dir.mk omniorb_41x_new/src/lib/omniORB/orbcore/dir.mk
--- omniorb_41x_orig/src/lib/omniORB/orbcore/dir.mk	2010-10-11 19:46:19.920258957 +0300
+++ omniorb_41x_new/src/lib/omniORB/orbcore/dir.mk	2010-10-14 02:41:32.991999414 +0300
@@ -202,6 +202,11 @@
 
 
 #########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS += -DDISABLE_LONGDOUBLE
+endif
+#########################################################################
 
 ORB_OBJS      = $(ORB_SRCS:.cc=.o)
 CXXSRCS       = $(ORB_SRCS)
diff -Naur omniorb_41x_orig/src/services/mklib/dir.mk omniorb_41x_new/src/services/mklib/dir.mk
--- omniorb_41x_orig/src/services/mklib/dir.mk	2010-10-11 19:46:13.519261279 +0300
+++ omniorb_41x_new/src/services/mklib/dir.mk	2010-10-14 02:41:32.992999760 +0300
@@ -1,6 +1,14 @@
 include $(MAKEFILE_INC_DIR)cosinterfaces.mk
 include $(MAKEFILE_INC_DIR)libdefs.mk
 
+#########################################################################
+ifdef NoLongDouble
+#for disabling the definition of HAS_LongDouble
+  DIR_CPPFLAGS = -DDISABLE_LONGDOUBLE
+endif
+
+#########################################################################
+
 # Uncomment the next line to build BOA versions of the COS libraries
 # BUILD_BOA_COS_LIB = 1
 


More information about the omniORB-dev mailing list