[OpenDX2-dev] Patch: allow building with gcc >= 4.3.1 (perhaps >= 4.3.0 ?)

2008-06-27 Thread Marco Morandini

A quick and dirty solution, because
recent gccs barf with errors when
trying to compile

int main (unsigned int, char**),

and do not accept an implicit cast calling
DXApplication::initialize.
A better solution would be to change
the first argument of DXApplication::initialize,
but I fear that this could require to change the code
in a lot of files.
Let me know if you think that, instead of this
quick solution, I should try to change
DXApplication::initialize.

Thanks,

Marco

Index: src/uipp/base/Application.h
===
RCS file: /cvsroot/opendx2/dx/src/uipp/base/Application.h,v
retrieving revision 1.13
diff -u -r1.13 Application.h
--- src/uipp/base/Application.h 11 Nov 2005 07:07:58 -  1.13
+++ src/uipp/base/Application.h 27 Jun 2008 07:08:17 -
@@ -49,7 +49,7 @@
 //
 // The main program needs to access protected member functions.
 //
-friend int main(unsigned int argc,
+friend int main(int argc,
 char**   argv);
 
 
Index: src/uipp/dxui/Main.C
===
RCS file: /cvsroot/opendx2/dx/src/uipp/dxui/Main.C,v
retrieving revision 1.12
diff -u -r1.12 Main.C
--- src/uipp/dxui/Main.C6 Dec 2005 22:13:08 -   1.12
+++ src/uipp/dxui/Main.C27 Jun 2008 07:08:17 -
@@ -48,9 +48,12 @@
 //
 const char *AssertMsgString = "Internal error detected at \"%s\":%d.\n";
  
-int main(unsigned int argc,
+int main(int iargc,
  char**   argv)
 {
+// recent gccs do not accept int main (unsigned int, char**), 
+// but we need an unsigned int for DXApplication::initialize(&argc, argv)
+unsigned int argc = iargc;
 #if defined(HAVE_HCLXMINIT)
 // The following is not needed with the recent Exceed XDK. If you're
 // using an XDK < 11.0 then uncomment the following command.
Index: src/uipp/mb/Main.C
===
RCS file: /cvsroot/opendx2/dx/src/uipp/mb/Main.C,v
retrieving revision 1.7
diff -u -r1.7 Main.C
--- src/uipp/mb/Main.C  20 May 2000 17:49:40 -  1.7
+++ src/uipp/mb/Main.C  27 Jun 2008 07:08:17 -
@@ -22,9 +22,12 @@
 //
 const char *AssertMsgString = "Internal error detected at \"%s\":%d.\n";
 
-int main(unsigned int argc,
+int main(int iargc,
  char**   argv)
 {
+// recent gccs do not accept int main (unsigned int, char**), 
+// but we need an unsigned int for DXApplication::initialize(&argc, argv)
+unsigned int argc = iargc;
 #if defined(HAVE_HCLXMINIT)
 HCLXmInit();
 #endif
Index: src/uipp/prompter/Main.C
===
RCS file: /cvsroot/opendx2/dx/src/uipp/prompter/Main.C,v
retrieving revision 1.6
diff -u -r1.6 Main.C
--- src/uipp/prompter/Main.C16 May 2000 18:52:59 -  1.6
+++ src/uipp/prompter/Main.C27 Jun 2008 07:08:17 -
@@ -17,9 +17,12 @@
 #endif
 
 
-int main(unsigned int argc,
+int main(int iargc,
  char**   argv)
 {
+// recent gccs do not accept int main (unsigned int, char**), 
+// but we need an unsigned int for DXApplication::initialize(&argc, argv)
+unsigned int argc = iargc;
 #if defined(HAVE_HCLXMINIT)
  HCLXmInit();
 #endif
Index: src/uipp/startup/Main.C
===
RCS file: /cvsroot/opendx2/dx/src/uipp/startup/Main.C,v
retrieving revision 1.6
diff -u -r1.6 Main.C
--- src/uipp/startup/Main.C 16 May 2000 18:53:07 -  1.6
+++ src/uipp/startup/Main.C 27 Jun 2008 07:08:17 -
@@ -14,9 +14,12 @@
 extern "C" void HCLXmInit();
 #endif
 
-int main(unsigned int argc,
+int main(int iargc,
  char**   argv)
 {
+// recent gccs do not accept int main (unsigned int, char**), 
+// but we need an unsigned int for DXApplication::initialize(&argc, argv)
+unsigned int argc = iargc;
 #if defined(HAVE_HCLXMINIT)
 HCLXmInit();
 #endif
Index: src/uipp/tutor/Main.C
===
RCS file: /cvsroot/opendx2/dx/src/uipp/tutor/Main.C,v
retrieving revision 1.7
diff -u -r1.7 Main.C
--- src/uipp/tutor/Main.C   16 May 2000 18:53:15 -  1.7
+++ src/uipp/tutor/Main.C   27 Jun 2008 07:08:17 -
@@ -31,9 +31,12 @@
 //
 const char *AssertMsgString = "Internal error detected at \"%s\":%d.\n";
  
-int main(unsigned int argc,
+int main(int iargc,
  char**   argv)
 {
+// recent gccs do not accept int main (unsigned int, char**), 
+// but we need an unsigned int for DXApplication::initialize(&argc, argv)
+unsigned int argc = iargc;
 #if defined(HAVE_HCLXMINIT)
 HCLXmInit();
 #endif
___
OpenDX2-dev mailing list
OpenDX2-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/opendx2-dev


[OpenDX2-dev] Patch: on unix, use Magick-config while testing for Magick headers and libraries

2008-06-27 Thread Marco Morandini

On unix, Image Magick is not correctly detected
if the CPPFLAGS and LDFLAGS are not correctly set.
I'm proposing to duplicate the

AC_CHECK_HEADER([magick/api.h],[passed=`expr $passed + 1`],[failed=`expr 
$failed + 1`])


line. The first instance, verbatim, for windows. The second,
for unix, after adding the result of `Magick-config --cflags`
to CPPFLAGS (that is restored to the previous value afterward).

I'm not completely happy with this part of the patch

-AC_CHECK_LIB( Magick,GetImageInfo, passed=`expr $passed + 1`, 
failed=`expr $failed + 1`, [ $LIB_MAGICK ])
+AC_CHECK_LIB( c,GetImageInfo, passed=`expr $passed + 1`, 
failed=`expr $failed + 1`, [ $LIB_MAGICK ])


The reason of this change is that on some systems
the Magick library is not called libMagick.
For example, on my system I have

libMagickWand and libMagickCore

This is already taken in account by `Magick-config --libs` in

 LIB_MAGICK="`Magick-config --ldflags` `Magick-config --libs`"

so we simply have to check that a program using GetImageInfo can be 
built with LIB_MAGICK flags. Unfortunately, AC_CHECK_LIB requires a 
library name. So, I'm trying to fool the macro using, as library name, 
the c standard library. I dont' know there is any macro better suited 
for the check we want to perform here.


Marco

Index: configure.ac
===
RCS file: /cvsroot/opendx2/dx/configure.ac,v
retrieving revision 1.21
diff -u -r1.21 configure.ac
--- configure.ac24 Sep 2006 23:54:37 -  1.21
+++ configure.ac27 Jun 2008 07:08:16 -
@@ -801,8 +801,8 @@
 
 failed=0;
 passed=0;
-AC_CHECK_HEADER([magick/api.h],[passed=`expr $passed + 1`],[failed=`expr 
$failed + 1`])
 if test "$ARCH" = "intelnt" ; then
+AC_CHECK_HEADER([magick/api.h],[passed=`expr $passed + 1`],[failed=`expr 
$failed + 1`])
 AC_CHECK_LIB(CORE_RL_magick_,AcquireMagickMemory,passed=`expr $passed + 
1`,failed=`expr $failed + 1`,)
 AC_MSG_CHECKING(if ImageMagick package is complete)
 if test $passed -gt 0
@@ -835,8 +835,13 @@
 dnl format configuration libraries.
 
  if test "$HAVE_MC" = "yes" ; then
+INC_MAGICK="`Magick-config --cflags`"
+SAVECPPFLAGS="$CPPFLAGS"
+CPPFLAGS="`Magick-config --cppflags` $CPPFLAGS"
+AC_CHECK_HEADER([magick/api.h],[passed=`expr $passed + 1`],[failed=`expr 
$failed + 1`])
+CPPFLAGS="$SAVECPPFLAGS"
 LIB_MAGICK="`Magick-config --ldflags` `Magick-config --libs`"
-AC_CHECK_LIB( Magick,GetImageInfo, passed=`expr $passed + 1`, failed=`expr 
$failed + 1`, [ $LIB_MAGICK ])
+AC_CHECK_LIB( c,GetImageInfo, passed=`expr $passed + 1`, failed=`expr 
$failed + 1`, [ $LIB_MAGICK ])
 AC_MSG_CHECKING(if ImageMagick package is complete)
 if test $passed -gt 0
 then
___
OpenDX2-dev mailing list
OpenDX2-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/opendx2-dev