dplayx: Forward IDirectPlay::GetCaps to ::GetPlayerCaps.
[wine] / aclocal.m4
index f574ba1..ed27013 100644 (file)
@@ -22,18 +22,20 @@ dnl configuration script generated by Autoconf, you may include it
 dnl under the same distribution terms that you use for the rest of
 dnl that program.
 
-dnl **** Get the ldd program name; used by WINE_GET_SONAME ****
+dnl **** Get the programs used by WINE_GET_SONAME ****
 dnl
-dnl Usage: WINE_PATH_LDD
+dnl Usage: WINE_PATH_SONAME_TOOLS
 dnl
-AC_DEFUN([WINE_PATH_LDD],[AC_PATH_PROG(LDD,ldd,true,/sbin:/usr/sbin:$PATH)])
+AC_DEFUN([WINE_PATH_SONAME_TOOLS],
+[AC_PATH_PROG(LDD,ldd,true,/sbin:/usr/sbin:$PATH)
+AC_CHECK_TOOLS(READELF,[readelf],true)])
 
 dnl **** Extract the soname of a library ****
 dnl
 dnl Usage: WINE_CHECK_SONAME(library, function, [action-if-found, [action-if-not-found, [other_libraries, [pattern]]]])
 dnl
 AC_DEFUN([WINE_CHECK_SONAME],
-[AC_REQUIRE([WINE_PATH_LDD])dnl
+[AC_REQUIRE([WINE_PATH_SONAME_TOOLS])dnl
 AS_VAR_PUSHDEF([ac_Lib],[ac_cv_lib_soname_$1])dnl
 m4_pushdef([ac_lib_pattern],m4_default([$6],[lib$1]))dnl
 AC_MSG_CHECKING([for -l$1])
@@ -42,9 +44,11 @@ AC_CACHE_VAL(ac_Lib,
 LIBS="-l$1 $5 $LIBS"
   AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
   [case "$LIBEXT" in
-    dll) ;;
+    dll) AS_VAR_SET(ac_Lib,[`$ac_cv_path_LDD conftest.exe | grep "$1" | sed -e "s/dll.*/dll/"';2,$d'`]) ;;
     dylib) AS_VAR_SET(ac_Lib,[`otool -L conftest$ac_exeext | grep "ac_lib_pattern\\.[[0-9A-Za-z.]]*dylib" | sed -e "s/^.*\/\(ac_lib_pattern\.[[0-9A-Za-z.]]*dylib\).*$/\1/"';2,$d'`]) ;;
-    *) AS_VAR_SET(ac_Lib,[`$ac_cv_path_LDD conftest$ac_exeext | grep "ac_lib_pattern\\.$LIBEXT" | sed -e "s/^.*\(ac_lib_pattern\.$LIBEXT[[^     ]]*\).*$/\1/"';2,$d'`]) ;;
+    *) AS_VAR_SET(ac_Lib,[`$READELF -d conftest$ac_exeext | grep "NEEDED.*ac_lib_pattern\\.$LIBEXT" | sed -e "s/^.*\\m4_dquote(\\(ac_lib_pattern\\.$LIBEXT[[^   ]]*\\)\\).*$/\1/"';2,$d'`])
+       AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = x],
+             [AS_VAR_SET(ac_Lib,[`$LDD conftest$ac_exeext | grep "ac_lib_pattern\\.$LIBEXT" | sed -e "s/^.*\(ac_lib_pattern\.$LIBEXT[[^         ]]*\).*$/\1/"';2,$d'`])]) ;;
   esac])
   LIBS=$ac_check_soname_save_LIBS])dnl
 AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = "x"],
@@ -62,7 +66,7 @@ dnl
 dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]])
 dnl
 AC_DEFUN([WINE_TRY_ASM_LINK],
-[AC_LINK_IFELSE(AC_LANG_PROGRAM([[$2]],[[asm($1); $3]]),[$4],[$5])])
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[asm($1); $3]])],[$4],[$5])])
 
 dnl **** Check if we can link an empty program with special CFLAGS ****
 dnl
@@ -75,7 +79,7 @@ AC_DEFUN([WINE_TRY_CFLAGS],
 AC_CACHE_CHECK([whether the compiler supports $1], ac_var,
 [ac_wine_try_cflags_saved=$CFLAGS
 CFLAGS="$CFLAGS $1"
-AC_LINK_IFELSE(AC_LANG_SOURCE([int main(int argc, char *argv[]) { return 0; }]),
+AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) { return 0; }]])],
                [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
 CFLAGS=$ac_wine_try_cflags_saved])
 AS_IF([test AS_VAR_GET(ac_var) = yes],
@@ -89,7 +93,7 @@ dnl
 AC_DEFUN([WINE_TRY_SHLIB_FLAGS],
 [ac_wine_try_cflags_saved=$CFLAGS
 CFLAGS="$CFLAGS $1"
-AC_LINK_IFELSE([void myfunc() {}],[$2],[$3])
+AC_LINK_IFELSE([AC_LANG_SOURCE([void myfunc() {}])],[$2],[$3])
 CFLAGS=$ac_wine_try_cflags_saved])
 
 dnl **** Check whether we need to define a symbol on the compiler command line ****
@@ -125,10 +129,12 @@ dnl
 AC_DEFUN([WINE_CHECK_MINGW_PROG],
 [case "$host_cpu" in
   i[[3456789]]86*)
-    ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32, mingw32msvc, mingw32],
-                        m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-ac_wine_prefix-$2 ]))" ;;
+    ac_prefix_list="m4_foreach([ac_wine_prefix],[w64-mingw32, pc-mingw32, mingw32msvc, mingw32],
+                        m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-ac_wine_prefix-$2 ]))
+                        mingw32-$2" ;;
   x86_64)
-    ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32,w64-mingw32],[x86_64-ac_wine_prefix-$2 ])" ;;
+    ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32, w64-mingw32, mingw32msvc],
+                        m4_foreach([ac_wine_cpu],[x86_64,amd64],[ac_wine_cpu-ac_wine_prefix-$2 ]))" ;;
   *)
     ac_prefix_list="" ;;
 esac
@@ -140,7 +146,19 @@ dnl
 dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS])
 dnl
 AC_DEFUN([WINE_CONFIG_HELPERS],
-[wine_fn_append_file ()
+[ALL_MAKEFILE_DEPENDS="
+# Rules automatically generated by configure
+
+.INIT: Makefile
+.MAKEFILEDEPS:
+all: Makefile
+Makefile: Makefile.in Make.vars.in Make.rules config.status
+       @./config.status Make.tmp Makefile"
+
+ALL_POT_FILES=""
+AC_SUBST(ALL_TEST_RESOURCES,"")
+
+wine_fn_append_file ()
 {
     AS_VAR_APPEND($[1]," \\$as_nl      $[2]")
 }
@@ -150,42 +168,404 @@ wine_fn_append_rule ()
     AS_VAR_APPEND($[1],"$as_nl$[2]")
 }
 
-wine_fn_config_makefile ()
+wine_fn_has_flag ()
+{
+    expr ",$[2]," : ".*,$[1],.*" >/dev/null
+}
+
+wine_fn_all_dir_rules ()
 {
     ac_dir=$[1]
-    ac_deps=$[2]
+    ac_alldeps=$[2]
+    ac_makedep="\$(MAKEDEP)"
+    ac_input=Make.vars.in:$ac_dir/Makefile.in
+    if test $ac_dir != tools
+    then
+        dnl makedep is in tools so tools makefile cannot depend on it
+        ac_alldeps="$[2] $ac_makedep"
+    else
+        ac_alldeps="$[2] include/config.h"
+    fi
+    case $[2] in
+      *.in) ac_input=$ac_input:$[2] ;;
+      *) ac_makedep="$[2] $ac_makedep" ;;
+    esac
+
     wine_fn_append_file ALL_DIRS $ac_dir
     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
-"\$(RECURSE_TARGETS:%=$ac_dir/%) $ac_dir: $ac_dir/Makefile
-$ac_dir/Makefile $ac_dir/__depend__: $ac_dir/Makefile.in config.status $ac_deps
-       @./config.status --file $ac_dir/Makefile && cd $ac_dir && \$(MAKE) depend"
+"__clean__: $ac_dir/__clean__
+.PHONY: $ac_dir/__clean__
+$ac_dir/__clean__: $ac_dir/Makefile
+       @cd $ac_dir && \$(MAKE) clean
+       \$(RM) $ac_dir/Makefile
+$ac_dir/Makefile: $ac_dir/Makefile.in Make.vars.in config.status $ac_alldeps
+       @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend
+depend: $ac_dir/__depend__
+.PHONY: $ac_dir/__depend__
+$ac_dir/__depend__: $ac_makedep dummy
+       @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend"
+}
+
+wine_fn_pot_rules ()
+{
+    ac_dir=$[1]
+    ac_flags=$[2]
+
+    test "x$with_gettextpo" = xyes || return
+
+    if wine_fn_has_flag mc $ac_flags
+    then
+        wine_fn_append_file ALL_POT_FILES $ac_dir/msg.pot
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/msg.pot: $ac_dir/Makefile dummy
+       @cd $ac_dir && \$(MAKE) msg.pot
+$ac_dir/msg.pot: tools/wmc include"
+    fi
+    if wine_fn_has_flag po $ac_flags
+    then
+        wine_fn_append_file ALL_POT_FILES $ac_dir/rsrc.pot
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/rsrc.pot: $ac_dir/Makefile dummy
+       @cd $ac_dir && \$(MAKE) rsrc.pot
+$ac_dir/rsrc.pot: tools/wrc include"
+    fi
+}
+
+wine_fn_config_makefile ()
+{
+    ac_dir=$[1]
+    ac_enable=$[2]
+    ac_flags=$[3]
+    ac_rules=$[4]
+    AS_VAR_IF([$ac_enable],[no],[return 0])
+
+    wine_fn_all_dir_rules $ac_dir ${ac_rules:-Make.rules}
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"all: $ac_dir
+.PHONY: $ac_dir
+$ac_dir: $ac_dir/Makefile dummy
+       @cd $ac_dir && \$(MAKE)"
+
+    wine_fn_has_flag install-lib $ac_flags || wine_fn_has_flag install-dev $ac_flags || return
+
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
+$ac_dir/__install__:: $ac_dir
+       @cd $ac_dir && \$(MAKE) install
+$ac_dir/__uninstall__:: $ac_dir/Makefile
+       @cd $ac_dir && \$(MAKE) uninstall
+install:: $ac_dir/__install__
+__uninstall__: $ac_dir/__uninstall__"
+
+    if wine_fn_has_flag install-lib $ac_flags
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+".PHONY: $ac_dir/__install-lib__
+$ac_dir/__install-lib__:: $ac_dir
+       @cd $ac_dir && \$(MAKE) install-lib
+install-lib:: $ac_dir/__install-lib__"
+    fi
+
+    if wine_fn_has_flag install-dev $ac_flags
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+".PHONY: $ac_dir/__install-dev
+$ac_dir/__install-dev__:: $ac_dir
+       @cd $ac_dir && \$(MAKE) install-dev
+install-dev:: $ac_dir/__install-dev__"
+    fi
 }
 
 wine_fn_config_lib ()
 {
     ac_name=$[1]
-    wine_fn_append_file ALL_STATIC_LIBS dlls/$ac_name/lib$ac_name.a
+    ac_flags=$[2]
+    ac_dir=dlls/$ac_name
+    wine_fn_config_makefile $ac_dir enable_$ac_name "$ac_flags" dlls/Makeimplib.rules
+
+    if wine_fn_has_flag install-dev $ac_flags
+    then :
+    else
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
+$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir)
+       \$(INSTALL_DATA) $ac_dir/lib$ac_name.a \$(DESTDIR)\$(dlldir)/lib$ac_name.a
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_name.a
+install install-dev:: $ac_dir/__install__
+__uninstall__: $ac_dir/__uninstall__"
+    fi
+
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__builddeps__: $ac_dir"
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: tools/widl tools/winebuild tools/winegcc include"
+}
+
+wine_fn_config_dll ()
+{
+    ac_name=$[1]
+    ac_dir=dlls/$ac_name
+    ac_enable=$[2]
+    ac_flags=$[3]
+    ac_implib=${4:-$ac_name}
+    ac_file=$ac_dir/lib$ac_implib
+    ac_dll=$ac_name
+    ac_deps="tools/widl tools/winebuild tools/winegcc include"
+    ac_implibflags=""
+
+    case $ac_name in
+      *16) ac_implibflags=" -m16" ;;
+      *.*) ;;
+      *)   ac_dll=$ac_dll.dll ;;
+    esac
+
+    wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" dlls/Makedll.rules
+
+    AS_VAR_IF([$ac_enable],[no],
+              dnl enable_win16 is special in that it disables import libs too
+              [test "$ac_enable" != enable_win16 || return 0
+               wine_fn_has_flag implib $ac_flags && wine_fn_all_dir_rules $ac_dir dlls/Makedll.rules],
+
+              [wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir: __builddeps__
+manpages htmlpages sgmlpages xmlpages:: $ac_dir/Makefile
+       @cd $ac_dir && \$(MAKE) \$[@]"
+
+        if wine_fn_has_flag install-lib $ac_flags
+        then :
+        else
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+".PHONY: $ac_dir/__install-lib__ $ac_dir/__uninstall__
+install install-lib:: $ac_dir/__install-lib__
+__uninstall__: $ac_dir/__uninstall__"
+            if test -n "$DLLEXT"
+            then
+                wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
+       \$(INSTALL_PROGRAM) $ac_dir/$ac_dll$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT
+       \$(INSTALL_DATA) $ac_dir/$ac_dll.fake \$(DESTDIR)\$(fakedlldir)/$ac_dll
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_dll"
+            else
+                wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
+       \$(INSTALL_PROGRAM) $ac_dir/$ac_dll \$(DESTDIR)\$(dlldir)/$ac_dll
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll"
+            fi
+        fi
+
+        wine_fn_pot_rules $ac_dir $ac_flags])
+
+    if wine_fn_has_flag staticimplib $ac_flags
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT
+$ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps
+$ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile
+       @cd $ac_dir && \$(MAKE) lib$ac_implib.def
+$ac_file.$STATIC_IMPLIBEXT: $ac_dir/Makefile dummy
+       @cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT
+.PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
+$ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
+       \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
+install install-dev:: $ac_dir/__install-dev__
+__uninstall__: $ac_dir/__uninstall__"
+
+        if test "$IMPLIBEXT" != "$STATIC_IMPLIBEXT"
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install-dev__:: $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir) __builddeps__
+       \$(INSTALL_DATA) $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
+        fi
+
+        if test "x$CROSSTEST_DISABLE" = x
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: $ac_file.cross.a
+$ac_file.cross.a: $ac_dir/Makefile dummy
+       @cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a"
+        fi
+
+    elif wine_fn_has_flag implib $ac_flags
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: $ac_file.$IMPLIBEXT
+$ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
+       \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
+$ac_file.a: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
+       \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
+.PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
+$ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
+       \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
+install install-dev:: $ac_dir/__install-dev__
+__uninstall__: $ac_dir/__uninstall__"
+        if test "x$CROSSTEST_DISABLE" = x
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: $ac_file.cross.a
+$ac_file.cross.a: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
+       \$(WINEBUILD) \$(CROSSTARGET:%=-b %)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec"
+        fi
+
+        if test "$ac_name" != "$ac_implib"
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: dlls/lib$ac_implib.$IMPLIBEXT
+dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
+       \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
+clean::
+       \$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
+            if test "x$CROSSTEST_DISABLE" = x
+            then
+                wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"__builddeps__: dlls/lib$ac_implib.cross.a
+dlls/lib$ac_implib.cross.a: $ac_file.cross.a
+       \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.cross.a \$[@]"
+            fi
+        fi
+    fi
+}
+
+wine_fn_config_program ()
+{
+    ac_name=$[1]
+    ac_dir=programs/$ac_name
+    ac_enable=$[2]
+    ac_flags=$[3]
+    ac_program=$ac_name
+
+    case $ac_name in
+      *.*) ;;
+      *)   ac_program=$ac_program.exe ;;
+    esac
+
+    wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" programs/Makeprog.rules
+
+    AS_VAR_IF([$ac_enable],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir: __builddeps__"
+
+    wine_fn_pot_rules $ac_dir $ac_flags
+
+    wine_fn_has_flag install $ac_flags || return
     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
-"dlls/$ac_name/__install__ dlls/$ac_name/__install-dev__: dlls/$ac_name
-dlls/$ac_name dlls/$ac_name/lib$ac_name.cross.a: tools/widl tools/winebuild tools/winegcc include
-dlls/$ac_name/lib$ac_name.cross.a: dlls/$ac_name/Makefile dummy
-       @cd dlls/$ac_name && \$(MAKE) lib$ac_name.cross.a"
+".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
+install install-lib:: $ac_dir/__install__
+__uninstall__: $ac_dir/__uninstall__"
+
+    if test -n "$DLLEXT"
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
+       \$(INSTALL_PROGRAM) $ac_dir/$ac_program$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT
+       \$(INSTALL_DATA) $ac_dir/$ac_program.fake \$(DESTDIR)\$(fakedlldir)/$ac_program
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_program"
+
+        if test "x$enable_tools" != xno && wine_fn_has_flag installbin $ac_flags
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install__:: tools \$(DESTDIR)\$(bindir)
+       \$(INSTALL_SCRIPT) tools/wineapploader \$(DESTDIR)\$(bindir)/$ac_name
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(bindir)/$ac_name"
+        fi
+    else
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
+       \$(INSTALL_PROGRAM) $ac_dir/$ac_program \$(DESTDIR)\$(dlldir)/$ac_program
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program"
+    fi
+
+    if test "x$enable_tools" != xno && wine_fn_has_flag manpage $ac_flags
+    then
+        wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(mandir)/man\$(prog_manext)
+       \$(INSTALL_DATA) $ac_dir/$ac_name.man \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)
+$ac_dir/__uninstall__::
+       \$(RM) \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)"
+    fi])
 }
 
 wine_fn_config_test ()
 {
     ac_dir=$[1]
     ac_name=$[2]
-    wine_fn_append_file ALL_TEST_BINARIES $ac_name.exe
-    wine_fn_append_rule ALL_WINETEST_DEPENDS \
-"$ac_name.exe: \$(TOPOBJDIR)/$ac_dir/$ac_name.exe$DLLEXT
-       cp \$(TOPOBJDIR)/$ac_dir/$ac_name.exe$DLLEXT \$[@] && \$(STRIP) \$[@]
-$ac_name.rc:
-       echo \"$ac_name.exe TESTRES \\\"$ac_name.exe\\\"\" >\$[@] || (\$(RM) \$[@] && false)
-$ac_name.res: $ac_name.rc $ac_name.exe"
-    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: __builddeps__"
-    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir/__crosstest__: __buildcrossdeps__"
-}])
+    ac_flags=$[3]
+    wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
+    wine_fn_all_dir_rules $ac_dir Maketest.rules
+
+    AS_VAR_IF([enable_tests],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"all: $ac_dir
+.PHONY: $ac_dir
+$ac_dir: $ac_dir/Makefile programs/winetest/Makefile __builddeps__ dummy
+       @cd $ac_dir && \$(MAKE)
+programs/winetest: $ac_dir
+check test: $ac_dir/__test__
+.PHONY: $ac_dir/__test__
+$ac_dir/__test__: dummy
+       @cd $ac_dir && \$(MAKE) test
+testclean::
+       \$(RM) $ac_dir/*.ok"
+
+        if test "x$CROSSTEST_DISABLE" = x
+        then
+            wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"crosstest: $ac_dir/__crosstest__
+.PHONY: $ac_dir/__crosstest__
+$ac_dir/__crosstest__: $ac_dir/Makefile __builddeps__ dummy
+       @cd $ac_dir && \$(MAKE) crosstest"
+        fi])
+}
+
+wine_fn_config_tool ()
+{
+    ac_dir=$[1]
+    ac_flags=$[2]
+    AS_VAR_IF([enable_tools],[no],[return 0])
+
+    wine_fn_config_makefile $ac_dir enable_tools $ac_flags
+
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__tooldeps__: $ac_dir"
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: libs/port"
+    case $ac_dir in
+      tools/winebuild) wine_fn_append_rule ALL_MAKEFILE_DEPENDS "\$(WINEBUILD): $ac_dir" ;;
+    esac
+}
+
+wine_fn_config_makerules ()
+{
+    ac_rules=$[1]
+    ac_deps=$[2]
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_rules: $ac_rules.in $ac_deps config.status
+       @./config.status $ac_rules
+distclean::
+       \$(RM) $ac_rules"
+}
+
+wine_fn_config_symlink ()
+{
+    ac_link=$[1]
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"$ac_link:
+       @./config.status $ac_link
+distclean::
+       \$(RM) $ac_link"
+}
+
+if test "x$CROSSTEST_DISABLE" != x
+then
+    wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
+"crosstest:
+       @echo \"crosstest is not supported (mingw not installed?)\" && false"
+fi])
 
 dnl **** Define helper function to append a file to a makefile file list ****
 dnl
@@ -208,99 +588,75 @@ AC_DEFUN([WINE_CONFIG_EXTRA_DIR],
 
 dnl **** Create symlinks from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_SYMLINK(name,target)
+dnl Usage: WINE_CONFIG_SYMLINK(name,target,enable)
 dnl
 AC_DEFUN([WINE_CONFIG_SYMLINK],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
-AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
-m4_if([$2],,[test "$srcdir" = "." || ])WINE_APPEND_FILE(ALL_SYMLINKS,[$1])])
+m4_ifval([$3],[if test "x$[$3]" != xno; then
+])AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
+m4_if([$2],,[test "$srcdir" = "." || ])wine_fn_config_symlink $1[]m4_ifval([$3],[
+fi])])
 
 dnl **** Create a make rules file from config.status ****
 dnl
 dnl Usage: WINE_CONFIG_MAKERULES(file,var,deps)
 dnl
-AC_DEFUN([WINE_CONFIG_MAKERULES],
-[WINE_APPEND_FILE(ALL_MAKERULES,[$1])
-WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[$1: m4_ifval([$3],[$1.in $3],[$1.in]) config.status])
+AC_DEFUN([WINE_CONFIG_MAKERULES],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
+wine_fn_config_makerules $1 $3
 $2=$1
 AC_SUBST_FILE([$2])dnl
 AC_CONFIG_FILES([$1])])
 
 dnl **** Create a makefile from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_MAKEFILE(file,deps,var,enable)
+dnl Usage: WINE_CONFIG_MAKEFILE(file,enable,flags)
 dnl
 AC_DEFUN([WINE_CONFIG_MAKEFILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
-m4_pushdef([ac_dir],m4_bpatsubst([$1],[^\(\(.*\)/\)?Makefile$],[\2]))dnl
-m4_pushdef([ac_name],m4_bpatsubst(ac_dir,[.*/\(.*\)$],[\1]))dnl
-m4_if(ac_dir,,WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[$1: $1.in $2 config.status])
-AC_CONFIG_FILES([$1]),
-[wine_fn_config_makefile ac_dir m4_if(ac_dir,tools,[$2],["$2 \$(MAKEDEP)"])
-AS_VAR_PUSHDEF([ac_enable],m4_default([$4],[enable_]ac_name))dnl
-m4_ifval([$3],[test "x$ac_enable" != xno]m4_foreach([ac_var],[$3],[ && WINE_APPEND_FILE(ac_var,ac_dir)]))
-AS_VAR_POPDEF([ac_enable])])dnl
-m4_popdef([ac_dir])dnl
-m4_popdef([ac_name])])
+AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
+wine_fn_config_makefile [$1] ac_enable [$3]dnl
+AS_VAR_POPDEF([ac_enable])])
 
 dnl **** Create a dll makefile from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_DLL(name,enable,implib,implibsrc)
-dnl
-AC_DEFUN([WINE_CONFIG_DLL],
-[m4_pushdef([ac_implib],m4_ifval([$3],[dlls/$1/lib$3.$IMPLIBEXT]))dnl
-m4_pushdef([ac_crosslib],m4_ifval([$3],[dlls/$1/lib$3.cross.a]))dnl
-m4_pushdef([ac_staticlib],m4_ifval([$4],[dlls/$1/lib$3.$STATIC_IMPLIBEXT]))dnl
-m4_pushdef([ac_symlink],m4_if([$1],[$3],,[dlls/lib$3.$IMPLIBEXT]))dnl
-m4_ifval(ac_implib,[m4_ifval([$2],[test "x$[$2]" != xno && ])WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_implib)dnl
-m4_ifval(ac_symlink,[ && WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_symlink)])dnl
-m4_ifval(ac_staticlib,[ && WINE_APPEND_FILE(ALL_IMPORT_LIBS,ac_staticlib)])
-])WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,
-[m4_ifval(ac_implib,[ac_implib m4_ifval(ac_staticlib,[ac_staticlib ])ac_crosslib: tools/widl tools/winebuild tools/winegcc include
-m4_ifval(ac_symlink,[ac_symlink: ac_implib
-       \$(RM) \$[@] && \$(LN_S) $1/lib$3.$IMPLIBEXT \$[@]
-dlls/lib$3.cross.a: ac_crosslib
-       \$(RM) \$[@] && \$(LN_S) $1/lib$3.cross.a \$[@]
-clean::
-       \$(RM) ac_symlink
-])m4_ifval(ac_staticlib,[dlls/$1/lib$3.def: dlls/$1/$1.spec dlls/$1/Makefile
-       @cd dlls/$1 && \$(MAKE) \`basename \$[@]\`
-ac_staticlib ac_crosslib: dlls/$1/Makefile dummy
-       @cd dlls/$1 && \$(MAKE) \`basename \$[@]\`],
-[ac_implib ac_crosslib: dlls/$1/$1.spec dlls/$1/Makefile
-       @cd dlls/$1 && \$(MAKE) \`basename \$[@]\`])
-])dlls/$1 dlls/$1/__install__ dlls/$1/__install-lib__ dlls/$1/__install-dev__: __builddeps__])
-WINE_CONFIG_MAKEFILE([dlls/$1/Makefile],[dlls/Makedll.rules],[ALL_DLL_DIRS],[$2])dnl
-m4_popdef([ac_implib])dnl
-m4_popdef([ac_crosslib])dnl
-m4_popdef([ac_staticlib])dnl
-m4_popdef([ac_symlink])])
+dnl Usage: WINE_CONFIG_DLL(name,enable,flags,implib)
+dnl
+AC_DEFUN([WINE_CONFIG_DLL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
+AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
+wine_fn_config_dll [$1] ac_enable [$3] [$4]dnl
+AS_VAR_POPDEF([ac_enable])])
 
 dnl **** Create a program makefile from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_PROGRAM(name,var,enable)
+dnl Usage: WINE_CONFIG_PROGRAM(name,enable,flags)
 dnl
-AC_DEFUN([WINE_CONFIG_PROGRAM],
-[WINE_APPEND_RULE(ALL_MAKEFILE_DEPENDS,[programs/$1 programs/$1/__install__ programs/$1/__install-lib__: __builddeps__])
-WINE_CONFIG_MAKEFILE([programs/$1/Makefile],[programs/Makeprog.rules],[$2],[$3])])
+AC_DEFUN([WINE_CONFIG_PROGRAM],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
+AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
+wine_fn_config_program [$1] ac_enable [$3]dnl
+AS_VAR_POPDEF([ac_enable])])
 
 dnl **** Create a test makefile from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_TEST(dir)
+dnl Usage: WINE_CONFIG_TEST(dir,flags)
 dnl
 AC_DEFUN([WINE_CONFIG_TEST],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
 m4_pushdef([ac_suffix],m4_if(m4_substr([$1],0,9),[programs/],[.exe_test],[_test]))dnl
 m4_pushdef([ac_name],[m4_bpatsubst([$1],[.*/\(.*\)/tests$],[\1])])dnl
-wine_fn_config_test $1 ac_name[]ac_suffix
-WINE_CONFIG_MAKEFILE([$1/Makefile],[Maketest.rules],[ALL_TEST_DIRS],[enable_tests])dnl
+wine_fn_config_test $1 ac_name[]ac_suffix [$2]dnl
 m4_popdef([ac_suffix])dnl
 m4_popdef([ac_name])])
 
 dnl **** Create a static lib makefile from config.status ****
 dnl
-dnl Usage: WINE_CONFIG_LIB(name)
+dnl Usage: WINE_CONFIG_LIB(name,flags)
 dnl
 AC_DEFUN([WINE_CONFIG_LIB],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
-wine_fn_config_lib $1
-WINE_CONFIG_MAKEFILE([dlls/$1/Makefile],[dlls/Makeimplib.rules],[ALL_STATICLIB_DIRS])])
+wine_fn_config_lib [$1] [$2]])
+
+dnl **** Create a tool makefile from config.status ****
+dnl
+dnl Usage: WINE_CONFIG_TOOL(name,flags)
+dnl
+AC_DEFUN([WINE_CONFIG_TOOL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
+wine_fn_config_tool [$1] [$2]])
 
 dnl **** Add a message to the list displayed at the end ****
 dnl