@@ -190,6 +190,8 @@ void cdb2_protobuf_free(void *allocator_data, void *ptr)
190
190
#include <openssl/crypto.h>
191
191
192
192
static int cdb2_use_env_vars = 1 ;
193
+ static int cdb2_install_set_from_env = 0 ;
194
+ static int cdb2_uninstall_set_from_env = 0 ;
193
195
194
196
static int default_type_override_env = 0 ;
195
197
@@ -280,16 +282,16 @@ typedef void (*cdb2_init_t)(void);
280
282
#ifndef CDB2_INSTALL_LIBS
281
283
#define CDB2_INSTALL_LIBS NULL
282
284
#else
283
- extern void CDB2_INSTALL_LIBS (void );
285
+ extern void CDB2_INSTALL_LIBS (const char * );
284
286
#endif
285
- void (* cdb2_install )(void ) = CDB2_INSTALL_LIBS ;
287
+ void (* cdb2_install )(const char * ) = CDB2_INSTALL_LIBS ;
286
288
287
289
#ifndef CDB2_UNINSTALL_LIBS
288
290
#define CDB2_UNINSTALL_LIBS NULL
289
291
#else
290
- extern void CDB2_UNINSTALL_LIBS (void );
292
+ extern void CDB2_UNINSTALL_LIBS (const char * );
291
293
#endif
292
- void (* cdb2_uninstall )(void ) = CDB2_UNINSTALL_LIBS ;
294
+ void (* cdb2_uninstall )(const char * ) = CDB2_UNINSTALL_LIBS ;
293
295
294
296
#ifndef CDB2_IDENTITY_CALLBACKS
295
297
struct cdb2_identity * identity_cb = NULL ;
@@ -304,8 +306,14 @@ void (*cdb2_uninstall)(void) = CDB2_UNINSTALL_LIBS;
304
306
305
307
#if WITH_DL_LIBS
306
308
#include <dlfcn.h>
307
- void cdb2_set_install_libs (void (* ptr )(void )) { cdb2_install = ptr ; }
308
- void cdb2_set_uninstall_libs (void (* ptr )(void )) { cdb2_uninstall = ptr ; }
309
+ void cdb2_set_install_libs (void (* ptr )(const char * ))
310
+ {
311
+ cdb2_install = ptr ;
312
+ }
313
+ void cdb2_set_uninstall_libs (void (* ptr )(const char * ))
314
+ {
315
+ cdb2_uninstall = ptr ;
316
+ }
309
317
#endif
310
318
311
319
pthread_mutex_t cdb2_sockpool_mutex = PTHREAD_MUTEX_INITIALIZER ;
@@ -1395,6 +1403,18 @@ static void read_comdb2db_environment_cfg(cdb2_hndl_tp *hndl, const char *comdb2
1395
1403
process_env_var_int ("COMDB2_CONFIG_SOCKET_TIMEOUT" , & CDB2_SOCKET_TIMEOUT , & cdb2_socket_timeout_set_from_env );
1396
1404
process_env_var_int ("COMDB2_CONFIG_PROTOBUF_SIZE" , & CDB2_PROTOBUF_SIZE , & cdb2_protobuf_size_set_from_env );
1397
1405
1406
+ char * arg = getenv ("COMDB2_CONFIG_INSTALL_STATIC_LIBS" );
1407
+ if ((cdb2_install != NULL ) && arg != NULL ) {
1408
+ (* cdb2_install )(arg );
1409
+ cdb2_install_set_from_env = 1 ;
1410
+ }
1411
+
1412
+ arg = getenv ("COMDB2_CONFIG_UNINSTALL_STATIC_LIBS" );
1413
+ if ((cdb2_uninstall != NULL ) && arg != NULL ) {
1414
+ (* cdb2_uninstall )(arg );
1415
+ cdb2_uninstall_set_from_env = 1 ;
1416
+ }
1417
+
1398
1418
have_read_env = 1 ;
1399
1419
}
1400
1420
@@ -1564,15 +1584,20 @@ static void read_comdb2db_cfg(cdb2_hndl_tp *hndl, SBUF2 *s, const char *comdb2db
1564
1584
if (tok ) {
1565
1585
cdb2_allow_pmux_route = value_on_off (tok , & err , 1 );
1566
1586
}
1567
- } else if ((strcasecmp ("uninstall_static_libs_v2 " , tok ) == 0 ||
1568
- strcasecmp ("disable_static_libs" , tok ) == 0 )) {
1587
+ } else if (! cdb2_uninstall_set_from_env && (strcasecmp ("uninstall_static_libs_v4 " , tok ) == 0 ||
1588
+ strcasecmp ("disable_static_libs" , tok ) == 0 )) {
1569
1589
/* Provide a way to disable statically installed (via
1570
1590
* CDB2_INSTALL_LIBS) libraries. */
1591
+ tok = strtok_r (NULL , " :," , & last );
1571
1592
if (cdb2_uninstall != NULL )
1572
- (* cdb2_uninstall )();
1573
- } else if ((strcasecmp ("install_static_libs_v2" , tok ) == 0 || strcasecmp ("enable_static_libs" , tok ) == 0 )) {
1593
+ (* cdb2_uninstall )(tok );
1594
+ } else if (!cdb2_install_set_from_env &&
1595
+ (strcasecmp ("install_static_libs_v4" , tok ) == 0 || strcasecmp ("enable_static_libs" , tok ) == 0 )) {
1596
+ /* Provide a way to enable statically installed (via
1597
+ * CDB2_INSTALL_LIBS) libraries. */
1598
+ tok = strtok_r (NULL , " :," , & last );
1574
1599
if (cdb2_install != NULL )
1575
- (* cdb2_install )();
1600
+ (* cdb2_install )(tok );
1576
1601
#if WITH_DL_LIBS
1577
1602
} else if (strcasecmp ("lib" , tok ) == 0 ) {
1578
1603
tok = strtok_r (NULL , " :," , & last );
0 commit comments