Revision | a7afa029881c60fc30abaeafd96faf8be48711aa (tree) |
---|---|
Time | 2022-12-10 14:40:08 |
Author | phabrics <phabrics@phab...> |
Commiter | phabrics |
Miscellaneous changes for better handling system dependencies.
@@ -129,6 +129,7 @@ darwin*) | ||
129 | 129 | esac |
130 | 130 | |
131 | 131 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) |
132 | +AC_CHECK_PROG([CYGPATH_M], [cygpath], [cygpath -m], [echo]) | |
132 | 133 | |
133 | 134 | AC_SUBST(DEV_TAP_FILENAME) |
134 | 135 | AC_SUBST(SETCAP) |
@@ -792,7 +793,7 @@ dnl Start the list of display host support. | ||
792 | 793 | TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff" |
793 | 794 | |
794 | 795 | dnl Checks for GLIB. |
795 | -AM_PATH_GLIB_2_0([], [have_glib=$enable_glib], []) | |
796 | +AM_PATH_GLIB_2_0([], [AC_DEFINE([HAVE_GLIB], [], [Defined if GLIB 2.0 is found.])], []) | |
796 | 797 | |
797 | 798 | dnl Checks for display type support |
798 | 799 | AM_PATH_GTK_3_0([], [have_gtk=$enable_gtk], []) |
@@ -309,6 +309,7 @@ openvpn_main (int argc, char *argv[]) | ||
309 | 309 | return 0; /* NOTREACHED */ |
310 | 310 | } |
311 | 311 | |
312 | +#if 0 | |
312 | 313 | #ifdef WIN32 |
313 | 314 | int |
314 | 315 | wmain (int argc, wchar_t *wargv[]) { |
@@ -342,3 +343,4 @@ main (int argc, char *argv[]) { | ||
342 | 343 | return openvpn_main(argc, argv); |
343 | 344 | } |
344 | 345 | #endif |
346 | +#endif |
@@ -74,3 +74,9 @@ shlibvar.h: $(top_builddir)/config.h Makefile | ||
74 | 74 | grep LT_MODULE_PATH_VAR $(top_builddir)/config.h > $@ |
75 | 75 | grep LT_DLSEARCH_PATH $(top_builddir)/config.h >> $@ |
76 | 76 | echo "#define TME_PACKAGE_PATH \"$(libdir)\"" >> $@ |
77 | + echo -n "#define TME_PREFIX_PATH \"" >> $@ | |
78 | + echo / | tr -d "\n\r\f" >> $@ | |
79 | + echo \" >> $@ | |
80 | + echo -n "#define TME_WINDOWS_PATH \"" >> $@ | |
81 | + $(CYGPATH_W) / | tr -d "\n\r\f" >> $@ | |
82 | + echo \" >> $@ |
@@ -97,7 +97,7 @@ _tme_modules_find(const char *top_name, | ||
97 | 97 | unsigned int top_name_length, |
98 | 98 | char **_modules_dir) |
99 | 99 | { |
100 | - unsigned int modules_dir_length; | |
100 | + unsigned int modules_dir_length, prefix_length = strlen(TME_PREFIX_PATH); | |
101 | 101 | int pass; |
102 | 102 | const char *search_path; |
103 | 103 | const char *p1, *p2, *p3; |
@@ -147,9 +147,10 @@ _tme_modules_find(const char *top_name, | ||
147 | 147 | |
148 | 148 | /* form the modules index pathname to try, remembering what |
149 | 149 | part of it is the modules directory pathname: */ |
150 | - modules_dir_length = | |
150 | + modules_dir_length = | |
151 | + prefix_length | |
151 | 152 | /* the search path part, less any trailing slashes: */ |
152 | - (p2 - p1) + 1 | |
153 | + + (p2 - p1) | |
153 | 154 | /* a slash: */ |
154 | 155 | + 1 |
155 | 156 | + top_name_length |
@@ -162,23 +163,21 @@ _tme_modules_find(const char *top_name, | ||
162 | 163 | + strlen("-plugins.txt") |
163 | 164 | /* a NUL: */ |
164 | 165 | + 1); |
165 | - memcpy(modules_index_pathname, p1, (p2 - p1) + 1); | |
166 | - modules_index_pathname[(p2 - p1) + 1] = '/'; | |
167 | - memcpy(modules_index_pathname | |
168 | - + (p2 - p1) + 1 | |
169 | - + 1, | |
166 | + strcpy(modules_index_pathname, TME_PREFIX_PATH); | |
167 | + strncpy(modules_index_pathname + prefix_length, p1 + 1, (p2 - p1)); | |
168 | + prefix_length += (p2 - p1); | |
169 | + modules_index_pathname[prefix_length++] = '/'; | |
170 | + strncpy(modules_index_pathname + prefix_length, | |
170 | 171 | top_name, |
171 | 172 | top_name_length); |
172 | - modules_index_pathname[((p2 - p1) + 1 | |
173 | - + 1 | |
174 | - + top_name_length)] = '/'; | |
175 | - memcpy(modules_index_pathname | |
176 | - + modules_dir_length, | |
173 | + prefix_length += top_name_length; | |
174 | + modules_index_pathname[prefix_length++] = '/'; | |
175 | + strncpy(modules_index_pathname + prefix_length, | |
177 | 176 | top_name, |
178 | 177 | top_name_length); |
178 | + prefix_length += top_name_length; | |
179 | 179 | strcpy(modules_index_pathname |
180 | - + modules_dir_length | |
181 | - + top_name_length, | |
180 | + + prefix_length, | |
182 | 181 | "-plugins.txt"); |
183 | 182 | |
184 | 183 | /* try to open the modules index: */ |
@@ -193,6 +192,7 @@ _tme_modules_find(const char *top_name, | ||
193 | 192 | |
194 | 193 | /* keep trying: */ |
195 | 194 | tme_free(modules_index_pathname); |
195 | + prefix_length = strlen(TME_PREFIX_PATH); | |
196 | 196 | } |
197 | 197 | |
198 | 198 | /* stop if this was the last path: */ |
@@ -431,11 +431,10 @@ tme_bswap_u128(tme_uint128_t x) | ||
431 | 431 | typedef tme_uint64_t tme_time_t; |
432 | 432 | |
433 | 433 | static _tme_inline tme_time_t tme_thread_get_time _TME_P((void)) { |
434 | -#if defined(WIN32) || defined(USE_GLIB_TIME) && defined(_TME_HAVE_GLIB) | |
435 | -#ifdef USE_GLIB_TIME | |
434 | +#if defined(USE_GLIB_TIME) && defined(_TME_HAVE_GLIB) | |
436 | 435 | #define TME_FRAC_PER_SEC G_USEC_PER_SEC |
437 | 436 | return g_get_real_time(); |
438 | -#else | |
437 | +#elif defined(WIN32) | |
439 | 438 | #define TME_FRAC_PER_SEC 10000000 |
440 | 439 | FILETIME filetime; |
441 | 440 | ULARGE_INTEGER _time; |
@@ -447,7 +446,6 @@ static _tme_inline tme_time_t tme_thread_get_time _TME_P((void)) { | ||
447 | 446 | #else |
448 | 447 | return (_time.u.LowPart) | (_time.u.HighPart << 32); |
449 | 448 | #endif |
450 | -#endif | |
451 | 449 | #elif defined(USE_GETTIMEOFDAY) || !defined(_TME_HAVE_CLOCK_GETTIME) |
452 | 450 | #define TME_FRAC_PER_SEC 1000000 |
453 | 451 | struct timeval tv; |