From 8f16cd236828a8bb7be51696029e0e24b7a6c517 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 13 Jul 2004 06:35:55 +0000 Subject: [PATCH] m4/as-objc.m4: Add a macro to test for objective C Original commit message from CVS: * m4/as-objc.m4: Add a macro to test for objective C --- ChangeLog | 4 ++++ m4/as-objc.m4 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 m4/as-objc.m4 diff --git a/ChangeLog b/ChangeLog index 64fb047..b1e9b7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-07-12 David Schleef + + * m4/as-objc.m4: Add a macro to test for objective C + 2004-06-12 Thomas Vander Stichele * m4/gst-feature.m4: diff --git a/m4/as-objc.m4 b/m4/as-objc.m4 new file mode 100644 index 0000000..6773aaf --- /dev/null +++ b/m4/as-objc.m4 @@ -0,0 +1,54 @@ + + +# AC_PROG_OBJC([LIST-OF-COMPILERS]) +# +AC_DEFUN([AS_PROG_OBJC], +[ +AC_CHECK_TOOLS(OBJC, + [m4_default([$1], [objcc objc gcc cc CC])], + none) +AC_SUBST(OBJC) +OBJC_LDFLAGS="-lobjc" +AC_SUBST(OBJC_LDFLAGS) +if test "x$OBJC" != xnone ; then + _AM_DEPENDENCIES(OBJC) + AC_MSG_CHECKING([if Objective C compiler works]) + cat >>conftest.m < +@interface Moo:Object +{ +} +- moo; +int main(); +@end + +@implementation Moo +- moo +{ + exit(0); +} + +int main() +{ + id moo; + moo = [[Moo new]]; + [[moo moo]]; + return 1; +} +@end +EOF + ${OBJC} conftest.m ${OBJC_LDFLAGS} >&5 2>&5 + if test -f a.out -o -f a.exe ; then + result=yes + else + result=no + echo failed program is: >&5 + cat conftest.m >&5 + fi + rm -f conftest.m a.out a.exe + AC_MSG_RESULT([$result]) +fi + +]) + + -- 2.7.4