Re: abiword on Solaris

Adrian Miranda (ade@psg.com)
Thu, 19 Nov 1998 13:13:09 -0800 (PST)


Eric W. Sink writes:
> Thanks for the info. We definitely want AbiWord to compile/run properly
> on Solaris. However, since we don't have such a machine here yet,
> it's all too easy for us to make changes which work fine under Linux
> but cause Solaris builds to break. We apologize for the hassle.

No problem, I'm happy to help as much as time allows.

> We would probably like to incorporate your patch. How big would
> it be?

Very small, it's at the bottom of this message.

> In the future, questions like this one are perfect for our general
> mailing list, which is abiword-dev@abisource.com.

Any chance of an archive?

Also, I hope you'll one day switch to autoconf, it can make a lot of
things simpler.

I got the latest version 0.1.6, and made all the changes from scratch.

Here is a breakdown of what I needed to do to each file:

GET_JS.sh: The -e option is not supported by older bourne shells. It
probably works on Linux since you are using bash for /bin/sh. I think
changing -e to -f will take care of the problem.

util/xp/ut_assert.h: The __STRING macro you are using does not seem
to be standard. However, I think changing

__STRING(expr)

to:

#expr

will do what you are trying to do? And it's ANSI standard. I
apologize if that's not the best solution.

wp/ap/xp/ap_EditMethods.cpp: In several cases you have things ifdefed
out on LINUX. However, none of these things seem to require LINUX,
but should work on almost any UNIX with gtk. I changed it to
__unix__, but it should really be changed to something like USING_GTK.

Also, this file uses snprintf, which isn't available in many older
UNIXes, like Solaris 2.51 (it is in 2.6 and later). I did:

#define snprintf __snprintf

but that only works on Solaris 2.51, and perhaps a few others. A
better solution would be to provide an snprintf replacement, and use
autoconfigure to see if it is needed. In the meantime, you might want
to add a note for Solaris 2.51 users that they can solve the problem
using the above.

Lastly, also in the ap_EditMethods.cpp file, there were a couple of
lines that died because NULL is not defined as zero on Solaris
(Solaris defines it to (void *)0, which is apparently legal). I
changed those, along with a couple of places where the compiler only
warned but did not die. For example, the following code will compile
with g++ (egcs 1.1), but it gives a warning:

char *frog = NULL;

Better is to say:

char *frog = 0;

However, the first version does work, it just complains.

Let me know if you have any problems!

Adrian

diff -cr ../abi-0.1.6/GET_JS.sh ./GET_JS.sh
*** ../abi-0.1.6/GET_JS.sh Fri Nov 6 07:06:57 1998
--- ./GET_JS.sh Thu Nov 19 11:03:45 1998
***************
*** 54,60 ****
cp ../js/src/libjs.lib ${DISTDIR}/lib/libjs_s.lib
cp ../js/src/js.h ${DISTDIR}/include
else
! if [ -e ../js/src/.libs/libjs.a ]; then
echo cp ../js/src/.libs/libjs.a ${DISTDIR}/lib
cp ../js/src/.libs/libjs.a ${DISTDIR}/lib
echo cp ../js/src/js.h ${DISTDIR}/include
--- 54,60 ----
cp ../js/src/libjs.lib ${DISTDIR}/lib/libjs_s.lib
cp ../js/src/js.h ${DISTDIR}/include
else
! if [ -f ../js/src/.libs/libjs.a ]; then
echo cp ../js/src/.libs/libjs.a ${DISTDIR}/lib
cp ../js/src/.libs/libjs.a ${DISTDIR}/lib
echo cp ../js/src/js.h ${DISTDIR}/include
diff -cr ../abi-0.1.6/src/util/xp/ut_assert.h ./src/util/xp/ut_assert.h
*** ../abi-0.1.6/src/util/xp/ut_assert.h Thu Nov 12 08:05:33 1998
--- ./src/util/xp/ut_assert.h Thu Nov 19 11:28:32 1998
***************
*** 51,57 ****
# include "ut_unixAssert.h"
# define UT_ASSERT(expr) \
((void) ((expr) || \
! (UT_UnixAssertMsg(__STRING(expr), \
__FILE__, __LINE__), \
0)))
# endif
--- 51,57 ----
# include "ut_unixAssert.h"
# define UT_ASSERT(expr) \
((void) ((expr) || \
! (UT_UnixAssertMsg(#expr, \
__FILE__, __LINE__), \
0)))
# endif
diff -cr ../abi-0.1.6/src/wp/ap/xp/ap_EditMethods.cpp ./src/wp/ap/xp/ap_EditMethods.cpp
*** ../abi-0.1.6/src/wp/ap/xp/ap_EditMethods.cpp Tue Nov 17 09:24:16 1998
--- ./src/wp/ap/xp/ap_EditMethods.cpp Thu Nov 19 12:45:44 1998
***************
*** 1,3 ****
--- 1,4 ----
+ #define snprintf __snprintf
/* AbiWord
* Copyright (C) 1998 AbiSource, Inc.
*
***************
*** 22,28 ****
#ifdef WIN32
#include <windows.h> // needs to be first
#endif
! #ifdef LINUX
#include <gtk/gtk.h>
#endif
#endif /* DLGHACK */
--- 23,29 ----
#ifdef WIN32
#include <windows.h> // needs to be first
#endif
! #ifdef __unix__
#include <gtk/gtk.h>
#endif
#endif /* DLGHACK */
***************
*** 940,946 ****
if (pNewFrame)
pFrame = pNewFrame;

! UT_Bool bRet = pFrame->loadDocument(NULL);

if (pNewFrame)
pNewFrame->show();
--- 941,947 ----
if (pNewFrame)
pFrame = pNewFrame;

! UT_Bool bRet = pFrame->loadDocument((char *)0);

if (pNewFrame)
pNewFrame->show();
***************
*** 965,971 ****
UT_DEBUGMSG(("fileOpen: loading [%s]\n",pNewFile));
AP_App * pApp = pFrame->getApp();
UT_ASSERT(pApp);
! AP_Frame * pNewFrame = NULL;

// see if requested file is already open in another frame
UT_sint32 ndx = pApp->findFrame(pNewFile);
--- 966,972 ----
UT_DEBUGMSG(("fileOpen: loading [%s]\n",pNewFile));
AP_App * pApp = pFrame->getApp();
UT_ASSERT(pApp);
! AP_Frame * pNewFrame = 0;

// see if requested file is already open in another frame
UT_sint32 ndx = pApp->findFrame(pNewFile);
***************
*** 1013,1019 ****

// HACK: at least make something show
if (!bRes)
! bRes = pFrame->loadDocument(NULL);

if (pNewFrame)
pNewFrame->show();
--- 1014,1020 ----

// HACK: at least make something show
if (!bRes)
! bRes = pFrame->loadDocument((char *)0);

if (pNewFrame)
pNewFrame->show();
***************
*** 1246,1252 ****
#ifdef WIN32
PostQuitMessage (0);
#endif
! #ifdef LINUX
gtk_main_quit(); // what miguel uses
// exit(0); // what Andy had
#endif
--- 1247,1253 ----
#ifdef WIN32
PostQuitMessage (0);
#endif
! #ifdef __unix__
gtk_main_quit(); // what miguel uses
// exit(0); // what Andy had
#endif
***************
*** 1361,1370 ****

static UT_Bool _toggleSpan(FV_View * pView, const XML_Char * prop, const XML_Char * vOn, const XML_Char * vOff, UT_Bool bMultiple=UT_FALSE)
{
! const XML_Char * props_out[] = { NULL, NULL, 0};

// get current font info from pView
! const XML_Char ** props_in = NULL;
const XML_Char * s;

if (!pView->getCharFormat(&props_in))
--- 1362,1371 ----

static UT_Bool _toggleSpan(FV_View * pView, const XML_Char * prop, const XML_Char * vOn, const XML_Char * vOff, UT_Bool bMultiple=UT_FALSE)
{
! const XML_Char * props_out[] = { 0, 0, 0};

// get current font info from pView
! const XML_Char ** props_in = 0;
const XML_Char * s;

if (!pView->getCharFormat(&props_in))
***************
*** 1373,1379 ****
props_out[0] = prop;
props_out[1] = vOn; // be optimistic

! XML_Char * buf = NULL;

s = UT_getAttribute(prop, props_in);
if (s)
--- 1374,1380 ----
props_out[0] = prop;
props_out[1] = vOn; // be optimistic

! XML_Char * buf = 0;

s = UT_getAttribute(prop, props_in);
if (s)
***************
*** 1987,1993 ****
/*****************************************************************/
/*****************************************************************/

! #ifdef LINUX

#include "ap_UnixApp.h"
#include "ap_UnixFrame.h"
--- 1988,1994 ----
/*****************************************************************/
/*****************************************************************/

! #ifdef __unix__

#include "ap_UnixApp.h"
#include "ap_UnixFrame.h"
***************
*** 2001,2014 ****

char * _promptFile(AP_Frame *pFrame, UT_Bool bSaveAs)
{
! return _promptFile(pFrame, bSaveAs, NULL);
}

char * _promptFile(AP_Frame * /*pFrame*/, UT_Bool bSaveAs, char * pSuggestedName)
{
GtkFileSelection *pFS;
UT_Bool accepted = FALSE;
! char * fileName = NULL;

pFS = (GtkFileSelection *)gtk_file_selection_new(bSaveAs ? "Save file" : "Open File");

--- 2002,2015 ----

char * _promptFile(AP_Frame *pFrame, UT_Bool bSaveAs)
{
! return _promptFile(pFrame, bSaveAs, (char *)0);
}

char * _promptFile(AP_Frame * /*pFrame*/, UT_Bool bSaveAs, char * pSuggestedName)
{
GtkFileSelection *pFS;
UT_Bool accepted = FALSE;
! char * fileName = 0;

pFS = (GtkFileSelection *)gtk_file_selection_new(bSaveAs ? "Save file" : "Open File");

***************
*** 2047,2053 ****
{
GtkFontSelectionDialog * cf;
UT_Bool accepted = FALSE;
! gchar * selectedFont = NULL;

// TODO move this title to resources?
cf = (GtkFontSelectionDialog *) gtk_font_selection_dialog_new("Font Selection");
--- 2048,2054 ----
{
GtkFontSelectionDialog * cf;
UT_Bool accepted = FALSE;
! gchar * selectedFont = 0;

// TODO move this title to resources?
cf = (GtkFontSelectionDialog *) gtk_font_selection_dialog_new("Font Selection");
***************
*** 2608,2614 ****
return UT_TRUE;
}

! #endif /* LINUX */

/*****************************************************************/
/*****************************************************************/
--- 2609,2615 ----
return UT_TRUE;
}

! #endif /* __unix__ */

/*****************************************************************/
/*****************************************************************/



This archive was generated by hypermail 1.03b2.