patches for proto, libs and apps on BSD systems

Matthieu Herrb matthieu.herrb at laas.fr
Mon Jul 25 03:43:12 EST 2005


Hi,

with the attached patch the modular proto, libs and apps parts of the 
modular tree builds and mostly works on OpenBSD. There are still a few 
rought edges, but I think they are pretty minor. I'd like to have some 
comments of the people who did the most of the modularization work 
before committing this. It consists of the following elements:

- define a new autoconf test, AC_CSRG_BASED, which will define 
CSRG_BASED for BSD systems in config.h. The current imake configuration 
adds -DCSRG_BASED to StandardDefines for those systems and this macro is 
used to activate BSD specific behaviour in various places in the 
sources. I've also added this check to the configure.ac files where it's 
needed. There are still some of them missing, but I've not been able to 
fully test every application to spot them.

For now, I've added the definition of this test to proto/X11/x11.m4 
which gets installed in ${prefix}/share/aclocal when running make 
install in proto/X11. Any place before the build of lib/X11 could be 
used though,.

- add some tests for multi-thread support: some BSD systems don't 
provide pthread_* symbols in libc and need the UIThrStubs compiled in 
libX11. Moreover, OpenBSD doen't have getpwuid_r() and friends and thus 
libX11 need to be built with USE_MTSAFE_API undefined.

- the xconsole fix that was already discussed here, but that is not yet 
committed. (It needs some more cleaning too).
-- 
Matthieu Herrb
-------------- next part --------------
Index: app/xconsole/Makefile.am
===================================================================
RCS file: /cvs/fd/xorg/app/xconsole/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- app/xconsole/Makefile.am	20 Jul 2005 19:31:52 -0000	1.3
+++ app/xconsole/Makefile.am	22 Jul 2005 21:57:13 -0000
@@ -24,6 +24,10 @@
 xconsole_CFLAGS = $(XCONSOLE_CFLAGS)
 xconsole_LDADD = $(XCONSOLE_LIBS)
 
+if CSRG_BASED
+xconsole_LDADD += -lutil
+endif
+
 xconsole_SOURCES =	\
         xconsole.c
 
Index: app/xconsole/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/app/xconsole/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- app/xconsole/configure.ac	20 Jul 2005 19:31:52 -0000	1.2
+++ app/xconsole/configure.ac	22 Jul 2005 21:57:13 -0000
@@ -31,6 +31,8 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 
+AC_CSRG_BASED
+
 # Checks for pkg-config packages
 XAW_CHECK_XPRINT_SUPPORT(XCONSOLE)
 AC_SUBST(XCONSOLE_CFLAGS)
Index: app/xdm/Makefile.am
===================================================================
RCS file: /cvs/fd/xorg/app/xdm/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- app/xdm/Makefile.am	14 Jul 2005 22:55:17 -0000	1.2
+++ app/xdm/Makefile.am	23 Jul 2005 21:38:52 -0000
@@ -87,12 +87,18 @@
 xdmshell_SOURCES =	\
         xdmshell.c
 
+xdmshell_CFLAGS = $(XDM_CFLAGS)
+xdmshell_LIBS = $(XDM_LIBS)
+
 #
 #  sessreg
 #
 
 sessreg_SOURCES =	\
 	sessreg.c
+
+sessreg_CFLAGS = $(XDM_CFLAGS)
+sessreg_LIBS = $(XDM_LIBS)
 
 #
 #  chooser
Index: app/xdm/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/app/xdm/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- app/xdm/configure.ac	14 Jul 2005 22:55:17 -0000	1.2
+++ app/xdm/configure.ac	23 Jul 2005 21:33:35 -0000
@@ -35,7 +35,11 @@
 AC_CHECK_FUNC(mkstemp, 
    AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the `mkstemp' function.]))
 
+AC_CSRG_BASED
+
 XTRANS_TCP_FLAGS
+XTRANS_CONNECTION_FLAGS
+
 dnl Sets $SECURE_RPC to "yes" or "no"
 XTRANS_SECURE_RPC_FLAGS
 AM_CONDITIONAL(HAS_SECURE_RPC, test x$SECURE_RPC = xyes)
Index: app/xload/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/app/xload/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- app/xload/configure.ac	20 Jul 2005 19:31:57 -0000	1.2
+++ app/xload/configure.ac	23 Jul 2005 16:35:46 -0000
@@ -31,6 +31,8 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 
+AC_CSRG_BASED
+
 # Checks for pkg-config packages
 XAW_CHECK_XPRINT_SUPPORT(XLOAD)
 
Index: app/xman/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/app/xman/configure.ac,v
retrieving revision 1.5
diff -u -r1.5 configure.ac
--- app/xman/configure.ac	23 Jul 2005 16:48:10 -0000	1.5
+++ app/xman/configure.ac	23 Jul 2005 16:48:23 -0000
@@ -31,6 +31,8 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 
+AC_CSRG_BASED
+
 AC_CHECK_FUNC([mkstemp], 
    AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the `mkstemp' function.]))
 
Index: lib/X11/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/lib/X11/configure.ac,v
retrieving revision 1.20
diff -u -r1.20 configure.ac
--- lib/X11/configure.ac	15 Jul 2005 04:08:51 -0000	1.20
+++ lib/X11/configure.ac	24 Jul 2005 17:32:01 -0000
@@ -21,6 +21,9 @@
 AC_PATH_PROGS(RAWCPP, [cpp], [$(CPP)], 
    [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
 
+# Check for BSD systems
+AC_CSRG_BASED
+
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(BIGREQS, bigreqsproto)
 AC_SUBST(BIGREQS_CFLAGS)
@@ -126,10 +129,15 @@
                 [Disable Xlib support for Multithreading]),
               [xthreads=$enableval],[xthreads=yes])
 
+AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
+
 case x$xthreads in
 xyes)
 	AC_DEFINE(XTHREADS,[],[Whether libX11 is compiled with thread support])
+	if test x$mtsafeapi = xyes
+	then
 	AC_DEFINE(XUSE_MTSAFE_API,[],[Whether libX11 needs to use MT safe API's])
+	fi
 	;;
 *)
 	;;
@@ -137,6 +145,9 @@
 AC_SUBST(XTHREADS)
 AC_SUBST(XUSE_MTSAFE_API)
 
+AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
+AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
+
 AC_CHECK_LIB(Xdmcp, XdmcpWrap, [xdmauth="yes"], [xdmauth="no"], [$XDMCP_LIBS])
 
 case x$xdmauth in
@@ -366,6 +377,8 @@
 echo " Loadable i18n module support:            "$XLIB_LOADABLE_I18N
 echo " Loadable xcursory library support:       "$XLIB_LOADABLE_XCURSOR
 echo " Threading support:                       "$xthreads
+echo " Use Threads safe API:                    "$mtsafeapi
+echo " Threads stubs in libX11:                 "$thrstubs
 echo " XCMS:                                    "$XCMS
 echo " Internationalization support:            "$XLOCALE
 echo " XF86BigFont support:                     "$XF86BIGFONT
Index: lib/X11/src/Makefile.am
===================================================================
RCS file: /cvs/fd/xorg/lib/X11/src/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- lib/X11/src/Makefile.am	16 Jul 2005 06:25:35 -0000	1.5
+++ lib/X11/src/Makefile.am	18 Jul 2005 19:38:07 -0000
@@ -326,13 +326,18 @@
 libX11_la_SOURCES+=udcInf.c
 endif
 
+if THRSTUBS
+libX11_la_SOURCES+=UIThrStubs.c
+endif
+
 x11datadir = @X11_DATADIR@
 x11data_DATA = XKeysymDB XErrorDB
 
 EXTRA_DIST = \
 	$(x11data_DATA) \
 	os2Stubs.c \
-	udcInf.c
+	udcInf.c \
+	UIThrStubs.c 
 
 #
 # Figure out which sub-libraries to link into Xlib
Index: proto/X11/Makefile.am
===================================================================
RCS file: /cvs/fd/xorg/proto/X11/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- proto/X11/Makefile.am	3 Jul 2005 07:55:00 -0000	1.4
+++ proto/X11/Makefile.am	17 Jul 2005 20:27:30 -0000
@@ -27,6 +27,9 @@
 	Xwindows.h \
 	Xwinsock.h
 
+aclocaldir = $(datadir)/aclocal
+aclocal_DATA = x11.m4
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xproto.pc
 
Index: proto/X11/configure.ac
===================================================================
RCS file: /cvs/fd/xorg/proto/X11/configure.ac,v
retrieving revision 1.6
diff -u -r1.6 configure.ac
--- proto/X11/configure.ac	22 Jul 2005 08:01:39 -0000	1.6
+++ proto/X11/configure.ac	24 Jul 2005 17:05:39 -0000
@@ -11,6 +11,7 @@
 			       USE_FDS_BITS="fds_bits"
 			   ],,
 			   [
+			       #include <sys/types.h>
 			       #include <sys/select.h>
 			   ])
 fi
Index: proto/X11/x11.m4
===================================================================
RCS file: proto/X11/x11.m4
diff -N proto/X11/x11.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ proto/X11/x11.m4	17 Jul 2005 21:02:39 -0000
@@ -0,0 +1,31 @@
+dnl
+dnl Copyright (c) 2005 Matthieu Herrb
+dnl
+dnl Permission to use, copy, modify, and distribute this software for any
+dnl purpose with or without fee is hereby granted, provided that the above
+dnl copyright notice and this permission notice appear in all copies.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl
+
+AC_DEFUN([AC_CSRG_BASED],
+[AC_MSG_CHECKING([for CSRG based system])
+AC_EGREP_CPP(yes,
+[#if defined(__Darwin__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+yes
+#endif
+],
+[AC_MSG_RESULT([yes])
+AC_DEFINE([CSRG_BASED],[],[Using a BSD system derived from CSRG sources])
+ac_x11_csrg_based=yes],
+[AC_MSG_RESULT([no])
+ac_x11_csrg_based=no])
+AM_CONDITIONAL([CSRG_BASED], test x$ac_x11_csrg_based = xyes)
+])
+


More information about the xorg-modular mailing list