1
/* $Id: config.h 3554 2011-05-05 09:10:15Z nanang $ */
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__
25
* @brief PJLIB Main configuration settings.
28
/********************************************************************
29
* Include compiler specific configuration.
32
# include <pj/compat/cc_msvc.h>
33
#elif defined(__GNUC__)
34
# include <pj/compat/cc_gcc.h>
35
#elif defined(__CW32__)
36
# include <pj/compat/cc_mwcc.h>
37
#elif defined(__MWERKS__)
38
# include <pj/compat/cc_codew.h>
39
#elif defined(__GCCE__)
40
# include <pj/compat/cc_gcce.h>
41
#elif defined(__ARMCC__)
42
# include <pj/compat/cc_armcc.h>
44
# error "Unknown compiler."
48
/********************************************************************
49
* Include target OS specific configuration.
51
#if defined(PJ_AUTOCONF)
55
# include <pj/compat/os_auto.h>
57
#elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
61
# include <pj/compat/os_symbian.h>
63
#elif defined(PJ_WIN32_WINCE) || defined(_WIN32_WCE) || defined(UNDER_CE)
67
# undef PJ_WIN32_WINCE
68
# define PJ_WIN32_WINCE 1
69
# include <pj/compat/os_win32_wince.h>
71
/* Also define Win32 */
74
#elif defined(PJ_WIN32) || defined(_WIN32) || defined(__WIN32__) || \
75
defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__)
81
# include <pj/compat/os_win32.h>
83
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0
87
# include <pj/compat/os_linux_kernel.h>
89
#elif defined(PJ_LINUX) || defined(linux) || defined(__linux)
95
# include <pj/compat/os_linux.h>
97
#elif defined(PJ_PALMOS) && PJ_PALMOS!=0
101
# include <pj/compat/os_palmos.h>
103
#elif defined(PJ_SUNOS) || defined(sun) || defined(__sun)
109
# include <pj/compat/os_sunos.h>
111
#elif defined(PJ_DARWINOS) || defined(__MACOSX__) || \
112
defined (__APPLE__) || defined (__MACH__)
117
# define PJ_DARWINOS 1
118
# include <pj/compat/os_darwinos.h>
120
#elif defined(PJ_RTEMS) && PJ_RTEMS!=0
124
# include <pj/compat/os_rtems.h>
126
# error "Please specify target os."
130
/********************************************************************
131
* Target machine specific configuration.
133
#if defined(PJ_AUTOCONF)
135
* Autoconf configured
137
#include <pj/compat/m_auto.h>
139
#elif defined (PJ_M_I386) || defined(_i386_) || defined(i_386_) || \
140
defined(_X86_) || defined(x86) || defined(__i386__) || \
141
defined(__i386) || defined(_M_IX86) || defined(__I86__)
143
* Generic i386 processor family, little-endian
147
# define PJ_M_NAME "i386"
148
# define PJ_HAS_PENTIUM 1
149
# define PJ_IS_LITTLE_ENDIAN 1
150
# define PJ_IS_BIG_ENDIAN 0
153
#elif defined (PJ_M_X86_64) || defined(__amd64__) || defined(__amd64) || \
154
defined(__x86_64__) || defined(__x86_64)
156
* AMD 64bit processor, little endian
159
# define PJ_M_X86_64 1
160
# define PJ_M_NAME "x86_64"
161
# define PJ_HAS_PENTIUM 1
162
# define PJ_IS_LITTLE_ENDIAN 1
163
# define PJ_IS_BIG_ENDIAN 0
165
#elif defined(PJ_M_IA64) || defined(__ia64__) || defined(_IA64) || \
166
defined(__IA64__) || defined( _M_IA64)
168
* Intel IA64 processor, little endian
172
# define PJ_M_NAME "ia64"
173
# define PJ_HAS_PENTIUM 1
174
# define PJ_IS_LITTLE_ENDIAN 1
175
# define PJ_IS_BIG_ENDIAN 0
177
#elif defined (PJ_M_M68K) && PJ_M_M68K != 0
180
* Motorola m68k processor, big endian
184
# define PJ_M_NAME "m68k"
185
# define PJ_HAS_PENTIUM 0
186
# define PJ_IS_LITTLE_ENDIAN 0
187
# define PJ_IS_BIG_ENDIAN 1
190
#elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \
193
* DEC Alpha processor, little endian
196
# define PJ_M_ALPHA 1
197
# define PJ_M_NAME "alpha"
198
# define PJ_HAS_PENTIUM 0
199
# define PJ_IS_LITTLE_ENDIAN 1
200
# define PJ_IS_BIG_ENDIAN 0
203
#elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \
204
defined(__MIPS__) || defined(MIPS) || defined(_MIPS_)
206
* MIPS, default to little endian
210
# define PJ_M_NAME "mips"
211
# define PJ_HAS_PENTIUM 0
212
# if !defined(PJ_IS_LITTLE_ENDIAN) && !defined(PJ_IS_BIG_ENDIAN)
213
# define PJ_IS_LITTLE_ENDIAN 1
214
# define PJ_IS_BIG_ENDIAN 0
218
#elif defined (PJ_M_SPARC) || defined( __sparc__) || defined(__sparc)
220
* Sun Sparc, big endian
223
# define PJ_M_SPARC 1
224
# define PJ_M_NAME "sparc"
225
# define PJ_HAS_PENTIUM 0
226
# define PJ_IS_LITTLE_ENDIAN 0
227
# define PJ_IS_BIG_ENDIAN 1
229
#elif defined (PJ_M_ARMV4) || defined(ARM) || defined(_ARM_) || \
230
defined(ARMV4) || defined(__arm__)
232
* ARM, default to little endian
235
# define PJ_M_ARMV4 1
236
# define PJ_M_NAME "armv4"
237
# define PJ_HAS_PENTIUM 0
238
# if !defined(PJ_IS_LITTLE_ENDIAN) && !defined(PJ_IS_BIG_ENDIAN)
239
# define PJ_IS_LITTLE_ENDIAN 1
240
# define PJ_IS_BIG_ENDIAN 0
243
#elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \
244
defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || \
247
* PowerPC, big endian
250
# define PJ_M_POWERPC 1
251
# define PJ_M_NAME "powerpc"
252
# define PJ_HAS_PENTIUM 0
253
# define PJ_IS_LITTLE_ENDIAN 0
254
# define PJ_IS_BIG_ENDIAN 1
256
#elif defined (PJ_M_NIOS2) || defined(__nios2) || defined(__nios2__) || \
257
defined(__NIOS2__) || defined(__M_NIOS2) || defined(_ARCH_NIOS2)
259
* Nios2, little endian
262
# define PJ_M_NIOS2 1
263
# define PJ_M_NAME "nios2"
264
# define PJ_HAS_PENTIUM 0
265
# define PJ_IS_LITTLE_ENDIAN 1
266
# define PJ_IS_BIG_ENDIAN 0
269
# error "Please specify target machine."
272
/* Include size_t definition. */
273
#include <pj/compat/size_t.h>
275
/* Include site/user specific configuration to control PJLIB features.
276
* YOU MUST CREATE THIS FILE YOURSELF!!
278
#include <pj/config_site.h>
280
/********************************************************************
284
/* Overrides for DOXYGEN */
286
# undef PJ_FUNCTIONS_ARE_INLINED
287
# undef PJ_HAS_FLOATING_POINT
288
# undef PJ_LOG_MAX_LEVEL
289
# undef PJ_LOG_MAX_SIZE
290
# undef PJ_LOG_USE_STACK_BUFFER
291
# undef PJ_TERM_HAS_COLOR
292
# undef PJ_POOL_DEBUG
294
# undef PJ_MAX_HOSTNAME
295
# undef PJ_IOQUEUE_MAX_HANDLES
297
# undef PJ_HAS_SEMAPHORE
298
# undef PJ_HAS_EVENT_OBJ
299
# undef PJ_ENABLE_EXTRA_CHECK
300
# undef PJ_EXCEPTION_USE_WIN32_SEH
301
# undef PJ_HAS_ERROR_STRING
303
# define PJ_HAS_IPV6 1
307
* @defgroup pj_config Build Configuration
310
* This section contains macros that can set during PJLIB build process
311
* to controll various aspects of the library.
313
* <b>Note</b>: the values in this page does NOT necessarily reflect to the
314
* macro values during the build process.
318
* If this macro is set to 1, it will enable some debugging checking
321
* Default: equal to (NOT NDEBUG).
332
* Enable this macro to activate logging to mutex/semaphore related events.
333
* This is useful to troubleshoot concurrency problems such as deadlocks.
334
* In addition, you should also add PJ_LOG_HAS_THREAD_ID flag to the
335
* log decoration to assist the troubleshooting.
339
#ifndef PJ_DEBUG_MUTEX
340
# define PJ_DEBUG_MUTEX 0
344
* Expand functions in *_i.h header files as inline.
348
#ifndef PJ_FUNCTIONS_ARE_INLINED
349
# define PJ_FUNCTIONS_ARE_INLINED 0
353
* Use floating point computations in the library.
357
#ifndef PJ_HAS_FLOATING_POINT
358
# define PJ_HAS_FLOATING_POINT 1
362
* Declare maximum logging level/verbosity. Lower number indicates higher
363
* importance, with the highest importance has level zero. The least
364
* important level is five in this implementation, but this can be extended
365
* by supplying the appropriate implementation.
367
* The level conventions:
374
* - 6: more detailed trace
378
#ifndef PJ_LOG_MAX_LEVEL
379
# define PJ_LOG_MAX_LEVEL 5
383
* Maximum message size that can be sent to output device for each call
384
* to PJ_LOG(). If the message size is longer than this value, it will be cut.
385
* This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER
390
#ifndef PJ_LOG_MAX_SIZE
391
# define PJ_LOG_MAX_SIZE 4000
396
* Does the log get the buffer from the stack? (default is yes).
397
* If the value is set to NO, then the buffer will be taken from static
398
* buffer, which in this case will make the log function non-reentrant.
402
#ifndef PJ_LOG_USE_STACK_BUFFER
403
# define PJ_LOG_USE_STACK_BUFFER 1
408
* Colorfull terminal (for logging etc).
412
#ifndef PJ_TERM_HAS_COLOR
413
# define PJ_TERM_HAS_COLOR 1
418
* Set this flag to non-zero to enable various checking for pool
419
* operations. When this flag is set, assertion must be enabled
420
* in the application.
422
* This will slow down pool creation and destruction and will add
423
* few bytes of overhead, so application would normally want to
424
* disable this feature on release build.
429
# define PJ_SAFE_POOL 0
434
* If pool debugging is used, then each memory allocation from the pool
435
* will call malloc(), and pool will release all memory chunks when it
436
* is destroyed. This works better when memory verification programs
437
* such as Rational Purify is used.
441
#ifndef PJ_POOL_DEBUG
442
# define PJ_POOL_DEBUG 0
447
* Specify this as \a stack_size argument in #pj_thread_create() to specify
448
* that thread should use default stack size for the current platform.
452
#ifndef PJ_THREAD_DEFAULT_STACK_SIZE
453
# define PJ_THREAD_DEFAULT_STACK_SIZE 8192
458
* Specify if PJ_CHECK_STACK() macro is enabled to check the sanity of
459
* the stack. The OS implementation may check that no stack overflow
460
* occurs, and it also may collect statistic about stack usage. Note
461
* that this will increase the footprint of the libraries since it
462
* tracks the filename and line number of each functions.
464
#ifndef PJ_OS_HAS_CHECK_STACK
465
# define PJ_OS_HAS_CHECK_STACK 0
469
* Do we have alternate pool implementation?
473
#ifndef PJ_HAS_POOL_ALT_API
474
# define PJ_HAS_POOL_ALT_API PJ_POOL_DEBUG
479
* Support TCP in the library.
480
* Disabling TCP will reduce the footprint slightly (about 6KB).
485
# define PJ_HAS_TCP 1
489
* Support IPv6 in the library. If this support is disabled, some IPv6
490
* related functions will return PJ_EIPV6NOTSUP.
492
* Default: 0 (disabled, for now)
495
# define PJ_HAS_IPV6 0
499
* Maximum hostname length.
500
* Libraries sometimes needs to make copy of an address to stack buffer;
501
* the value here affects the stack usage.
505
#ifndef PJ_MAX_HOSTNAME
506
# define PJ_MAX_HOSTNAME (128)
510
* Maximum consecutive identical error for accept() operation before
511
* activesock stops calling the next ioqueue accept.
515
#ifndef PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR
516
# define PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR 50
520
* Constants for declaring the maximum handles that can be supported by
521
* a single IOQ framework. This constant might not be relevant to the
522
* underlying I/O queue impelementation, but still, developers should be
523
* aware of this constant, to make sure that the program will not break when
524
* the underlying implementation changes.
526
#ifndef PJ_IOQUEUE_MAX_HANDLES
527
# define PJ_IOQUEUE_MAX_HANDLES (64)
532
* If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more
533
* things to ensure thread safety of handle unregistration operation by
534
* employing reference counter to each handle.
536
* In addition, the ioqueue will preallocate memory for the handles,
537
* according to the maximum number of handles that is specified during
540
* All applications would normally want this enabled, but you may disable
542
* - there is no dynamic unregistration to all ioqueues.
543
* - there is no threading, or there is no preemptive multitasking.
547
#ifndef PJ_IOQUEUE_HAS_SAFE_UNREG
548
# define PJ_IOQUEUE_HAS_SAFE_UNREG 1
553
* Default concurrency setting for sockets/handles registered to ioqueue.
554
* This controls whether the ioqueue is allowed to call the key's callback
555
* concurrently/in parallel. The default is yes, which means that if there
556
* are more than one pending operations complete simultaneously, more
557
* than one threads may call the key's callback at the same time. This
558
* generally would promote good scalability for application, at the
559
* expense of more complexity to manage the concurrent accesses.
561
* Please see the ioqueue documentation for more info.
563
#ifndef PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY
564
# define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY 1
569
* if ioqueue concurrency is disallowed, PJ_IOQUEUE_HAS_SAFE_UNREG
572
#if (PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY==0) && (PJ_IOQUEUE_HAS_SAFE_UNREG==0)
573
# error PJ_IOQUEUE_HAS_SAFE_UNREG must be enabled if ioqueue concurrency \
579
* When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in
580
* ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the
581
* ioqueue key is kept in closing state before it can be reused.
583
* The value is in miliseconds.
587
#ifndef PJ_IOQUEUE_KEY_FREE_DELAY
588
# define PJ_IOQUEUE_KEY_FREE_DELAY 500
593
* Determine if FD_SETSIZE is changeable/set-able. If so, then we will
594
* set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking
597
#ifndef PJ_FD_SETSIZE_SETABLE
598
# if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \
599
(defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0)
600
# define PJ_FD_SETSIZE_SETABLE 1
602
# define PJ_FD_SETSIZE_SETABLE 0
607
* Overrides FD_SETSIZE so it is consistent throughout the library.
608
* We only do this if we detected that FD_SETSIZE is changeable. If
609
* FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be
610
* set to value lower than FD_SETSIZE.
612
#if PJ_FD_SETSIZE_SETABLE
613
/* Only override FD_SETSIZE if the value has not been set */
615
# define FD_SETSIZE PJ_IOQUEUE_MAX_HANDLES
618
/* When FD_SETSIZE is not changeable, check if PJ_IOQUEUE_MAX_HANDLES
619
* is lower than FD_SETSIZE value.
622
# if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE
623
# error "PJ_IOQUEUE_MAX_HANDLES is greater than FD_SETSIZE"
630
* Specify whether #pj_enum_ip_interface() function should exclude
631
* loopback interfaces.
635
#ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF
636
# define PJ_IP_HELPER_IGNORE_LOOPBACK_IF 1
641
* Has semaphore functionality?
645
#ifndef PJ_HAS_SEMAPHORE
646
# define PJ_HAS_SEMAPHORE 1
651
* Event object (for synchronization, e.g. in Win32)
655
#ifndef PJ_HAS_EVENT_OBJ
656
# define PJ_HAS_EVENT_OBJ 1
661
* Maximum file name length.
664
# define PJ_MAXPATH 260
669
* Enable library's extra check.
670
* If this macro is enabled, #PJ_ASSERT_RETURN macro will expand to
671
* run-time checking. If this macro is disabled, #PJ_ASSERT_RETURN
672
* will simply evaluate to #pj_assert().
674
* You can disable this macro to reduce size, at the risk of crashes
675
* if invalid value (e.g. NULL) is passed to the library.
679
#ifndef PJ_ENABLE_EXTRA_CHECK
680
# define PJ_ENABLE_EXTRA_CHECK 1
685
* Enable name registration for exceptions with #pj_exception_id_alloc().
686
* If this feature is enabled, then the library will keep track of
687
* names associated with each exception ID requested by application via
688
* #pj_exception_id_alloc().
690
* Disabling this macro will reduce the code and .bss size by a tad bit.
691
* See also #PJ_MAX_EXCEPTION_ID.
695
#ifndef PJ_HAS_EXCEPTION_NAMES
696
# define PJ_HAS_EXCEPTION_NAMES 1
700
* Maximum number of unique exception IDs that can be requested
701
* with #pj_exception_id_alloc(). For each entry, a small record will
702
* be allocated in the .bss segment.
706
#ifndef PJ_MAX_EXCEPTION_ID
707
# define PJ_MAX_EXCEPTION_ID 16
711
* Should we use Windows Structured Exception Handling (SEH) for the
716
#ifndef PJ_EXCEPTION_USE_WIN32_SEH
717
# define PJ_EXCEPTION_USE_WIN32_SEH 0
721
* Should we attempt to use Pentium's rdtsc for high resolution
726
#ifndef PJ_TIMESTAMP_USE_RDTSC
727
# define PJ_TIMESTAMP_USE_RDTSC 0
731
* Is native platform error positive number?
734
#ifndef PJ_NATIVE_ERR_POSITIVE
735
# define PJ_NATIVE_ERR_POSITIVE 1
739
* Include error message string in the library (pj_strerror()).
740
* This is very much desirable!
744
#ifndef PJ_HAS_ERROR_STRING
745
# define PJ_HAS_ERROR_STRING 1
750
* Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom
751
* functions to compare alnum strings. On some systems, they're faster
752
* then stricmp/strcasecmp, but they can be slower on other systems.
753
* When disabled, pjlib will fallback to stricmp/strnicmp.
757
#ifndef PJ_HAS_STRICMP_ALNUM
758
# define PJ_HAS_STRICMP_ALNUM 0
763
* Types of QoS backend implementation.
767
* Dummy QoS backend implementation, will always return error on all
770
#define PJ_QOS_DUMMY 1
772
/** QoS backend based on setsockopt(IP_TOS) */
775
/** QoS backend for Windows Mobile 6 */
778
/** QoS backend for Symbian */
779
#define PJ_QOS_SYMBIAN 4
782
* Force the use of some QoS backend API for some platforms.
784
#ifndef PJ_QOS_IMPLEMENTATION
785
# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE && _WIN32_WCE >= 0x502
786
/* Windows Mobile 6 or later */
787
# define PJ_QOS_IMPLEMENTATION PJ_QOS_WM
793
* Enable secure socket. For most platforms, this is implemented using
794
* OpenSSL, so this will require OpenSSL to be installed. For Symbian
795
* platform, this is implemented natively using CSecureSocket.
797
* Default: 0 (for now)
799
#ifndef PJ_HAS_SSL_SOCK
800
# define PJ_HAS_SSL_SOCK 0
805
* Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See
806
* https://trac.pjsip.org/repos/ticket/1197.
810
#ifndef PJ_SOCK_DISABLE_WSAECONNRESET
811
# define PJ_SOCK_DISABLE_WSAECONNRESET 1
817
/********************************************************************
822
* @defgroup pj_dll_target Building Dynamic Link Libraries (DLL/DSO)
826
* The libraries support generation of dynamic link libraries for
827
* Symbian ABIv2 target (.dso/Dynamic Shared Object files, in Symbian
828
* terms). Similar procedures may be applied for Win32 DLL with some
831
* Depending on the platforms, these steps may be necessary in order to
832
* produce the dynamic libraries:
833
* - Create the (Visual Studio) projects to produce DLL output. PJLIB
834
* does not provide ready to use project files to produce DLL, so
835
* you need to create these projects yourself. For Symbian, the MMP
836
* files have been setup to produce DSO files for targets that
838
* - In the (Visual Studio) projects, some macros need to be declared
839
* so that appropriate modifiers are added to symbol declarations
840
* and definitions. Please see the macro section below for information
841
* regarding these macros. For Symbian, these have been taken care by the
843
* - Some build systems require .DEF file to be specified when creating
844
* the DLL. For Symbian, .DEF files are included in pjlib distribution,
845
* in <tt>pjlib/build.symbian</tt> directory. These DEF files are
846
* created by running <tt>./makedef.sh all</tt> from this directory,
849
* Macros related for building DLL/DSO files:
850
* - For platforms that supports dynamic link libraries generation,
851
* it must declare <tt>PJ_EXPORT_SPECIFIER</tt> macro which value contains
852
* the prefix to be added to symbol definition, to export this
853
* symbol in the DLL/DSO. For example, on Win32/Visual Studio, the
854
* value of this macro is \a __declspec(dllexport), and for ARM
855
* ABIv2/Symbian, the value is \a EXPORT_C.
856
* - For platforms that supports linking with dynamic link libraries,
857
* it must declare <tt>PJ_IMPORT_SPECIFIER</tt> macro which value contains
858
* the prefix to be added to symbol declaration, to import this
859
* symbol from a DLL/DSO. For example, on Win32/Visual Studio, the
860
* value of this macro is \a __declspec(dllimport), and for ARM
861
* ABIv2/Symbian, the value is \a IMPORT_C.
862
* - Both <tt>PJ_EXPORT_SPECIFIER</tt> and <tt>PJ_IMPORT_SPECIFIER</tt>
863
* macros above can be declared in your \a config_site.h if they are not
865
* - When PJLIB is built as DLL/DSO, both <tt>PJ_DLL</tt> and
866
* <tt>PJ_EXPORTING</tt> macros must be declared, so that
867
* <tt>PJ_EXPORT_SPECIFIER</tt> modifier will be added into function
869
* - When application wants to link dynamically with PJLIB, then it
870
* must declare <tt>PJ_DLL</tt> macro when using/including PJLIB header,
871
* so that <tt>PJ_IMPORT_SPECIFIER</tt> modifier is properly added into
872
* symbol declarations.
874
* When <b>PJ_DLL</b> macro is not declared, static linking is assumed.
876
* For example, here are some settings to produce DLLs with Visual Studio
878
* - Create Visual Studio projects to produce DLL. Add the appropriate
879
* project dependencies to avoid link errors.
880
* - In the projects, declare <tt>PJ_DLL</tt> and <tt>PJ_EXPORTING</tt>
882
* - Declare these macros in your <tt>config_site.h</tt>:
884
#define PJ_EXPORT_SPECIFIER __declspec(dllexport)
885
#define PJ_IMPORT_SPECIFIER __declspec(dllimport)
887
* - And in the application (that links with the DLL) project, add
888
* <tt>PJ_DLL</tt> in the macro declarations.
894
* @defgroup pj_config Build Configuration
899
* @def PJ_INLINE(type)
900
* @param type The return type of the function.
901
* Expand the function as inline.
903
#define PJ_INLINE(type) PJ_INLINE_SPECIFIER type
906
* This macro declares platform/compiler specific specifier prefix
907
* to be added to symbol declaration to export the symbol when PJLIB
908
* is built as dynamic library.
910
* This macro should have been added by platform specific headers,
911
* if the platform supports building dynamic library target.
913
#ifndef PJ_EXPORT_DECL_SPECIFIER
914
# define PJ_EXPORT_DECL_SPECIFIER
919
* This macro declares platform/compiler specific specifier prefix
920
* to be added to symbol definition to export the symbol when PJLIB
921
* is built as dynamic library.
923
* This macro should have been added by platform specific headers,
924
* if the platform supports building dynamic library target.
926
#ifndef PJ_EXPORT_DEF_SPECIFIER
927
# define PJ_EXPORT_DEF_SPECIFIER
932
* This macro declares platform/compiler specific specifier prefix
933
* to be added to symbol declaration to import the symbol.
935
* This macro should have been added by platform specific headers,
936
* if the platform supports building dynamic library target.
938
#ifndef PJ_IMPORT_DECL_SPECIFIER
939
# define PJ_IMPORT_DECL_SPECIFIER
944
* This macro has been deprecated. It will evaluate to nothing.
946
#ifndef PJ_EXPORT_SYMBOL
947
# define PJ_EXPORT_SYMBOL(x)
953
* @param type The return type of the function.
954
* Declare a function.
957
# if defined(PJ_EXPORTING)
958
# define PJ_DECL(type) PJ_EXPORT_DECL_SPECIFIER type
960
# define PJ_DECL(type) PJ_IMPORT_DECL_SPECIFIER type
962
#elif !defined(PJ_DECL)
963
# if defined(__cplusplus)
964
# define PJ_DECL(type) type
966
# define PJ_DECL(type) extern type
973
* @param type The return type of the function.
976
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
977
# define PJ_DEF(type) PJ_EXPORT_DEF_SPECIFIER type
978
#elif !defined(PJ_DEF)
979
# define PJ_DEF(type) type
984
* @def PJ_DECL_NO_RETURN(type)
985
* @param type The return type of the function.
986
* Declare a function that will not return.
989
* @def PJ_IDECL_NO_RETURN(type)
990
* @param type The return type of the function.
991
* Declare an inline function that will not return.
995
* Mark beginning of declaration section in a header file.
999
* Mark end of declaration section in a header file.
1002
# define PJ_DECL_NO_RETURN(type) PJ_DECL(type) PJ_NORETURN
1003
# define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN
1004
# define PJ_BEGIN_DECL extern "C" {
1005
# define PJ_END_DECL }
1007
# define PJ_DECL_NO_RETURN(type) PJ_NORETURN PJ_DECL(type)
1008
# define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type)
1009
# define PJ_BEGIN_DECL
1010
# define PJ_END_DECL
1016
* @def PJ_DECL_DATA(type)
1017
* @param type The data type.
1018
* Declare a global data.
1021
# if defined(PJ_EXPORTING)
1022
# define PJ_DECL_DATA(type) PJ_EXPORT_DECL_SPECIFIER extern type
1024
# define PJ_DECL_DATA(type) PJ_IMPORT_DECL_SPECIFIER extern type
1026
#elif !defined(PJ_DECL_DATA)
1027
# define PJ_DECL_DATA(type) extern type
1032
* @def PJ_DEF_DATA(type)
1033
* @param type The data type.
1034
* Define a global data.
1036
#if defined(PJ_DLL) && defined(PJ_EXPORTING)
1037
# define PJ_DEF_DATA(type) PJ_EXPORT_DEF_SPECIFIER type
1038
#elif !defined(PJ_DEF_DATA)
1039
# define PJ_DEF_DATA(type) type
1044
* @def PJ_IDECL(type)
1045
* @param type The function's return type.
1046
* Declare a function that may be expanded as inline.
1049
* @def PJ_IDEF(type)
1050
* @param type The function's return type.
1051
* Define a function that may be expanded as inline.
1054
#if PJ_FUNCTIONS_ARE_INLINED
1055
# define PJ_IDECL(type) PJ_INLINE(type)
1056
# define PJ_IDEF(type) PJ_INLINE(type)
1058
# define PJ_IDECL(type) PJ_DECL(type)
1059
# define PJ_IDEF(type) PJ_DEF(type)
1064
* @def PJ_UNUSED_ARG(arg)
1065
* @param arg The argument name.
1066
* PJ_UNUSED_ARG prevents warning about unused argument in a function.
1068
#define PJ_UNUSED_ARG(arg) (void)arg
1072
* @param id Any identifier that will be printed as TODO message.
1073
* PJ_TODO macro will display TODO message as warning during compilation.
1074
* Example: PJ_TODO(CLEAN_UP_ERROR);
1077
# define PJ_TODO(id) TODO___##id:
1081
* Function attributes to inform that the function may throw exception.
1083
* @param x The exception list, enclosed in parenthesis.
1085
#define __pj_throw__(x)
1089
/********************************************************************
1092
#ifndef PJ_HAS_HIGH_RES_TIMER
1093
# error "PJ_HAS_HIGH_RES_TIMER is not defined!"
1096
#if !defined(PJ_HAS_PENTIUM)
1097
# error "PJ_HAS_PENTIUM is not defined!"
1100
#if !defined(PJ_IS_LITTLE_ENDIAN)
1101
# error "PJ_IS_LITTLE_ENDIAN is not defined!"
1104
#if !defined(PJ_IS_BIG_ENDIAN)
1105
# error "PJ_IS_BIG_ENDIAN is not defined!"
1108
#if !defined(PJ_EMULATE_RWMUTEX)
1109
# error "PJ_EMULATE_RWMUTEX should be defined in compat/os_xx.h"
1112
#if !defined(PJ_THREAD_SET_STACK_SIZE)
1113
# error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h"
1116
#if !defined(PJ_THREAD_ALLOCATE_STACK)
1117
# error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h"
1122
/** PJLIB version major number. */
1123
#define PJ_VERSION_NUM_MAJOR 1
1125
/** PJLIB version minor number. */
1126
#define PJ_VERSION_NUM_MINOR 10
1128
/** PJLIB version revision number. */
1129
#define PJ_VERSION_NUM_REV 0
1132
* Extra suffix for the version (e.g. "-trunk"), or empty for
1133
* web release version.
1135
#define PJ_VERSION_NUM_EXTRA ""
1138
* PJLIB version number consists of three bytes with the following format:
1139
* 0xMMIIRR00, where MM: major number, II: minor number, RR: revision
1140
* number, 00: always zero for now.
1142
#define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \
1143
(PJ_VERSION_NUM_MINOR << 16) | \
1144
(PJ_VERSION_NUM_REV << 8))
1147
* PJLIB version string constant. @see pj_get_version()
1149
PJ_DECL_DATA(const char*) PJ_VERSION;
1152
* Get PJLIB version string.
1154
* @return #PJ_VERSION constant.
1156
PJ_DECL(const char*) pj_get_version(void);
1159
* Dump configuration to log with verbosity equal to info(3).
1161
PJ_DECL(void) pj_dump_config(void);
1166
#endif /* __PJ_CONFIG_H__ */