1 /* just define a list of macros to push elements in INC
2 * so we can easily use them and change order on demand
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
14 * - INCPUSH_APPLLIB_OLD_EXP
15 * - INCPUSH_SITELIB_STEM
16 * - INCPUSH_PERL_VENDORLIB_STEM
17 * - INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
20 #ifndef DEFINE_INC_MACROS
22 /* protect against multiple inclusions */
23 #define DEFINE_INC_MACROS 1
26 # define INCPUSH_APPLLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \
27 INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
31 /* sitearch is always relative to sitelib on Windows for
32 * DLL-based path intuition to work correctly */
34 # define INCPUSH_SITEARCH_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITEARCH_EXP), \
35 INCPUSH_CAN_RELOCATE);
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);
45 # define INCPUSH_SITELIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_EXP), \
46 INCPUSH_CAN_RELOCATE);
50 #ifdef PERL_VENDORARCH_EXP
51 /* vendorarch is always relative to vendorlib on Windows for
52 * DLL-based path intuition to work correctly */
54 # define INCPUSH_PERL_VENDORARCH_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORARCH_EXP), INCPUSH_CAN_RELOCATE);
58 #ifdef PERL_VENDORLIB_EXP
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);
64 # define INCPUSH_PERL_VENDORLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_EXP), INCPUSH_CAN_RELOCATE);
69 # define INCPUSH_ARCHLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(ARCHLIB_EXP), INCPUSH_CAN_RELOCATE);
72 /* used by INCPUSH_PRIVLIB_EXP */
74 # define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
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);
81 # define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PRIVLIB_EXP), INCPUSH_CAN_RELOCATE);
84 #ifdef PERL_OTHERLIBDIRS
85 # define INCPUSH_PERL_OTHERLIBDIRS S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
86 INCPUSH_ADD_VERSIONED_SUB_DIRS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE);
90 /* submacros for INCPUSH_PERL5LIB */
92 #define _INCPUSH_PERL5LIB_IF if (perl5lib && *perl5lib != '\0')
95 # define _INCPUSH_PERL5LIB_ADD _INCPUSH_PERL5LIB_IF incpush_use_sep(perl5lib, 0, INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR);
98 /* Treat PERL5?LIB as a possible search list logical name -- the
99 * "natural" VMS idiom for a Unix path string. We allow each
100 * element to be a set of |-separated directories for compatibility.
102 # define _INCPUSH_PERL5LIB_ADD char buf[256]; \
104 if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \
106 incpush_use_sep(buf, 0, \
107 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \
108 } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0));
111 /* this macro is special and use submacros from above */
112 #define INCPUSH_PERL5LIB if (!TAINTING_get) { _INCPUSH_PERL5LIB_ADD }
114 /* Use the ~-expanded versions of APPLLIB (undocumented),
115 SITELIB and VENDORLIB for older versions
118 # define INCPUSH_APPLLIB_OLD_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(APPLLIB_EXP), \
119 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR|INCPUSH_CAN_RELOCATE);
122 #if defined(SITELIB_STEM) && defined(PERL_INC_VERSION_LIST)
123 /* Search for version-specific dirs below here */
124 # define INCPUSH_SITELIB_STEM S_incpush_use_sep(aTHX_ STR_WITH_LEN(SITELIB_STEM), \
125 INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
129 #if defined(PERL_VENDORLIB_STEM) && defined(PERL_INC_VERSION_LIST)
130 /* Search for version-specific dirs below here */
131 # define INCPUSH_PERL_VENDORLIB_STEM S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_VENDORLIB_STEM), \
132 INCPUSH_ADD_OLD_VERS|INCPUSH_CAN_RELOCATE);
135 #ifdef PERL_OTHERLIBDIRS
136 # define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY S_incpush_use_sep(aTHX_ STR_WITH_LEN(PERL_OTHERLIBDIRS), \
137 INCPUSH_ADD_OLD_VERS|INCPUSH_ADD_ARCHONLY_SUB_DIRS|INCPUSH_CAN_RELOCATE);
141 /* define all undefined macros... */
142 #ifndef INCPUSH_APPLLIB_EXP
143 #define INCPUSH_APPLLIB_EXP
145 #ifndef INCPUSH_SITEARCH_EXP
146 #define INCPUSH_SITEARCH_EXP
148 #ifndef INCPUSH_SITELIB_EXP
149 #define INCPUSH_SITELIB_EXP
151 #ifndef INCPUSH_PERL_VENDORARCH_EXP
152 #define INCPUSH_PERL_VENDORARCH_EXP
154 #ifndef INCPUSH_PERL_VENDORLIB_EXP
155 #define INCPUSH_PERL_VENDORLIB_EXP
157 #ifndef INCPUSH_ARCHLIB_EXP
158 #define INCPUSH_ARCHLIB_EXP
160 #ifndef INCPUSH_PRIVLIB_EXP
161 #define INCPUSH_PRIVLIB_EXP
163 #ifndef INCPUSH_PERL_OTHERLIBDIRS
164 #define INCPUSH_PERL_OTHERLIBDIRS
166 #ifndef INCPUSH_PERL5LIB
167 #define INCPUSH_PERL5LIB
169 #ifndef INCPUSH_APPLLIB_OLD_EXP
170 #define INCPUSH_APPLLIB_OLD_EXP
172 #ifndef INCPUSH_SITELIB_STEM
173 #define INCPUSH_SITELIB_STEM
175 #ifndef INCPUSH_PERL_VENDORLIB_STEM
176 #define INCPUSH_PERL_VENDORLIB_STEM
178 #ifndef INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
179 #define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
182 #endif /* DEFINE_INC_MACROS */