[smpeg] Don't clobber CXXFLAGS

TellowKrinkle tellowkrinkle at gmail.com
Sat Mar 7 03:45:52 EST 2020


This way the user can add CXXFLAGS and not have them be overwritten by CFLAGS

Also adds the `-std=c++03` flag because newer compilers default to C++11 which breaks the build due to new rules on narrowing conversions.  Possible alternative solution is to add `-Wno-narrowing` instead

Index: configure.in
===================================================================
--- configure.in	(revision 413)
+++ configure.in	(working copy)
@@ -65,7 +65,7 @@
 case "$target" in
     alpha*-*-linux*)
 	if test x$ac_cv_prog_gcc = xyes; then
-            CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
+            SMPEG_CFLAGS="$SMPEG_CFLAGS -mcpu=ev4 -Wa,-mall"
         fi
         ;;
     sparc*-*-solaris*)
@@ -115,17 +115,17 @@
               , enable_debug=yes)
 if test x$enable_debug != xyes; then
     if test x$ac_cv_prog_gcc = xyes; then
-        CFLAGS="$CFLAGS -fexpensive-optimizations -fomit-frame-pointer"
+        SMPEG_CFLAGS="$SMPEG_CFLAGS -fexpensive-optimizations -fomit-frame-pointer"
     fi
     case "$target" in
         i486-*-*)  # Yeah right. :)
             if test x$ac_cv_prog_gcc = xyes; then
-                CFLAGS="$CFLAGS -march=486"
+                SMPEG_CFLAGS="$SMPEG_CFLAGS -march=486"
             fi
             ;;
         i?86-*-*)
             if test x$ac_cv_prog_gcc = xyes; then
-                CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
+                SMPEG_CFLAGS="$SMPEG_CFLAGS -march=pentium -mcpu=pentiumpro"
             fi
             ;;
     esac
@@ -137,7 +137,7 @@
             :,
 	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
 )
-CFLAGS="$CFLAGS $SDL_CFLAGS"
+SMPEG_CFLAGS="$SMPEG_CFLAGS $SDL_CFLAGS"
 LIBS="$LIBS $SDL_LIBS"
 
 dnl See if we need to pass -lm for the math library
@@ -158,7 +158,7 @@
     AC_MSG_RESULT($use_mmx)
 
     if test x$use_mmx = xyes; then
-        CFLAGS="$CFLAGS -DUSE_MMX"
+        SMPEG_CFLAGS="$SMPEG_CFLAGS -DUSE_MMX"
         ASFLAGS="$ASFLAGS -DUSE_MMX"
         CCASFLAGS="$CCASFLAGS -DUSE_MMX"
     fi
@@ -169,7 +169,7 @@
 [  --enable-timestamp-sync  enable system timestamp sync [default=yes]],
               , enable_timestamp_sync=no)
 if test x$enable_timestamp_sync = xyes; then
-	CFLAGS="$CFLAGS -DUSE_TIMESTAMP_SYNC"
+	SMPEG_CFLAGS="$SMPEG_CFLAGS -DUSE_TIMESTAMP_SYNC"
 fi
 
 dnl Enable the use of the system thread
@@ -177,7 +177,7 @@
 [  --enable-threaded-system enable system thread         [default=no]],
               , enable_threaded_system=no)
 if test x$enable_threaded_system = xyes; then
-	CFLAGS="$CFLAGS -DUSE_SYSTEM_THREAD"
+	SMPEG_CFLAGS="$SMPEG_CFLAGS -DUSE_SYSTEM_THREAD"
 fi
 
 dnl Disable using a thread for the video callback
@@ -185,7 +185,7 @@
 [  --enable-video-callback-thread enable video callback thread [default=yes]],
               , enable_video_callback_thread=yes)
 if test x$enable_video_callback_thread = xno; then
-	CFLAGS="$CFLAGS -DDISABLE_VIDEO_CALLBACK_THREAD"
+	SMPEG_CFLAGS="$SMPEG_CFLAGS -DDISABLE_VIDEO_CALLBACK_THREAD"
 fi
 
 dnl Enable threaded audio
@@ -193,7 +193,7 @@
 [  --enable-threaded-audio  enable threaded audio        [default=yes]],
               , enable_threaded_audio=yes)
 if test x$enable_threaded_audio = xyes; then
-	CFLAGS="$CFLAGS -DTHREADED_AUDIO"
+	SMPEG_CFLAGS="$SMPEG_CFLAGS -DTHREADED_AUDIO"
 fi
 
 dnl Disable assertions in release builds
@@ -201,20 +201,21 @@
 [  --enable-assertions     Enable consistency checks in decoding [default=no]],
               , enable_assertions=no)
 if test x$enable_assertions != xyes; then
-    CFLAGS="$CFLAGS -DNDEBUG"
+    SMPEG_CFLAGS="$SMPEG_CFLAGS -DNDEBUG"
 fi
 
 dnl Activate compiler warnings
-CFLAGS="$CFLAGS -Wall"
+SMPEG_CFLAGS="$SMPEG_CFLAGS -Wall"
 
 dnl Add the source include directories
-CFLAGS="$CFLAGS -I.. -DNOCONTROLS"
-CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/audio -I\$(top_srcdir)/video"
-CXXFLAGS="$CFLAGS"
+SMPEG_CFLAGS="$SMPEG_CFLAGS -I.. -DNOCONTROLS"
+SMPEG_CFLAGS="$SMPEG_CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/audio -I\$(top_srcdir)/video"
 
+dnl Set CFLAGS and CXXFLAGS based on above options
+CFLAGS="$CFLAGS $SMPEG_CFLAGS"
+dnl Need C++03 because C++11 has stricter rules on narrowing conversion
+CXXFLAGS="$CXXFLAGS -std=c++03 $SMPEG_CFLAGS"
 
-dnl C++ flags are the same as the C flags
-CXXFLAGS="$CFLAGS"
 if test x$GCC = xyes; then
     # Check to see if options -fno-rtti -fno-exceptions are supported
     AC_MSG_CHECKING(if $CXX supports -fno-rtti -fno-exceptions)



More information about the smpeg mailing list