uname(1) on UnixWare (Solaris)

Bang Jun-Young bjy at mogua.org
Tue Jun 5 23:42:16 CDT 2001


On Tue, Jun 05, 2001 at 12:18:00AM -0700, Francois Gouget wrote:
> On Tue, 5 Jun 2001, Bang Jun-Young wrote:
> > 1. Configure message is wrong:
> >    checking whether we can build a Linux dll... yes
> >    I see this even on FreeBSD and NetBSD. :( It's not a Linux dll, 
> >    but an FreeBSD/NetBSD dll.
> 
>    Maybe this message should be changed, yes. But I don't think you
> should put a `uname` there.

Could you explain me a bit further why we shouldn't do that?

> > 2. Linux/FreeBSD/NetBSD running on x86 are all based on ELF, so
> >    replacing 'Linux' with 'ELF' would be more appropriate. The 
> >    problem is, however, they have slightly different linker flags 
> >    for building shared libraries. For example, giving -Bsymbolic
> >    when compiling sources on NetBSD causes an error even though 
> >    compiler/linker toolchain is almost same as one used in Linux.
> >    It's due to different startup code, but unfortunately, I
> >    have no idea how to detect it during configure process without
> >    help from uname. 
> 
>    If it gives an error then it should be easy to detect with autoconf:
> Just use the flags that cause the command to fail. If it fails then we
> must use other flags. Otherwise these are the ones to use.
>    What kind of error is it btw?

programs/winetest.c couldn't find where the global variable environ
is. It could be easily fixed by adding 'extern char **environ' to the 
beginning of the file without touching ld flags, but I thought it
would be better if I was able to do the same without touching sources
instead.

> > 3. IMHO, my modification is more readable than existing code. 
> 
>    Why don't you show us the new code, or an outline thereof?

Oh, I'm sorry to forget that. *) Here it is. 

Jun-Young

-- 
Bang Jun-Young <bjy at mogua.org>

-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /home/wine/wine/configure.in,v
retrieving revision 1.204
diff -u -r1.204 configure.in
--- configure.in	2001/05/31 21:35:15	1.204
+++ configure.in	2001/06/05 00:49:09
@@ -593,20 +593,39 @@
 LDDLLFLAGS=""
 if test "$LIBEXT" = "so"
 then
-  AC_CACHE_CHECK("whether we can build a Linux dll",
-                 ac_cv_c_dll_linux,
-  [saved_cflags=$CFLAGS
-  CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
-  AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
-  CFLAGS=$saved_cflags
-  ])
-  if test "$ac_cv_c_dll_linux" = "yes"
+  OSNAME=`uname`
+  if test "$OSNAME" = "Linux"
   then
-    LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%) -Wl,-rpath,\$(libdir)"
-    LDDLLFLAGS="-Wl,-Bsymbolic"
-  else
+    AC_CACHE_CHECK("whether we can build a Linux dll",
+                   ac_cv_c_dll_linux,
+    [saved_cflags=$CFLAGS
+    CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
+    AC_TRY_LINK(,[return 1],ac_cv_c_dll_linux="yes",ac_cv_c_dll_linux="no")
+    CFLAGS=$saved_cflags
+    ])
+    if test "$ac_cv_c_dll_linux" = "yes"
+    then
+      LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%) -Wl,-rpath,\$(libdir)"
+      LDDLLFLAGS="-Wl,-Bsymbolic"
+    fi
+  elif test "$OSNAME" = "FreeBSD"
+  then
+    AC_CACHE_CHECK("whether we can build a FreeBSD dll",
+                   ac_cv_c_dll_freebsd,
+    [saved_cflags=$CFLAGS
+    CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
+    AC_TRY_LINK(,[return 1],ac_cv_c_dll_freebsd="yes",ac_cv_c_dll_freebsd="no")
+    CFLAGS=$saved_cflags
+    ])
+    if test "$ac_cv_c_dll_freebsd" = "yes"
+    then
+      LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%) -Wl,-rpath,\$(libdir)"
+      LDDLLFLAGS="-Wl,-Bsymbolic"
+    fi
+  elif test "$OSNAME" = "UnixWare"
+  then
     AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll,
-                 ac_cv_c_dll_unixware,
+                   ac_cv_c_dll_unixware,
     [saved_cflags=$CFLAGS
     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
     AC_TRY_LINK(,[return 1],ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")
@@ -616,22 +635,24 @@
     then
       LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,\$(libdir)/%)"
       LDDLLFLAGS="-Wl,-B,symbolic"
-    else
-      AC_CACHE_CHECK("whether we can build a NetBSD a.out dll",
+    fi
+  elif test "$OSNAME" = "NetBSD"
+  then
+    AC_CACHE_CHECK("whether we can build a NetBSD dll",
                    ac_cv_c_dll_netbsd,
-      [saved_cflags=$CFLAGS
-      CFLAGS="$CFLAGS -fPIC -Wl,-Bshareable,-Bforcearchive"
-      AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
-      CFLAGS=$saved_cflags
-      ])
-      if test "$ac_cv_c_dll_netbsd" = "yes"
-      then
-        LDSHARED="\$(CC) -Wl,-Bshareable,-Bforcearchive"
-        LDDLLFLAGS="" #FIXME
-      fi
+    [saved_cflags=$CFLAGS
+    CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
+    AC_TRY_LINK(,[return 1],ac_cv_c_dll_netbsd="yes",ac_cv_c_dll_netbsd="no")
+    CFLAGS=$saved_cflags
+    ])
+    if test "$ac_cv_c_dll_netbsd" = "yes"
+    then
+      LDSHARED="\$(CC) -shared \$(SONAME:%=-Wl,-soname,%) -Wl,-rpath,\$(libdir)"
+      LDDLLFLAGS=""
     fi
   fi
-  if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
+
+  if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_freebsd" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
   then
     LIBEXT="a"
     if test "$DLLWRAP" = "dllwrap"; then


More information about the wine-devel mailing list