1
/* $Id: config.h 4795 2014-03-14 06:58:10Z riza $ */
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(WIN32) || defined(PJ_WIN64) || defined(_WIN64) || \
81
defined(WIN64) || defined(__TOS_WIN__)
82
# if defined(PJ_WIN64) || defined(_WIN64) || defined(WIN64)
91
# include <pj/compat/os_win32.h>
93
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0
97
# include <pj/compat/os_linux_kernel.h>
99
#elif defined(PJ_LINUX) || defined(linux) || defined(__linux)
105
# include <pj/compat/os_linux.h>
107
#elif defined(PJ_PALMOS) && PJ_PALMOS!=0
111
# include <pj/compat/os_palmos.h>
113
#elif defined(PJ_SUNOS) || defined(sun) || defined(__sun)
119
# include <pj/compat/os_sunos.h>
121
#elif defined(PJ_DARWINOS) || defined(__MACOSX__) || \
122
defined (__APPLE__) || defined (__MACH__)
127
# define PJ_DARWINOS 1
128
# include <pj/compat/os_darwinos.h>
130
#elif defined(PJ_RTEMS) && PJ_RTEMS!=0
134
# include <pj/compat/os_rtems.h>
136
# error "Please specify target os."
140
/********************************************************************
141
* Target machine specific configuration.
143
#if defined(PJ_AUTOCONF)
145
* Autoconf configured
147
#include <pj/compat/m_auto.h>
149
#elif defined (PJ_M_I386) || defined(_i386_) || defined(i_386_) || \
150
defined(_X86_) || defined(x86) || defined(__i386__) || \
151
defined(__i386) || defined(_M_IX86) || defined(__I86__)
153
* Generic i386 processor family, little-endian
157
# define PJ_M_NAME "i386"
158
# define PJ_HAS_PENTIUM 1
159
# define PJ_IS_LITTLE_ENDIAN 1
160
# define PJ_IS_BIG_ENDIAN 0
163
#elif defined (PJ_M_X86_64) || defined(__amd64__) || defined(__amd64) || \
164
defined(__x86_64__) || defined(__x86_64)
166
* AMD 64bit processor, little endian
169
# define PJ_M_X86_64 1
170
# define PJ_M_NAME "x86_64"
171
# define PJ_HAS_PENTIUM 1
172
# define PJ_IS_LITTLE_ENDIAN 1
173
# define PJ_IS_BIG_ENDIAN 0
175
#elif defined(PJ_M_IA64) || defined(__ia64__) || defined(_IA64) || \
176
defined(__IA64__) || defined( _M_IA64)
178
* Intel IA64 processor, default to little endian
182
# define PJ_M_NAME "ia64"
183
# define PJ_HAS_PENTIUM 1
184
# define PJ_IS_LITTLE_ENDIAN 1
185
# define PJ_IS_BIG_ENDIAN 0
187
#elif defined (PJ_M_M68K) && PJ_M_M68K != 0
190
* Motorola m68k processor, big endian
194
# define PJ_M_NAME "m68k"
195
# define PJ_HAS_PENTIUM 0
196
# define PJ_IS_LITTLE_ENDIAN 0
197
# define PJ_IS_BIG_ENDIAN 1
200
#elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \
203
* DEC Alpha processor, little endian
206
# define PJ_M_ALPHA 1
207
# define PJ_M_NAME "alpha"
208
# define PJ_HAS_PENTIUM 0
209
# define PJ_IS_LITTLE_ENDIAN 1
210
# define PJ_IS_BIG_ENDIAN 0
213
#elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \
214
defined(__MIPS__) || defined(MIPS) || defined(_MIPS_)
216
* MIPS, bi-endian, so raise error if endianness is not configured
220
# define PJ_M_NAME "mips"
221
# define PJ_HAS_PENTIUM 0
222
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
223
# error Endianness must be declared for this processor
227
#elif defined (PJ_M_SPARC) || defined( __sparc__) || defined(__sparc)
229
* Sun Sparc, big endian
232
# define PJ_M_SPARC 1
233
# define PJ_M_NAME "sparc"
234
# define PJ_HAS_PENTIUM 0
235
# define PJ_IS_LITTLE_ENDIAN 0
236
# define PJ_IS_BIG_ENDIAN 1
238
#elif defined (PJ_M_ARMV4) || defined(ARM) || defined(_ARM_) || \
239
defined(ARMV4) || defined(__arm__)
241
* ARM, bi-endian, so raise error if endianness is not configured
244
# define PJ_M_ARMV4 1
245
# define PJ_M_NAME "armv4"
246
# define PJ_HAS_PENTIUM 0
247
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
248
# error Endianness must be declared for this processor
251
#elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \
252
defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || \
255
* PowerPC, bi-endian, so raise error if endianness is not configured
258
# define PJ_M_POWERPC 1
259
# define PJ_M_NAME "powerpc"
260
# define PJ_HAS_PENTIUM 0
261
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
262
# error Endianness must be declared for this processor
265
#elif defined (PJ_M_NIOS2) || defined(__nios2) || defined(__nios2__) || \
266
defined(__NIOS2__) || defined(__M_NIOS2) || defined(_ARCH_NIOS2)
268
* Nios2, little endian
271
# define PJ_M_NIOS2 1
272
# define PJ_M_NAME "nios2"
273
# define PJ_HAS_PENTIUM 0
274
# define PJ_IS_LITTLE_ENDIAN 1
275
# define PJ_IS_BIG_ENDIAN 0
278
# error "Please specify target machine."
281
/* Include size_t definition. */
282
#include <pj/compat/size_t.h>
284
/* Include site/user specific configuration to control PJLIB features.
285
* YOU MUST CREATE THIS FILE YOURSELF!!
287
#include <pj/config_site.h>
289
/********************************************************************
293
/* Overrides for DOXYGEN */
295
# undef PJ_FUNCTIONS_ARE_INLINED
296
# undef PJ_HAS_FLOATING_POINT
297
# undef PJ_LOG_MAX_LEVEL
298
# undef PJ_LOG_MAX_SIZE
299
# undef PJ_LOG_USE_STACK_BUFFER
300
# undef PJ_TERM_HAS_COLOR
301
# undef PJ_POOL_DEBUG
303
# undef PJ_MAX_HOSTNAME
304
# undef PJ_IOQUEUE_MAX_HANDLES
306
# undef PJ_HAS_SEMAPHORE
307
# undef PJ_HAS_EVENT_OBJ
308
# undef PJ_ENABLE_EXTRA_CHECK
309
# undef PJ_EXCEPTION_USE_WIN32_SEH
310
# undef PJ_HAS_ERROR_STRING
312
# define PJ_HAS_IPV6 1
316
* @defgroup pj_config Build Configuration
319
* This section contains macros that can set during PJLIB build process
320
* to controll various aspects of the library.
322
* <b>Note</b>: the values in this page does NOT necessarily reflect to the
323
* macro values during the build process.
327
* If this macro is set to 1, it will enable some debugging checking
330
* Default: equal to (NOT NDEBUG).
341
* Enable this macro to activate logging to mutex/semaphore related events.
342
* This is useful to troubleshoot concurrency problems such as deadlocks.
343
* In addition, you should also add PJ_LOG_HAS_THREAD_ID flag to the
344
* log decoration to assist the troubleshooting.
348
#ifndef PJ_DEBUG_MUTEX
349
# define PJ_DEBUG_MUTEX 0
353
* Expand functions in *_i.h header files as inline.
357
#ifndef PJ_FUNCTIONS_ARE_INLINED
358
# define PJ_FUNCTIONS_ARE_INLINED 0
362
* Use floating point computations in the library.
366
#ifndef PJ_HAS_FLOATING_POINT
367
# define PJ_HAS_FLOATING_POINT 1
371
* Declare maximum logging level/verbosity. Lower number indicates higher
372
* importance, with the highest importance has level zero. The least
373
* important level is five in this implementation, but this can be extended
374
* by supplying the appropriate implementation.
376
* The level conventions:
383
* - 6: more detailed trace
387
#ifndef PJ_LOG_MAX_LEVEL
388
# define PJ_LOG_MAX_LEVEL 5
392
* Maximum message size that can be sent to output device for each call
393
* to PJ_LOG(). If the message size is longer than this value, it will be cut.
394
* This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER
399
#ifndef PJ_LOG_MAX_SIZE
400
# define PJ_LOG_MAX_SIZE 4000
405
* Does the log get the buffer from the stack? (default is yes).
406
* If the value is set to NO, then the buffer will be taken from static
407
* buffer, which in this case will make the log function non-reentrant.
411
#ifndef PJ_LOG_USE_STACK_BUFFER
412
# define PJ_LOG_USE_STACK_BUFFER 1
416
* Enable log indentation feature.
420
#ifndef PJ_LOG_ENABLE_INDENT
421
# define PJ_LOG_ENABLE_INDENT 1
425
* Number of PJ_LOG_INDENT_CHAR to put every time pj_log_push_indent()
430
#ifndef PJ_LOG_INDENT_SIZE
431
# define PJ_LOG_INDENT_SIZE 1
435
* Log indentation character.
439
#ifndef PJ_LOG_INDENT_CHAR
440
# define PJ_LOG_INDENT_CHAR '.'
444
* Colorfull terminal (for logging etc).
448
#ifndef PJ_TERM_HAS_COLOR
449
# define PJ_TERM_HAS_COLOR 1
454
* Set this flag to non-zero to enable various checking for pool
455
* operations. When this flag is set, assertion must be enabled
456
* in the application.
458
* This will slow down pool creation and destruction and will add
459
* few bytes of overhead, so application would normally want to
460
* disable this feature on release build.
465
# define PJ_SAFE_POOL 0
470
* If pool debugging is used, then each memory allocation from the pool
471
* will call malloc(), and pool will release all memory chunks when it
472
* is destroyed. This works better when memory verification programs
473
* such as Rational Purify is used.
477
#ifndef PJ_POOL_DEBUG
478
# define PJ_POOL_DEBUG 0
483
* Enable timer heap debugging facility. When this is enabled, application
484
* can call pj_timer_heap_dump() to show the contents of the timer heap
485
* along with the source location where the timer entries were scheduled.
486
* See https://trac.pjsip.org/repos/ticket/1527 for more info.
490
#ifndef PJ_TIMER_DEBUG
491
# define PJ_TIMER_DEBUG 0
496
* Set this to 1 to enable debugging on the group lock. Default: 0
498
#ifndef PJ_GRP_LOCK_DEBUG
499
# define PJ_GRP_LOCK_DEBUG 0
504
* Specify this as \a stack_size argument in #pj_thread_create() to specify
505
* that thread should use default stack size for the current platform.
509
#ifndef PJ_THREAD_DEFAULT_STACK_SIZE
510
# define PJ_THREAD_DEFAULT_STACK_SIZE 8192
515
* Specify if PJ_CHECK_STACK() macro is enabled to check the sanity of
516
* the stack. The OS implementation may check that no stack overflow
517
* occurs, and it also may collect statistic about stack usage. Note
518
* that this will increase the footprint of the libraries since it
519
* tracks the filename and line number of each functions.
521
#ifndef PJ_OS_HAS_CHECK_STACK
522
# define PJ_OS_HAS_CHECK_STACK 0
526
* Do we have alternate pool implementation?
530
#ifndef PJ_HAS_POOL_ALT_API
531
# define PJ_HAS_POOL_ALT_API PJ_POOL_DEBUG
536
* Support TCP in the library.
537
* Disabling TCP will reduce the footprint slightly (about 6KB).
542
# define PJ_HAS_TCP 1
546
* Support IPv6 in the library. If this support is disabled, some IPv6
547
* related functions will return PJ_EIPV6NOTSUP.
549
* Default: 0 (disabled, for now)
552
# define PJ_HAS_IPV6 1
556
* Maximum hostname length.
557
* Libraries sometimes needs to make copy of an address to stack buffer;
558
* the value here affects the stack usage.
562
#ifndef PJ_MAX_HOSTNAME
563
# define PJ_MAX_HOSTNAME (128)
567
* Maximum consecutive identical error for accept() operation before
568
* activesock stops calling the next ioqueue accept.
572
#ifndef PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR
573
# define PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR 50
577
* Constants for declaring the maximum handles that can be supported by
578
* a single IOQ framework. This constant might not be relevant to the
579
* underlying I/O queue impelementation, but still, developers should be
580
* aware of this constant, to make sure that the program will not break when
581
* the underlying implementation changes.
583
#ifndef PJ_IOQUEUE_MAX_HANDLES
584
# define PJ_IOQUEUE_MAX_HANDLES (64)
589
* If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more
590
* things to ensure thread safety of handle unregistration operation by
591
* employing reference counter to each handle.
593
* In addition, the ioqueue will preallocate memory for the handles,
594
* according to the maximum number of handles that is specified during
597
* All applications would normally want this enabled, but you may disable
599
* - there is no dynamic unregistration to all ioqueues.
600
* - there is no threading, or there is no preemptive multitasking.
604
#ifndef PJ_IOQUEUE_HAS_SAFE_UNREG
605
# define PJ_IOQUEUE_HAS_SAFE_UNREG 1
610
* Default concurrency setting for sockets/handles registered to ioqueue.
611
* This controls whether the ioqueue is allowed to call the key's callback
612
* concurrently/in parallel. The default is yes, which means that if there
613
* are more than one pending operations complete simultaneously, more
614
* than one threads may call the key's callback at the same time. This
615
* generally would promote good scalability for application, at the
616
* expense of more complexity to manage the concurrent accesses.
618
* Please see the ioqueue documentation for more info.
620
#ifndef PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY
621
# define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY 1
626
* if ioqueue concurrency is disallowed, PJ_IOQUEUE_HAS_SAFE_UNREG
629
#if (PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY==0) && (PJ_IOQUEUE_HAS_SAFE_UNREG==0)
630
# error PJ_IOQUEUE_HAS_SAFE_UNREG must be enabled if ioqueue concurrency \
636
* When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in
637
* ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the
638
* ioqueue key is kept in closing state before it can be reused.
640
* The value is in miliseconds.
644
#ifndef PJ_IOQUEUE_KEY_FREE_DELAY
645
# define PJ_IOQUEUE_KEY_FREE_DELAY 500
650
* Determine if FD_SETSIZE is changeable/set-able. If so, then we will
651
* set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking
654
#ifndef PJ_FD_SETSIZE_SETABLE
655
# if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \
656
(defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0)
657
# define PJ_FD_SETSIZE_SETABLE 1
659
# define PJ_FD_SETSIZE_SETABLE 0
664
* Overrides FD_SETSIZE so it is consistent throughout the library.
665
* We only do this if we detected that FD_SETSIZE is changeable. If
666
* FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be
667
* set to value lower than FD_SETSIZE.
669
#if PJ_FD_SETSIZE_SETABLE
670
/* Only override FD_SETSIZE if the value has not been set */
672
# define FD_SETSIZE PJ_IOQUEUE_MAX_HANDLES
675
/* When FD_SETSIZE is not changeable, check if PJ_IOQUEUE_MAX_HANDLES
676
* is lower than FD_SETSIZE value.
679
# if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE
680
# error "PJ_IOQUEUE_MAX_HANDLES is greater than FD_SETSIZE"
687
* Specify whether #pj_enum_ip_interface() function should exclude
688
* loopback interfaces.
692
#ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF
693
# define PJ_IP_HELPER_IGNORE_LOOPBACK_IF 1
698
* Has semaphore functionality?
702
#ifndef PJ_HAS_SEMAPHORE
703
# define PJ_HAS_SEMAPHORE 1
708
* Event object (for synchronization, e.g. in Win32)
712
#ifndef PJ_HAS_EVENT_OBJ
713
# define PJ_HAS_EVENT_OBJ 1
718
* Maximum file name length.
721
# define PJ_MAXPATH 260
726
* Enable library's extra check.
727
* If this macro is enabled, #PJ_ASSERT_RETURN macro will expand to
728
* run-time checking. If this macro is disabled, #PJ_ASSERT_RETURN
729
* will simply evaluate to #pj_assert().
731
* You can disable this macro to reduce size, at the risk of crashes
732
* if invalid value (e.g. NULL) is passed to the library.
736
#ifndef PJ_ENABLE_EXTRA_CHECK
737
# define PJ_ENABLE_EXTRA_CHECK 1
742
* Enable name registration for exceptions with #pj_exception_id_alloc().
743
* If this feature is enabled, then the library will keep track of
744
* names associated with each exception ID requested by application via
745
* #pj_exception_id_alloc().
747
* Disabling this macro will reduce the code and .bss size by a tad bit.
748
* See also #PJ_MAX_EXCEPTION_ID.
752
#ifndef PJ_HAS_EXCEPTION_NAMES
753
# define PJ_HAS_EXCEPTION_NAMES 1
757
* Maximum number of unique exception IDs that can be requested
758
* with #pj_exception_id_alloc(). For each entry, a small record will
759
* be allocated in the .bss segment.
763
#ifndef PJ_MAX_EXCEPTION_ID
764
# define PJ_MAX_EXCEPTION_ID 16
768
* Should we use Windows Structured Exception Handling (SEH) for the
773
#ifndef PJ_EXCEPTION_USE_WIN32_SEH
774
# define PJ_EXCEPTION_USE_WIN32_SEH 0
778
* Should we attempt to use Pentium's rdtsc for high resolution
783
#ifndef PJ_TIMESTAMP_USE_RDTSC
784
# define PJ_TIMESTAMP_USE_RDTSC 0
788
* Is native platform error positive number?
791
#ifndef PJ_NATIVE_ERR_POSITIVE
792
# define PJ_NATIVE_ERR_POSITIVE 1
796
* Include error message string in the library (pj_strerror()).
797
* This is very much desirable!
801
#ifndef PJ_HAS_ERROR_STRING
802
# define PJ_HAS_ERROR_STRING 1
807
* Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom
808
* functions to compare alnum strings. On some systems, they're faster
809
* then stricmp/strcasecmp, but they can be slower on other systems.
810
* When disabled, pjlib will fallback to stricmp/strnicmp.
814
#ifndef PJ_HAS_STRICMP_ALNUM
815
# define PJ_HAS_STRICMP_ALNUM 0
820
* Types of QoS backend implementation.
824
* Dummy QoS backend implementation, will always return error on all
827
#define PJ_QOS_DUMMY 1
829
/** QoS backend based on setsockopt(IP_TOS) */
832
/** QoS backend for Windows Mobile 6 */
835
/** QoS backend for Symbian */
836
#define PJ_QOS_SYMBIAN 4
839
* Force the use of some QoS backend API for some platforms.
841
#ifndef PJ_QOS_IMPLEMENTATION
842
# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE && _WIN32_WCE >= 0x502
843
/* Windows Mobile 6 or later */
844
# define PJ_QOS_IMPLEMENTATION PJ_QOS_WM
850
* Enable secure socket. For most platforms, this is implemented using
851
* OpenSSL, so this will require OpenSSL to be installed. For Symbian
852
* platform, this is implemented natively using CSecureSocket.
854
* Default: 0 (for now)
856
#ifndef PJ_HAS_SSL_SOCK
857
# define PJ_HAS_SSL_SOCK 0
862
* Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See
863
* https://trac.pjsip.org/repos/ticket/1197.
867
#ifndef PJ_SOCK_DISABLE_WSAECONNRESET
868
# define PJ_SOCK_DISABLE_WSAECONNRESET 1
874
/********************************************************************
879
* @defgroup pj_dll_target Building Dynamic Link Libraries (DLL/DSO)
883
* The libraries support generation of dynamic link libraries for
884
* Symbian ABIv2 target (.dso/Dynamic Shared Object files, in Symbian
885
* terms). Similar procedures may be applied for Win32 DLL with some
888
* Depending on the platforms, these steps may be necessary in order to
889
* produce the dynamic libraries:
890
* - Create the (Visual Studio) projects to produce DLL output. PJLIB
891
* does not provide ready to use project files to produce DLL, so
892
* you need to create these projects yourself. For Symbian, the MMP
893
* files have been setup to produce DSO files for targets that
895
* - In the (Visual Studio) projects, some macros need to be declared
896
* so that appropriate modifiers are added to symbol declarations
897
* and definitions. Please see the macro section below for information
898
* regarding these macros. For Symbian, these have been taken care by the
900
* - Some build systems require .DEF file to be specified when creating
901
* the DLL. For Symbian, .DEF files are included in pjlib distribution,
902
* in <tt>pjlib/build.symbian</tt> directory. These DEF files are
903
* created by running <tt>./makedef.sh all</tt> from this directory,
906
* Macros related for building DLL/DSO files:
907
* - For platforms that supports dynamic link libraries generation,
908
* it must declare <tt>PJ_EXPORT_SPECIFIER</tt> macro which value contains
909
* the prefix to be added to symbol definition, to export this
910
* symbol in the DLL/DSO. For example, on Win32/Visual Studio, the
911
* value of this macro is \a __declspec(dllexport), and for ARM
912
* ABIv2/Symbian, the value is \a EXPORT_C.
913
* - For platforms that supports linking with dynamic link libraries,
914
* it must declare <tt>PJ_IMPORT_SPECIFIER</tt> macro which value contains
915
* the prefix to be added to symbol declaration, to import this
916
* symbol from a DLL/DSO. For example, on Win32/Visual Studio, the
917
* value of this macro is \a __declspec(dllimport), and for ARM
918
* ABIv2/Symbian, the value is \a IMPORT_C.
919
* - Both <tt>PJ_EXPORT_SPECIFIER</tt> and <tt>PJ_IMPORT_SPECIFIER</tt>
920
* macros above can be declared in your \a config_site.h if they are not
922
* - When PJLIB is built as DLL/DSO, both <tt>PJ_DLL</tt> and
923
* <tt>PJ_EXPORTING</tt> macros must be declared, so that
924
* <tt>PJ_EXPORT_SPECIFIER</tt> modifier will be added into function
926
* - When application wants to link dynamically with PJLIB, then it
927
* must declare <tt>PJ_DLL</tt> macro when using/including PJLIB header,
928
* so that <tt>PJ_IMPORT_SPECIFIER</tt> modifier is properly added into
929
* symbol declarations.
931
* When <b>PJ_DLL</b> macro is not declared, static linking is assumed.
933
* For example, here are some settings to produce DLLs with Visual Studio
935
* - Create Visual Studio projects to produce DLL. Add the appropriate
936
* project dependencies to avoid link errors.
937
* - In the projects, declare <tt>PJ_DLL</tt> and <tt>PJ_EXPORTING</tt>
939
* - Declare these macros in your <tt>config_site.h</tt>:
941
#define PJ_EXPORT_SPECIFIER __declspec(dllexport)
942
#define PJ_IMPORT_SPECIFIER __declspec(dllimport)
944
* - And in the application (that links with the DLL) project, add
945
* <tt>PJ_DLL</tt> in the macro declarations.
951
* @defgroup pj_config Build Configuration
956
* @def PJ_INLINE(type)
957
* @param type The return type of the function.
958
* Expand the function as inline.
960
#define PJ_INLINE(type) PJ_INLINE_SPECIFIER type
963
* This macro declares platform/compiler specific specifier prefix
964
* to be added to symbol declaration to export the symbol when PJLIB
965
* is built as dynamic library.
967
* This macro should have been added by platform specific headers,
968
* if the platform supports building dynamic library target.
970
#ifndef PJ_EXPORT_DECL_SPECIFIER
971
# define PJ_EXPORT_DECL_SPECIFIER
976
* This macro declares platform/compiler specific specifier prefix
977
* to be added to symbol definition to export the symbol when PJLIB
978
* is built as dynamic library.
980
* This macro should have been added by platform specific headers,
981
* if the platform supports building dynamic library target.
983
#ifndef PJ_EXPORT_DEF_SPECIFIER
984
# define PJ_EXPORT_DEF_SPECIFIER
989
* This macro declares platform/compiler specific specifier prefix
990
* to be added to symbol declaration to import the symbol.
992
* This macro should have been added by platform specific headers,
993
* if the platform supports building dynamic library target.
995
#ifndef PJ_IMPORT_DECL_SPECIFIER
996
# define PJ_IMPORT_DECL_SPECIFIER
1001
* This macro has been deprecated. It will evaluate to nothing.
1003
#ifndef PJ_EXPORT_SYMBOL
1004
# define PJ_EXPORT_SYMBOL(x)
1009
* @def PJ_DECL(type)
1010
* @param type The return type of the function.
1011
* Declare a function.
1014
# if defined(PJ_EXPORTING)
1015
# define PJ_DECL(type) PJ_EXPORT_DECL_SPECIFIER type
1017
# define PJ_DECL(type) PJ_IMPORT_DECL_SPECIFIER type
1019
#elif !defined(PJ_DECL)
1020
# if defined(__cplusplus)
1021
# define PJ_DECL(type) type
1023
# define PJ_DECL(type) extern type
1030
* @param type The return type of the function.
1031
* Define a function.
1033
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
1034
# define PJ_DEF(type) PJ_EXPORT_DEF_SPECIFIER type
1035
#elif !defined(PJ_DEF)
1036
# define PJ_DEF(type) type
1041
* @def PJ_DECL_NO_RETURN(type)
1042
* @param type The return type of the function.
1043
* Declare a function that will not return.
1046
* @def PJ_IDECL_NO_RETURN(type)
1047
* @param type The return type of the function.
1048
* Declare an inline function that will not return.
1051
* @def PJ_BEGIN_DECL
1052
* Mark beginning of declaration section in a header file.
1056
* Mark end of declaration section in a header file.
1059
# define PJ_DECL_NO_RETURN(type) PJ_DECL(type) PJ_NORETURN
1060
# define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN
1061
# define PJ_BEGIN_DECL extern "C" {
1062
# define PJ_END_DECL }
1064
# define PJ_DECL_NO_RETURN(type) PJ_NORETURN PJ_DECL(type)
1065
# define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type)
1066
# define PJ_BEGIN_DECL
1067
# define PJ_END_DECL
1073
* @def PJ_DECL_DATA(type)
1074
* @param type The data type.
1075
* Declare a global data.
1078
# if defined(PJ_EXPORTING)
1079
# define PJ_DECL_DATA(type) PJ_EXPORT_DECL_SPECIFIER extern type
1081
# define PJ_DECL_DATA(type) PJ_IMPORT_DECL_SPECIFIER extern type
1083
#elif !defined(PJ_DECL_DATA)
1084
# define PJ_DECL_DATA(type) extern type
1089
* @def PJ_DEF_DATA(type)
1090
* @param type The data type.
1091
* Define a global data.
1093
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
1094
# define PJ_DEF_DATA(type) PJ_EXPORT_DEF_SPECIFIER type
1095
#elif !defined(PJ_DEF_DATA)
1096
# define PJ_DEF_DATA(type) type
1101
* @def PJ_IDECL(type)
1102
* @param type The function's return type.
1103
* Declare a function that may be expanded as inline.
1106
* @def PJ_IDEF(type)
1107
* @param type The function's return type.
1108
* Define a function that may be expanded as inline.
1111
#if PJ_FUNCTIONS_ARE_INLINED
1112
# define PJ_IDECL(type) PJ_INLINE(type)
1113
# define PJ_IDEF(type) PJ_INLINE(type)
1115
# define PJ_IDECL(type) PJ_DECL(type)
1116
# define PJ_IDEF(type) PJ_DEF(type)
1121
* @def PJ_UNUSED_ARG(arg)
1122
* @param arg The argument name.
1123
* PJ_UNUSED_ARG prevents warning about unused argument in a function.
1125
#define PJ_UNUSED_ARG(arg) (void)arg
1129
* @param id Any identifier that will be printed as TODO message.
1130
* PJ_TODO macro will display TODO message as warning during compilation.
1131
* Example: PJ_TODO(CLEAN_UP_ERROR);
1134
# define PJ_TODO(id) TODO___##id:
1138
* Simulate race condition by sleeping the thread in strategic locations.
1142
# define PJ_RACE_ME(x)
1146
* Function attributes to inform that the function may throw exception.
1148
* @param x The exception list, enclosed in parenthesis.
1150
#define __pj_throw__(x)
1154
/********************************************************************
1157
#ifndef PJ_HAS_HIGH_RES_TIMER
1158
# error "PJ_HAS_HIGH_RES_TIMER is not defined!"
1161
#if !defined(PJ_HAS_PENTIUM)
1162
# error "PJ_HAS_PENTIUM is not defined!"
1165
#if !defined(PJ_IS_LITTLE_ENDIAN)
1166
# error "PJ_IS_LITTLE_ENDIAN is not defined!"
1169
#if !defined(PJ_IS_BIG_ENDIAN)
1170
# error "PJ_IS_BIG_ENDIAN is not defined!"
1173
#if !defined(PJ_EMULATE_RWMUTEX)
1174
# error "PJ_EMULATE_RWMUTEX should be defined in compat/os_xx.h"
1177
#if !defined(PJ_THREAD_SET_STACK_SIZE)
1178
# error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h"
1181
#if !defined(PJ_THREAD_ALLOCATE_STACK)
1182
# error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h"
1187
/** PJLIB version major number. */
1188
#define PJ_VERSION_NUM_MAJOR 2
1190
/** PJLIB version minor number. */
1191
#define PJ_VERSION_NUM_MINOR 2
1193
/** PJLIB version revision number. */
1194
#define PJ_VERSION_NUM_REV 1
1197
* Extra suffix for the version (e.g. "-trunk"), or empty for
1198
* web release version.
1200
#define PJ_VERSION_NUM_EXTRA ""
1203
* PJLIB version number consists of three bytes with the following format:
1204
* 0xMMIIRR00, where MM: major number, II: minor number, RR: revision
1205
* number, 00: always zero for now.
1207
#define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \
1208
(PJ_VERSION_NUM_MINOR << 16) | \
1209
(PJ_VERSION_NUM_REV << 8))
1212
* PJLIB version string constant. @see pj_get_version()
1214
PJ_DECL_DATA(const char*) PJ_VERSION;
1217
* Get PJLIB version string.
1219
* @return #PJ_VERSION constant.
1221
PJ_DECL(const char*) pj_get_version(void);
1224
* Dump configuration to log with verbosity equal to info(3).
1226
PJ_DECL(void) pj_dump_config(void);
1231
#endif /* __PJ_CONFIG_H__ */