Browse Source

Fix --disable-mpg123 by telling automake to not compile it, instead of using ifdefs

Bart van Strien 12 years ago
parent
commit
c99fb2fb99

+ 1 - 0
platform/unix/configure.ac

@@ -66,6 +66,7 @@ AS_VAR_IF([enable_exe], [no], [], #else
 	  AC_DEFINE([LOVE_BUILD_EXE], [], [Don't build launcher]))
 
 AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
+AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno])
 
 # Set our includes as automake variable
 AC_SUBST([LOVE_INCLUDES], ["$includes"])

+ 2 - 0
platform/unix/exclude

@@ -1,3 +1,5 @@
 \./libraries/luasocket/libluasocket/wsocket\.*
 \./modules/sound/lullaby/FLACDecoder\.*
 \./love\.cpp
+\./modules/sound/lullaby/Mpg123Decoder\.cpp
+\./modules/sound/lullaby/Mpg123Decoder\.h

+ 19 - 7
platform/unix/gen-makefile

@@ -4,7 +4,9 @@ cd src
 inc_current='$(srcdir)'
 inc_modules="$inc_current/modules"
 inc_libraries="$inc_current/libraries"
-echo "AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries \$(LOVE_INCLUDES) \$(FILE_OFFSET)
+
+cat > Makefile.am << EOF
+AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries \$(LOVE_INCLUDES) \$(FILE_OFFSET)
 AUTOMAKE_OPTIONS = subdir-objects
 SUBDIRS =
 
@@ -19,10 +21,20 @@ endif
 # libLÖVE
 lib_LTLIBRARIES = liblove.la
 liblove_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS)
-liblove_la_SOURCES = \\" > Makefile.am.tmp
-find . \( \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) \) -exec echo '{}' \\ \; >> Makefile.am.tmp
-cat Makefile.am.tmp | grep -v -f"../platform/unix/exclude" | head -c -3 > Makefile.am
-#head -c -3 Makefile.am.tmp > Makefile.am
-rm Makefile.am.tmp
+liblove_la_SOURCES = \\
+EOF
+
+find . \( \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) \) -exec echo '{}' \\ \; \
+	| grep -v -f"../platform/unix/exclude" | head -c -3 >> Makefile.am
+
+printf "\n\n" >> Makefile.am
+cat >> Makefile.am << EOF
+if !LOVE_NOMPG123
+liblove_la_SOURCES += \\
+./modules/sound/lullaby/Mpg123Decoder.cpp \\
+./modules/sound/lullaby/Mpg123Decoder.h
+endif
+EOF
+
 cd ..
-echo src/Makefile.am is updated! \^.^
+echo "src/Makefile.am is updated! ^.^"

+ 0 - 4
src/modules/sound/lullaby/Mpg123Decoder.cpp

@@ -18,8 +18,6 @@
  * 3. This notice may not be removed or altered from any source distribution.
  **/
 
-#ifndef LOVE_NOMPG123
-
 #include "Mpg123Decoder.h"
 
 #include "common/Exception.h"
@@ -234,5 +232,3 @@ int Mpg123Decoder::feed(int bytes)
 } // lullaby
 } // sound
 } // love
-
-#endif // LOVE_NOMPG123

+ 0 - 2
src/modules/sound/lullaby/Mpg123Decoder.h

@@ -18,7 +18,6 @@
  * 3. This notice may not be removed or altered from any source distribution.
  **/
 
-#ifndef LOVE_NOMPG123
 #ifndef LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
 #define LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
 
@@ -77,4 +76,3 @@ private:
 } // love
 
 #endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
-#endif // LOVE_NOMPG123