From c56f8b9f0d576a7c081c8cd25580843e3bc8971c Mon Sep 17 00:00:00 2001 From: ramiro Date: Sun, 3 May 1998 06:36:27 +0000 Subject: [PATCH] Make sure the client can properly link with motif 2.1 and gnu libc2 on linux. Also link with libBrokenLocale.so since locale support in motif 2.1 with GLIBC is currently broken. --- cmd/xfe/Makefile | 28 +++++++++--- config/Makefile | 34 +++++++++++--- config/xmversion.sh | 105 -------------------------------------------- 3 files changed, 49 insertions(+), 118 deletions(-) diff --git a/cmd/xfe/Makefile b/cmd/xfe/Makefile index 9393b226389..51d250b6ce4 100644 --- a/cmd/xfe/Makefile +++ b/cmd/xfe/Makefile @@ -574,11 +574,19 @@ endif # Linux ifeq ($(OS_ARCH),Linux) -# Some linux platforms (there's so many of them) need special defines -# for different versions of motif. Right now the only significant -# define is NS_MOTIF2_XP_LD_FLAGS (-lXp needed for motif 2.x) +# If the motif.mk file exists, it might define extra flags needed for +# specific versions of motif. +# +# Currently there is only 2 flags: +# +# MOZILLA_XM_2_1_PRINT_SHELL_FLAGS: X Print Shell Extension available +# starting with X11R6.3 and needed by motif 2.1. +# +# MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS: Needed because of currently +# broken locale support in motif 2.1 when linked with gnu libc2. +# +# Please direct questions about motif and linux to ramiro@netscape.com. # -# The file motif.mk holds such defines. -include $(DEPTH)/config/motif.mk XTOOLLIB = -L/usr/X11R6/lib -lXt -lSM -lICE @@ -592,8 +600,10 @@ else MOTIFLIB =\ $(MOTIFPATCH_LIB) \ + $(MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS) \ -L/usr/X11R6/lib -lXm \ - $(NS_MOTIF2_XP_LD_FLAGS) + $(MOZILLA_XM_2_1_PRINT_SHELL_FLAGS) + endif else @@ -607,7 +617,13 @@ OTHER_LIBS = $(MOTIFLIB) $(XTOOLLIB) $(XMULIB) $(EXTENSIONLIB) $(XLIB) -lm -ldl # get two identical binaries. # ifeq ($(OS_RELEASE)$(CPU_ARCH),2.0x86) -DYN_MOTIFLIB = $(MOTIFPATCH_LIB) -lXm $(NS_MOTIF2_XP_LD_FLAGS) + +DYN_MOTIFLIB =\ + $(MOTIFPATCH_LIB) \ + $(MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS) \ + -lXm \ + $(MOZILLA_XM_2_1_PRINT_SHELL_FLAGS) + EXTRA_EXPORT_OBJS = $(OBJDIR)/$(XFE_PROGNAME)-motif-export EXTRA_EXPORT_BINARY = $(EXTRA_EXPORT_OBJS) diff --git a/config/Makefile b/config/Makefile index 594947e2d44..609dcc976a4 100644 --- a/config/Makefile +++ b/config/Makefile @@ -52,20 +52,40 @@ ifeq ($(OS_ARCH)$(OS_RELEASE),IRIX5) TARGETS += $(OBJDIR)/gtscc$(BIN_SUFFIX) endif -# On linux we need to generake a motif.mk file which has special defines -# for different motif versions. +# On linux we need to generake a motif.mk file which has special flags +# for different motif versions and/or broken libraries. +# +# Currently there is only 2 flags: +# +# MOZILLA_XM_2_1_PRINT_SHELL_FLAGS: X Print Shell Extension available +# starting with X11R6.3 and needed by motif 2.1. +# +# MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS: Needed because of currently +# broken locale support in motif 2.1 when linked with gnu libc2. +# +# Please direct questions about motif and linux to ramiro@netscape.com. +# ifeq ($(OS_ARCH),Linux) -#GARBAGE += motif.mk - export:: motif.mk motif.mk: @rm -f $@ -ifeq ($(shell $(DEPTH)/config/xmversion.sh),2) - @echo "NS_MOTIF2_XP_LD_FLAGS = -lXp" > $@ + +# Check for motif 2.1 which needs the X Print Shell extension (-lXp) +# +# Also check for /lib/libc.so.6 (GNU libc2). If we are using GLIBC2 with +# Motif 2.1, we need to check for /usr/lib/libBrokenLocale.so. At this +# time locale support on motif 2.1 seems to break with GLIBC2. +ifeq ($(shell $(DEPTH)/config/xmversion.sh),2.1) + + @echo "MOZILLA_XM_2_1_PRINT_SHELL_FLAGS = -lXp" > $@ + + @if test -f /lib/libc.so.6 -a -f /usr/lib/libBrokenLocale.so; then \ + echo "MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS = -lBrokenLocale" >> $@; \ + fi else - @echo "NS_MOTIF2_XP_LD_FLAGS =" > $@ + @echo "" > $@ endif endif diff --git a/config/xmversion.sh b/config/xmversion.sh index 4e9b348833d..e69de29bb2d 100755 --- a/config/xmversion.sh +++ b/config/xmversion.sh @@ -1,105 +0,0 @@ -#!/bin/sh -# -# The contents of this file are subject to the Netscape Public License -# Version 1.0 (the "NPL"); you may not use this file except in -# compliance with the NPL. You may obtain a copy of the NPL at -# http://www.mozilla.org/NPL/ -# -# Software distributed under the NPL is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL -# for the specific language governing rights and limitations under the -# NPL. -# -# The Initial Developer of this code under the NPL is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -############################################################################## -## -## Name: xmversion.sh - a fast way to get a motif lib's version -## -## Description: Print the major version number for motif libs on the -## system that executes the script. Can be tweaked to output -## more info. (such as cmd line args to print major/minor -## version numbers). Currently prints only the major number. -## -## Also, more checks need to be added for more platforms. -## Currently this script is only usefull in the Linux Universe -## where there are a many versions of motif. -## -## Author: Ramiro Estrugo -## -############################################################################## - -# The string build into the motif libs -MOTIF_VERSION_STRING="Motif Version" - -# Make motif 1.x the default -MOTIF_DEFAULT_VERSION=1 - -# Reasonable defaults for motif lib locations -MOTIF_LIB_DIR=/usr/lib -MOTIF_STATIC_LIB=libXm.a -MOTIF_SHARED_LIB=libXm.so - -os=`uname` - -case `uname` -in - Linux) - case `uname -m` - in - ppc) - MOTIF_LIB_DIR=/usr/local/motif-1.2.4/lib - ;; - - i386|i486|i586|i686) - MOTIF_LIB_DIR=/usr/X11R6/lib - ;; - esac - ;; - - SunOS) - case `uname -r` - in - 5.3|5.4|5.5.1|5.6) - MOTIF_LIB_DIR=/usr/dt/lib - ;; - esac - ;; - - HP-UX) - MOTIF_LIB_DIR=/usr/lib/Motif1.2 - MOTIF_SHARED_LIB=libXm.sl - ;; - - AIX) - MOTIF_LIB_DIR=/usr/lib - MOTIF_SHARED_LIB=libXm.a - ;; - -esac - -# Look for the shared one first -MOTIF_LIB= - -if [ -f $MOTIF_LIB_DIR/$MOTIF_SHARED_LIB ] -then - MOTIF_LIB=$MOTIF_LIB_DIR/$MOTIF_SHARED_LIB -else - if [ -f $MOTIF_LIB_DIR/$MOTIF_STATIC_LIB ] - then - MOTIF_LIB=$MOTIF_LIB_DIR/$MOTIF_STATIC_LIB - else - echo $MOTIF_DEFAULT_VERSION - exit - fi -fi - -VERSION=`strings $MOTIF_LIB | grep "Motif Version" | awk '{ print $3;}'` - -MAJOR=`echo $VERSION | awk -F"." '{ print $1; }'` - -echo $MAJOR