2 # LB_DARWIN_CHECK_FUNCS
4 # check for functions in the darwin kernel
5 # Note that this is broken for cross compiling
7 AC_DEFUN([LB_DARWIN_CHECK_FUNCS],
8 [AC_FOREACH([AC_Func], [$1],
9 [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Func),
10 [Define to 1 if you have the `]AC_Func[' function.])])dnl
13 AC_MSG_CHECKING([for $1])
14 AS_IF([AC_TRY_COMMAND(nm /mach | grep "[$1]" >/dev/null 2>/dev/null)],[
16 AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$ac_func])) $2
18 AC_MSG_RESULT([no]) $3
24 # LB_DARWIN_CONDITIONALS
26 # AM_CONDITIONALs for darwin
28 AC_DEFUN([LB_DARWIN_CONDITIONALS],
37 AC_DEFUN([LB_PROG_DARWIN],
38 [kernel_framework="/System/Library/Frameworks/Kernel.framework"
40 # FIXME: there should be a better way to get these than hard coding them
44 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -arch ppc -mtune=G4 -mlong-branch"
45 EXTRA_KLDFLAGS="-arch ppc"
48 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -arch i386"
49 EXTRA_KLDFLAGS="-arch i386"
53 # Kernel of OS X is not 64bits(even in Tiger), but -m64 can be taken by gcc in Tiger
54 # (Tiger can support 64bits applications), so we have to eliminate -m64 while
55 # building kextensions for and OS X.
56 CC=`echo $CC | sed -e "s/\-m64//g"`
57 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -x c -pipe -Wno-trigraphs -fasm-blocks -g -O0"
58 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-four-char-constants -Wmost -O0"
59 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -fmessage-length=0"
60 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -I$kernel_framework/Headers"
61 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -I$kernel_framework/Headers/bsd"
62 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -I$kernel_framework/PrivateHeaders"
63 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -fno-common -nostdinc -fno-builtin"
64 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -finline -fno-keep-inline-functions"
65 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -force_cpusubtype_ALL -fno-exceptions"
66 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -msoft-float -static"
67 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -DKERNEL -DKERNEL_PRIVATE"
68 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -DDRIVER_PRIVATE -DAPPLE -DNeXT"
69 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -D__KERNEL__ -D__DARWIN__"
71 # C flags for Panther/Tiger
75 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -D__DARWIN8__"
78 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -ffix-and-continue"
83 # Debugging flags. Remove!
85 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -O0 -DMACH_ASSERT=1"
86 EXTRA_KLDFLAGS="$EXTRA_KLDFLAGS -static -nostdlib -r"
87 EXTRA_KLIBS="-lkmodc++ -lkmod -lcc_kext"
90 AC_SUBST(EXTRA_KLDFLAGS)
93 kextdir='/System/Library/Extensions/$(firstword $(macos_PROGRAMS)).kext'
94 plistdir='$(kextdir)/Contents'
95 macosdir='$(plistdir)/MacOS'