1
/* $Id: config.h 4415 2013-03-05 08:34:45Z ming $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJ_CONFIG_H__
21
#define __PJ_CONFIG_H__
26
* @brief PJLIB Main configuration settings.
29
/********************************************************************
30
* Include compiler specific configuration.
33
# include <pj/compat/cc_msvc.h>
34
#elif defined(__GNUC__)
35
# include <pj/compat/cc_gcc.h>
36
#elif defined(__CW32__)
37
# include <pj/compat/cc_mwcc.h>
38
#elif defined(__MWERKS__)
39
# include <pj/compat/cc_codew.h>
40
#elif defined(__GCCE__)
41
# include <pj/compat/cc_gcce.h>
42
#elif defined(__ARMCC__)
43
# include <pj/compat/cc_armcc.h>
45
# error "Unknown compiler."
48
/* PJ_ALIGN_DATA is compiler specific directive to align data address */
50
# error "PJ_ALIGN_DATA is not defined!"
53
/********************************************************************
54
* Include target OS specific configuration.
56
#if defined(PJ_AUTOCONF)
60
# include <pj/compat/os_auto.h>
62
#elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
66
# include <pj/compat/os_symbian.h>
68
#elif defined(PJ_WIN32_WINCE) || defined(_WIN32_WCE) || defined(UNDER_CE)
72
# undef PJ_WIN32_WINCE
73
# define PJ_WIN32_WINCE 1
74
# include <pj/compat/os_win32_wince.h>
76
/* Also define Win32 */
79
#elif defined(PJ_WIN32) || defined(_WIN32) || defined(__WIN32__) || \
80
defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__)
86
# include <pj/compat/os_win32.h>
88
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0
92
# include <pj/compat/os_linux_kernel.h>
94
#elif defined(PJ_LINUX) || defined(linux) || defined(__linux)
100
# include <pj/compat/os_linux.h>
102
#elif defined(PJ_PALMOS) && PJ_PALMOS!=0
106
# include <pj/compat/os_palmos.h>
108
#elif defined(PJ_SUNOS) || defined(sun) || defined(__sun)
114
# include <pj/compat/os_sunos.h>
116
#elif defined(PJ_DARWINOS) || defined(__MACOSX__) || \
117
defined (__APPLE__) || defined (__MACH__)
122
# define PJ_DARWINOS 1
123
# include <pj/compat/os_darwinos.h>
125
#elif defined(PJ_RTEMS) && PJ_RTEMS!=0
129
# include <pj/compat/os_rtems.h>
131
# error "Please specify target os."
135
/********************************************************************
136
* Target machine specific configuration.
138
#if defined(PJ_AUTOCONF)
140
* Autoconf configured
142
#include <pj/compat/m_auto.h>
144
#elif defined (PJ_M_I386) || defined(_i386_) || defined(i_386_) || \
145
defined(_X86_) || defined(x86) || defined(__i386__) || \
146
defined(__i386) || defined(_M_IX86) || defined(__I86__)
148
* Generic i386 processor family, little-endian
152
# define PJ_M_NAME "i386"
153
# define PJ_HAS_PENTIUM 1
154
# define PJ_IS_LITTLE_ENDIAN 1
155
# define PJ_IS_BIG_ENDIAN 0
158
#elif defined (PJ_M_X86_64) || defined(__amd64__) || defined(__amd64) || \
159
defined(__x86_64__) || defined(__x86_64)
161
* AMD 64bit processor, little endian
164
# define PJ_M_X86_64 1
165
# define PJ_M_NAME "x86_64"
166
# define PJ_HAS_PENTIUM 1
167
# define PJ_IS_LITTLE_ENDIAN 1
168
# define PJ_IS_BIG_ENDIAN 0
170
#elif defined(PJ_M_IA64) || defined(__ia64__) || defined(_IA64) || \
171
defined(__IA64__) || defined( _M_IA64)
173
* Intel IA64 processor, default to little endian
177
# define PJ_M_NAME "ia64"
178
# define PJ_HAS_PENTIUM 1
179
# define PJ_IS_LITTLE_ENDIAN 1
180
# define PJ_IS_BIG_ENDIAN 0
182
#elif defined (PJ_M_M68K) && PJ_M_M68K != 0
185
* Motorola m68k processor, big endian
189
# define PJ_M_NAME "m68k"
190
# define PJ_HAS_PENTIUM 0
191
# define PJ_IS_LITTLE_ENDIAN 0
192
# define PJ_IS_BIG_ENDIAN 1
195
#elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \
198
* DEC Alpha processor, little endian
201
# define PJ_M_ALPHA 1
202
# define PJ_M_NAME "alpha"
203
# define PJ_HAS_PENTIUM 0
204
# define PJ_IS_LITTLE_ENDIAN 1
205
# define PJ_IS_BIG_ENDIAN 0
208
#elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \
209
defined(__MIPS__) || defined(MIPS) || defined(_MIPS_)
211
* MIPS, bi-endian, so raise error if endianness is not configured
215
# define PJ_M_NAME "mips"
216
# define PJ_HAS_PENTIUM 0
217
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
218
# error Endianness must be declared for this processor
222
#elif defined (PJ_M_SPARC) || defined( __sparc__) || defined(__sparc)
224
* Sun Sparc, big endian
227
# define PJ_M_SPARC 1
228
# define PJ_M_NAME "sparc"
229
# define PJ_HAS_PENTIUM 0
230
# define PJ_IS_LITTLE_ENDIAN 0
231
# define PJ_IS_BIG_ENDIAN 1
233
#elif defined (PJ_M_ARMV4) || defined(ARM) || defined(_ARM_) || \
234
defined(ARMV4) || defined(__arm__)
236
* ARM, bi-endian, so raise error if endianness is not configured
239
# define PJ_M_ARMV4 1
240
# define PJ_M_NAME "armv4"
241
# define PJ_HAS_PENTIUM 0
242
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
243
# error Endianness must be declared for this processor
246
#elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \
247
defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || \
250
* PowerPC, bi-endian, so raise error if endianness is not configured
253
# define PJ_M_POWERPC 1
254
# define PJ_M_NAME "powerpc"
255
# define PJ_HAS_PENTIUM 0
256
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
257
# error Endianness must be declared for this processor
260
#elif defined (PJ_M_NIOS2) || defined(__nios2) || defined(__nios2__) || \
261
defined(__NIOS2__) || defined(__M_NIOS2) || defined(_ARCH_NIOS2)
263
* Nios2, little endian
266
# define PJ_M_NIOS2 1
267
# define PJ_M_NAME "nios2"
268
# define PJ_HAS_PENTIUM 0
269
# define PJ_IS_LITTLE_ENDIAN 1
270
# define PJ_IS_BIG_ENDIAN 0
273
# error "Please specify target machine."
276
/* Include size_t definition. */
277
#include <pj/compat/size_t.h>
279
/* Include site/user specific configuration to control PJLIB features.
280
* YOU MUST CREATE THIS FILE YOURSELF!!
282
#include <pj/config_site.h>
284
/********************************************************************
288
/* Overrides for DOXYGEN */
290
# undef PJ_FUNCTIONS_ARE_INLINED
291
# undef PJ_HAS_FLOATING_POINT
292
# undef PJ_LOG_MAX_LEVEL
293
# undef PJ_LOG_MAX_SIZE
294
# undef PJ_LOG_USE_STACK_BUFFER
295
# undef PJ_TERM_HAS_COLOR
296
# undef PJ_POOL_DEBUG
298
# undef PJ_MAX_HOSTNAME
299
# undef PJ_IOQUEUE_MAX_HANDLES
301
# undef PJ_HAS_SEMAPHORE
302
# undef PJ_HAS_EVENT_OBJ
303
# undef PJ_ENABLE_EXTRA_CHECK
304
# undef PJ_EXCEPTION_USE_WIN32_SEH
305
# undef PJ_HAS_ERROR_STRING
307
# define PJ_HAS_IPV6 1
311
* @defgroup pj_config Build Configuration
314
* This section contains macros that can set during PJLIB build process
315
* to controll various aspects of the library.
317
* <b>Note</b>: the values in this page does NOT necessarily reflect to the
318
* macro values during the build process.
322
* If this macro is set to 1, it will enable some debugging checking
325
* Default: equal to (NOT NDEBUG).
336
* Enable this macro to activate logging to mutex/semaphore related events.
337
* This is useful to troubleshoot concurrency problems such as deadlocks.
338
* In addition, you should also add PJ_LOG_HAS_THREAD_ID flag to the
339
* log decoration to assist the troubleshooting.
343
#ifndef PJ_DEBUG_MUTEX
344
# define PJ_DEBUG_MUTEX 0
348
* Expand functions in *_i.h header files as inline.
352
#ifndef PJ_FUNCTIONS_ARE_INLINED
353
# define PJ_FUNCTIONS_ARE_INLINED 0
357
* Use floating point computations in the library.
361
#ifndef PJ_HAS_FLOATING_POINT
362
# define PJ_HAS_FLOATING_POINT 1
366
* Declare maximum logging level/verbosity. Lower number indicates higher
367
* importance, with the highest importance has level zero. The least
368
* important level is five in this implementation, but this can be extended
369
* by supplying the appropriate implementation.
371
* The level conventions:
378
* - 6: more detailed trace
382
#ifndef PJ_LOG_MAX_LEVEL
383
# define PJ_LOG_MAX_LEVEL 5
387
* Maximum message size that can be sent to output device for each call
388
* to PJ_LOG(). If the message size is longer than this value, it will be cut.
389
* This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER
394
#ifndef PJ_LOG_MAX_SIZE
395
# define PJ_LOG_MAX_SIZE 4000
400
* Does the log get the buffer from the stack? (default is yes).
401
* If the value is set to NO, then the buffer will be taken from static
402
* buffer, which in this case will make the log function non-reentrant.
406
#ifndef PJ_LOG_USE_STACK_BUFFER
407
# define PJ_LOG_USE_STACK_BUFFER 1
411
* Enable log indentation feature.
415
#ifndef PJ_LOG_ENABLE_INDENT
416
# define PJ_LOG_ENABLE_INDENT 1
420
* Number of PJ_LOG_INDENT_CHAR to put every time pj_log_push_indent()
425
#ifndef PJ_LOG_INDENT_SIZE
426
# define PJ_LOG_INDENT_SIZE 1
430
* Log indentation character.
434
#ifndef PJ_LOG_INDENT_CHAR
435
# define PJ_LOG_INDENT_CHAR '.'
439
* Colorfull terminal (for logging etc).
443
#ifndef PJ_TERM_HAS_COLOR
444
# define PJ_TERM_HAS_COLOR 1
449
* Set this flag to non-zero to enable various checking for pool
450
* operations. When this flag is set, assertion must be enabled
451
* in the application.
453
* This will slow down pool creation and destruction and will add
454
* few bytes of overhead, so application would normally want to
455
* disable this feature on release build.
460
# define PJ_SAFE_POOL 0
465
* If pool debugging is used, then each memory allocation from the pool
466
* will call malloc(), and pool will release all memory chunks when it
467
* is destroyed. This works better when memory verification programs
468
* such as Rational Purify is used.
472
#ifndef PJ_POOL_DEBUG
473
# define PJ_POOL_DEBUG 0
478
* Enable timer heap debugging facility. When this is enabled, application
479
* can call pj_timer_heap_dump() to show the contents of the timer heap
480
* along with the source location where the timer entries were scheduled.
481
* See https://trac.pjsip.org/repos/ticket/1527 for more info.
485
#ifndef PJ_TIMER_DEBUG
486
# define PJ_TIMER_DEBUG 0
491
* Set this to 1 to enable debugging on the group lock. Default: 0
493
#ifndef PJ_GRP_LOCK_DEBUG
494
# define PJ_GRP_LOCK_DEBUG 0
499
* Specify this as \a stack_size argument in #pj_thread_create() to specify
500
* that thread should use default stack size for the current platform.
504
#ifndef PJ_THREAD_DEFAULT_STACK_SIZE
505
# define PJ_THREAD_DEFAULT_STACK_SIZE 8192
510
* Specify if PJ_CHECK_STACK() macro is enabled to check the sanity of
511
* the stack. The OS implementation may check that no stack overflow
512
* occurs, and it also may collect statistic about stack usage. Note
513
* that this will increase the footprint of the libraries since it
514
* tracks the filename and line number of each functions.
516
#ifndef PJ_OS_HAS_CHECK_STACK
517
# define PJ_OS_HAS_CHECK_STACK 0
521
* Do we have alternate pool implementation?
525
#ifndef PJ_HAS_POOL_ALT_API
526
# define PJ_HAS_POOL_ALT_API PJ_POOL_DEBUG
531
* Support TCP in the library.
532
* Disabling TCP will reduce the footprint slightly (about 6KB).
537
# define PJ_HAS_TCP 1
541
* Support IPv6 in the library. If this support is disabled, some IPv6
542
* related functions will return PJ_EIPV6NOTSUP.
544
* Default: 0 (disabled, for now)
547
# define PJ_HAS_IPV6 0
551
* Maximum hostname length.
552
* Libraries sometimes needs to make copy of an address to stack buffer;
553
* the value here affects the stack usage.
557
#ifndef PJ_MAX_HOSTNAME
558
# define PJ_MAX_HOSTNAME (128)
562
* Maximum consecutive identical error for accept() operation before
563
* activesock stops calling the next ioqueue accept.
567
#ifndef PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR
568
# define PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR 50
572
* Constants for declaring the maximum handles that can be supported by
573
* a single IOQ framework. This constant might not be relevant to the
574
* underlying I/O queue impelementation, but still, developers should be
575
* aware of this constant, to make sure that the program will not break when
576
* the underlying implementation changes.
578
#ifndef PJ_IOQUEUE_MAX_HANDLES
579
# define PJ_IOQUEUE_MAX_HANDLES (64)
584
* If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more
585
* things to ensure thread safety of handle unregistration operation by
586
* employing reference counter to each handle.
588
* In addition, the ioqueue will preallocate memory for the handles,
589
* according to the maximum number of handles that is specified during
592
* All applications would normally want this enabled, but you may disable
594
* - there is no dynamic unregistration to all ioqueues.
595
* - there is no threading, or there is no preemptive multitasking.
599
#ifndef PJ_IOQUEUE_HAS_SAFE_UNREG
600
# define PJ_IOQUEUE_HAS_SAFE_UNREG 1
605
* Default concurrency setting for sockets/handles registered to ioqueue.
606
* This controls whether the ioqueue is allowed to call the key's callback
607
* concurrently/in parallel. The default is yes, which means that if there
608
* are more than one pending operations complete simultaneously, more
609
* than one threads may call the key's callback at the same time. This
610
* generally would promote good scalability for application, at the
611
* expense of more complexity to manage the concurrent accesses.
613
* Please see the ioqueue documentation for more info.
615
#ifndef PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY
616
# define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY 1
621
* if ioqueue concurrency is disallowed, PJ_IOQUEUE_HAS_SAFE_UNREG
624
#if (PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY==0) && (PJ_IOQUEUE_HAS_SAFE_UNREG==0)
625
# error PJ_IOQUEUE_HAS_SAFE_UNREG must be enabled if ioqueue concurrency \
631
* When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in
632
* ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the
633
* ioqueue key is kept in closing state before it can be reused.
635
* The value is in miliseconds.
639
#ifndef PJ_IOQUEUE_KEY_FREE_DELAY
640
# define PJ_IOQUEUE_KEY_FREE_DELAY 500
645
* Determine if FD_SETSIZE is changeable/set-able. If so, then we will
646
* set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking
649
#ifndef PJ_FD_SETSIZE_SETABLE
650
# if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \
651
(defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0)
652
# define PJ_FD_SETSIZE_SETABLE 1
654
# define PJ_FD_SETSIZE_SETABLE 0
659
* Overrides FD_SETSIZE so it is consistent throughout the library.
660
* We only do this if we detected that FD_SETSIZE is changeable. If
661
* FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be
662
* set to value lower than FD_SETSIZE.
664
#if PJ_FD_SETSIZE_SETABLE
665
/* Only override FD_SETSIZE if the value has not been set */
667
# define FD_SETSIZE PJ_IOQUEUE_MAX_HANDLES
670
/* When FD_SETSIZE is not changeable, check if PJ_IOQUEUE_MAX_HANDLES
671
* is lower than FD_SETSIZE value.
674
# if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE
675
# error "PJ_IOQUEUE_MAX_HANDLES is greater than FD_SETSIZE"
682
* Specify whether #pj_enum_ip_interface() function should exclude
683
* loopback interfaces.
687
#ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF
688
# define PJ_IP_HELPER_IGNORE_LOOPBACK_IF 1
693
* Has semaphore functionality?
697
#ifndef PJ_HAS_SEMAPHORE
698
# define PJ_HAS_SEMAPHORE 1
703
* Event object (for synchronization, e.g. in Win32)
707
#ifndef PJ_HAS_EVENT_OBJ
708
# define PJ_HAS_EVENT_OBJ 1
713
* Maximum file name length.
716
# define PJ_MAXPATH 260
721
* Enable library's extra check.
722
* If this macro is enabled, #PJ_ASSERT_RETURN macro will expand to
723
* run-time checking. If this macro is disabled, #PJ_ASSERT_RETURN
724
* will simply evaluate to #pj_assert().
726
* You can disable this macro to reduce size, at the risk of crashes
727
* if invalid value (e.g. NULL) is passed to the library.
731
#ifndef PJ_ENABLE_EXTRA_CHECK
732
# define PJ_ENABLE_EXTRA_CHECK 1
737
* Enable name registration for exceptions with #pj_exception_id_alloc().
738
* If this feature is enabled, then the library will keep track of
739
* names associated with each exception ID requested by application via
740
* #pj_exception_id_alloc().
742
* Disabling this macro will reduce the code and .bss size by a tad bit.
743
* See also #PJ_MAX_EXCEPTION_ID.
747
#ifndef PJ_HAS_EXCEPTION_NAMES
748
# define PJ_HAS_EXCEPTION_NAMES 1
752
* Maximum number of unique exception IDs that can be requested
753
* with #pj_exception_id_alloc(). For each entry, a small record will
754
* be allocated in the .bss segment.
758
#ifndef PJ_MAX_EXCEPTION_ID
759
# define PJ_MAX_EXCEPTION_ID 16
763
* Should we use Windows Structured Exception Handling (SEH) for the
768
#ifndef PJ_EXCEPTION_USE_WIN32_SEH
769
# define PJ_EXCEPTION_USE_WIN32_SEH 0
773
* Should we attempt to use Pentium's rdtsc for high resolution
778
#ifndef PJ_TIMESTAMP_USE_RDTSC
779
# define PJ_TIMESTAMP_USE_RDTSC 0
783
* Is native platform error positive number?
786
#ifndef PJ_NATIVE_ERR_POSITIVE
787
# define PJ_NATIVE_ERR_POSITIVE 1
791
* Include error message string in the library (pj_strerror()).
792
* This is very much desirable!
796
#ifndef PJ_HAS_ERROR_STRING
797
# define PJ_HAS_ERROR_STRING 1
802
* Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom
803
* functions to compare alnum strings. On some systems, they're faster
804
* then stricmp/strcasecmp, but they can be slower on other systems.
805
* When disabled, pjlib will fallback to stricmp/strnicmp.
809
#ifndef PJ_HAS_STRICMP_ALNUM
810
# define PJ_HAS_STRICMP_ALNUM 0
815
* Types of QoS backend implementation.
819
* Dummy QoS backend implementation, will always return error on all
822
#define PJ_QOS_DUMMY 1
824
/** QoS backend based on setsockopt(IP_TOS) */
827
/** QoS backend for Windows Mobile 6 */
830
/** QoS backend for Symbian */
831
#define PJ_QOS_SYMBIAN 4
834
* Force the use of some QoS backend API for some platforms.
836
#ifndef PJ_QOS_IMPLEMENTATION
837
# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE && _WIN32_WCE >= 0x502
838
/* Windows Mobile 6 or later */
839
# define PJ_QOS_IMPLEMENTATION PJ_QOS_WM
845
* Enable secure socket. For most platforms, this is implemented using
846
* OpenSSL, so this will require OpenSSL to be installed. For Symbian
847
* platform, this is implemented natively using CSecureSocket.
849
* Default: 0 (for now)
851
#ifndef PJ_HAS_SSL_SOCK
852
# define PJ_HAS_SSL_SOCK 0
857
* Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See
858
* https://trac.pjsip.org/repos/ticket/1197.
862
#ifndef PJ_SOCK_DISABLE_WSAECONNRESET
863
# define PJ_SOCK_DISABLE_WSAECONNRESET 1
869
/********************************************************************
874
* @defgroup pj_dll_target Building Dynamic Link Libraries (DLL/DSO)
878
* The libraries support generation of dynamic link libraries for
879
* Symbian ABIv2 target (.dso/Dynamic Shared Object files, in Symbian
880
* terms). Similar procedures may be applied for Win32 DLL with some
883
* Depending on the platforms, these steps may be necessary in order to
884
* produce the dynamic libraries:
885
* - Create the (Visual Studio) projects to produce DLL output. PJLIB
886
* does not provide ready to use project files to produce DLL, so
887
* you need to create these projects yourself. For Symbian, the MMP
888
* files have been setup to produce DSO files for targets that
890
* - In the (Visual Studio) projects, some macros need to be declared
891
* so that appropriate modifiers are added to symbol declarations
892
* and definitions. Please see the macro section below for information
893
* regarding these macros. For Symbian, these have been taken care by the
895
* - Some build systems require .DEF file to be specified when creating
896
* the DLL. For Symbian, .DEF files are included in pjlib distribution,
897
* in <tt>pjlib/build.symbian</tt> directory. These DEF files are
898
* created by running <tt>./makedef.sh all</tt> from this directory,
901
* Macros related for building DLL/DSO files:
902
* - For platforms that supports dynamic link libraries generation,
903
* it must declare <tt>PJ_EXPORT_SPECIFIER</tt> macro which value contains
904
* the prefix to be added to symbol definition, to export this
905
* symbol in the DLL/DSO. For example, on Win32/Visual Studio, the
906
* value of this macro is \a __declspec(dllexport), and for ARM
907
* ABIv2/Symbian, the value is \a EXPORT_C.
908
* - For platforms that supports linking with dynamic link libraries,
909
* it must declare <tt>PJ_IMPORT_SPECIFIER</tt> macro which value contains
910
* the prefix to be added to symbol declaration, to import this
911
* symbol from a DLL/DSO. For example, on Win32/Visual Studio, the
912
* value of this macro is \a __declspec(dllimport), and for ARM
913
* ABIv2/Symbian, the value is \a IMPORT_C.
914
* - Both <tt>PJ_EXPORT_SPECIFIER</tt> and <tt>PJ_IMPORT_SPECIFIER</tt>
915
* macros above can be declared in your \a config_site.h if they are not
917
* - When PJLIB is built as DLL/DSO, both <tt>PJ_DLL</tt> and
918
* <tt>PJ_EXPORTING</tt> macros must be declared, so that
919
* <tt>PJ_EXPORT_SPECIFIER</tt> modifier will be added into function
921
* - When application wants to link dynamically with PJLIB, then it
922
* must declare <tt>PJ_DLL</tt> macro when using/including PJLIB header,
923
* so that <tt>PJ_IMPORT_SPECIFIER</tt> modifier is properly added into
924
* symbol declarations.
926
* When <b>PJ_DLL</b> macro is not declared, static linking is assumed.
928
* For example, here are some settings to produce DLLs with Visual Studio
930
* - Create Visual Studio projects to produce DLL. Add the appropriate
931
* project dependencies to avoid link errors.
932
* - In the projects, declare <tt>PJ_DLL</tt> and <tt>PJ_EXPORTING</tt>
934
* - Declare these macros in your <tt>config_site.h</tt>:
936
#define PJ_EXPORT_SPECIFIER __declspec(dllexport)
937
#define PJ_IMPORT_SPECIFIER __declspec(dllimport)
939
* - And in the application (that links with the DLL) project, add
940
* <tt>PJ_DLL</tt> in the macro declarations.
946
* @defgroup pj_config Build Configuration
951
* @def PJ_INLINE(type)
952
* @param type The return type of the function.
953
* Expand the function as inline.
955
#define PJ_INLINE(type) PJ_INLINE_SPECIFIER type
958
* This macro declares platform/compiler specific specifier prefix
959
* to be added to symbol declaration to export the symbol when PJLIB
960
* is built as dynamic library.
962
* This macro should have been added by platform specific headers,
963
* if the platform supports building dynamic library target.
965
#ifndef PJ_EXPORT_DECL_SPECIFIER
966
# define PJ_EXPORT_DECL_SPECIFIER
971
* This macro declares platform/compiler specific specifier prefix
972
* to be added to symbol definition to export the symbol when PJLIB
973
* is built as dynamic library.
975
* This macro should have been added by platform specific headers,
976
* if the platform supports building dynamic library target.
978
#ifndef PJ_EXPORT_DEF_SPECIFIER
979
# define PJ_EXPORT_DEF_SPECIFIER
984
* This macro declares platform/compiler specific specifier prefix
985
* to be added to symbol declaration to import the symbol.
987
* This macro should have been added by platform specific headers,
988
* if the platform supports building dynamic library target.
990
#ifndef PJ_IMPORT_DECL_SPECIFIER
991
# define PJ_IMPORT_DECL_SPECIFIER
996
* This macro has been deprecated. It will evaluate to nothing.
998
#ifndef PJ_EXPORT_SYMBOL
999
# define PJ_EXPORT_SYMBOL(x)
1004
* @def PJ_DECL(type)
1005
* @param type The return type of the function.
1006
* Declare a function.
1009
# if defined(PJ_EXPORTING)
1010
# define PJ_DECL(type) PJ_EXPORT_DECL_SPECIFIER type
1012
# define PJ_DECL(type) PJ_IMPORT_DECL_SPECIFIER type
1014
#elif !defined(PJ_DECL)
1015
# if defined(__cplusplus)
1016
# define PJ_DECL(type) type
1018
# define PJ_DECL(type) extern type
1025
* @param type The return type of the function.
1026
* Define a function.
1028
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
1029
# define PJ_DEF(type) PJ_EXPORT_DEF_SPECIFIER type
1030
#elif !defined(PJ_DEF)
1031
# define PJ_DEF(type) type
1036
* @def PJ_DECL_NO_RETURN(type)
1037
* @param type The return type of the function.
1038
* Declare a function that will not return.
1041
* @def PJ_IDECL_NO_RETURN(type)
1042
* @param type The return type of the function.
1043
* Declare an inline function that will not return.
1046
* @def PJ_BEGIN_DECL
1047
* Mark beginning of declaration section in a header file.
1051
* Mark end of declaration section in a header file.
1054
# define PJ_DECL_NO_RETURN(type) PJ_DECL(type) PJ_NORETURN
1055
# define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN
1056
# define PJ_BEGIN_DECL extern "C" {
1057
# define PJ_END_DECL }
1059
# define PJ_DECL_NO_RETURN(type) PJ_NORETURN PJ_DECL(type)
1060
# define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type)
1061
# define PJ_BEGIN_DECL
1062
# define PJ_END_DECL
1068
* @def PJ_DECL_DATA(type)
1069
* @param type The data type.
1070
* Declare a global data.
1073
# if defined(PJ_EXPORTING)
1074
# define PJ_DECL_DATA(type) PJ_EXPORT_DECL_SPECIFIER extern type
1076
# define PJ_DECL_DATA(type) PJ_IMPORT_DECL_SPECIFIER extern type
1078
#elif !defined(PJ_DECL_DATA)
1079
# define PJ_DECL_DATA(type) extern type
1084
* @def PJ_DEF_DATA(type)
1085
* @param type The data type.
1086
* Define a global data.
1088
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
1089
# define PJ_DEF_DATA(type) PJ_EXPORT_DEF_SPECIFIER type
1090
#elif !defined(PJ_DEF_DATA)
1091
# define PJ_DEF_DATA(type) type
1096
* @def PJ_IDECL(type)
1097
* @param type The function's return type.
1098
* Declare a function that may be expanded as inline.
1101
* @def PJ_IDEF(type)
1102
* @param type The function's return type.
1103
* Define a function that may be expanded as inline.
1106
#if PJ_FUNCTIONS_ARE_INLINED
1107
# define PJ_IDECL(type) PJ_INLINE(type)
1108
# define PJ_IDEF(type) PJ_INLINE(type)
1110
# define PJ_IDECL(type) PJ_DECL(type)
1111
# define PJ_IDEF(type) PJ_DEF(type)
1116
* @def PJ_UNUSED_ARG(arg)
1117
* @param arg The argument name.
1118
* PJ_UNUSED_ARG prevents warning about unused argument in a function.
1120
#define PJ_UNUSED_ARG(arg) (void)arg
1124
* @param id Any identifier that will be printed as TODO message.
1125
* PJ_TODO macro will display TODO message as warning during compilation.
1126
* Example: PJ_TODO(CLEAN_UP_ERROR);
1129
# define PJ_TODO(id) TODO___##id:
1133
* Simulate race condition by sleeping the thread in strategic locations.
1137
# define PJ_RACE_ME(x)
1141
* Function attributes to inform that the function may throw exception.
1143
* @param x The exception list, enclosed in parenthesis.
1145
#define __pj_throw__(x)
1149
/********************************************************************
1152
#ifndef PJ_HAS_HIGH_RES_TIMER
1153
# error "PJ_HAS_HIGH_RES_TIMER is not defined!"
1156
#if !defined(PJ_HAS_PENTIUM)
1157
# error "PJ_HAS_PENTIUM is not defined!"
1160
#if !defined(PJ_IS_LITTLE_ENDIAN)
1161
# error "PJ_IS_LITTLE_ENDIAN is not defined!"
1164
#if !defined(PJ_IS_BIG_ENDIAN)
1165
# error "PJ_IS_BIG_ENDIAN is not defined!"
1168
#if !defined(PJ_EMULATE_RWMUTEX)
1169
# error "PJ_EMULATE_RWMUTEX should be defined in compat/os_xx.h"
1172
#if !defined(PJ_THREAD_SET_STACK_SIZE)
1173
# error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h"
1176
#if !defined(PJ_THREAD_ALLOCATE_STACK)
1177
# error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h"
1182
/** PJLIB version major number. */
1183
#define PJ_VERSION_NUM_MAJOR 2
1185
/** PJLIB version minor number. */
1186
#define PJ_VERSION_NUM_MINOR 1
1188
/** PJLIB version revision number. */
1189
#define PJ_VERSION_NUM_REV 0
1192
* Extra suffix for the version (e.g. "-trunk"), or empty for
1193
* web release version.
1195
#define PJ_VERSION_NUM_EXTRA ""
1198
* PJLIB version number consists of three bytes with the following format:
1199
* 0xMMIIRR00, where MM: major number, II: minor number, RR: revision
1200
* number, 00: always zero for now.
1202
#define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \
1203
(PJ_VERSION_NUM_MINOR << 16) | \
1204
(PJ_VERSION_NUM_REV << 8))
1207
* PJLIB version string constant. @see pj_get_version()
1209
PJ_DECL_DATA(const char*) PJ_VERSION;
1212
* Get PJLIB version string.
1214
* @return #PJ_VERSION constant.
1216
PJ_DECL(const char*) pj_get_version(void);
1219
* Dump configuration to log with verbosity equal to info(3).
1221
PJ_DECL(void) pj_dump_config(void);
1226
#endif /* __PJ_CONFIG_H__ */