Author: cazfi Date: Wed Dec 10 17:21:40 2014 New Revision: 27237 URL: http://svn.gna.org/viewcvs/freeciv?rev=27237&view=rev Log: Define macros needed by fcthread.h header in freeciv_config.h includable to external projects.
See patch #5493 Modified: trunk/configure.ac trunk/gen_headers/freeciv_config.h.in trunk/utility/fcthread.c trunk/utility/fcthread.h Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=27237&r1=27236&r2=27237&view=diff ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Wed Dec 10 17:21:40 2014 @@ -699,10 +699,10 @@ FC_LD_FLAGS([-pthread], [], [LIBS]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[return pthread_create(NULL, NULL, NULL, NULL);]])], - [AC_DEFINE([HAVE_PTHREAD], [1], [Use pthreads as thread implementation]) + [AC_DEFINE([FREECIV_HAVE_PTHREAD], [1], [Use pthreads as thread implementation]) thread_impl=pthreads AC_MSG_RESULT([pthreads]) - AC_DEFINE([HAVE_THREAD_COND], [1], [Has thread condition variable implementation])]) + AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation])]) thread_cond=true fi @@ -712,7 +712,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]], [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])], - [AC_DEFINE([HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation]) + [AC_DEFINE([FREECIV_HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation]) thread_impl=windows AC_MSG_RESULT([windows])]) fi Modified: trunk/gen_headers/freeciv_config.h.in URL: http://svn.gna.org/viewcvs/freeciv/trunk/gen_headers/freeciv_config.h.in?rev=27237&r1=27236&r2=27237&view=diff ============================================================================== --- trunk/gen_headers/freeciv_config.h.in (original) +++ trunk/gen_headers/freeciv_config.h.in Wed Dec 10 17:21:40 2014 @@ -23,4 +23,13 @@ /* Metaserver URL */ #undef FREECIV_META_URL +/* Use pthreads as thread implementation */ +#undef FREECIV_HAVE_PTHREAD + +/* Use Windows threads as thread implementation */ +#undef FREECIV_HAVE_WINTHREADS + +/* Has thread condition variable implementation */ +#undef FREECIV_HAVE_THREAD_COND + #endif /* FC__FREECIV_CONFIG_H */ Modified: trunk/utility/fcthread.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/fcthread.c?rev=27237&r1=27236&r2=27237&view=diff ============================================================================== --- trunk/utility/fcthread.c (original) +++ trunk/utility/fcthread.c Wed Dec 10 17:21:40 2014 @@ -15,14 +15,14 @@ #include <fc_config.h> #endif -// utility +/* utility */ #include "log.h" #include "mem.h" #include "support.h" #include "fcthread.h" -#ifdef HAVE_PTHREAD +#ifdef FREECIV_HAVE_PTHREAD struct fc_thread_wrap_data { void *arg; @@ -152,7 +152,7 @@ pthread_cond_signal(cond); } -#elif defined(HAVE_WINTHREADS) +#elif defined(FREECIV_HAVE_WINTHREADS) struct fc_thread_wrap_data { void *arg; @@ -245,16 +245,16 @@ /* TODO: Windows thread condition variable support. * Currently related functions are always dummy ones below - * (see #ifndef HAVE_THREAD_COND) */ + * (see #ifndef FREECIV_HAVE_THREAD_COND) */ #else /* No thread implementation */ #error "No working thread implementation" -#endif /* HAVE_PTHREAD || HAVE_WINTHREADS */ - - -#ifndef HAVE_THREAD_COND +#endif /* FREECIV_HAVE_PTHREAD || FREECIV_HAVE_WINTHREADS */ + + +#ifndef FREECIV_HAVE_THREAD_COND /* Dummy thread condition variable functions */ @@ -282,14 +282,14 @@ void fc_thread_cond_signal(fc_thread_cond *cond) {} -#endif /* !HAVE_THREAD_COND */ +#endif /* !FREECIV_HAVE_THREAD_COND */ /********************************************************************** Has freeciv thread condition variable implementation ***********************************************************************/ bool has_thread_cond_impl(void) { -#ifdef HAVE_THREAD_COND +#ifdef FREECIV_HAVE_THREAD_COND return TRUE; #else return FALSE; Modified: trunk/utility/fcthread.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/fcthread.h?rev=27237&r1=27236&r2=27237&view=diff ============================================================================== --- trunk/utility/fcthread.h (original) +++ trunk/utility/fcthread.h Wed Dec 10 17:21:40 2014 @@ -18,32 +18,36 @@ extern "C" { #endif /* __cplusplus */ +/* gen_headers */ +#include "freeciv_config.h" + +/* utility */ #include "support.h" /* bool */ -#ifdef HAVE_PTHREAD +#ifdef FREECIV_HAVE_PTHREAD #include <pthread.h> #define fc_thread pthread_t #define fc_mutex pthread_mutex_t #define fc_thread_cond pthread_cond_t -#elif defined (HAVE_WINTHREADS) +#elif defined (FREECIV_HAVE_WINTHREADS) #include <windows.h> #define fc_thread HANDLE * #define fc_mutex HANDLE * -#ifndef HAVE_THREAD_COND +#ifndef FREECIV_HAVE_THREAD_COND #define fc_thread_cond char -#else /* HAVE_THREAD_COND */ -#warning HAVE_THREAD_COND defined but we have no real Windows implementation -#endif /* HAVE_THREAD_COND */ +#else /* FREECIV_HAVE_THREAD_COND */ +#warning FREECIV_HAVE_THREAD_COND defined but we have no real Windows implementation +#endif /* FREECIV_HAVE_THREAD_COND */ #else /* No pthreads nor winthreads */ #error "No working thread implementation" -#endif /* HAVE_PTHREAD */ +#endif /* FREECIV_HAVE_PTHREAD */ int fc_thread_start(fc_thread *thread, void (*function) (void *arg), void *arg); void fc_thread_wait(fc_thread *thread); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits