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);
80 #elif defined(NETWARE)
81 # define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ PRIVLIB_EXP, 0, INCPUSH_CAN_RELOCATE);
83 # define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PRIVLIB_EXP), INCPUSH_CAN_RELOCATE);
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);
92 /* submacros for INCPUSH_PERL5LIB */
94 #if defined(PERL_USE_SAFE_PUTENV) && ! defined(HAS_UNSETENV)
95 # define _INCPUSH_PERL5LIB_IF if (perl5lib && *perl5lib != '\0')
97 # define _INCPUSH_PERL5LIB_IF if (perl5lib)
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.
106 # define _INCPUSH_PERL5LIB_ADD _INCPUSH_PERL5LIB_IF incpush_use_sep(perl5lib, 0, INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR);
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.
113 # define _INCPUSH_PERL5LIB_ADD char buf[256]; \
115 if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \
117 incpush_use_sep(buf, 0, \
118 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \
119 } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0));
122 /* this macro is special and use submacros from above */
123 #define INCPUSH_PERL5LIB if (!TAINTING_get) { _INCPUSH_PERL5LIB_ADD }
125 /* Use the ~-expanded versions of APPLLIB (undocumented),
126 SITELIB and VENDORLIB for older versions
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);
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);
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);
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);
152 /* define all undefined macros... */
153 #ifndef INCPUSH_APPLLIB_EXP
154 #define INCPUSH_APPLLIB_EXP
156 #ifndef INCPUSH_SITEARCH_EXP
157 #define INCPUSH_SITEARCH_EXP
159 #ifndef INCPUSH_SITELIB_EXP
160 #define INCPUSH_SITELIB_EXP
162 #ifndef INCPUSH_PERL_VENDORARCH_EXP
163 #define INCPUSH_PERL_VENDORARCH_EXP
165 #ifndef INCPUSH_PERL_VENDORLIB_EXP
166 #define INCPUSH_PERL_VENDORLIB_EXP
168 #ifndef INCPUSH_PRIVLIB_EXP
169 #define INCPUSH_PRIVLIB_EXP
171 #ifndef INCPUSH_PERL_OTHERLIBDIRS
172 #define INCPUSH_PERL_OTHERLIBDIRS
174 #ifndef INCPUSH_PERL5LIB
175 #define INCPUSH_PERL5LIB
177 #ifndef INCPUSH_APPLLIB_OLD_EXP
178 #define INCPUSH_APPLLIB_OLD_EXP
180 #ifndef INCPUSH_SITELIB_STEM
181 #define INCPUSH_SITELIB_STEM
183 #ifndef INCPUSH_PERL_VENDORLIB_STEM
184 #define INCPUSH_PERL_VENDORLIB_STEM
186 #ifndef INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
187 #define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
190 #endif /* DEFINE_INC_MACROS */