diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-09-10 06:24:16 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-09-10 06:24:16 +0000 |
commit | 8dc13b99b51555be6fa16d271ddb02d995b46d96 (patch) | |
tree | 83fb595c0ed16c5ffebcfa865eb3112322e66cdd /src | |
parent | d6554ccc1ec223c52f33ff034491e64ac1fa92aa (diff) | |
download | usdx-8dc13b99b51555be6fa16d271ddb02d995b46d96.tar.gz usdx-8dc13b99b51555be6fa16d271ddb02d995b46d96.tar.xz usdx-8dc13b99b51555be6fa16d271ddb02d995b46d96.zip |
FreeBSD compatibility fixes:
- {$IF Defined(Linux)} -> {$IF Defined(Linux) or Defined(BSD)} or {$IF Defined(UNIX)}
- config-freebsd.inc added
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1357 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/base/UAudioCore_Portaudio.pas | 6 | ||||
-rw-r--r-- | src/base/UCommon.pas | 17 | ||||
-rw-r--r-- | src/base/UConfig.pas | 2 | ||||
-rw-r--r-- | src/base/UDLLManager.pas | 31 | ||||
-rw-r--r-- | src/base/UMain.pas | 8 | ||||
-rw-r--r-- | src/base/UPlatform.pas | 24 | ||||
-rw-r--r-- | src/base/uPluginLoader.pas | 12 | ||||
-rw-r--r-- | src/lib/FreeImage/FreeImage.pas | 12 | ||||
-rw-r--r-- | src/lib/SQLite/SQLite3.pas | 12 | ||||
-rw-r--r-- | src/lib/portaudio/portaudio.pas | 14 | ||||
-rw-r--r-- | src/lib/portmixer/portmixer.pas | 12 | ||||
-rw-r--r-- | src/lib/projectM/projectM-0_9.inc | 6 | ||||
-rw-r--r-- | src/screens/UScreenOptionsGraphics.pas | 4 | ||||
-rw-r--r-- | src/switches.inc | 22 | ||||
-rw-r--r-- | src/ultrastardx.dpr | 12 |
15 files changed, 92 insertions, 102 deletions
diff --git a/src/base/UAudioCore_Portaudio.pas b/src/base/UAudioCore_Portaudio.pas index bcc8a001..cd279d99 100644 --- a/src/base/UAudioCore_Portaudio.pas +++ b/src/base/UAudioCore_Portaudio.pas @@ -50,11 +50,11 @@ const // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment // Note2: Windows Default-API is MME, but DirectSound is faster array[0..0] of TPaHostApiTypeId = ( paDirectSound ); -{$ELSEIF Defined(LINUX)} - // Note: Portmixer has no mixer support for JACK at the moment - array[0..2] of TPaHostApiTypeId = ( paALSA, paJACK, paOSS ); {$ELSEIF Defined(DARWIN)} array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); // paCoreAudio +{$ELSEIF Defined(UNIX)} + // Note: Portmixer has no mixer support for JACK at the moment + array[0..2] of TPaHostApiTypeId = ( paALSA, paJACK, paOSS ); {$ELSE} array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); {$IFEND} diff --git a/src/base/UCommon.pas b/src/base/UCommon.pas index 41e3c1f1..54c54760 100644 --- a/src/base/UCommon.pas +++ b/src/base/UCommon.pas @@ -81,7 +81,7 @@ uses // data used by the ...Locale() functions -{$IFDEF LINUX} +{$IF Defined(LINUX) or Defined(BSD)} var PrevNumLocale: string; @@ -91,7 +91,7 @@ const function setlocale(category: integer; locale: pchar): pchar; cdecl; external 'c' name 'setlocale'; -{$ENDIF} +{$IFEND} // In Linux and maybe MacOSX some units (like cwstring) call setlocale(LC_ALL, '') // to set the language/country specific locale (e.g. charset) for this application. @@ -111,17 +111,17 @@ function setlocale(category: integer; locale: pchar): pchar; cdecl; external 'c' // for each call to projectM instead of changing it globally. procedure SetDefaultNumericLocale(); begin - {$ifdef LINUX} + {$IF Defined(LINUX) or Defined(BSD)} PrevNumLocale := setlocale(LC_NUMERIC, nil); setlocale(LC_NUMERIC, 'C'); - {$endif} + {$IFEND} end; procedure RestoreNumericLocale(); begin - {$ifdef LINUX} + {$IF Defined(LINUX) or Defined(BSD)} setlocale(LC_NUMERIC, PChar(PrevNumLocale)); - {$endif} + {$IFEND} end; (* @@ -275,7 +275,7 @@ var FilePath, LocalFileName: string; SearchInfo: TSearchRec; begin -{$IFDEF LINUX} // eddie: Changed FPC to LINUX: Windows and Mac OS X dont have case sensitive file systems +{$IF Defined(LINUX) or Defined(BSD)} // speed up standard case if FileExists(FileName) then begin @@ -300,8 +300,9 @@ begin end; FindClose(SearchInfo); {$ELSE} + // Windows and Mac OS X do not have case sensitive file systems Result := FileExists(FileName); -{$ENDIF} +{$IFEND} end; diff --git a/src/base/UConfig.pas b/src/base/UConfig.pas index b77c2a5a..9ee0a668 100644 --- a/src/base/UConfig.pas +++ b/src/base/UConfig.pas @@ -85,6 +85,8 @@ const {$I ../config-win.inc} {$ELSEIF Defined(Linux)} {$I ../config-linux.inc} + {$ELSEIF Defined(FreeBSD)} + {$I ../config-freebsd.inc} {$ELSEIF Defined(Darwin)} {$I ../config-darwin.inc} {$ELSE} diff --git a/src/base/UDLLManager.pas b/src/base/UDLLManager.pas index 3d32a72a..e71a7eb0 100644 --- a/src/base/UDLLManager.pas +++ b/src/base/UDLLManager.pas @@ -45,25 +45,24 @@ var const DLLPath = 'Plugins'; - {$IFDEF MSWINDOWS} - DLLExt = '.dll'; - {$ENDIF} - {$IFDEF LINUX} - DLLExt = '.so'; - {$ENDIF} - {$IFDEF DARWIN} - DLLExt = '.dylib'; - {$ENDIF} +{$IF Defined(MSWINDOWS)} + DLLExt = '.dll'; +{$ELSEIF Defined(DARWIN)} + DLLExt = '.dylib'; +{$ELSEIF Defined(UNIX)} + DLLExt = '.so'; +{$IFEND} implementation -uses {$IFDEF MSWINDOWS} - windows, - {$ELSE} - dynlibs, - {$ENDIF} - ULog, - SysUtils; +uses + {$IFDEF MSWINDOWS} + windows, + {$ELSE} + dynlibs, + {$ENDIF} + ULog, + SysUtils; constructor TDLLMan.Create; diff --git a/src/base/UMain.pas b/src/base/UMain.pas index 08b9cc4a..c9167aa7 100644 --- a/src/base/UMain.pas +++ b/src/base/UMain.pas @@ -451,12 +451,12 @@ begin // This would create a new OpenGL render-context and all texture data // would be invalidated. // On Linux the mode MUST be resetted, otherwise graphics will be corrupted. - {$IFDEF LINUX} + {$IF Defined(LINUX) or Defined(BSD)} if boolean( Ini.FullScreen ) then SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN) else SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE); - {$ENDIF} + {$IFEND} end; SDL_KEYDOWN: begin @@ -473,7 +473,7 @@ begin // FIXME: SDL_SetVideoMode creates a new OpenGL RC so we have to // reload all texture data (-> whitescreen bug). // Only Linux is able to handle screen-switching this way. - {$IFDEF LINUX} + {$IF Defined(LINUX) or Defined(BSD)} if boolean( Ini.FullScreen ) then begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); @@ -486,7 +486,7 @@ begin end; glViewPort(0, 0, ScreenW, ScreenH); - {$ENDIF} + {$IFEND} end // if print is pressed -> make screenshot and save to screenshot path else if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then diff --git a/src/base/UPlatform.pas b/src/base/UPlatform.pas index 1dcdb5b9..e88e45b2 100644 --- a/src/base/UPlatform.pas +++ b/src/base/UPlatform.pas @@ -43,15 +43,13 @@ implementation uses SysUtils, - {$IFDEF MSWINDOWS} + {$IF Defined(MSWINDOWS)} UPlatformWindows, - {$ENDIF} - {$IFDEF LINUX} - UPlatformLinux, - {$ENDIF} - {$IFDEF DARWIN} + {$ELSEIF Defined(DARWIN)} UPlatformMacOSX, - {$ENDIF} + {$ELSEIF Defined(UNIX)} + UPlatformLinux, + {$IFEND} ULog; @@ -158,15 +156,13 @@ end; initialization -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} Platform_singleton := TPlatformWindows.Create; -{$ENDIF} -{$IFDEF LINUX} - Platform_singleton := TPlatformLinux.Create; -{$ENDIF} -{$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} Platform_singleton := TPlatformMacOSX.Create; -{$ENDIF} +{$ELSEIF Defined(UNIX)} + Platform_singleton := TPlatformLinux.Create; +{$IFEND} finalization Platform_singleton.Free; diff --git a/src/base/uPluginLoader.pas b/src/base/uPluginLoader.pas index b2142702..d0e878c4 100644 --- a/src/base/uPluginLoader.pas +++ b/src/base/uPluginLoader.pas @@ -93,15 +93,13 @@ type end; const - {$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} PluginFileExtension = '.dll'; - {$ENDIF} - {$IFDEF LINUX} - PluginFileExtension = '.so'; - {$ENDIF} - {$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} PluginFileExtension = '.dylib'; - {$ENDIF} +{$ELSEIF Defined(UNIX)} + PluginFileExtension = '.so'; +{$IFEND} implementation diff --git a/src/lib/FreeImage/FreeImage.pas b/src/lib/FreeImage/FreeImage.pas index de05aca1..69c0a0d1 100644 --- a/src/lib/FreeImage/FreeImage.pas +++ b/src/lib/FreeImage/FreeImage.pas @@ -49,15 +49,13 @@ uses {$ENDIF} const -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} FIDLL = 'freeimage.dll'; -{$ENDIF} -{$IFDEF LINUX} - FIDLL = 'libfreeimage.so'; -{$ENDIF} -{$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} FIDLL = 'libfreeimage.dylib'; -{$ENDIF} +{$ELSEIF Defined(UNIX)} + FIDLL = 'libfreeimage.so'; +{$IFEND} {$IFNDEF MSWINDOWS} type diff --git a/src/lib/SQLite/SQLite3.pas b/src/lib/SQLite/SQLite3.pas index c702554a..b300f9f2 100644 --- a/src/lib/SQLite/SQLite3.pas +++ b/src/lib/SQLite/SQLite3.pas @@ -20,16 +20,14 @@ unit SQLite3; interface const -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} SQLiteDLL = 'sqlite3.dll'; -{$ENDIF} -{$IFDEF LINUX} - SQLiteDLL = 'sqlite3.so'; -{$ENDIF} -{$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} SQLiteDLL = 'libsqlite3.dylib'; {$linklib libsqlite3} -{$ENDIF} +{$ELSEIF Defined(UNIX)} + SQLiteDLL = 'sqlite3.so'; +{$IFEND} // Return values for sqlite3_exec() and sqlite3_step() diff --git a/src/lib/portaudio/portaudio.pas b/src/lib/portaudio/portaudio.pas index f8c08bfd..a0286b48 100644 --- a/src/lib/portaudio/portaudio.pas +++ b/src/lib/portaudio/portaudio.pas @@ -57,17 +57,15 @@ uses ctypes; const -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} LibName = 'portaudio_x86.dll'; -{$ENDIF} -{$IFDEF LINUX} - LibName = 'libportaudio.so'; -{$ENDIF} -{$IFDEF DARWIN} -// this is for portaudio version 19 +{$ELSEIF Defined(DARWIN)} + // this is for portaudio version 19 LibName = 'libportaudio.2.dylib'; {$LINKLIB libportaudio.2} -{$ENDIF} +{$ELSEIF Defined(UNIX)} + LibName = 'libportaudio.so'; +{$IFEND} {** Retrieve the release number of the currently running PortAudio build, eg 1900. diff --git a/src/lib/portmixer/portmixer.pas b/src/lib/portmixer/portmixer.pas index d657cf85..b84e0cd6 100644 --- a/src/lib/portmixer/portmixer.pas +++ b/src/lib/portmixer/portmixer.pas @@ -49,16 +49,14 @@ uses portaudio; const -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} LibName = 'portmixer.dll'; -{$ENDIF} -{$IFDEF LINUX} - LibName = 'libportmixer.so'; -{$ENDIF} -{$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} // LibName = 'libportmixer.dylib'; // {$LINKLIB libportaudio} -{$ENDIF} +{$ELSEIF Defined(UNIX)} + LibName = 'libportmixer.so'; +{$IFEND} type PPxMixer = Pointer; diff --git a/src/lib/projectM/projectM-0_9.inc b/src/lib/projectM/projectM-0_9.inc index a3908c77..6b525cf7 100644 --- a/src/lib/projectM/projectM-0_9.inc +++ b/src/lib/projectM/projectM-0_9.inc @@ -4,11 +4,11 @@ uses {$ENDIF} const -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} libprojectM = 'libprojectM.dll'; -{$ELSE} +{$ELSEIF Defined(UNIX)} libprojectM = 'libprojectM.so'; -{$ENDIF} +{$IFEND} {**************** INTERNAL SECTION ****************} diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index afee44a9..66c46b0f 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -64,9 +64,9 @@ begin // FIXME: changing the video mode does not work this way in windows // and MacOSX as all textures will be invalidated through this. // See the ALT+TAB code too. - {$IFDEF Linux} + {$IF Defined(Linux) or Defined(BSD)} Reinitialize3D(); - {$ENDIF} + {$IFEND} FadeTo(@ScreenOptions); end; end; diff --git a/src/switches.inc b/src/switches.inc index 940087f3..6504ea55 100644 --- a/src/switches.inc +++ b/src/switches.inc @@ -39,15 +39,6 @@ {$DEFINE HaveBASS} {$UNDEF UseSerialPort} {$DEFINE UseMIDIPort} -{$ELSEIF Defined(LINUX)} - // include defines but no constants - {$I config-linux.inc} - - // use "configure --enable-debug", "make debug" or - // the command-line parameter "-debug" instead of defining DEBUG directly - {.$DEFINE DEBUG} - // linux apps are always console-apps so leave this defined. - {$DEFINE CONSOLE} {$ELSEIF Defined(DARWIN)} // include defines but no constants {$I config-darwin.inc} @@ -57,6 +48,19 @@ {$DEFINE CONSOLE} {.$DEFINE HaveBASS} {$DEFINE UTF8_FILENAMES} +{$ELSEIF Defined(UNIX)} + // include defines but no constants + {$IF Defined(FREEBSD)} + {$I config-freebsd.inc} + {$ELSEIF Defined(Linux)} + {$I config-linux.inc} + {$IFEND} + + // use "configure --enable-debug", "make debug" or + // the command-line parameter "-debug" instead of defining DEBUG directly + {.$DEFINE DEBUG} + // linux apps are always console-apps so leave this defined. + {$DEFINE CONSOLE} {$IFEND} // audio config diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr index 3cb32279..6717e19c 100644 --- a/src/ultrastardx.dpr +++ b/src/ultrastardx.dpr @@ -173,15 +173,13 @@ uses UParty in 'base\UParty.pas', // TODO: rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin UPlatform in 'base\UPlatform.pas', -{$IFDEF MSWINDOWS} +{$IF Defined(MSWINDOWS)} UPlatformWindows in 'base\UPlatformWindows.pas', -{$ENDIF} -{$IFDEF LINUX} - UPlatformLinux in 'base\UPlatformLinux.pas', -{$ENDIF} -{$IFDEF DARWIN} +{$ELSEIF Defined(DARWIN)} UPlatformMacOSX in 'base/UPlatformMacOSX.pas', -{$ENDIF} +{$ELSEIF Defined(UNIX)} + UPlatformLinux in 'base\UPlatformLinux.pas', +{$IFEND} //------------------------------ //Includes - Media |