Browse Source

Support building in cygwin.

Revised the compiler platform macros. Building goes like
$ AMDAPPSDKROOT= CPPFLAGS=-I/usr/include/ncurses ./configure
nfactor-troky
Markus Peloquin 10 years ago
parent
commit
bf8e37ce19
  1. 30
      adl.c
  2. 14
      adl_functions.h
  3. 16
      api.c
  4. 6
      configure.ac
  5. 9
      miner.h
  6. 9
      util.c

30
adl.c

@ -9,32 +9,32 @@ @@ -9,32 +9,32 @@
#include "config.h"
#if defined(HAVE_ADL) && (defined(__linux) || defined (WIN32))
#if defined(HAVE_ADL) && (defined(__unix__) || defined (WIN32))
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef HAVE_CURSES
#include <curses.h>
# include <curses.h>
#endif
#include "miner.h"
#include "ADL_SDK/adl_sdk.h"
#include "compat.h"
#if defined (__linux)
#include <dlfcn.h>
#include <stdlib.h>
#include <unistd.h>
#if defined (__unix__)
# include <dlfcn.h>
# include <stdlib.h>
# include <unistd.h>
#else /* WIN32 */
#include <windows.h>
#include <tchar.h>
# include <windows.h>
# include <tchar.h>
#endif
#include "adl_functions.h"
#ifndef HAVE_CURSES
#define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__)
# define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__)
#endif
bool adl_active;
@ -69,7 +69,7 @@ static void __stdcall ADL_Main_Memory_Free (void **lpBuffer) @@ -69,7 +69,7 @@ static void __stdcall ADL_Main_Memory_Free (void **lpBuffer)
}
}
#if defined (LINUX)
#if defined (UNIX)
// equivalent functions in linux
static void *GetProcAddress(void *pLibrary, const char *name)
{
@ -114,7 +114,7 @@ static ADL_OVERDRIVE6_FANSPEED_SET ADL_Overdrive6_FanSpeed_Set; @@ -114,7 +114,7 @@ static ADL_OVERDRIVE6_FANSPEED_SET ADL_Overdrive6_FanSpeed_Set;
static ADL_OVERDRIVE6_STATE_SET ADL_Overdrive6_State_Set;
static ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set;
#if defined (LINUX)
#if defined (UNIX)
static void *hDLL; // Handle to .so library
#else
HINSTANCE hDLL; // Handle to DLL
@ -266,7 +266,7 @@ static bool prepare_adl(void) @@ -266,7 +266,7 @@ static bool prepare_adl(void)
{
int result;
#if defined (LINUX)
#if defined (UNIX)
hDLL = dlopen( "libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL);
#else
hDLL = LoadLibrary("atiadlxx.dll");
@ -397,7 +397,7 @@ void init_adl(int nDevs) @@ -397,7 +397,7 @@ void init_adl(int nDevs)
"strUDID:%s "
"iBusNumber:%d "
"iDeviceNumber:%d "
#if defined(__linux)
#if defined(__linux__)
"iDrvIndex:%d "
#endif
"iFunctionNumber:%d "
@ -409,7 +409,7 @@ void init_adl(int nDevs) @@ -409,7 +409,7 @@ void init_adl(int nDevs)
lpInfo[i].strUDID,
lpInfo[i].iBusNumber,
lpInfo[i].iDeviceNumber,
#if defined(__linux)
#if defined(__linux__)
lpInfo[i].iDrvIndex,
#endif
lpInfo[i].iFunctionNumber,
@ -1584,7 +1584,7 @@ static void free_adl(void) @@ -1584,7 +1584,7 @@ static void free_adl(void)
{
ADL_Main_Memory_Free ((void **)&lpInfo);
ADL_Main_Control_Destroy ();
#if defined (LINUX)
#if defined (UNIX)
dlclose(hDLL);
#else
FreeLibrary(hDLL);

14
adl_functions.h

@ -29,13 +29,13 @@ @@ -29,13 +29,13 @@
// AMD ADL function types from Version 3.0
// ------------------------------------------------------------------------------------------------------------
#if defined (linux)
#include <dlfcn.h> //dyopen, dlsym, dlclose
#include <stdlib.h>
#include <string.h> //memeset
#if defined (__unix__)
# include <dlfcn.h> //dyopen, dlsym, dlclose
# include <stdlib.h>
# include <string.h> //memeset
#else
#include <windows.h>
#include <tchar.h>
# include <windows.h>
# include <tchar.h>
#endif
#include "ADL_SDK/adl_sdk.h"
@ -267,7 +267,7 @@ typedef int ( *ADL_WORKSTATION_LOADBALANCING_CAPS ) (int iAdapterIndex, int *lpR @@ -267,7 +267,7 @@ typedef int ( *ADL_WORKSTATION_LOADBALANCING_CAPS ) (int iAdapterIndex, int *lpR
// ------------------------------------------------------------------------------------------------------------
#ifdef LINUX
#ifdef __linux__
// ADL Linux
typedef int ( *ADL_ADAPTER_MEMORYINFO_GET ) (int iAdapterIndex, ADLMemoryInfo *lpMemoryInfo);
typedef int ( *ADL_CONTROLLER_COLOR_SET ) (int iAdapterIndex, int iControllerIndex, ADLGamma adlGamma);

16
api.c

@ -152,23 +152,19 @@ static const char *SCRYPTSTR = "scrypt"; @@ -152,23 +152,19 @@ static const char *SCRYPTSTR = "scrypt";
static const char *DEVICECODE = "GPU ";
static const char *OSINFO =
#if defined(__linux)
#if defined(__linux__)
"Linux";
#else
#if defined(__APPLE__)
#elif defined(__APPLE__)
"Apple";
#else
#if defined (WIN32)
#elif defined(WIN32)
"Windows";
#else
#if defined(unix)
#elif defined(__CYGWIN__)
"Cygwin";
#elif defined(__unix__)
"Unix";
#else
"Unknown";
#endif
#endif
#endif
#endif
#define _DEVS "DEVS"
#define _POOLS "POOLS"

6
configure.ac

@ -297,10 +297,10 @@ AM_CONDITIONAL(USE_GIT_VERSION, [test x$usegitver = xyes]) @@ -297,10 +297,10 @@ AM_CONDITIONAL(USE_GIT_VERSION, [test x$usegitver = xyes])
#check execv signature
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <process.h>
int execv(const char*, const char*const*);
int execv(const char*, char *const*);
])],
AC_DEFINE([EXECV_2ND_ARG_TYPE], [const char* const*], [int execv(const char*, const char*const*);]),
AC_DEFINE([EXECV_2ND_ARG_TYPE], [char* const*], [int execv(const char*, char*const*);]))
AC_DEFINE([EXECV_2ND_ARG_TYPE], [char* const*], [int execv(const char*, char*const*);]),
AC_DEFINE([EXECV_2ND_ARG_TYPE], [const char* const*], [int execv(const char*, const char*const*);]))
dnl CCAN wants to know a lot of vars.
# All the configuration checks. Regrettably, the __attribute__ checks will

9
miner.h

@ -84,10 +84,11 @@ static inline int fsync (int fd) @@ -84,10 +84,11 @@ static inline int fsync (int fd)
#endif
#endif /* __MINGW32__ */
#if defined (__linux)
#ifndef LINUX
#define LINUX
#endif
#if defined (__unix__) && !defined(UNIX)
# define UNIX
#endif
#if defined (__linux__) && !defined(LINUX)
# define LINUX
#endif
#ifdef WIN32

9
util.c

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
#include <sys/types.h>
#ifndef WIN32
#include <fcntl.h>
# ifdef __linux
# ifdef __linux__
# include <sys/prctl.h>
# endif
# include <sys/socket.h>
@ -63,15 +63,16 @@ static void keep_sockalive(SOCKETTYPE fd) @@ -63,15 +63,16 @@ static void keep_sockalive(SOCKETTYPE fd)
#endif
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&tcp_one, sizeof(tcp_one));
#ifndef __linux__
if (!opt_delaynet)
#ifndef __linux
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one));
#else /* __linux */
#else /* __linux__ */
if (!opt_delaynet)
setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one));
setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_one, sizeof(tcp_one));
setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof(tcp_keepidle));
setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl));
#endif /* __linux */
#endif /* __linux__ */
#ifdef __APPLE_CC__
setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &tcp_keepintvl, sizeof(tcp_keepintvl));

Loading…
Cancel
Save