@@ -263,7 +263,45 @@ bool ConfigGenerator::buildDefaultValues()
263263 const auto autoDet = getConfigOption (" autodetect" );
264264 if ((autoDet == m_configValues.end ()) || (autoDet->m_value != " 0" )) {
265265 // Enable all the auto detected libs
266- list.resize (0 );
266+ vector<string> list;
267+ if (getConfigList (" AUTODETECT_LIBS" , list)) {
268+ fastToggleConfigValue (" autodetect" , true );
269+ } else {
270+ // If no auto list then just use hard enables
271+ fastToggleConfigValue (" bzlib" , true );
272+ fastToggleConfigValue (" iconv" , true );
273+ fastToggleConfigValue (" lzma" , true );
274+ fastToggleConfigValue (" schannel" , true );
275+ fastToggleConfigValue (" sdl" , true );
276+ fastToggleConfigValue (" sdl2" , true );
277+ fastToggleConfigValue (" zlib" , true );
278+
279+ // Enable hwaccels by default.
280+ fastToggleConfigValue (" d3d11va" , true );
281+ fastToggleConfigValue (" dxva2" , true );
282+
283+ string sFileName ;
284+ if (findFile (m_rootDirectory + " compat/cuda/dynlink_cuda.h" , sFileName )) {
285+ fastToggleConfigValue (" cuda" , true );
286+ fastToggleConfigValue (" cuvid" , true );
287+ }
288+ if (findFile (m_rootDirectory + " compat/nvenc/nvEncodeAPI.h" , sFileName )) {
289+ fastToggleConfigValue (" nvenc" , true );
290+ }
291+ }
292+ }
293+
294+ return buildForcedValues ();
295+ }
296+
297+ bool ConfigGenerator::buildAutoDetectValues ()
298+ {
299+ // Check if auto detection is enabled
300+ const auto autoDet = getConfigOption (" autodetect" );
301+ if ((autoDet != m_configValues.end ())) {
302+ // Enable/Disable all the auto detected libs
303+ const bool enableAuto = (autoDet->m_value != " 0" );
304+ vector<string> list;
267305 if (getConfigList (" AUTODETECT_LIBS" , list)) {
268306 string sFileName ;
269307 for (const auto & i : list) {
@@ -386,35 +424,11 @@ bool ConfigGenerator::buildDefaultValues()
386424 // Just disable
387425 enable = false ;
388426 }
389- fastToggleConfigValue (i, enable);
390- }
391- fastToggleConfigValue (" autodetect" , true );
392- } else {
393- // If no auto list then just use hard enables
394- fastToggleConfigValue (" bzlib" , true );
395- fastToggleConfigValue (" iconv" , true );
396- fastToggleConfigValue (" lzma" , true );
397- fastToggleConfigValue (" schannel" , true );
398- fastToggleConfigValue (" sdl" , true );
399- fastToggleConfigValue (" sdl2" , true );
400- fastToggleConfigValue (" zlib" , true );
401-
402- // Enable hwaccels by default.
403- fastToggleConfigValue (" d3d11va" , true );
404- fastToggleConfigValue (" dxva2" , true );
405-
406- string sFileName ;
407- if (findFile (m_rootDirectory + " compat/cuda/dynlink_cuda.h" , sFileName )) {
408- fastToggleConfigValue (" cuda" , true );
409- fastToggleConfigValue (" cuvid" , true );
410- }
411- if (findFile (m_rootDirectory + " compat/nvenc/nvEncodeAPI.h" , sFileName )) {
412- fastToggleConfigValue (" nvenc" , true );
427+ toggleConfigValue (i, enable && enableAuto, true );
413428 }
414429 }
415430 }
416-
417- return buildForcedValues ();
431+ return true ;
418432}
419433
420434bool ConfigGenerator::buildForcedValues ()
@@ -876,8 +890,8 @@ void ConfigGenerator::buildReplaceValues(
876890 }
877891 }
878892 for (auto & newReplaceValue : newReplaceValues) {
879- // Add them to the returned list (done here so that any checks above that test if it is reserved only operate on
880- // the unmodified original list)
893+ // Add them to the returned list (done here so that any checks above that test if it is reserved only
894+ // operate on the unmodified original list)
881895 replaceValues[newReplaceValue.first ] = newReplaceValue.second ;
882896 }
883897
0 commit comments