[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Detecting kfreebsd kernel while compiling [hurd]



Hi Joachim!

On Tue, 2010-02-02 at 14:35:01 +0100, Joachim Wiedorn wrote:
> Guillem Jover <guillem@debian.org> wrote:
> > As being said on the list, explicitly checking for those on the source
> > is not usually the correct solution. I've taken a look at the xfe code

> But what is the correct solution?

It depends. Most of the stuff is best autodetected at build time, which
as Thorsten has pointed out with autotools is pretty easy to accomplish,
but autotools can also be abused horribly. Some other stuff can simply
rely on preprocessor macros. Some others are best detected at run-time.
And then some things are best left to the human building the software
to decide.

I guess it's worth writting about, I might consider writting this kind
of porting articles at some point.

> > For the tty ones in xvt/ttyinit.c the linux check is wrong, it should
> > check for __GLIBC__ (which is what was intended as can be read from

> But __GLIBC__ would be also true for GNU/kFreeBSD, but the existing
> device is not /dev/ptmx. So I must differentiate between GNU/Linux and
> GNU/kFreeBSD, isn't it?

No, because as all those GNU based systems use glibc they have openpty()
available which is taken care of by the LIBC_OPENPTY macro.

Also it seems you removed support for other systems? I'm attaching an
updated (and untested) patch for this one.

> > Then there's the mount/unmount support, which seems to be truly Linux
> > specific.
>
> But I still I don't know how to change them for the right support on
> GNU/kFreeBSD and GNU/Hurd. I think I must speak with upstream.

After a closer look, it does not seem it might need that much changes
to work on something non-Linux. It seems to need mostly a file with the
list of file systems and another with the mounted ones, so FSTAB_PATH
seems fine, but MTAB_PATH would be "/etc/mtab" on other unices. Then
there's some code assuming udev is being used. And the filesystem
names will need to be adapted per kernel. Code in ‘src/FileList.cpp’
and ‘src/DirList.cpp’ AFAICS.

> > And finally the package support, which should not be kernel dependent
> > at all (currently wrongly checks for Linux). This check should just be
> > removed and the functionality enabled at build or run time if dpkg or

> Where are the code about you speak here? I don't understand your idea
> and I don't know what I should change.

The code is in ‘src/XFilePackage.cpp’. There's a bogus detection system
in main() which just executes ‘dpkg --version’ and ‘rpm --version’ and
based on that decides if the distribution is either deb or rpm based.
Which seems wrong, as dpkg can be found in stuff like Gentoo, or some
rpm based system, and the user most likely do not want a package being
installed through the non-native packaging system. Probably the best in
this case is to specify the packaging system at build time with a new
configure --with-<PACKAGE> option (check autoconf's AC_ARG_WITH).

regards,
guillem
Package:     xfe
Subject:     xvt for other kernel
Author:      Joachim Wiedorn <ad_debian at joonet.de>
Forwarded:   still in  discussion
Last-Update: 2010-01-29

For xvt inside of xfe there is the need to configure xvt
depending of the Operating System. Fixed the macro checks
for several systems, including GNU based ones (which enables
support for GNU/Hurd and GNU/kFreeBSD).
---
 xvt/ttyinit.c |   25 ++++++++++++++-----------
 xvt/xvt.h     |    5 -----
 2 files changed, 14 insertions(+), 16 deletions(-)

--- a/xvt/ttyinit.c
+++ b/xvt/ttyinit.c
@@ -115,7 +115,7 @@
 #define SCTTY_IOCTL
 #endif /* SUNOS */
 
-/*#ifdef SUNOS5*/
+/* Solaris */
 #ifdef __sun
 #include <sys/stropts.h>
 #include <sys/file.h>
@@ -123,39 +123,42 @@
 #include <utmpx.h>
 #define SVR4_UTMPX
 #define SVR4_PTY
-#endif /* SUNOS5 */
+#endif
 
-#ifdef OSF1
+/* OSF/1 */
+#ifdef __osf__
 #include <sys/ioctl.h>
 #define SVR4_UTMP
 #define BSD_PTY
 #define SCTTY_IOCTL
-#endif /* OSF1 */
+#endif
 
-#ifdef AIX3
+/* AIX */
+#ifdef _AIX3
 #include <sys/ioctl.h>
 #include <sys/stropts.h>
 #define SVR4_UTMP
 #define BSD_PTY
 #endif /* AIX3 */
 
-#ifdef ULTRIX
+/* Ultrix */
+#ifdef __ultrix__
 #include <sys/ioctl.h>
 #include <sgtty.h>
 #define BSD_PTY
 #define BSD_TTY
 #define BSD_UTMP
 #define TTYTAB "/etc/ttys"	/* File to search for tty utmp slot number */
-#endif /* ULTRIX */
+#endif 
 
-/*#ifdef HPUX*/
+/* HP-UX */
 #ifdef __hpux
 #define SVR4_UTMP
 #define BSD_PTY
-#endif /* HPUX */
+#endif
 
-/*#ifdef LINUX*/
-#ifdef linux
+/* glibc based systems */
+#ifdef __GLIBC__
 #include <sys/ioctl.h>
 #include <pty.h>
 #define LIBC_OPENPTY
--- a/xvt/xvt.h
+++ b/xvt/xvt.h
@@ -58,11 +58,6 @@ int getdtablesize();
 int grantpt(int);
 int unlockpt(int);
 char *ptsname(int);
-#else /* !SUNOS5 */
-/*#ifndef LINUX*/
-#ifndef linux
-int ioctl(int fd, unsigned request, char *arg);
-#endif /* LINUX */
 #endif /* !SUNOS5 */
 
 

Reply to: