ole32: Error handling clean up in local_server_thread.
[wine/multimedia.git] / aclocal.m4
blob1745d16f1c010caadafcc37b60444a27d5c3b8c9
1 dnl Macros used to build the Wine configure script
2 dnl
3 dnl Copyright 2002 Alexandre Julliard
4 dnl
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2.1 of the License, or (at your option) any later version.
9 dnl
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 dnl Lesser General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library; if not, write to the Free Software
17 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 dnl
19 dnl As a special exception to the GNU Lesser General Public License,
20 dnl if you distribute this file as part of a program that contains a
21 dnl configuration script generated by Autoconf, you may include it
22 dnl under the same distribution terms that you use for the rest of
23 dnl that program.
25 dnl **** Initialize the programs used by other checks ****
26 dnl
27 dnl Usage: WINE_PATH_SONAME_TOOLS
28 dnl Usage: WINE_PATH_PKG_CONFIG
29 dnl
30 AC_DEFUN([WINE_PATH_SONAME_TOOLS],
31 [AC_PATH_PROG(LDD,ldd,true,/sbin:/usr/sbin:$PATH)
32 AC_CHECK_TOOL(READELF,[readelf],true)])
34 AC_DEFUN([WINE_PATH_PKG_CONFIG],
35 [AC_CHECK_TOOL(PKG_CONFIG,[pkg-config])])
37 dnl **** Extract the soname of a library ****
38 dnl
39 dnl Usage: WINE_CHECK_SONAME(library, function, [action-if-found, [action-if-not-found, [other_libraries, [pattern]]]])
40 dnl
41 AC_DEFUN([WINE_CHECK_SONAME],
42 [AC_REQUIRE([WINE_PATH_SONAME_TOOLS])dnl
43 AS_VAR_PUSHDEF([ac_Lib],[ac_cv_lib_soname_$1])dnl
44 m4_pushdef([ac_lib_pattern],m4_default([$6],[lib$1]))dnl
45 AC_MSG_CHECKING([for -l$1])
46 AC_CACHE_VAL(ac_Lib,
47 [ac_check_soname_save_LIBS=$LIBS
48 LIBS="-l$1 $5 $LIBS"
49   AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
50   [case "$LIBEXT" in
51     dll) AS_VAR_SET(ac_Lib,[`$ac_cv_path_LDD conftest.exe | grep "$1" | sed -e "s/dll.*/dll/"';2,$d'`]) ;;
52     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'`]) ;;
53     *) 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'`])
54        AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = x],
55              [AS_VAR_SET(ac_Lib,[`$LDD conftest$ac_exeext | grep "ac_lib_pattern\\.$LIBEXT" | sed -e "s/^.*\(ac_lib_pattern\.$LIBEXT[[^  ]]*\).*$/\1/"';2,$d'`])]) ;;
56   esac])
57   LIBS=$ac_check_soname_save_LIBS])dnl
58 AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = "x"],
59       [AC_MSG_RESULT([not found])
60        $4],
61       [AC_MSG_RESULT(AS_VAR_GET(ac_Lib))
62        AC_DEFINE_UNQUOTED(AS_TR_CPP(SONAME_LIB$1),["]AS_VAR_GET(ac_Lib)["],
63                           [Define to the soname of the lib$1 library.])
64        $3])dnl
65 m4_popdef([ac_lib_pattern])dnl
66 AS_VAR_POPDEF([ac_Lib])])
68 dnl **** Get flags from pkg-config or alternate xxx-config program ****
69 dnl
70 dnl Usage: WINE_PACKAGE_FLAGS(var,pkg-name,[default-lib,[cflags-alternate,libs-alternate]])
71 dnl
72 AC_DEFUN([WINE_PACKAGE_FLAGS],
73 [AC_REQUIRE([WINE_PATH_PKG_CONFIG])dnl
74 AC_ARG_VAR([$1]_CFLAGS, [C compiler flags for $2, overriding pkg-config])dnl
75 AS_IF([test -n "$[$1]_CFLAGS"],[],
76       [test -n "$PKG_CONFIG"],
77       [[$1]_CFLAGS=`$PKG_CONFIG --cflags [$2] 2>/dev/null`])
78 m4_ifval([$4],[[$1]_CFLAGS=[$]{[$1]_CFLAGS:-`[$4] 2>/dev/null`}])
79 CPPFLAGS="$CPPFLAGS $[$1]_CFLAGS"
80 AC_ARG_VAR([$1]_LIBS, [Linker flags for $2, overriding pkg-config])dnl
81 AS_IF([test -n "$[$1]_LIBS"],[],
82       [test -n "$PKG_CONFIG"],
83       [[$1]_LIBS=`$PKG_CONFIG --libs [$2] 2>/dev/null`])
84 m4_ifval([$5],[[$1]_LIBS=[$]{[$1]_LIBS:-`[$5] 2>/dev/null`}])
85 m4_ifval([$3],[[$1]_LIBS=[$]{[$1]_LIBS:-"$3"}])])
87 dnl **** Link C code with an assembly file ****
88 dnl
89 dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]])
90 dnl
91 AC_DEFUN([WINE_TRY_ASM_LINK],
92 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[asm($1); $3]])],[$4],[$5])])
94 dnl **** Check if we can link an empty program with special CFLAGS ****
95 dnl
96 dnl Usage: WINE_TRY_CFLAGS(flags,[action-if-yes,[action-if-no]])
97 dnl
98 dnl The default action-if-yes is to append the flags to EXTRACFLAGS.
99 dnl
100 AC_DEFUN([WINE_TRY_CFLAGS],
101 [AS_VAR_PUSHDEF([ac_var], ac_cv_cflags_[[$1]])dnl
102 AC_CACHE_CHECK([whether the compiler supports $1], ac_var,
103 [ac_wine_try_cflags_saved=$CFLAGS
104 CFLAGS="$CFLAGS $1"
105 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) { return 0; }]])],
106                [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
107 CFLAGS=$ac_wine_try_cflags_saved])
108 AS_IF([test AS_VAR_GET(ac_var) = yes],
109       [m4_default([$2], [EXTRACFLAGS="$EXTRACFLAGS $1"])], [$3])dnl
110 AS_VAR_POPDEF([ac_var])])
112 dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS ****
114 dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]])
116 AC_DEFUN([WINE_TRY_SHLIB_FLAGS],
117 [ac_wine_try_cflags_saved=$CFLAGS
118 CFLAGS="$CFLAGS $1"
119 AC_LINK_IFELSE([AC_LANG_SOURCE([void myfunc() {}])],[$2],[$3])
120 CFLAGS=$ac_wine_try_cflags_saved])
122 dnl **** Check whether we need to define a symbol on the compiler command line ****
124 dnl Usage: WINE_CHECK_DEFINE(name),[action-if-yes,[action-if-no]])
126 AC_DEFUN([WINE_CHECK_DEFINE],
127 [AS_VAR_PUSHDEF([ac_var],[ac_cv_cpp_def_$1])dnl
128 AC_CACHE_CHECK([whether we need to define $1],ac_var,
129     AC_EGREP_CPP(yes,[#ifndef $1
131 #endif],
132     [AS_VAR_SET(ac_var,yes)],[AS_VAR_SET(ac_var,no)]))
133 AS_IF([test AS_VAR_GET(ac_var) = yes],
134       [CFLAGS="$CFLAGS -D$1"
135   LINTFLAGS="$LINTFLAGS -D$1"])dnl
136 AS_VAR_POPDEF([ac_var])])
138 dnl **** Check for functions with some extra libraries ****
140 dnl Usage: WINE_CHECK_LIB_FUNCS(funcs,libs,[action-if-found,[action-if-not-found]])
142 AC_DEFUN([WINE_CHECK_LIB_FUNCS],
143 [ac_wine_check_funcs_save_LIBS="$LIBS"
144 LIBS="$LIBS $2"
145 AC_CHECK_FUNCS([$1],[$3],[$4])
146 LIBS="$ac_wine_check_funcs_save_LIBS"])
148 dnl **** Check for a mingw program, trying the various mingw prefixes ****
150 dnl Usage: WINE_CHECK_MINGW_PROG(variable,prog,[value-if-not-found],[path])
152 AC_DEFUN([WINE_CHECK_MINGW_PROG],
153 [case "$host_cpu" in
154   i[[3456789]]86*)
155     ac_prefix_list="m4_foreach([ac_wine_prefix],[w64-mingw32, pc-mingw32, mingw32msvc, mingw32],
156                         m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-ac_wine_prefix-$2 ]))
157                         mingw32-$2" ;;
158   x86_64)
159     ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32, w64-mingw32, mingw32msvc],
160                         m4_foreach([ac_wine_cpu],[x86_64,amd64],[ac_wine_cpu-ac_wine_prefix-$2 ]))" ;;
161   *)
162     ac_prefix_list="" ;;
163 esac
164 AC_CHECK_PROGS([$1],[$ac_prefix_list],[$3],[$4])])
167 dnl **** Define helper functions for creating config.status files ****
169 dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS])
171 AC_DEFUN([WINE_CONFIG_HELPERS],
172 [ALL_MAKEFILE_DEPENDS="
173 # Rules automatically generated by configure
175 .INIT: Makefile
176 .MAKEFILEDEPS:
177 all: Makefile
178 Makefile: Makefile.in Make.vars.in Make.rules config.status
179         @./config.status Make.tmp Makefile"
181 ALL_POT_FILES=""
182 AC_SUBST(ALL_TEST_RESOURCES,"")
184 wine_fn_append_file ()
186     AS_VAR_APPEND($[1]," \\$as_nl       $[2]")
189 wine_fn_append_rule ()
191     AS_VAR_APPEND($[1],"$as_nl$[2]")
194 wine_fn_has_flag ()
196     expr ",$[2]," : ".*,$[1],.*" >/dev/null
199 wine_fn_all_dir_rules ()
201     ac_dir=$[1]
202     ac_alldeps=$[2]
203     ac_makedep="\$(MAKEDEP)"
204     ac_input=Make.vars.in:$ac_dir/Makefile.in
205     if test $ac_dir != tools
206     then
207         dnl makedep is in tools so tools makefile cannot depend on it
208         ac_alldeps="$[2] $ac_makedep"
209     else
210         ac_alldeps="$[2] include/config.h"
211     fi
212     case $[2] in
213       *.in) ac_input=$ac_input:$[2] ;;
214       *) ac_makedep="$[2] $ac_makedep" ;;
215     esac
217     wine_fn_append_file ALL_DIRS $ac_dir
218     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
219 "__clean__: $ac_dir/__clean__
220 .PHONY: $ac_dir/__clean__
221 $ac_dir/__clean__: $ac_dir/Makefile
222         @cd $ac_dir && \$(MAKE) clean
223         \$(RM) $ac_dir/Makefile
224 $ac_dir/Makefile: $ac_dir/Makefile.in Make.vars.in config.status $ac_alldeps
225         @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend
226 depend: $ac_dir/__depend__
227 .PHONY: $ac_dir/__depend__
228 $ac_dir/__depend__: $ac_makedep dummy
229         @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend"
232 wine_fn_pot_rules ()
234     ac_dir=$[1]
235     ac_flags=$[2]
237     test "x$with_gettextpo" = xyes || return
239     if wine_fn_has_flag mc $ac_flags
240     then
241         wine_fn_append_file ALL_POT_FILES $ac_dir/msg.pot
242         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
243 "$ac_dir/msg.pot: $ac_dir/Makefile dummy
244         @cd $ac_dir && \$(MAKE) msg.pot
245 $ac_dir/msg.pot: tools/wmc include"
246     fi
247     if wine_fn_has_flag po $ac_flags
248     then
249         wine_fn_append_file ALL_POT_FILES $ac_dir/rsrc.pot
250         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
251 "$ac_dir/rsrc.pot: $ac_dir/Makefile dummy
252         @cd $ac_dir && \$(MAKE) rsrc.pot
253 $ac_dir/rsrc.pot: tools/wrc include"
254     fi
257 wine_fn_config_makefile ()
259     ac_dir=$[1]
260     ac_enable=$[2]
261     ac_flags=$[3]
262     ac_rules=$[4]
263     AS_VAR_IF([$ac_enable],[no],[return 0])
265     wine_fn_all_dir_rules $ac_dir ${ac_rules:-Make.rules}
266     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
267 "all: $ac_dir
268 .PHONY: $ac_dir
269 $ac_dir: $ac_dir/Makefile dummy
270         @cd $ac_dir && \$(MAKE)"
272     wine_fn_has_flag install-lib $ac_flags || wine_fn_has_flag install-dev $ac_flags || return
274     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
275 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
276 $ac_dir/__install__:: $ac_dir
277         @cd $ac_dir && \$(MAKE) install
278 $ac_dir/__uninstall__:: $ac_dir/Makefile
279         @cd $ac_dir && \$(MAKE) uninstall
280 install:: $ac_dir/__install__
281 __uninstall__: $ac_dir/__uninstall__"
283     if wine_fn_has_flag install-lib $ac_flags
284     then
285         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
286 ".PHONY: $ac_dir/__install-lib__
287 $ac_dir/__install-lib__:: $ac_dir
288         @cd $ac_dir && \$(MAKE) install-lib
289 install-lib:: $ac_dir/__install-lib__"
290     fi
292     if wine_fn_has_flag install-dev $ac_flags
293     then
294         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
295 ".PHONY: $ac_dir/__install-dev
296 $ac_dir/__install-dev__:: $ac_dir
297         @cd $ac_dir && \$(MAKE) install-dev
298 install-dev:: $ac_dir/__install-dev__"
299     fi
302 wine_fn_config_lib ()
304     ac_name=$[1]
305     ac_flags=$[2]
306     ac_dir=dlls/$ac_name
307     wine_fn_config_makefile $ac_dir enable_$ac_name "$ac_flags" dlls/Makeimplib.rules
309     if wine_fn_has_flag install-dev $ac_flags
310     then :
311     else
312         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
313 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
314 $ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir)
315         \$(INSTALL_DATA) $ac_dir/lib$ac_name.a \$(DESTDIR)\$(dlldir)/lib$ac_name.a
316 $ac_dir/__uninstall__::
317         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_name.a
318 install install-dev:: $ac_dir/__install__
319 __uninstall__: $ac_dir/__uninstall__"
320     fi
322     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__builddeps__: $ac_dir"
323     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: tools/widl tools/winebuild tools/winegcc include"
326 wine_fn_config_dll ()
328     ac_name=$[1]
329     ac_dir=dlls/$ac_name
330     ac_enable=$[2]
331     ac_flags=$[3]
332     ac_implib=${4:-$ac_name}
333     ac_file=$ac_dir/lib$ac_implib
334     ac_dll=$ac_name
335     ac_deps="tools/widl tools/winebuild tools/winegcc include"
336     ac_implibflags=""
338     case $ac_name in
339       *16) ac_implibflags=" -m16" ;;
340       *.*) ;;
341       *)   ac_dll=$ac_dll.dll ;;
342     esac
344     wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" dlls/Makedll.rules
346     AS_VAR_IF([$ac_enable],[no],
347               dnl enable_win16 is special in that it disables import libs too
348               [test "$ac_enable" != enable_win16 || return 0
349                wine_fn_has_flag implib $ac_flags && wine_fn_all_dir_rules $ac_dir dlls/Makedll.rules],
351               [wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
352 "$ac_dir: __builddeps__
353 manpages htmlpages sgmlpages xmlpages:: $ac_dir/Makefile
354         @cd $ac_dir && \$(MAKE) \$[@]"
356         if wine_fn_has_flag install-lib $ac_flags
357         then :
358         else
359             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
360 ".PHONY: $ac_dir/__install-lib__ $ac_dir/__uninstall__
361 install install-lib:: $ac_dir/__install-lib__
362 __uninstall__: $ac_dir/__uninstall__"
363             if test -n "$DLLEXT"
364             then
365                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
366 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
367         \$(INSTALL_PROGRAM) $ac_dir/$ac_dll$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT
368         \$(INSTALL_DATA) $ac_dir/$ac_dll.fake \$(DESTDIR)\$(fakedlldir)/$ac_dll
369 $ac_dir/__uninstall__::
370         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_dll"
371             else
372                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
373 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
374         \$(INSTALL_PROGRAM) $ac_dir/$ac_dll \$(DESTDIR)\$(dlldir)/$ac_dll
375 $ac_dir/__uninstall__::
376         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll"
377             fi
378         fi
380         wine_fn_pot_rules $ac_dir $ac_flags])
382     if wine_fn_has_flag staticimplib $ac_flags
383     then
384         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
385 "__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT
386 $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps
387 $ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile
388         @cd $ac_dir && \$(MAKE) lib$ac_implib.def
389 $ac_file.$STATIC_IMPLIBEXT: $ac_dir/Makefile dummy
390         @cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT
391 .PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
392 $ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
393         \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
394 $ac_dir/__uninstall__::
395         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
396 install install-dev:: $ac_dir/__install-dev__
397 __uninstall__: $ac_dir/__uninstall__"
399         if test "$IMPLIBEXT" != "$STATIC_IMPLIBEXT"
400         then
401             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
402 "$ac_dir/__install-dev__:: $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir) __builddeps__
403         \$(INSTALL_DATA) $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT
404 $ac_dir/__uninstall__::
405         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
406         fi
408         if test "x$CROSSTEST_DISABLE" = x
409         then
410             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
411 "__builddeps__: $ac_file.cross.a
412 $ac_file.cross.a: $ac_dir/Makefile dummy
413         @cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a"
414         fi
416     elif wine_fn_has_flag implib $ac_flags
417     then
418         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
419 "__builddeps__: $ac_file.$IMPLIBEXT
420 $ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
421         \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
422 $ac_file.a: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
423         \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
424 .PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
425 $ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
426         \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
427 $ac_dir/__uninstall__::
428         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
429 install install-dev:: $ac_dir/__install-dev__
430 __uninstall__: $ac_dir/__uninstall__"
431         if test "x$CROSSTEST_DISABLE" = x
432         then
433             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
434 "__builddeps__: $ac_file.cross.a
435 $ac_file.cross.a: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
436         \$(WINEBUILD) \$(CROSSTARGET:%=-b %)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec"
437         fi
439         if test "$ac_name" != "$ac_implib"
440         then
441             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
442 "__builddeps__: dlls/lib$ac_implib.$IMPLIBEXT
443 dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
444         \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
445 clean::
446         \$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
447             if test "x$CROSSTEST_DISABLE" = x
448             then
449                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
450 "__builddeps__: dlls/lib$ac_implib.cross.a
451 dlls/lib$ac_implib.cross.a: $ac_file.cross.a
452         \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.cross.a \$[@]"
453             fi
454         fi
455     fi
458 wine_fn_config_program ()
460     ac_name=$[1]
461     ac_dir=programs/$ac_name
462     ac_enable=$[2]
463     ac_flags=$[3]
464     ac_program=$ac_name
466     case $ac_name in
467       *.*) ;;
468       *)   ac_program=$ac_program.exe ;;
469     esac
471     wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" programs/Makeprog.rules
473     AS_VAR_IF([$ac_enable],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
474 "$ac_dir: __builddeps__"
476     wine_fn_pot_rules $ac_dir $ac_flags
478     wine_fn_has_flag install $ac_flags || return
479     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
480 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
481 install install-lib:: $ac_dir/__install__
482 __uninstall__: $ac_dir/__uninstall__"
484     if test -n "$DLLEXT"
485     then
486         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
487 "$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
488         \$(INSTALL_PROGRAM) $ac_dir/$ac_program$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT
489         \$(INSTALL_DATA) $ac_dir/$ac_program.fake \$(DESTDIR)\$(fakedlldir)/$ac_program
490 $ac_dir/__uninstall__::
491         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_program"
493         if test "x$enable_tools" != xno && wine_fn_has_flag installbin $ac_flags
494         then
495             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
496 "$ac_dir/__install__:: tools \$(DESTDIR)\$(bindir)
497         \$(INSTALL_SCRIPT) tools/wineapploader \$(DESTDIR)\$(bindir)/$ac_name
498 $ac_dir/__uninstall__::
499         \$(RM) \$(DESTDIR)\$(bindir)/$ac_name"
500         fi
501     else
502         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
503 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
504         \$(INSTALL_PROGRAM) $ac_dir/$ac_program \$(DESTDIR)\$(dlldir)/$ac_program
505 $ac_dir/__uninstall__::
506         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program"
507     fi
509     if test "x$enable_tools" != xno && wine_fn_has_flag manpage $ac_flags
510     then
511         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
512 "$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(mandir)/man\$(prog_manext)
513         \$(INSTALL_DATA) $ac_dir/$ac_name.man \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)
514 $ac_dir/__uninstall__::
515         \$(RM) \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)"
516     fi])
519 wine_fn_config_test ()
521     ac_dir=$[1]
522     ac_name=$[2]
523     ac_flags=$[3]
524     wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
525     wine_fn_all_dir_rules $ac_dir Maketest.rules
527     AS_VAR_IF([enable_tests],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
528 "all: $ac_dir
529 .PHONY: $ac_dir
530 $ac_dir: $ac_dir/Makefile programs/winetest/Makefile __builddeps__ dummy
531         @cd $ac_dir && \$(MAKE)
532 programs/winetest: $ac_dir
533 check test: $ac_dir/__test__
534 .PHONY: $ac_dir/__test__
535 $ac_dir/__test__: dummy
536         @cd $ac_dir && \$(MAKE) test
537 testclean::
538         \$(RM) $ac_dir/*.ok"
540         if test "x$CROSSTEST_DISABLE" = x
541         then
542             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
543 "crosstest: $ac_dir/__crosstest__
544 .PHONY: $ac_dir/__crosstest__
545 $ac_dir/__crosstest__: $ac_dir/Makefile __builddeps__ dummy
546         @cd $ac_dir && \$(MAKE) crosstest"
547         fi])
550 wine_fn_config_tool ()
552     ac_dir=$[1]
553     ac_flags=$[2]
554     AS_VAR_IF([enable_tools],[no],[return 0])
556     wine_fn_config_makefile $ac_dir enable_tools $ac_flags
558     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__tooldeps__: $ac_dir"
559     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: libs/port"
560     case $ac_dir in
561       tools/winebuild) wine_fn_append_rule ALL_MAKEFILE_DEPENDS "\$(WINEBUILD): $ac_dir" ;;
562     esac
565 wine_fn_config_makerules ()
567     ac_rules=$[1]
568     ac_deps=$[2]
569     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
570 "$ac_rules: $ac_rules.in $ac_deps config.status
571         @./config.status $ac_rules
572 distclean::
573         \$(RM) $ac_rules"
576 wine_fn_config_symlink ()
578     ac_link=$[1]
579     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
580 "$ac_link:
581         @./config.status $ac_link
582 distclean::
583         \$(RM) $ac_link"
586 if test "x$CROSSTEST_DISABLE" != x
587 then
588     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
589 "crosstest:
590         @echo \"crosstest is not supported (mingw not installed?)\" && false"
591 fi])
593 dnl **** Define helper function to append a file to a makefile file list ****
595 dnl Usage: WINE_APPEND_FILE(var,file)
597 AC_DEFUN([WINE_APPEND_FILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_file $1 "$2"])
599 dnl **** Define helper function to append a rule to a makefile command list ****
601 dnl Usage: WINE_APPEND_RULE(var,rule)
603 AC_DEFUN([WINE_APPEND_RULE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_rule $1 "$2"])
605 dnl **** Create nonexistent directories from config.status ****
607 dnl Usage: WINE_CONFIG_EXTRA_DIR(dirname)
609 AC_DEFUN([WINE_CONFIG_EXTRA_DIR],
610 [AC_CONFIG_COMMANDS([$1],[test -d "$1" || { AC_MSG_NOTICE([creating $1]); AS_MKDIR_P("$1"); }])])
612 dnl **** Create symlinks from config.status ****
614 dnl Usage: WINE_CONFIG_SYMLINK(name,target,enable)
616 AC_DEFUN([WINE_CONFIG_SYMLINK],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
617 m4_ifval([$3],[if test "x$[$3]" != xno; then
618 ])AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
619 m4_if([$2],,[test "$srcdir" = "." || ])wine_fn_config_symlink $1[]m4_ifval([$3],[
620 fi])])
622 dnl **** Create a make rules file from config.status ****
624 dnl Usage: WINE_CONFIG_MAKERULES(file,var,deps)
626 AC_DEFUN([WINE_CONFIG_MAKERULES],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
627 wine_fn_config_makerules $1 $3
628 $2=$1
629 AC_SUBST_FILE([$2])dnl
630 AC_CONFIG_FILES([$1])])
632 dnl **** Create a makefile from config.status ****
634 dnl Usage: WINE_CONFIG_MAKEFILE(file,enable,flags)
636 AC_DEFUN([WINE_CONFIG_MAKEFILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
637 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
638 wine_fn_config_makefile [$1] ac_enable [$3]dnl
639 AS_VAR_POPDEF([ac_enable])])
641 dnl **** Create a dll makefile from config.status ****
643 dnl Usage: WINE_CONFIG_DLL(name,enable,flags,implib)
645 AC_DEFUN([WINE_CONFIG_DLL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
646 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
647 wine_fn_config_dll [$1] ac_enable [$3] [$4]dnl
648 AS_VAR_POPDEF([ac_enable])])
650 dnl **** Create a program makefile from config.status ****
652 dnl Usage: WINE_CONFIG_PROGRAM(name,enable,flags)
654 AC_DEFUN([WINE_CONFIG_PROGRAM],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
655 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
656 wine_fn_config_program [$1] ac_enable [$3]dnl
657 AS_VAR_POPDEF([ac_enable])])
659 dnl **** Create a test makefile from config.status ****
661 dnl Usage: WINE_CONFIG_TEST(dir,flags)
663 AC_DEFUN([WINE_CONFIG_TEST],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
664 m4_pushdef([ac_suffix],m4_if(m4_substr([$1],0,9),[programs/],[.exe_test],[_test]))dnl
665 m4_pushdef([ac_name],[m4_bpatsubst([$1],[.*/\(.*\)/tests$],[\1])])dnl
666 wine_fn_config_test $1 ac_name[]ac_suffix [$2]dnl
667 m4_popdef([ac_suffix])dnl
668 m4_popdef([ac_name])])
670 dnl **** Create a static lib makefile from config.status ****
672 dnl Usage: WINE_CONFIG_LIB(name,flags)
674 AC_DEFUN([WINE_CONFIG_LIB],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
675 wine_fn_config_lib [$1] [$2]])
677 dnl **** Create a tool makefile from config.status ****
679 dnl Usage: WINE_CONFIG_TOOL(name,flags)
681 AC_DEFUN([WINE_CONFIG_TOOL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
682 wine_fn_config_tool [$1] [$2]])
684 dnl **** Add a message to the list displayed at the end ****
686 dnl Usage: WINE_NOTICE(notice)
687 dnl Usage: WINE_NOTICE_WITH(with_flag, test, notice)
688 dnl Usage: WINE_WARNING(warning)
689 dnl Usage: WINE_WARNING_WITH(with_flag, test, warning)
690 dnl Usage: WINE_PRINT_MESSAGES
692 AC_DEFUN([WINE_NOTICE],[AS_VAR_APPEND([wine_notices],["|$1"])])
693 AC_DEFUN([WINE_WARNING],[AS_VAR_APPEND([wine_warnings],["|$1"])])
695 AC_DEFUN([WINE_NOTICE_WITH],[AS_IF([$2],[case "x$with_$1" in
696   x)   WINE_NOTICE([$3]) ;;
697   xno) ;;
698   *)   AC_MSG_ERROR([$3
699 This is an error since --with-$1 was requested.]) ;;
700 esac])])
702 AC_DEFUN([WINE_WARNING_WITH],[AS_IF([$2],[case "x$with_$1" in
703   x)   WINE_WARNING([$3]) ;;
704   xno) ;;
705   *)   AC_MSG_ERROR([$3
706 This is an error since --with-$1 was requested.]) ;;
707 esac])])
709 AC_DEFUN([WINE_ERROR_WITH],[AS_IF([$2],[case "x$with_$1" in
710   xno) ;;
711   *)   AC_MSG_ERROR([$3
712 Use the --without-$1 option if you really want this.]) ;;
713 esac])])
715 AC_DEFUN([WINE_PRINT_MESSAGES],[ac_save_IFS="$IFS"
716 if test "x$wine_notices != "x; then
717     echo >&AS_MESSAGE_FD
718     IFS="|"
719     for msg in $wine_notices; do
720         IFS="$ac_save_IFS"
721         if test -n "$msg"; then
722             AC_MSG_NOTICE([$msg])
723         fi
724     done
726 IFS="|"
727 for msg in $wine_warnings; do
728     IFS="$ac_save_IFS"
729     if test -n "$msg"; then
730         echo >&2
731         AC_MSG_WARN([$msg])
732     fi
733 done
734 IFS="$ac_save_IFS"])
736 dnl Local Variables:
737 dnl compile-command: "autoreconf --warnings=all"
738 dnl End: