Re: [AD] Magic main UNIX, final (?) take

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> > Possibly. I'm not sure we really need to though though, as the Allegro 
> > shared library is not nescessarily binary compatible for WIP releases 
> > anyway.
> 
>    Well, the WIP will become a release one day, won't it? Or are you
> just suggesting that by the time it does, we'll have got rid of __crt0_*
> completely?

Well, they're not actually used anywhere else, and I doubt user programs 
use them. Still, it doesn't really hurt to play on the safe side until 
they can actually be removed from every port available...

Unless someone starts complaining, I'm going to apply the attached patch.
It's basically the same as the last one, but it retains the __crt0_* 
variables.

>    In fact it should link with liballeg-4.1.so and liballeg-4.1.so
> should be a symbolic link to the real library liballeg-4.1.so.x.

Even though they would be incompatible for different values of x?
A program compiled with Allegro 4.1.15 can/will fail to work properly with 
allegro 4.1.14 or 4.1.16. Conversely, a program compiled with 4.1.16 will 
fail to run with 4.1.15. I know the solution is a simple recompile, but 
still... I'd prefer it if WIP releases did not all share one 
liballeg-4.1.so...

Evert
Index: configure.in
===================================================================
RCS file: /cvsroot/alleg/allegro/configure.in,v
retrieving revision 1.82
diff -u -r1.82 configure.in
--- configure.in	17 Aug 2004 19:39:42 -0000	1.82
+++ configure.in	27 Aug 2004 15:31:21 -0000
@@ -118,6 +118,11 @@
    _warnmode="Ignoring compiler warnings."
 fi
 
+dnl Enable magic main (default: no).
+AC_ARG_ENABLE(magicmain,
+[  --enable-magicmain[=x]  enable magic main [default=no]],
+test "X$enableval" == "Xyes" && AC_DEFINE(ALLEGRO_WITH_MAGIC_MAIN,1,[Define if you need to use a magic main.]))
+
 dnl Check that $prefix is set (needed for ALLEGRO_ACTEST_GCC_INCLUDE_PREFIX)
 test "$prefix" = NONE && prefix=/usr/local
 
Index: include/allegro/platform/alunix.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/platform/alunix.h,v
retrieving revision 1.12
diff -u -r1.12 alunix.h
--- include/allegro/platform/alunix.h	9 Apr 2004 10:37:45 -0000	1.12
+++ include/allegro/platform/alunix.h	27 Aug 2004 15:31:22 -0000
@@ -25,16 +25,19 @@
 extern int    __crt0_argc;
 extern char **__crt0_argv;
 
+#undef END_OF_MAIN
+#ifdef ALLEGRO_WITH_MAGIC_MAIN
+
 #ifndef ALLEGRO_NO_MAGIC_MAIN
    #define ALLEGRO_MAGIC_MAIN
    #define main _mangled_main
-   #undef END_OF_MAIN
    #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
 #else
-   #undef END_OF_MAIN
    #define END_OF_MAIN() void *_mangled_main_address;
 #endif
 
+#endif
+
 
 
 /**************************************/
Index: src/unix/umain.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/unix/umain.c,v
retrieving revision 1.2
diff -u -r1.2 umain.c
--- src/unix/umain.c	6 Nov 2001 15:30:47 -0000	1.2
+++ src/unix/umain.c	27 Aug 2004 15:31:24 -0000
@@ -17,6 +17,9 @@
 
 
 #include "allegro/internal/alconfig.h"
+
+#ifdef ALLEGRO_WITH_MAGIC_MAIN
+
 #undef main
 
 
@@ -39,3 +42,4 @@
    return (*real_main)(argc, argv);
 }
 
+#endif
Index: src/unix/usystem.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/unix/usystem.c,v
retrieving revision 1.31
diff -u -r1.31 usystem.c
--- src/unix/usystem.c	17 Aug 2004 19:39:43 -0000	1.31
+++ src/unix/usystem.c	27 Aug 2004 15:31:24 -0000
@@ -410,9 +410,11 @@
       return;
    }
 
+#ifdef ALLEGRO_WITH_MAGIC_MAIN
    /* Try the captured argv[0] */   
    if (_find_executable_file(__crt0_argv[0], output, size))
       return;
+#endif
 
    /* Give up; return empty string */
    do_uconvert ("", U_ASCII, output, U_CURRENT, size);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/