[nas] compiling on sparc solaris 8

Jon Trulson jon at radscan.com
Sat Feb 23 17:37:41 MST 2002


On Sun, 24 Feb 2002, Robert Andersson wrote:

> Date: Sun, 24 Feb 2002 02:27:11 +0100
> From: Robert Andersson <robert at gslt.hum.gu.se>
> To: nas at radscan.com
> Subject: [nas] compiling on sparc solaris 8
> 
> hi all!
> 
> have problems compiling under sparc solaris 8 (sun enterprise 450)
> first i got errors from cc1 telling me that 't' i not a valid option
> (the -mt flag). well changed that into just -m in all the
> makefiles... (don't know if this was so good). anyway now i get the
> following compiling errors
> 
> gcc -fpcc-struct-return -c   -I../../include -I/usr/openwin/include -I.. -Dsun -Dsparc -DSVR4 -DSYSV   -DXTHREADS -m -DMALLOC_0_RETURNS_NULL  -O2  mutex.c
> In file included from mutex.c:24:
> mutex.h:60: invalid initializer
> mutex.h:61: invalid initializer
> gmake[1]: *** [mutex.o] Error 1
> gmake[1]: Leaving directory `/usr/local/src/nas-1.5/lib/audio'
> gmake: *** [all] Error 2
> 
> any ideas what's going on like? 
> 

	Yes... Seems on some SVR4 systems (USL/SUN), the X environment
doesn't define XMUTEX_INITIALIZER properly in Xthreads.  Attached is a new
lib/audio/mutex.h that should hopefully work.  I'm assuming of course that
the proper XMUTEX_INITIALIZER definition is the same as on UW systems.  
Please give it a try and let me know.  I am currently in the middle of
trying to get this and various other fixes into a 1.5a dev release, which
I'd like to release tonight or tommorrow.

> yours,
> /robert
> 

-- 
Jon Trulson    mailto:jon at radscan.com
ID: 1A9A2B09, FP: C23F328A721264E7 B6188192EC733962
PGP keys at http://radscan.com/~jon/PGPKeys.txt
#include <std/disclaimer.h>
Bad Color Temperature, Too much Peach.
-------------- next part --------------
/*
 * mutexes for libaudio
 * 
 * Jon Trulson, 11/25/2001
 *
 * $Id: mutex.h,v 1.1 2001/11/26 00:20:08 jon Exp $
 *
 */

/*
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission.  M.I.T. makes no representations about the
suitability of this software for any purpose.  It is provided "as is"
without express or implied warranty.
*/


#include "NasConfig.h"		/* see if we should try to use mutexes */

#ifndef _MUTEX_H_INCLUDED
#define _MUTEX_H_INCLUDED

/*JET*/
/*#define DEBUG_MUTEX*/

/*JET*/
#define NAS_USEMTSAFEAPI

#ifdef DEBUG_MUTEX
# define MDBG_START(x) fprintf(stderr, "%s: %s@%d ...", x, __FILE__, __LINE__);
# define MDBG_END() fprintf(stderr, "done\n");
#else
# define MDBG_START(x)
# define MDBG_END()
#endif

#include <audio/audiolib.h>

#include <stdio.h>
#include <errno.h>

#include <audio/Aproto.h>
#include <audio/Afuncs.h>
#include <audio/Aosdefs.h>

/* NAS_USEMTSAFEAPI is defined in config/NasConfig.h.  If undefined
   thread safety will be disabled */

#if defined(XTHREADS) && defined(NAS_USEMTSAFEAPI)

# include <X11/Xthreads.h>
typedef xmutex_rec _AuMutex;
# ifndef XMUTEX_INITIALIZER

				/*  These systems don't seem to define
				    XMUTEX_INITIALIZER, even though they
				    should */
#  if defined(SVR4) && (defined(USL) || defined(sun))
#   define XMUTEX_INITIALIZER {0}
#  else
#   define XMUTEX_INITIALIZER 0;
#  endif
# endif
# define _AU_MUTEX_INITIALIZER    XMUTEX_INITIALIZER
#else
typedef unsigned int _AuMutex;
# define _AU_MUTEX_INITIALIZER    0
#endif

#ifdef _INSTANTIATE_GLOBALS
_AuMutex _serv_mutex = _AU_MUTEX_INITIALIZER;
_AuMutex _init_mutex = _AU_MUTEX_INITIALIZER;
#else
extern _AuMutex _serv_mutex;
extern _AuMutex _init_mutex;
#endif


/* NAS_USEMTSAFEAPI is defined in config/NasConfig.h.  If undefined
   thread safety will be disabled */

#if defined(XTHREADS) && defined(NAS_USEMTSAFEAPI)
#define _AuLockServer()      { \
                               MDBG_START("LOCK   _serv_mutex"); \
                               xmutex_lock(&_serv_mutex); \
                               MDBG_END(); \
                             }
#define _AuUnlockServer()    { \
                               MDBG_START("UNLOCK _serv_mutex"); \
                               xmutex_unlock(&_serv_mutex); \
                               MDBG_END(); \
                             }

#define _AuLockMutex(x)      { \
                               MDBG_START("LOCK   mutex"); \
                               xmutex_lock(&(x)); \
                               MDBG_END(); \
                             }
#define _AuUnlockMutex(x)    { \
                               MDBG_START("UNLOCK  mutex"); \
                               xmutex_unlock(&(x)); \
                               MDBG_END(); \
                             }

#else
#define _AuLockServer()
#define _AuUnlockServer()

#define _AuLockMutex(x)
#define _AuUnlockMutex(x)
#endif



#endif /* _MUTEX_H_INCLUDED */


More information about the Nas mailing list