Commit 794bf0fd authored by Pierre d'Herbemont's avatar Pierre d'Herbemont Committed by Alexandre Julliard

Add Darwin/Mac OS X support to the build system.

parent c2d34775
......@@ -5878,6 +5878,70 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for poll in -lpoll" >&5
echo $ECHO_N "checking for poll in -lpoll... $ECHO_C" >&6
if test "${ac_cv_lib_poll_poll+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpoll $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char poll ();
int
main ()
{
poll ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_poll_poll=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_poll_poll=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_poll_poll" >&5
echo "${ECHO_T}$ac_cv_lib_poll_poll" >&6
if test $ac_cv_lib_poll_poll = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPOLL 1
_ACEOF
LIBS="-lpoll $LIBS"
fi
echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6
if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
......@@ -12521,6 +12585,62 @@ echo "${ECHO_T}$ac_cv_c_dll_unixware" >&6
then
LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
LDDLL="\$(CC) -Wl,-G,-B,symbolic"
else
echo "$as_me:$LINENO: checking whether we can build a Mach-O (Mac OS X/Darwin) dll" >&5
echo $ECHO_N "checking whether we can build a Mach-O (Mac OS X/Darwin) dll... $ECHO_C" >&6
if test "${ac_cv_c_dll_macho+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -bundle"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_dll_macho="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_dll_macho="no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
echo "$as_me:$LINENO: result: $ac_cv_c_dll_macho" >&5
echo "${ECHO_T}$ac_cv_c_dll_macho" >&6
if test "$ac_cv_c_dll_macho" = "yes"
then
LIBEXT="dylib"
LDDLL="\$(CC) -bundle -flat_namespace -undefined suppress"
LDSHARED="\$(CC) -dynamiclib"
CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp"
fi
fi
fi
fi
......@@ -12675,6 +12795,9 @@ case $build_os in
cygwin*|mingw32*)
LDPATH="PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\""
;;
darwin*|macosx*)
LDPATH="DYLD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$DYLD_LIBRARY_PATH\""
;;
*)
LDPATH="LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\""
;;
......
......@@ -137,6 +137,8 @@ dnl Check for -lresolv for Solaris
AC_CHECK_FUNCS(inet_aton,,AC_CHECK_LIB(resolv,inet_aton))
dnl Check for -lxpg4 for FreeBSD
AC_CHECK_LIB(xpg4,_xpg4_setrunelocale)
dnl Check for -lpoll for Mac OS X/Darwin
AC_CHECK_LIB(poll,poll)
dnl Check for -lpthread
AC_CHECK_LIB(pthread,pthread_create,AC_SUBST(LIBPTHREAD,"-lpthread"))
......@@ -915,6 +917,17 @@ case $host_os in
then
LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
LDDLL="\$(CC) -Wl,-G,-B,symbolic"
else
AC_CACHE_CHECK(whether we can build a Mach-O (Mac OS X/Darwin) dll, ac_cv_c_dll_macho,
[WINE_TRY_CFLAGS([-bundle], ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")])
if test "$ac_cv_c_dll_macho" = "yes"
then
LIBEXT="dylib"
LDDLL="\$(CC) -bundle -flat_namespace -undefined suppress"
LDSHARED="\$(CC) -dynamiclib"
CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp"
fi
fi
fi
fi
......@@ -943,6 +956,8 @@ fi
case $build_os in
cygwin*|mingw32*)
AC_SUBST(LDPATH,"PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$PATH\"") ;;
darwin*|macosx*)
AC_SUBST(LDPATH,"DYLD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$DYLD_LIBRARY_PATH\"") ;;
*)
AC_SUBST(LDPATH,"LD_LIBRARY_PATH=\"\$(TOOLSDIR)/libs/unicode:\$\$LD_LIBRARY_PATH\"") ;;
esac
......
......@@ -248,6 +248,9 @@
/* Define to 1 if you have the `ossaudio' library (-lossaudio). */
#undef HAVE_LIBOSSAUDIO
/* Define to 1 if you have the `poll' library (-lpoll). */
#undef HAVE_LIBPOLL
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
......
......@@ -31,7 +31,13 @@ $(LIBNAME).a: $(DEFNAME)
$(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
$(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
.PHONY: install-lib-so install-lib-dll install-dev-so install-dev-dll
$(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
$(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
$(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
$(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
.PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
$(MKINSTALLDIRS) $(libdir)
......@@ -41,6 +47,10 @@ install-lib-dll: $(LIBNAME).dll dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
install-dev-so: dummy
$(MKINSTALLDIRS) $(libdir)
cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
......@@ -49,11 +59,15 @@ install-dev-dll: $(LIBNAME).a dummy
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
install-dev-dylib: dummy
$(MKINSTALLDIRS) $(libdir)
cd $(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
install install-lib:: $(LIBEXT:%=install-lib-%)
install install-dev:: $(LIBEXT:%=install-dev-%)
uninstall::
$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION)
$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
clean::
$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll
$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib
......@@ -2403,10 +2403,26 @@ else
LDSHARED="\$(CC) -Wl,-Bshareable,-Bforcearchive"
LDXXSHARED="\$(CXX) -Wl,-Bshareable,-Bforcearchive"
LDDLLFLAGS="" #FIXME
else
AC_CACHE_CHECK([whether we can build a Mach-O (Mac OS X/Darwin) dll],
ac_cv_c_dll_macho,
[saved_cflags=$CFLAGS
CFLAGS="$CFLAGS -bundle"
AC_TRY_LINK(,[return 1], ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")
CFLAGS=$saved_cflags
])
if test "$ac_cv_c_dll_macho" = "yes"
then
LDSHARED="\$(CC) -bundle -flat_namespace -undefined suppress"
LDXXSHARED="\$(CXX) -bundle -flat_namespace -undefined suppress"
LDDLLFLAGS="-fno-common"
CFLAGS="$CFLAGS -ffixed-r13 -no-cpp-precomp -Dsocklen_t=u_int32_t"
CXXFLAGS="$CXXFLAGS -ffixed-r13 -no-cpp-precomp -Dsocklen_t=u_int32_t"
fi
fi
fi
fi
if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no" -a "$ac_cv_c_dll_macho" = "no"
then
AC_MSG_ERROR([Could not find how to build a dynamically linked library])
fi
......@@ -2455,6 +2471,20 @@ then
CXXFLAGS="$CXXFLAGS -D__sun__"
fi
dnl *** check for the need to define __powerpc__
AC_CACHE_CHECK(whether we need to define __powerpc__,ac_cv_cpp_def_powerpc,
AC_EGREP_CPP(yes,[#if (defined(__ppc__) || defined(__PPC__) || defined(__POWERPC__)) && !defined(__powerpc__)
yes
#endif],
ac_cv_cpp_def_powerpc="yes", ac_cv_cpp_def_powerpc="no"))
if test "$ac_cv_cpp_def_powerpc" = "yes"
then
CFLAGS="$CFLAGS -D__powerpc__"
CXXFLAGS="$CXXFLAGS -D__powerpc__"
fi
dnl **** Test Winelib-related features of the C++ compiler
AC_LANG_CPLUSPLUS()
if test "x${GCC}" = "xyes"
......@@ -2710,9 +2740,12 @@ if test -z "$WINE_LIBRARY_ROOT"
then
WINE_LIBRARY_ROOT=":/usr/lib/wine:/usr/local/lib:/usr/local/lib/wine:/opt/wine/lib"
else
AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.so],[
AC_MSG_ERROR([Could not find the Wine libraries (libwine.so)])
],$WINE_LIBRARY_ROOT)
AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.so],
[
AC_PATH_FILE(WINE_LIBRARY_ROOT,[libwine.dylib],
[AC_MSG_ERROR([Could not find the Wine libraries (libwine.dylib or libwine.so)])],
$WINE_LIBRARY_ROOT)
], $WINE_LIBRARY_ROOT)
fi
AC_PATH_LIBRARY(WINE_LIBRARY_ROOT,[-lwine],[],[
AC_MSG_ERROR([Could not link with the Wine libraries (libwine.so)])
......@@ -2746,6 +2779,7 @@ then
WINE_DLL_ROOT="/lib:/lib/wine:/usr/lib:/usr/lib/wine:/usr/local/lib:/usr/local/lib/wine"
fi
fi
AC_PATH_FILE(WINE_DLL_ROOT,[libntdll.def],[
AC_MSG_ERROR([Could not find the Wine dlls (libntdll.def)])
],[$WINE_DLL_ROOT])
......@@ -2771,7 +2805,13 @@ then
AC_MSG_ERROR([Could not find Wine's wrc tool])
fi
LDPATH="LD_LIBRARY_PATH=\"$LDPATH:\$\$LD_LIBRARY_PATH\""
case $build_os in
darwin*|macosx*)
LDPATH="DYLD_LIBRARY_PATH=\"$LDPATH:\$\$DYLD_LIBRARY_PATH\"";;
*)
LDPATH="LD_LIBRARY_PATH=\"$LDPATH:\$\$LD_LIBRARY_PATH\""
esac
AC_SUBST(LDPATH)
AC_SUBST(WINE_INCLUDE_PATH)
AC_SUBST(WINE_LIBRARY_PATH)
......@@ -3000,8 +3040,6 @@ ALL_LIBRARIES = $(LIBRARIES:%=-l%) $(GLOBAL_LIBRARIES:%=-l%) $(WINE_LIBRARIES)
LDSHARED = @LDSHARED@
LDXXSHARED= @LDXXSHARED@
LDDLLFLAGS= @LDDLLFLAGS@
STRIP = strip
STRIPFLAGS= --strip-unneeded
LN_S = @LN_S@
RM = rm -f
MV = mv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment