-if test x"$GXX" = "xyes"; then
- CXXFLAGS="${CXXFLAGS} -Wall -Wextra"
- # Add -Werror in debug mode
- if test x"${enable_debug+set}" = xset; then
- CXXFLAGS="${CXXFLAGS} -Werror"
- fi
-fi
+AS_IF([test "x${GXX}" = "xyes" ], [
+ CXXFLAGS="-Wall -Wextra ${CXXFLAGS}"
+ AS_IF([ test "x${enable_debug}" = "xyes" ], [
+ # Add -Werror in debug mode
+ CXXFLAGS="-Werror ${CXXFLAGS}"
+ ], [
+ # hide private symbols in non-debug mode
+ visibility="-fvisibility=hidden"
+ ])
+])
+
+# Check for debug
+AC_MSG_CHECKING(whether to compile debug version)
+debugflags=""
+AS_CASE([${enable_debug}],
+ [ yes ], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([__RTAUDIO_DEBUG__])
+ debugflags="${debugflags} -g -O0"
+ object_path=Debug
+ ],
+ [ no ], [
+ AC_MSG_RESULT([no!])
+ debugflags="${debugflags} -O3"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+
+# For debugging and optimization ... overwrite default because it has both -g and -O2
+AS_IF([test "x$debugflags" != x],
+ AS_IF([test "x$override_cxx" = "xyes" ], CXXFLAGS="$CXXFLAGS $debugflags", CXXFLAGS="$debugflags $CXXFLAGS")
+ AS_IF([test "x$override_c" = "xyes" ], CFLAGS="$CFLAGS $debugflags", CFLAGS="$debugflags $CFLAGS")
+ )
+