File:  [Synchronet] / sbbs / src / xpdev / common.gmake
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:45:44 2018 UTC (8 years, 3 months ago) by root
Branches: digitaldynamics, MAIN
CVS tags: v_315b, HEAD
3.15b

XPDEV-MT_CFLAGS	+=	-DXPDEV_THREAD_SAFE
XPDEV_LIBS	+=	-lm
XPDEV-MT_LIBS	+=	-lm
ifeq ($(os),netbsd)     # NetBSD
 XPDEV_LIBS	+=	-lossaudio
 XPDEV-MT_LIBS	+=	-lossaudio -lpthread
endif
ifeq ($(os),openbsd)    # OpenBSD
 XPDEV_LIBS	+=	-lossaudio
 XPDEV-MT_LIBS	+=	-lossaudio -lpthread
endif
ifeq ($(os),sunos)	# Solaris
 XPDEV_LIBS	+=	-lsocket
 XPDEV-MT_LIBS	+=	-lpthread -lsocket
endif
ifeq ($(os),darwin)	# Mac OS/X
 XPDEV-MT_LIBS	+=	-lpthread
endif
ifeq ($(os),qnx)	# QNX
 XPDEV-MT_LIBS	+=	-lpthread
endif
ifeq ($(os),linux)	# Linux
 XPDEV-MT_LIBS	+=	-lpthread
endif
ifeq ($(shell if [ -c /dev/urandom ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_DEV_URANDOM -DURANDOM_DEV=\"/dev/urandom\"
 XPDEV_CFLAGS		+=	-DHAS_DEV_URANDOM -DURANDOM_DEV=\"/dev/urandom\"
endif
ifeq ($(shell if [ -L /dev/urandom ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_DEV_URANDOM -DURANDOM_DEV=\"/dev/urandom\"
 XPDEV_CFLAGS		+=	-DHAS_DEV_URANDOM -DURANDOM_DEV=\"/dev/urandom\"
endif
ifeq ($(shell if [ -c /dev/random ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_DEV_RANDOM -DRANDOM_DEV=\"/dev/random\"
 XPDEV_CFLAGS		+=	-DHAS_DEV_RANDOM -DRANDOM_DEV=\"/dev/random\"
endif
ifeq ($(shell if [ -f /usr/include/dev/speaker/speaker.h ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_DEV_SPEAKER_SPEAKER_H
 XPDEV_CFLAGS		+=	-DHAS_DEV_SPEAKER_SPEAKER_H
endif
ifeq ($(shell if [ -f /usr/include/machine/speaker.h ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_MACHINE_SPEAKER_H
 XPDEV_CFLAGS		+=	-DHAS_MACHINE_SPEAKER_H
endif
ifeq ($(shell if [ -f /usr/include/machine/spkr.h ] ; then echo YES ; fi),YES)
 XPDEV-MT_CFLAGS	+=	-DHAS_MACHINE_SPKR_H
 XPDEV_CFLAGS		+=	-DHAS_MACHINE_SPKR_H
endif

# FreeBSD, OpenBSD, NetBSD, Linux, SunOS, and Darwin all have random()/srandom()
ifeq ($(os),freebsd)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC -DHAS_SRANDOMDEV_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC -DHAS_SRANDOMDEV_FUNC
endif
ifeq ($(os),openbsd)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC -DHAS_SRANDOMDEV_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC -DHAS_SRANDOMDEV_FUNC
endif
ifeq ($(os),netbsd)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC
endif
ifeq ($(os),linux)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC
endif
ifeq ($(os),sunos)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC
endif
ifeq ($(os),darwin)
 XPDEV-MT_CFLAGS	+=	-DHAS_RANDOM_FUNC
 XPDEV_CFLAGS		+=	-DHAS_RANDOM_FUNC
endif

# Find SDL headers!
ifdef USE_SDL_AUDIO
 ifdef SDL_CONFIG
  ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
   WITH_SDL_AUDIO	:=	1
  endif
 else
  ifeq ($(os),darwin)
   ifeq ($(shell if [ -d /Library/Frameworks/SDL.framework ] ; then echo YES ; fi),YES)
    SDL_FRAMEWORK_PATH	?=	/Library/Frameworks
   endif
   ifdef SDL_FRAMEWORK_PATH
    WITH_SDL_AUDIO	:=	1
   endif
  else
   ifeq ($(shell sdl-config --cflags > /dev/null 2>&1 && echo YES),YES)
    SDL_CONFIG := sdl-config
    WITH_SDL_AUDIO	:=	1
   else
    ifeq ($(shell sdl13-config --cflags > /dev/null 2>&1 && echo YES),YES)
     SDL_CONFIG := sdl13-config
     WITH_SDL_AUDIO	:=	1
    else
     ifeq ($(shell sdl12-config --cflags > /dev/null 2>&1 && echo YES),YES)
      SDL_CONFIG := sdl12-config
      WITH_SDL_AUDIO	:=	1
     else
      ifeq ($(shell sdl11-config --cflags > /dev/null 2>&1 && echo YES),YES)
       SDL_CONFIG := sdl11-config
       WITH_SDL_AUDIO	:=	1
      endif
     endif
    endif
   endif
  endif
 endif
endif

ifdef STATIC
 STATIC_SDL := true
endif

ifdef WITH_SDL_AUDIO
 ifdef SDL_CONFIG
  ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
   XPDEV-MT_CFLAGS	+=	-DWITH_SDL_AUDIO
   XPDEV-MT_CFLAGS	+=	$(shell $(SDL_CONFIG) --cflags)
   XPDEV_CFLAGS	+=	-DWITH_SDL_AUDIO
   XPDEV_CFLAGS	+=	$(shell $(SDL_CONFIG) --cflags)
   ifdef STATIC_SDL
    XPDEV-MT_LIBS	+=	$(shell $(SDL_CONFIG) --static-libs)
    XPDEV-MT_CFLAGS	+=	-DSTATIC_SDL
    XPDEV-LIBS	+=	$(shell $(SDL_CONFIG) --static-libs)
    XPDEV-CFLAGS	+=	-DSTATIC_SDL
   else
    ifeq ($(os),darwin)
     XPDEV-MT_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
     XPDEV_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
    endif
    ifeq ($(os),linux)
     XPDEV-MT_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
     XPDEV_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
    endif
    ifeq ($(os),sunos)
     XPDEV-MT_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
     XPDEV_LIBS		+=  $(UL_PRE)dl$(UL_SUF)
    endif
   endif
  endif
 else
  ifeq ($(os),darwin)
   XPDEV-MT_CFLAGS	+=	-DWITH_SDL_AUDIO -DSTATIC_SDL
   XPDEV-MT_CFLAGS	+=	-I${SDL_FRAMEWORK_PATH}/SDL.framework/Headers
   XPDEV-MT_LIBS	+=	-F${SDL_FRAMEWORK_PATH} -framework SDL -framework Cocoa -framework Carbon -I${SDL_FRAMEWORK_PATH}/SDL.framework/Headers
   XPDEV_CFLAGS	+=	-DWITH_SDL_AUDIO -DSTATIC_SDL
   XPDEV_CFLAGS	+=	-I${SDL_FRAMEWORK_PATH}/SDL.framework/Headers
   XPDEV_LIBS	+=	-F${SDL_FRAMEWORK_PATH} -framework SDL -framework Cocoa -framework Carbon -I${SDL_FRAMEWORK_PATH}/SDL.framework/Headers
  endif
 endif
endif

X_PATH ?=      $(shell if [ -f /usr/X11R6/include/X11/Xlib.h ]; then echo /usr/X11R6 ; elif [ -f /usr/local/include/X11/Xlib.h ] ; then echo /usr/local ; elif [ -f /usr/X11R7/include/X11/Xlib.h ] ; then echo /usr/X11R7 ; elif [ -f /usr/X11/include/X11/Xlib.h ] ; then echo /usr/X11 ; elif [ -f /usr/X/include/X11/Xlib.h ] ; then echo /usr/X ; elif [ -f /usr/include/X11/Xlib.h ] ; then echo /usr ; else echo 0 ; fi)

ifeq ($(os),sunos)
 X_PATH	?=	/usr/X
else
 X_PATH ?=	/usr/X11R6
endif
X_HEADERS	?=	$(X_PATH)$(DIRSEP)include
X_PRESENT	= $(shell if [ ! \( -f $(X_HEADERS)$(DIRSEP)X11$(DIRSEP)Xlib.h -a -f $(X_HEADERS)$(DIRSEP)X11$(DIRSEP)Xutil.h -a -f $(X_HEADERS)$(DIRSEP)X11$(DIRSEP)keysym.h -a -f $(X_HEADERS)$(DIRSEP)X11$(DIRSEP)Xatom.h \) ] ; then echo NO ; else echo YES ; fi )
ifeq ($(X_PRESENT),NO)
 NO_X=1
else
 ifeq ($(os),darwin)	# No X11 for OSX
  ifndef HAS_DLOPEN
   NO_X=1
  endif
 endif
endif

XPDEV-MT_CFLAGS	+=	-I$(X_HEADERS)
XPDEV_CFLAGS	+=	-I$(X_HEADERS)

ifndef WITHOUT_PORTAUDIO
 PORTAUDIO_PATH ?=      $(shell if [ -f /usr/local/include/portaudio.h ]; then echo /usr/local ; elif [ -f /usr/include/portaudio.h ] ; then echo /usr ; else echo NOTFOUND ; fi)

 ifneq ($(PORTAUDIO_PATH),NOTFOUND)
  XPDEV_CFLAGS += -DWITH_PORTAUDIO
 endif
endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.