1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Kill off OSMAJORVERSION and OSMINORVERSION defines/cpp flags

This has meant very little for a long time as configure.ac just
hardcoded these values depending on the current OS versions at the
time.

The only place where this is really 'needed' is XlationSvc.c in DtSvc
so that differences between locale specifications on various versions
of an OS can be accounted for. So for now, we just define those when
building DtSvc.

We could probably safely remove them as well with an update to the
Xlate locale DB to remove ancient cruft we don't care about anymore.

For various other modules, like dtlogin, dtsession, etc we just use
the code that was already being used due to the hardcoded values we've
had for the last 10-ish years.
This commit is contained in:
Jon Trulson 2022-08-06 17:02:52 -06:00
parent 6fddca178f
commit 2d0c4d6d39
20 changed files with 61 additions and 120 deletions

View file

@ -63,15 +63,6 @@ build_netbsd=no
build_solaris=no
build_aix=no
dnl For now, we need to fake the OSMAJORVERSION, OSMINORVERSION. In Linux
dnl this never mattered anyway as it was always the kernel version. We will
dnl choose defaults here. These need to be removed in the code in favor
dnl of actual checks for functionality. So this should be considered
dnl temporary.
OSMAJORVERSION=4
OSMINORVERSION=15
dnl locations of libs/includes if not in 'standard' places like on
dnl linux (/usr/...). We build these up based on where X11 is, and
dnl other things as we go along.
@ -84,8 +75,6 @@ supports_pam=no
case "${build_os}" in
linux*)
build_linux=yes
OSMAJORVERSION=4
OSMINORVERSION=15
SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -D_POSIX_SOURCE \
-D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE"
supports_pam=yes
@ -93,8 +82,6 @@ case "${build_os}" in
freebsd*)
build_freebsd=yes
bsd=yes
OSMAJORVERSION=10
OSMINORVERSION=0
# fbsd needs the iconv plug to avoid conflict with libiconv
# and libc implementations. We prefer the libc impl.
SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DLIBICONV_PLUG"
@ -102,20 +89,14 @@ case "${build_os}" in
openbsd*)
build_openbsd=yes
bsd=yes
OSMAJORVERSION=6
OSMINORVERSION=2
;;
netbsd*)
build_netbsd=yes
bsd=yes
OSMAJORVERSION=8
OSMINORVERSION=0
supports_pam=yes
;;
solaris*|sun*)
build_solaris=yes
OSMAJORVERSION=5
OSMINORVERSION=10
;;
aix*)
build_aix=yes
@ -130,9 +111,6 @@ AM_CONDITIONAL([NETBSD], [test "$build_netbsd" = "yes"])
AM_CONDITIONAL([SOLARIS], [test "$build_solaris" = "yes"])
AM_CONDITIONAL([AIX], [test "$build_aix" = "yes"])
dnl Add osmajor/minor version to cppflags.
OSVERSION="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION"
dnl set CSRG_BASED define for the BSD's.
if test "$bsd" = "yes"
then
@ -547,7 +525,7 @@ dnl shouldn't be modified. It suggests that you create a special
dnl variable and presumably add those to your Makefile.am files. We
dnl have 192 of these currently, so... The user will just have to
dnl deal, or modify them here directly.
CPPFLAGS="${CPPFLAGS} ${SOURCE_CPP_DEFINES} ${CPP_COMPILER_FLAGS} ${OSVERSION}"
CPPFLAGS="${CPPFLAGS} ${SOURCE_CPP_DEFINES} ${CPP_COMPILER_FLAGS}"
CFLAGS="${CFLAGS} ${C_COMPILER_FLAGS} ${EXTRA_INCS} ${PTHREAD_CFLAGS}"
CXXFLAGS="${CXXFLAGS} ${CXX_COMPILER_FLAGS} ${EXTRA_INCS} ${PTHREAD_CFLAGS}"
LIBS="${EXTRA_LIBS} ${LIBS} ${PTHREAD_LIBS}"

View file

@ -2245,8 +2245,10 @@ int _DtXlateGetXlateEnv(
809 = (int) (100.0 * atof("8.09"));
===========================*/
#if !defined(OSMAJORVERSION) || !defined(OSMINORVERSION) || OSMAJORVERSION == 0
#error OSMAJORVERSION and/or OSMINORVERSION not defined
#if !defined(OSMAJORVERSION) && !defined(OSMINORVERSION)
#warning "OSMAJORVERSION and OSMINORVERSION not defined, assuming 99.0:
#define OSMAJORVERSION 99
#define OSMINORVERSION 0
#endif
#if defined(__linux__) || defined(CSRG_BASED)

View file

@ -19,6 +19,35 @@ if SOLARIS
libDtSvc_la_CPPFLAGS += -DNO_REGCOMP
endif
# OSVERSION hackery. This database works by comparing a number
# computed with the OS major/minor versions to determine appropriate
# entries in the Xlocale DB. These are currently hardcoded per OS in
# configure.ac. Well, no more. Now they will be hardcoded per OS
# here - the only place where they are really needed currently, until
# some time in the future when old and irrelevant entries are removed
# from the DB and we won't need this at all.
if LINUX
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=4 -DOSMINORVERSION=15
endif
if FREEBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=10 -DOSMINORVERSION=0
endif
if OPENBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=6 -DOSMINORVERSION=2
endif
if NETBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=8 -DOSMINORVERSION=0
endif
if SOLARIS
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=5 -DOSMINORVERSION=10
endif
libDtSvc_la_SOURCES = DtCodelibs/buf.C \
DtCodelibs/buf.h \
DtCodelibs/filegen.C \

View file

@ -55,9 +55,7 @@
#endif /* sun */
#ifdef __FreeBSD__
#if OSMAJORVERSION > 8
#define UT_UTMPX
#endif
#define UT_HOST ut_host
#define UT_NO_pututline
#endif

View file

@ -209,12 +209,7 @@ init(int init_as_source)
return(0);
}
len = sizeof(sockaddr_in);
#if defined(_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname(_sock, (sockaddr *)&_hostaddr, (size_t *)&len)
< 0) {
#else
if (getsockname(_sock, (sockaddr *)&_hostaddr, &len) < 0) {
#endif
return(0);
}
return(listen(_sock,5) == 0);
@ -440,13 +435,9 @@ accept()
#endif
sockaddr_in saddr;
#if defined(_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
_msgsock = ::accept(_sock, (struct sockaddr *)&saddr,
(size_t *)&addrlen);
#else
_msgsock = ::accept(_sock, (struct sockaddr *)&saddr,
&addrlen);
#endif
if (_msgsock < 0) {
_tt_syslog( 0, LOG_ERR, "_Tt_stream_socket::accept(): "
"accept(): %m" );

View file

@ -410,11 +410,7 @@ gettransient(int proto, int vers, int *sockp)
_tt_syslog(0, LOG_ERR, "bind(): %m");
return(0);
}
#if defined (_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname(s, (sockaddr *)&addr, (size_t *)&len) < 0) {
#else
if (getsockname(s, (sockaddr *)&addr, &len) < 0) {
#endif
_tt_syslog(0, LOG_ERR, "getsockname(): %m");
return(0);
}

View file

@ -230,17 +230,6 @@ util_vfork(void)
/*
* putenv() is non-POSIX, so the parameter types can vary a bit...
*/
#ifdef __cplusplus
extern "C" {
#endif
#if (defined(sun) && OSMAJORVERSION >= 5 && OSMINORVERSION >= 4 && OSMINORVERSION <=10 )
extern int putenv(const char *string);
#elif !(defined(__aix) || defined(__NetBSD__))
extern int putenv(char *string);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
int
util_putenv(STRING string)
{

View file

@ -51,7 +51,7 @@
#endif
#include <fcntl.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8 || defined(HAS_PAM_LIBRARY)
#if defined (__FreeBSD__) || defined(HAS_PAM_LIBRARY)
#include <utmpx.h>
#else
#include <utmp.h>

View file

@ -54,7 +54,7 @@
# include <sys/types.h>
# include <sys/signal.h>
# include <sys/stat.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
# include <utmpx.h>
#else
# include <utmp.h>
@ -1646,7 +1646,7 @@ GettyMessage( struct display *d, int msgnum )
int
GettyRunning( struct display *d )
{
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
struct utmpx utmp; /* local struct for new entry */
struct utmpx *u; /* pointer to entry in utmp file */
#else
@ -1671,7 +1671,7 @@ GettyRunning( struct display *d )
return FALSE;
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
bzero(&utmp, sizeof(struct utmpx));
#else
bzero(&utmp, sizeof(struct utmp));

View file

@ -39,7 +39,7 @@
# include <signal.h>
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
# include <utmpx.h>
#else
# include <utmp.h>

View file

@ -112,10 +112,6 @@ extern int errno;
# define DONT_USE_DES
# elif defined(sun)
# define USE_CRYPT
# if (OSMAJORVERSION >= 4)
/* avoid strange sun crypt hackery */
# define crypt _crypt
# endif
# endif
# define USE_ENCRYPT
#endif

View file

@ -67,7 +67,7 @@
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
# include <setjmp.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8 || defined(HAS_PAM_LIBRARY)
#if defined(__FreeBSD__) || defined(HAS_PAM_LIBRARY)
# include <utmpx.h>
#else
# include <utmp.h>

View file

@ -165,11 +165,7 @@ GetChooserAddr (char *addr, int *lenp)
int len;
len = sizeof in_addr;
#if defined (_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname (chooserFd, (struct sockaddr *)&in_addr, (size_t *)&len) < 0)
#else
if (getsockname (chooserFd, (struct sockaddr *)&in_addr, &len) < 0)
#endif
return -1;
Debug ("Chooser socket port: %d\n", ntohs(in_addr.sin_port));
memmove( addr, (char *) &in_addr, len);

View file

@ -45,10 +45,6 @@
**
** Conditional compiles for HPUX:
**
** OSMAJORVERSION < 8
** HP-UX 7.0/7.03 restricted license counting algorithms
** are used. Otherwise HP-UX 8.0 and beyond is used
**
** AUDIT HP C2 security enhancements; checks for existence of
** SECUREPASSWD file and authenticates user against
** password contained in that file. Also performs
@ -1022,7 +1018,7 @@ Authenticate( struct display *d, char *name, char *passwd, char **msg )
}
#endif
#if defined(__OpenBSD__) && OSMAJORVERSION > 5
#if defined(__OpenBSD__)
/*
* Use the OpenBSD getpwnam_shadow function to get the crypt()ed password
*/

View file

@ -45,10 +45,6 @@
**
** Conditional compiles for HPUX:
**
** OSMAJORVERSION < 8
** HP-UX 7.0/7.03 restricted license counting algorithms
** are used. Otherwise HP-UX 8.0 and beyond is used
**
** AUDIT HP C2 security enhancements; checks for existence of
** SECUREPASSWD file and authenticates user against
** password contained in that file. Also performs

View file

@ -91,10 +91,6 @@ extern "C"
mntctl(int, int, char *);
ssize_t writev(int, const struct iovec *, int);
}
#if (OSMAJORVERSION==4) && (OSMINORVERSION==2)
/* Temporary hack till the /usr/lpp/xlC/include/unistd.h file is fixed. */
extern "C" { int lockf(int, int, off_t); }
#endif
#endif /* _AIX */
#include <DtMail/DtMail.hh>

View file

@ -35,26 +35,17 @@
#ifndef _BOOLEAN_
#define _BOOLEAN_
#if (defined(sun) && OSMAJORVERSION <= 5 && OSMINORVERSION <= 3)
#if defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#define true B_TRUE
#define false B_FALSE
#elif defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#if defined(__XOPEN_OR_POSIX)
# if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
#else
# else
#define true B_TRUE
#define false B_FALSE
#endif
#elif defined(__linux__)
#define false 0
#define true 1
#define boolean int
#elif defined(CSRG_BASED)
# endif
#elif defined(__linux__) || defined(CSRG_BASED)
#include <stdbool.h>
#define boolean bool
#else

View file

@ -36,26 +36,17 @@
#ifndef _BOOLEAN_
#define _BOOLEAN_
#if (defined(sun) && OSMAJORVERSION <= 5 && OSMINORVERSION <= 3)
#if defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#define true B_TRUE
#define false B_FALSE
#elif defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#if defined(__XOPEN_OR_POSIX)
# if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
#else
# else
#define true B_TRUE
#define false B_FALSE
#endif
#elif defined(__linux__)
#define false 0
#define true 1
#define boolean int
#elif defined(CSRG_BASED)
# endif
#elif defined(__linux__) || defined(CSRG_BASED)
#include <stdbool.h>
#define boolean bool
#else

View file

@ -114,11 +114,7 @@ Invoke::Invoke(const char *command, // Command to Run
memset(&oldsigquit_act, '\0', sizeof (struct sigaction));
memset(&oldsigint_act, '\0', sizeof (struct sigaction));
#if (defined(sun) && OSMAJORVERSION == 5 && OSMINORVERSION <= 4)
action.sa_handler = (void (*)())SIG_IGN;
#else
action.sa_handler = SIG_IGN;
#endif
sigaction(SIGINT, &action, &oldsigint_act);
sigaction(SIGQUIT, &action, &oldsigquit_act);

View file

@ -1827,7 +1827,7 @@ localAuthenticate(
/*
* Get password entry for 'name' or 'uid'.
*/
#if defined(__OpenBSD__) && OSMAJORVERSION > 5
#if defined(__OpenBSD__)
if ((pwent = (name == NULL ?
getpwuid_shadow(uid) : getpwnam_shadow(name))) == NULL)
#else