Skip to content
Snippets Groups Projects
Commit 1a251396 authored by David Tschumperlé's avatar David Tschumperlé
Browse files

Do not require -lpthread when compiling in minimal mode.

parent 93536dcb
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
   
// Include standard C++ headers. // Include standard C++ headers.
// This is the minimal set of required headers to make CImg-based codes compile. // This is the minimal set of required headers to make CImg-based codes compile.
#ifdef _PTHREAD_H
#define cimg_use_pthread
#endif
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstdarg> #include <cstdarg>
...@@ -366,6 +369,7 @@ ...@@ -366,6 +369,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <pthread.h> #include <pthread.h>
#define cimg_use_pthread
#ifdef cimg_use_xshm #ifdef cimg_use_xshm
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
...@@ -3067,7 +3071,7 @@ namespace cimg_library_suffixed { ...@@ -3067,7 +3071,7 @@ namespace cimg_library_suffixed {
void lock(const unsigned int n) { WaitForSingleObject(mutex[n],INFINITE); } void lock(const unsigned int n) { WaitForSingleObject(mutex[n],INFINITE); }
void unlock(const unsigned int n) { ReleaseMutex(mutex[n]); } void unlock(const unsigned int n) { ReleaseMutex(mutex[n]); }
int trylock(const unsigned int) { return 0; } int trylock(const unsigned int) { return 0; }
#elif defined(_PTHREAD_H) #elif cimg_use_pthread
pthread_mutex_t mutex[32]; pthread_mutex_t mutex[32];
Mutex_info() { for (unsigned int i = 0; i<32; ++i) pthread_mutex_init(&mutex[i],0); } Mutex_info() { for (unsigned int i = 0; i<32; ++i) pthread_mutex_init(&mutex[i],0); }
void lock(const unsigned int n) { pthread_mutex_lock(&mutex[n]); } void lock(const unsigned int n) { pthread_mutex_lock(&mutex[n]); }
...@@ -336,7 +336,7 @@ menu: ...@@ -336,7 +336,7 @@ menu:
all: $(FILES) all: $(FILES)
clean: clean:
rm -rf *.exe *.o *~ \#* $(FILES) $(EXTRA_FILES) rm -rf *.exe *.o *.obj *~ \#* $(FILES) $(EXTRA_FILES)
ifneq ($(EXE_PRE),) ifneq ($(EXE_PRE),)
rm -f $(EXE_PRE)* rm -f $(EXE_PRE)*
endif endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment