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 #else 81 # define INCPUSH_PRIVLIB_EXP S_incpush_use_sep(aTHX_ STR_WITH_LEN(PRIVLIB_EXP), INCPUSH_CAN_RELOCATE); 82 #endif 83 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); 87 #endif 88 89 90 /* submacros for INCPUSH_PERL5LIB */ 91 92 #define _INCPUSH_PERL5LIB_IF if (perl5lib && *perl5lib != '\0') 93 94 #ifndef VMS 95 # define _INCPUSH_PERL5LIB_ADD _INCPUSH_PERL5LIB_IF incpush_use_sep(perl5lib, 0, INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); 96 #else 97 /* VMS */ 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. 101 */ 102 # define _INCPUSH_PERL5LIB_ADD char buf[256]; \ 103 int idx = 0; \ 104 if (vmstrnenv("PERL5LIB",buf,0,NULL,0)) \ 105 do { \ 106 incpush_use_sep(buf, 0, \ 107 INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR); \ 108 } while (vmstrnenv("PERL5LIB",buf,++idx,NULL,0)); 109 #endif 110 111 /* this macro is special and use submacros from above */ 112 #define INCPUSH_PERL5LIB if (!TAINTING_get) { _INCPUSH_PERL5LIB_ADD } 113 114 /* Use the ~-expanded versions of APPLLIB (undocumented), 115 SITELIB and VENDORLIB for older versions 116 */ 117 #ifdef APPLLIB_EXP 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); 120 #endif 121 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); 126 #endif 127 128 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); 133 #endif 134 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); 138 #endif 139 140 141 /* define all undefined macros... */ 142 #ifndef INCPUSH_APPLLIB_EXP 143 #define INCPUSH_APPLLIB_EXP 144 #endif 145 #ifndef INCPUSH_SITEARCH_EXP 146 #define INCPUSH_SITEARCH_EXP 147 #endif 148 #ifndef INCPUSH_SITELIB_EXP 149 #define INCPUSH_SITELIB_EXP 150 #endif 151 #ifndef INCPUSH_PERL_VENDORARCH_EXP 152 #define INCPUSH_PERL_VENDORARCH_EXP 153 #endif 154 #ifndef INCPUSH_PERL_VENDORLIB_EXP 155 #define INCPUSH_PERL_VENDORLIB_EXP 156 #endif 157 #ifndef INCPUSH_ARCHLIB_EXP 158 #define INCPUSH_ARCHLIB_EXP 159 #endif 160 #ifndef INCPUSH_PRIVLIB_EXP 161 #define INCPUSH_PRIVLIB_EXP 162 #endif 163 #ifndef INCPUSH_PERL_OTHERLIBDIRS 164 #define INCPUSH_PERL_OTHERLIBDIRS 165 #endif 166 #ifndef INCPUSH_PERL5LIB 167 #define INCPUSH_PERL5LIB 168 #endif 169 #ifndef INCPUSH_APPLLIB_OLD_EXP 170 #define INCPUSH_APPLLIB_OLD_EXP 171 #endif 172 #ifndef INCPUSH_SITELIB_STEM 173 #define INCPUSH_SITELIB_STEM 174 #endif 175 #ifndef INCPUSH_PERL_VENDORLIB_STEM 176 #define INCPUSH_PERL_VENDORLIB_STEM 177 #endif 178 #ifndef INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY 179 #define INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY 180 #endif 181 182 #endif /* DEFINE_INC_MACROS */ 183