From: Pekka Riikonen Date: Fri, 1 Nov 2002 12:07:51 +0000 (+0000) Subject: Do not include silcdefs.h in installed headers anymore. Include X-Git-Tag: silc.server.0.9.8~20 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=8ea2a4ce03f30c1742dd3af1dd9b6838e60a93eb Do not include silcdefs.h in installed headers anymore. Include silcdefs.h only during compilation time. --- diff --git a/configure.in.pre b/configure.in.pre index 6bc96a41..ab88a677 100644 --- a/configure.in.pre +++ b/configure.in.pre @@ -1002,6 +1002,9 @@ win32/libsilcclient/Makefile ) fi +# Use our configuration in compilation +CFLAGS="-DHAVE_SILCDEFS_H $CFLAGS" + AC_OUTPUT s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir` diff --git a/includes/Makefile.am b/includes/Makefile.am index a23b73d9..bf47b28e 100644 --- a/includes/Makefile.am +++ b/includes/Makefile.am @@ -26,8 +26,7 @@ include_HEADERS = \ silcbeos.h \ silcos2.h \ silcversion.h \ - version_internal.h \ - silcdefs.h + version_internal.h endif EXTRA_DIST = \ diff --git a/includes/silcincludes.h b/includes/silcincludes.h index 060a357e..2580ea09 100644 --- a/includes/silcincludes.h +++ b/includes/silcincludes.h @@ -64,24 +64,26 @@ extern "C" { #endif #endif +#if defined(HAVE_SILCDEFS_H) /* Automatically generated configuration header */ #include "silcdefs.h" +#endif /* HAVE_SILCDEFS_H */ /* Platform specific includes */ -#ifdef SILC_WIN32 +#if defined(SILC_WIN32) #include "silcwin32.h" #endif -#ifdef SILC_EPOC +#if defined(SILC_EPOC) #include "silcepoc.h" #endif -#ifdef SILC_BEOS +#if defined(SILC_BEOS) #include "silcbeos.h" #endif -#ifdef SILC_OS2 +#if defined(SILC_OS2) #include "silcos2.h" #endif @@ -122,7 +124,7 @@ extern "C" { #error assert.h not found in the system #endif -#ifndef SILC_WIN32 +#if !defined(SILC_WIN32) #include #include @@ -270,7 +272,7 @@ extern "C" { #include "silcvcard.h" #include "silcapputil.h" -#ifdef SILC_SIM +#if defined(SILC_SIM) /* SILC Module library includes */ #include "silcsim.h" #include "silcsimutil.h" diff --git a/lib/doc/silcclient_using.html b/lib/doc/silcclient_using.html index 3dd3acf0..780c7f31 100644 --- a/lib/doc/silcclient_using.html +++ b/lib/doc/silcclient_using.html @@ -313,6 +313,14 @@ capabilities which are also available for client library user. You should have compiled the Toolkit with --enable-debug option so that run-time debugging is enabled. +
 
+Then, to say in your application you would like to use the debugging use +the SILC_ENABLE_DEBUG macro. Put this macro to your main header file, or +some other file that needs the debugging enabled. After using this macro +you are able to use the debugging routines provided by the SILC Toolkit. +Note that, the Toolkit library must be compiled with --enable-debug for +this macro to have any effect. +
 
To turn on the run-time debugging set the global variable "silc_debug" to TRUE. To see packet hexdumps you can set also "silc_debug_hexdump" to TRUE. diff --git a/lib/silcutil/unix/silcunixmutex.c b/lib/silcutil/unix/silcunixmutex.c index 1b531b0a..6b92ee32 100644 --- a/lib/silcutil/unix/silcunixmutex.c +++ b/lib/silcutil/unix/silcunixmutex.c @@ -21,39 +21,47 @@ #include "silcincludes.h" -#ifdef SILC_THREADS - /* SILC Mutex structure */ struct SilcMutexStruct { +#ifdef SILC_THREADS pthread_mutex_t mutex; +#else + void *tmp; +#endif /* SILC_THREADS */ }; bool silc_mutex_alloc(SilcMutex *mutex) { +#ifdef SILC_THREADS *mutex = silc_calloc(1, sizeof(**mutex)); if (*mutex == NULL) return FALSE; pthread_mutex_init(&(*mutex)->mutex, NULL); +#endif /* SILC_THREADS */ return TRUE; } void silc_mutex_free(SilcMutex mutex) { +#ifdef SILC_THREADS pthread_mutex_destroy(&mutex->mutex); silc_free(mutex); +#endif /* SILC_THREADS */ } void silc_mutex_lock(SilcMutex mutex) { +#ifdef SILC_THREADS if (pthread_mutex_lock(&mutex->mutex)) assert(FALSE); +#endif /* SILC_THREADS */ } void silc_mutex_unlock(SilcMutex mutex) { +#ifdef SILC_THREADS if (pthread_mutex_unlock(&mutex->mutex)) assert(FALSE); -} - #endif /* SILC_THREADS */ +} diff --git a/lib/silcutil/win32/silcwin32mutex.c b/lib/silcutil/win32/silcwin32mutex.c index 0a186f59..95a6e265 100644 --- a/lib/silcutil/win32/silcwin32mutex.c +++ b/lib/silcutil/win32/silcwin32mutex.c @@ -21,38 +21,46 @@ #include "silcincludes.h" -#ifdef SILC_THREADS - /* SILC Mutex structure */ struct SilcMutexStruct { +#ifdef SILC_THREADS HANDLE mutex; +#else + void *tmp; +#endif /* SILC_THREADS */ }; bool silc_mutex_alloc(SilcMutex *mutex) { +#ifdef SILC_THREADS *mutex = silc_calloc(1, sizeof(**mutex)); (*mutex)->mutex = CreateMutex(NULL, FALSE, NULL); if (!(*mutex)->mutex) { silc_free(*mutex); return FALSE; } +#endif /* SILC_THREADS */ return TRUE; } void silc_mutex_free(SilcMutex mutex) { +#ifdef SILC_THREADS CloseHandle(mutex->mutex); silc_free(mutex); +#endif /* SILC_THREADS */ } void silc_mutex_lock(SilcMutex mutex) { +#ifdef SILC_THREADS WaitForSingleObject(mutex->mutex, INFINITE); +#endif /* SILC_THREADS */ } void silc_mutex_unlock(SilcMutex mutex) { +#ifdef SILC_THREADS ReleaseMutex(mutex->mutex); -} - #endif /* SILC_THREADS */ +}