This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
msgrcv: properly downgrade the receive buffer
[perl5.git] / perl_inc_macro.h
CommitLineData
7d00a340
N
1/* just define a list of macros to push elements in INC
2* so we can easily use them and change order on demand
3*
4* list of available INCPUSH macros
5* - INCPUSH_APPLLIB_EXP
6* - INCPUSH_SITEARCH_EXP
7* - INCPUSH_SITELIB_EXP
8* - INCPUSH_PERL_VENDORARCH_EXP
9* - INCPUSH_PERL_VENDORLIB_EXP
10* - INCPUSH_ARCHLIB_EXP
11* - INCPUSH_PRIVLIB_EXP
12* - INCPUSH_PERL_OTHERLIBDIRS
13* - INCPUSH_PERL5LIB
14* - INCPUSH_APPLLIB_OLD_EXP
15* - INCPUSH_SITELIB_STEM
16* - INCPUSH_PERL_VENDORLIB_STEM
17* - INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
18*/
19
20#ifndef DEFINE_INC_MACROS
21
22/* protect against multiple inclusions */
23#define DEFINE_INC_MACROS 1
24
25#ifdef APPLLIB_EXP
26# define INCPUSH_APPLLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \
27 INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
28#endif
29
30#ifdef SITEARCH_EXP
31 /* sitearch is always relative to sitelib on Windows for
32 * DLL-based path intuition to work correctly */
33# if !defined(WIN32)
34# define INCPUSH_SITEARCH_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITEARCH_EXP), \
35 INCPUSH_CAN_RELOCATE);
36# endif
37#endif
38
39#ifdef SITELIB_EXP
40# if defined(WIN32)
41 /* this picks up sitearch as well */
42# define INCPUSH_SITELIB_EXP s = PerlEnv_sitelib_path(PERL_FS_VERSION, &len); \
43 if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
44# else
45# define INCPUSH_SITELIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_EXP), \
46 INCPUSH_CAN_RELOCATE);
47# endif
48#endif
49
50#ifdef PERL_VENDORARCH_EXP
51 /* vendorarch is always relative to vendorlib on Windows for
52 * DLL-based path intuition to work correctly */
53# if !defined(WIN32)
54# define INCPUSH_PERL_VENDORARCH_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORARCH_EXP), INCPUSH_CAN_RELOCATE);
55# endif
56#endif
57
58#ifdef PERL_VENDORLIB_EXP
59# if defined(WIN32)
60 /* this picks up vendorarch as well */
61# define INCPUSH_PERL_VENDORLIB_EXP s = PerlEnv_vendorlib_path(PERL_FS_VERSION, &len); \
62 if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
63# else
64# define INCPUSH_PERL_VENDORLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_EXP), INCPUSH_CAN_RELOCATE);
65# endif
66#endif
67
68#ifdef ARCHLIB_EXP
69# define INCPUSH_ARCHLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(ARCHLIB_EXP), INCPUSH_CAN_RELOCATE);
70#endif
71
72/* used by INCPUSH_PRIVLIB_EXP */
73#ifndef PRIVLIB_EXP
74# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
75#endif
76
77#if defined(WIN32)
78# define INCPUSH_PRIVLIB_EXP s = PerlEnv_lib_path(PERL_FS_VERSION, &len); \
79 if (s) incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
80#elif defined(NETWARE)
81# define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ PRIVLIB_EXP, 0, INCPUSH_CAN_RELOCATE);
82#else
83# define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PRIVLIB_EXP), INCPUSH_CAN_RELOCATE);
84#endif
85
86#ifdef PERL_OTHERLIBDIRS
87# define INCPUSH_PERL_OTHERLIBDIRS S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
88 INCPUSH_ADD_VERSIONED_SUB_DIRS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE);
89#endif
90
91
92/* submacros for INCPUSH_PERL5LIB */
93
94#if defined(PERL_USE_SAFE_PUTENV) && ! defined(HAS_UNSETENV)
95# define _INCPUSH_PERL5LIB_IF if (perl5lib && *perl5lib != '\0')
96#else
97# define _INCPUSH_PERL5LIB_IF if (perl5lib)
98#endif
99
100#ifndef VMS
101/*
102 * It isn't possible to delete an environment variable with
103 * PERL_USE_SAFE_PUTENV set unless unsetenv() is also available, so in that
104 * case we treat PERL5LIB as undefined if it has a zero-length value.
105 */
106# define _INCPUSH_PERL5LIB_ADD _INCPUSH_PERL5LIB_IF incpush_use_sep(perl5lib, 0, INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR);
107#else
108/* VMS */
109 /* Treat PERL5?LIB as a possible search list logical name -- the
110 * "natural" VMS idiom for a Unix path string. We allow each
111 * element to be a set of |-separated directories for compatibility.
112 */
113# define _INCPUSH_PERL5LIB_ADD char buf[256]; \
114 int idx = 0; \
115 if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \
116 do { \
117 incpush_use_sep(buf, 0, \
118 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \
119 } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0));
120#endif
121
122/* this macro is special and use submacros from above */
123#define INCPUSH_PERL5LIB if (!TAINTING_get) { _INCPUSH_PERL5LIB_ADD }
124
125/* Use the ~-expanded versions of APPLLIB (undocumented),
126 SITELIB and VENDORLIB for older versions
127*/
128#ifdef APPLLIB_EXP
129# define INCPUSH_APPLLIB_OLD_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \
130 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE);
131#endif
132
133#if defined(SITELIB_STEM) && defined(PERL_INC_VERSION_LIST)
134 /* Search for version-specific dirs below here */
135# define INCPUSH_SITELIB_STEM S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_STEM), \
136 INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
137#endif
138
139
140#if defined(PERL_VENDORLIB_STEM) && defined(PERL_INC_VERSION_LIST)
141 /* Search for version-specific dirs below here */
142# define INCPUSH_PERL_VENDORLIB_STEM S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_STEM), \
143 INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
144#endif
145
146#ifdef PERL_OTHERLIBDIRS
147# define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
148 INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE);
149#endif
150
151
152/* define all undefined macros... */
153#ifndef INCPUSH_APPLLIB_EXP
154#define INCPUSH_APPLLIB_EXP
155#endif
156#ifndef INCPUSH_SITEARCH_EXP
157#define INCPUSH_SITEARCH_EXP
158#endif
159#ifndef INCPUSH_SITELIB_EXP
160#define INCPUSH_SITELIB_EXP
161#endif
162#ifndef INCPUSH_PERL_VENDORARCH_EXP
163#define INCPUSH_PERL_VENDORARCH_EXP
164#endif
165#ifndef INCPUSH_PERL_VENDORLIB_EXP
166#define INCPUSH_PERL_VENDORLIB_EXP
167#endif
ea5f21e3
SH
168#ifndef INCPUSH_ARCHLIB_EXP
169#define INCPUSH_ARCHLIB_EXP
170#endif
7d00a340
N
171#ifndef INCPUSH_PRIVLIB_EXP
172#define INCPUSH_PRIVLIB_EXP
173#endif
174#ifndef INCPUSH_PERL_OTHERLIBDIRS
175#define INCPUSH_PERL_OTHERLIBDIRS
176#endif
177#ifndef INCPUSH_PERL5LIB
178#define INCPUSH_PERL5LIB
179#endif
180#ifndef INCPUSH_APPLLIB_OLD_EXP
181#define INCPUSH_APPLLIB_OLD_EXP
182#endif
183#ifndef INCPUSH_SITELIB_STEM
184#define INCPUSH_SITELIB_STEM
185#endif
186#ifndef INCPUSH_PERL_VENDORLIB_STEM
187#define INCPUSH_PERL_VENDORLIB_STEM
188#endif
189#ifndef INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
190#define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
191#endif
192
ea5f21e3 193#endif /* DEFINE_INC_MACROS */