source: trunk/third/gtkhtml/macros/gnome-objc-checks.m4 @ 16767

Revision 16767, 2.1 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16766, which included commits to RCS files with non-trunk default branches.
Line 
1AC_DEFUN([GNOME_CHECK_OBJC],
2[
3dnl Look for an ObjC compiler.
4dnl 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, "")
10    fi
11  fi
12
13  AC_REQUIRE([GNOME_PTHREAD_CHECK])
14
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",,
21        $OBJC_LIBS)],
22      $OBJC_LIBS)])
23  AC_SUBST(OBJC_LIBS)
24
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
31{
32}
33@end
34@implementation myRandomObj
35@end
36int main () {
37  /* No, you are not seeing double.  Remember that square brackets
38     are the autoconf m4 quotes.  */
39  id myid = [[myRandomObj alloc]];
40  [[myid free]];
41  return 0;
42}
43EOF
44
45      $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
46      result=$?
47      rm -f conftest*
48
49      if test $result -eq 0; then
50        ac_cv_prog_objc_works=yes
51      fi
52    else
53      ac_cv_prog_objc_works=no
54    fi
55  ])
56
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
60])
61
62AC_DEFUN([GNOME_INIT_OBJC],
63[
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
70        else
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
74        fi
75       
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
79
80        AC_SUBST(OBGNOME_INCLUDEDIR)
81        AC_SUBST(OBGNOME_LIBS)
82        AC_SUBST(OBGTK_LIBS)
83])
Note: See TracBrowser for help on using the repository browser.