1 AC_DEFUN([GNOME_CHECK_OBJC],
3 dnl Look for an ObjC compiler.
4 dnl FIXME: extend list of possible names of ObjC compilers.
5 AC_CHECK_PROGS(OBJC, $OBJC egcs, "")
6 if test "x$OBJC" = "x" ; then
7 AC_CHECK_PROGS(OBJC, $OBJC egcc, "")
8 if test "x$OBJC" = "x" ; then
9 AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
13 AC_REQUIRE([GNOME_PTHREAD_CHECK])
15 OBJC_LIBS="-lobjc $PTHREAD_LIB"
16 AC_CHECK_FUNC(sched_yield,,[
17 AC_CHECK_LIB(rt,sched_yield,
18 OBJC_LIBS="$OBJC_LIBS -lrt",[
19 AC_CHECK_LIB(posix4,sched_yield,
20 OBJC_LIBS="$OBJC_LIBS -lposix4",,
25 AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
26 ac_cv_prog_objc_works, [
27 if test -n "$OBJC"; then
28 cat > conftest.m <<EOF
29 #include <objc/Object.h>
30 @interface myRandomObj : Object
34 @implementation myRandomObj
37 /* No, you are not seeing double. Remember that square brackets
38 are the autoconf m4 quotes. */
39 id myid = [[myRandomObj alloc]];
45 $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
49 if test $result -eq 0; then
50 ac_cv_prog_objc_works=yes
53 ac_cv_prog_objc_works=no
57 AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes)
58 dnl Also set the shell variable OBJECTIVE_C to "yes" or "no".
59 OBJECTIVE_C=$ac_cv_prog_objc_works
62 AC_DEFUN([GNOME_INIT_OBJC],
64 AC_MSG_CHECKING(for an obGnomeConf.sh)
65 my_gnome_libdir=`$GNOME_CONFIG --libdir`
66 if test -f $my_gnome_libdir/obGnomeConf.sh; then
67 . $my_gnome_libdir/obGnomeConf.sh
68 AC_MSG_RESULT(found $my_gnome_libdir)
69 ac_cv_have_gnome_objc=yes
71 AC_MSG_RESULT(not found)
72 AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install)
73 ac_cv_have_gnome_objc=no
76 dnl Add a conditional on whether or not we have gnome-objc
77 AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes)
78 HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc
80 AC_SUBST(OBGNOME_INCLUDEDIR)
81 AC_SUBST(OBGNOME_LIBS)