[vlc-commits] [Git][videolan/vlc][master] configure: use `-Og` optimization level if `--enable-debug` is used

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Wed Jul 15 16:36:25 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
515cebc5 by Fatih Uzunoglu at 2026-07-15T18:03:05+02:00
configure: use `-Og` optimization level if `--enable-debug` is used

... and `--disable-optimizations` is not set.

Currently it appears that we have only one build for the nightlies,
and both the release and debug nightlies are built with no optimization
level set (which is effectively `-O0`), since we use `--enable-debug`.
Unlike the contribs, for VLC itself it is better to have proper
debuggable application without aggressive optimization. For that reason,
`-Og` seems to be a safe choice when we intend the application to be
debugged, such as with the nightlies.

Ideally we should have separate debug and release builds, where `-Og`
and `-O3` are used, respectively. But if we can't afford to do that,
just using `-Og` provides massive benefit over no optimization at all,
according to the benchmarks.

- - - - -


1 changed file:

- configure.ac


Changes:

=====================================
configure.ac
=====================================
@@ -1530,21 +1530,26 @@ AC_ARG_ENABLE([optimizations],
 dnl Check for various optimization flags
 AS_IF([test "${enable_optimizations}" != "no"], [
 
-  dnl -O3 only in production builds
   AS_IF([test "${enable_debug}" = "no"], [
-    VLC_SAVE_FLAGS
-    CFLAGS="${CFLAGS} -O3"
-    CXXFLAGS="${CXXFLAGS} -O3"
-    OBJCFLAGS="${OBJCFLAGS} -O3"
-    AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
-        ac_cv_c_o3=yes
-      ], [
-        ac_cv_c_o3=no
-      ])
+    dnl -O3 only in production builds
+    OPTIMIZATION_LEVEL="-O3"
+  ], [
+    dnl -Og is used if --enable-debug is set, but --disable-optimizations is not
+    OPTIMIZATION_LEVEL="-Og"
+  ])
+
+  VLC_SAVE_FLAGS
+  CFLAGS="${CFLAGS} ${OPTIMIZATION_LEVEL}"
+  CXXFLAGS="${CXXFLAGS} ${OPTIMIZATION_LEVEL}"
+  OBJCFLAGS="${OBJCFLAGS} ${OPTIMIZATION_LEVEL}"
+  AC_CACHE_CHECK([if $CC accepts ${OPTIMIZATION_LEVEL}],  [ac_cv_c_O], [
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
+      ac_cv_c_O=yes
+    ], [
+      ac_cv_c_O=no
     ])
-    AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
   ])
+  AS_IF([test "${ac_cv_c_O}" = "no"], [VLC_RESTORE_FLAGS])
 
   dnl Check for fast maths
   AX_APPEND_COMPILE_FLAGS([-fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range], [CFLAGS])



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/515cebc51ed3e401bbb8ccf47378e285f1aca3c8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/515cebc51ed3e401bbb8ccf47378e285f1aca3c8
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list