- Update build system to support IOKit and CoreFoundation frameworks

on Darwin.
- Add support for the -framework "name" linker option.
- NtQueryVolumeInformationFile set device info on Darwin.
This commit is contained in:
Emmanuel Maillard 2004-08-19 01:20:45 +00:00 committed by Alexandre Julliard
parent 4e64906797
commit 2300ce663a
6 changed files with 84 additions and 4 deletions

9
configure vendored
View File

@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES'
# Initialize some variables set by options.
@ -14046,6 +14046,11 @@ echo "${ECHO_T}$ac_cv_c_dll_macho" >&6
LDLIBWINEFLAGS="-seg1addr 0x140000"
COREFOUNDATIONLIB="-framework CoreFoundation"
IOKITLIB="-framework IOKit"
IOKITLIB = "$IOKITLIB $COREFOUNDATIONLIB"
fi
fi
fi
@ -20924,6 +20929,8 @@ s,@DLLWRAP@,$DLLWRAP,;t t
s,@ac_ct_DLLWRAP@,$ac_ct_DLLWRAP,;t t
s,@LDEXECFLAGS@,$LDEXECFLAGS,;t t
s,@LDLIBWINEFLAGS@,$LDLIBWINEFLAGS,;t t
s,@COREFOUNDATIONLIB@,$COREFOUNDATIONLIB,;t t
s,@IOKITLIB@,$IOKITLIB,;t t
s,@CROSSTEST@,$CROSSTEST,;t t
s,@CROSSCC@,$CROSSCC,;t t
s,@CROSSWINDRES@,$CROSSWINDRES,;t t

View File

@ -944,6 +944,11 @@ case $host_os in
AC_SUBST(LDEXECFLAGS,"-seg1addr 0x120000")
dnl Relocate libwine.dyld too
AC_SUBST(LDLIBWINEFLAGS,"-seg1addr 0x140000")
dnl declare needed frameworks
AC_SUBST(COREFOUNDATIONLIB,"-framework CoreFoundation")
AC_SUBST(IOKITLIB,"-framework IOKit")
dnl using IOKit imply we use CoreFoundation too
IOKITLIB = "$IOKITLIB $COREFOUNDATIONLIB"
fi
fi
fi

View File

@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = kernel32.dll
IMPORTS = ntdll
EXTRALIBS = $(LIBUNICODE)
EXTRALIBS = $(LIBUNICODE) @COREFOUNDATIONLIB@
SPEC_SRCS16 = \
comm.drv.spec \

View File

@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ntdll.dll
EXTRALIBS = $(LIBUNICODE)
EXTRALIBS = $(LIBUNICODE) @IOKITLIB@
C_SRCS = \
cdrom.c \

View File

@ -1349,6 +1349,68 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
break;
}
#elif defined (__APPLE__)
#include <IOKit/IOKitLib.h>
#include <CoreFoundation/CFNumber.h> /* for kCFBooleanTrue, kCFBooleanFalse */
#include <paths.h>
struct statfs stfs;
info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
if (fstatfs( fd, &stfs ) < 0) break;
/* stfs.f_type is reserved (always set to 0) so use IOKit */
kern_return_t kernResult = KERN_FAILURE;
mach_port_t masterPort;
char bsdName[6]; /* disk#\0 */
strncpy(bsdName, stfs.f_mntfromname+strlen(_PATH_DEV) , 5);
bsdName[5] = 0;
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
if (kernResult == KERN_SUCCESS)
{
CFMutableDictionaryRef matching = IOBSDNameMatching(masterPort, 0, bsdName);
if (matching)
{
CFMutableDictionaryRef properties;
io_service_t devService = IOServiceGetMatchingService(masterPort, matching);
if (IORegistryEntryCreateCFProperties(devService,
&properties,
kCFAllocatorDefault, 0) != KERN_SUCCESS)
break;
if ( CFEqual(
CFDictionaryGetValue(properties, CFSTR("Removable")),
kCFBooleanTrue)
) info->Characteristics |= FILE_REMOVABLE_MEDIA;
if ( CFEqual(
CFDictionaryGetValue(properties, CFSTR("Writable")),
kCFBooleanFalse)
) info->Characteristics |= FILE_READ_ONLY_DEVICE;
/*
NB : mounted disk image (.img/.dmg) don't provide specific type
*/
CFStringRef type;
if ( (type = CFDictionaryGetValue(properties, CFSTR("Type"))) )
{
if ( CFStringCompare(type, CFSTR("CD-ROM"), 0) == kCFCompareEqualTo
|| CFStringCompare(type, CFSTR("DVD-ROM"), 0) == kCFCompareEqualTo
)
{
info->DeviceType = FILE_DEVICE_CD_ROM_FILE_SYSTEM;
}
}
if (properties)
CFRelease(properties);
}
}
#else
static int warned;
if (!warned++) FIXME( "device info not properly supported on this platform\n" );

View File

@ -607,13 +607,15 @@ static void forward(int argc, char **argv, struct options* opts)
* object-file-name -llibrary -nostartfiles -nodefaultlibs
* -nostdlib -s -static -static-libgcc -shared -shared-libgcc
* -symbolic -Wl,option -Xlinker option -u symbol
* -framework name
*/
static int is_linker_arg(const char* arg)
{
static const char* link_switches[] =
{
"-nostartfiles", "-nodefaultlibs", "-nostdlib", "-s",
"-static", "-static-libgcc", "-shared", "-shared-libgcc", "-symbolic"
"-static", "-static-libgcc", "-shared", "-shared-libgcc", "-symbolic",
"-framework"
};
int j;
@ -734,6 +736,10 @@ int main(int argc, char **argv)
else next_is_arg = 1;
}
break;
case 'f':
if (strcmp("-framework", argv[i]) == 0)
next_is_arg = 1;
break;
}
if (next_is_arg) option_arg = argv[i+1];