configure: Add OBJC specific compiler flags
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 30 May 2012 09:24:06 +0000 (11:24 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 30 May 2012 09:28:53 +0000 (11:28 +0200)
See bug #643939.

configure.ac
sys/applemedia/Makefile.am

index 59b50f0..d831f91 100644 (file)
@@ -114,7 +114,7 @@ AC_PROG_CXX
 dnl determine if c++ is available on this system
 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
 
-AS_PROG_OBJC
+AC_PROG_OBJC
 
 dnl check if the compiler supports '-c' and '-o' options
 AM_PROG_CC_C_O
@@ -283,11 +283,22 @@ AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
 dnl define an ERROR_CFLAGS Makefile variable
 dnl -Waggregate-return - libexif returns aggregates
 dnl -Wundef - Windows headers check _MSC_VER unconditionally
-AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
-    -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
-    -Wwrite-strings -Wformat-security -Wold-style-definition
-    -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
-    -Wnested-externs $NO_WARNINGS])
+if test "x$HAVE_APPLE_MEDIA" != "xyes"; then
+  AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
+      -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
+      -Wwrite-strings -Wformat-security -Wold-style-definition
+      -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
+      -Wnested-externs $NO_WARNINGS])
+else
+  dnl work-around for us passing GST_CFLAGS to the ObjC-compiler, which
+  dnl doesn't understand all warning flags that the C compiler knows about
+  dnl (e.g. -Waddress) or causes problems with some flags (-Waggregate-return)
+  AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
+      -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
+      -Wwrite-strings -Wformat-security -Wold-style-definition
+      -Winit-self -Wmissing-include-dirs -Wno-multichar
+      -Wnested-externs $NO_WARNINGS])
+fi
 
 dnl define an ERROR_CXXFLAGS Makefile variable
 AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
@@ -295,6 +306,12 @@ AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
     -Wwrite-strings -Wformat-nonliteral -Wformat-security
     -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar $NO_WARNINGS])
 
+dnl define an ERROR_OBJCFLAGS Makefile variable
+AG_GST_SET_ERROR_OBJCFLAGS($FATAL_WARNINGS, [
+    -Wmissing-declarations -Wredundant-decls
+    -Wwrite-strings -Wformat-nonliteral -Wformat-security
+    -Winit-self -Wmissing-include-dirs -Wno-multichar $NO_WARNINGS])
+
 dnl define correct level for debugging messages
 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
 
@@ -1953,8 +1970,10 @@ dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
 dnl at make time with e.g. make ERROR_CFLAGS=""
 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
 GST_OPTION_CXXFLAGS="\$(WARNING_CXXFLAGS) \$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
+GST_OPTION_OBJCFLAGS="\$(WARNING_OBJCFLAGS) \$(ERROR_OBJCFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
 AC_SUBST(GST_OPTION_CFLAGS)
 AC_SUBST(GST_OPTION_CXXFLAGS)
+AC_SUBST(GST_OPTION_OBJCFLAGS)
 
 dnl FIXME: do we want to rename to GST_ALL_* ?
 dnl prefer internal headers to already installed ones
@@ -1962,14 +1981,18 @@ dnl also add builddir include for enumtypes and marshal
 dnl add GST_OPTION_CFLAGS, but overridable
 GST_CFLAGS="$GST_CFLAGS -DGST_USE_UNSTABLE_API"
 GST_CXXFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CXXFLAGS)"
+GST_OBJCFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_OBJCFLAGS)"
 GST_CFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
 AC_SUBST(GST_CFLAGS)
 AC_SUBST(GST_CXXFLAGS)
+AC_SUBST(GST_OBJCFLAGS)
 AC_SUBST(GST_LIBS)
 GST_PLUGINS_BAD_CXXFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
+GST_PLUGINS_BAD_OBJCFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
 GST_PLUGINS_BAD_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
 AC_SUBST(GST_PLUGINS_BAD_CFLAGS)
 AC_SUBST(GST_PLUGINS_BAD_CXXFLAGS)
+AC_SUBST(GST_PLUGINS_BAD_OBJCFLAGS)
 
 dnl LDFLAGS really should only contain flags, not libs - they get added before
 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
index 6b75328..59f88f9 100644 (file)
@@ -13,12 +13,12 @@ libgstapplemedia_la_SOURCES =                       \
        dynapi.c
 
 libgstapplemedia_la_CFLAGS =                   \
-       $(GST_CFLAGS)                           \
+       $(GST_OBJCFLAGS)                        \
        $(GST_BASE_CFLAGS)                      \
        $(GST_PLUGINS_BASE_CFLAGS)
 
 libgstapplemedia_la_OBJCFLAGS =                        \
-       $(GST_CFLAGS)                           \
+       $(GST_OBJCFLAGS)                        \
        $(GST_BASE_CFLAGS)                      \
        $(GST_PLUGINS_BASE_CFLAGS)