mshtml: Pass IUri to create_doc_uri.
[wine] / aclocal.m4
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.
24
25 dnl **** Get the programs used by WINE_GET_SONAME ****
26 dnl
27 dnl Usage: WINE_PATH_SONAME_TOOLS
28 dnl
29 AC_DEFUN([WINE_PATH_SONAME_TOOLS],
30 [AC_PATH_PROG(LDD,ldd,true,/sbin:/usr/sbin:$PATH)
31 AC_CHECK_TOOLS(READELF,[readelf],true)])
32
33 dnl **** Extract the soname of a library ****
34 dnl
35 dnl Usage: WINE_CHECK_SONAME(library, function, [action-if-found, [action-if-not-found, [other_libraries, [pattern]]]])
36 dnl
37 AC_DEFUN([WINE_CHECK_SONAME],
38 [AC_REQUIRE([WINE_PATH_SONAME_TOOLS])dnl
39 AS_VAR_PUSHDEF([ac_Lib],[ac_cv_lib_soname_$1])dnl
40 m4_pushdef([ac_lib_pattern],m4_default([$6],[lib$1]))dnl
41 AC_MSG_CHECKING([for -l$1])
42 AC_CACHE_VAL(ac_Lib,
43 [ac_check_soname_save_LIBS=$LIBS
44 LIBS="-l$1 $5 $LIBS"
45   AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
46   [case "$LIBEXT" in
47     dll) AS_VAR_SET(ac_Lib,[`$ac_cv_path_LDD conftest.exe | grep "$1" | sed -e "s/dll.*/dll/"';2,$d'`]) ;;
48     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'`]) ;;
49     *) 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'`])
50        AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = x],
51              [AS_VAR_SET(ac_Lib,[`$LDD conftest$ac_exeext | grep "ac_lib_pattern\\.$LIBEXT" | sed -e "s/^.*\(ac_lib_pattern\.$LIBEXT[[^  ]]*\).*$/\1/"';2,$d'`])]) ;;
52   esac])
53   LIBS=$ac_check_soname_save_LIBS])dnl
54 AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = "x"],
55       [AC_MSG_RESULT([not found])
56        $4],
57       [AC_MSG_RESULT(AS_VAR_GET(ac_Lib))
58        AC_DEFINE_UNQUOTED(AS_TR_CPP(SONAME_LIB$1),["]AS_VAR_GET(ac_Lib)["],
59                           [Define to the soname of the lib$1 library.])
60        $3])dnl
61 m4_popdef([ac_lib_pattern])dnl
62 AS_VAR_POPDEF([ac_Lib])])
63
64 dnl **** Link C code with an assembly file ****
65 dnl
66 dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]])
67 dnl
68 AC_DEFUN([WINE_TRY_ASM_LINK],
69 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]],[[asm($1); $3]])],[$4],[$5])])
70
71 dnl **** Check if we can link an empty program with special CFLAGS ****
72 dnl
73 dnl Usage: WINE_TRY_CFLAGS(flags,[action-if-yes,[action-if-no]])
74 dnl
75 dnl The default action-if-yes is to append the flags to EXTRACFLAGS.
76 dnl
77 AC_DEFUN([WINE_TRY_CFLAGS],
78 [AS_VAR_PUSHDEF([ac_var], ac_cv_cflags_[[$1]])dnl
79 AC_CACHE_CHECK([whether the compiler supports $1], ac_var,
80 [ac_wine_try_cflags_saved=$CFLAGS
81 CFLAGS="$CFLAGS $1"
82 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) { return 0; }]])],
83                [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
84 CFLAGS=$ac_wine_try_cflags_saved])
85 AS_IF([test AS_VAR_GET(ac_var) = yes],
86       [m4_default([$2], [EXTRACFLAGS="$EXTRACFLAGS $1"])], [$3])dnl
87 AS_VAR_POPDEF([ac_var])])
88
89 dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS ****
90 dnl
91 dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]])
92 dnl
93 AC_DEFUN([WINE_TRY_SHLIB_FLAGS],
94 [ac_wine_try_cflags_saved=$CFLAGS
95 CFLAGS="$CFLAGS $1"
96 AC_LINK_IFELSE([AC_LANG_SOURCE([void myfunc() {}])],[$2],[$3])
97 CFLAGS=$ac_wine_try_cflags_saved])
98
99 dnl **** Check whether we need to define a symbol on the compiler command line ****
100 dnl
101 dnl Usage: WINE_CHECK_DEFINE(name),[action-if-yes,[action-if-no]])
102 dnl
103 AC_DEFUN([WINE_CHECK_DEFINE],
104 [AS_VAR_PUSHDEF([ac_var],[ac_cv_cpp_def_$1])dnl
105 AC_CACHE_CHECK([whether we need to define $1],ac_var,
106     AC_EGREP_CPP(yes,[#ifndef $1
107 yes
108 #endif],
109     [AS_VAR_SET(ac_var,yes)],[AS_VAR_SET(ac_var,no)]))
110 AS_IF([test AS_VAR_GET(ac_var) = yes],
111       [CFLAGS="$CFLAGS -D$1"
112   LINTFLAGS="$LINTFLAGS -D$1"])dnl
113 AS_VAR_POPDEF([ac_var])])
114
115 dnl **** Check for functions with some extra libraries ****
116 dnl
117 dnl Usage: WINE_CHECK_LIB_FUNCS(funcs,libs,[action-if-found,[action-if-not-found]])
118 dnl
119 AC_DEFUN([WINE_CHECK_LIB_FUNCS],
120 [ac_wine_check_funcs_save_LIBS="$LIBS"
121 LIBS="$LIBS $2"
122 AC_CHECK_FUNCS([$1],[$3],[$4])
123 LIBS="$ac_wine_check_funcs_save_LIBS"])
124
125 dnl **** Check for a mingw program, trying the various mingw prefixes ****
126 dnl
127 dnl Usage: WINE_CHECK_MINGW_PROG(variable,prog,[value-if-not-found],[path])
128 dnl
129 AC_DEFUN([WINE_CHECK_MINGW_PROG],
130 [case "$host_cpu" in
131   i[[3456789]]86*)
132     ac_prefix_list="m4_foreach([ac_wine_prefix],[w64-mingw32, pc-mingw32, mingw32msvc, mingw32],
133                         m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-ac_wine_prefix-$2 ]))
134                         mingw32-$2" ;;
135   x86_64)
136     ac_prefix_list="m4_foreach([ac_wine_prefix],[pc-mingw32, w64-mingw32, mingw32msvc],
137                         m4_foreach([ac_wine_cpu],[x86_64,amd64],[ac_wine_cpu-ac_wine_prefix-$2 ]))" ;;
138   *)
139     ac_prefix_list="" ;;
140 esac
141 AC_CHECK_PROGS([$1],[$ac_prefix_list],[$3],[$4])])
142
143
144 dnl **** Define helper functions for creating config.status files ****
145 dnl
146 dnl Usage: AC_REQUIRE([WINE_CONFIG_HELPERS])
147 dnl
148 AC_DEFUN([WINE_CONFIG_HELPERS],
149 [ALL_MAKEFILE_DEPENDS="
150 # Rules automatically generated by configure
151
152 .INIT: Makefile
153 .MAKEFILEDEPS:
154 all: Makefile
155 Makefile: Makefile.in Make.vars.in Make.rules config.status
156         @./config.status Make.tmp Makefile"
157
158 ALL_POT_FILES=""
159 AC_SUBST(ALL_TEST_RESOURCES,"")
160
161 wine_fn_append_file ()
162 {
163     AS_VAR_APPEND($[1]," \\$as_nl       $[2]")
164 }
165
166 wine_fn_append_rule ()
167 {
168     AS_VAR_APPEND($[1],"$as_nl$[2]")
169 }
170
171 wine_fn_has_flag ()
172 {
173     expr ",$[2]," : ".*,$[1],.*" >/dev/null
174 }
175
176 wine_fn_all_dir_rules ()
177 {
178     ac_dir=$[1]
179     ac_alldeps=$[2]
180     ac_makedep="\$(MAKEDEP)"
181     ac_input=Make.vars.in:$ac_dir/Makefile.in
182     if test $ac_dir != tools
183     then
184         dnl makedep is in tools so tools makefile cannot depend on it
185         ac_alldeps="$[2] $ac_makedep"
186     else
187         ac_alldeps="$[2] include/config.h"
188     fi
189     case $[2] in
190       *.in) ac_input=$ac_input:$[2] ;;
191       *) ac_makedep="$[2] $ac_makedep" ;;
192     esac
193
194     wine_fn_append_file ALL_DIRS $ac_dir
195     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
196 "__clean__: $ac_dir/__clean__
197 .PHONY: $ac_dir/__clean__
198 $ac_dir/__clean__: $ac_dir/Makefile
199         @cd $ac_dir && \$(MAKE) clean
200         \$(RM) $ac_dir/Makefile
201 $ac_dir/Makefile: $ac_dir/Makefile.in Make.vars.in config.status $ac_alldeps
202         @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend
203 depend: $ac_dir/__depend__
204 .PHONY: $ac_dir/__depend__
205 $ac_dir/__depend__: $ac_makedep dummy
206         @./config.status --file $ac_dir/Makefile:$ac_input && cd $ac_dir && \$(MAKE) depend"
207 }
208
209 wine_fn_pot_rules ()
210 {
211     ac_dir=$[1]
212     ac_flags=$[2]
213
214     test "x$with_gettextpo" = xyes || return
215
216     if wine_fn_has_flag mc $ac_flags
217     then
218         wine_fn_append_file ALL_POT_FILES $ac_dir/msg.pot
219         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
220 "$ac_dir/msg.pot: $ac_dir/Makefile dummy
221         @cd $ac_dir && \$(MAKE) msg.pot
222 $ac_dir/msg.pot: tools/wmc include"
223     fi
224     if wine_fn_has_flag po $ac_flags
225     then
226         wine_fn_append_file ALL_POT_FILES $ac_dir/rsrc.pot
227         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
228 "$ac_dir/rsrc.pot: $ac_dir/Makefile dummy
229         @cd $ac_dir && \$(MAKE) rsrc.pot
230 $ac_dir/rsrc.pot: tools/wrc include"
231     fi
232 }
233
234 wine_fn_config_makefile ()
235 {
236     ac_dir=$[1]
237     ac_enable=$[2]
238     ac_flags=$[3]
239     ac_rules=$[4]
240     AS_VAR_IF([$ac_enable],[no],[return 0])
241
242     wine_fn_all_dir_rules $ac_dir ${ac_rules:-Make.rules}
243     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
244 "all: $ac_dir
245 .PHONY: $ac_dir
246 $ac_dir: $ac_dir/Makefile dummy
247         @cd $ac_dir && \$(MAKE)"
248
249     wine_fn_has_flag install-lib $ac_flags || wine_fn_has_flag install-dev $ac_flags || return
250
251     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
252 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
253 $ac_dir/__install__:: $ac_dir
254         @cd $ac_dir && \$(MAKE) install
255 $ac_dir/__uninstall__:: $ac_dir/Makefile
256         @cd $ac_dir && \$(MAKE) uninstall
257 install:: $ac_dir/__install__
258 __uninstall__: $ac_dir/__uninstall__"
259
260     if wine_fn_has_flag install-lib $ac_flags
261     then
262         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
263 ".PHONY: $ac_dir/__install-lib__
264 $ac_dir/__install-lib__:: $ac_dir
265         @cd $ac_dir && \$(MAKE) install-lib
266 install-lib:: $ac_dir/__install-lib__"
267     fi
268
269     if wine_fn_has_flag install-dev $ac_flags
270     then
271         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
272 ".PHONY: $ac_dir/__install-dev
273 $ac_dir/__install-dev__:: $ac_dir
274         @cd $ac_dir && \$(MAKE) install-dev
275 install-dev:: $ac_dir/__install-dev__"
276     fi
277 }
278
279 wine_fn_config_lib ()
280 {
281     ac_name=$[1]
282     ac_flags=$[2]
283     ac_dir=dlls/$ac_name
284     wine_fn_config_makefile $ac_dir enable_$ac_name "$ac_flags" dlls/Makeimplib.rules
285
286     if wine_fn_has_flag install-dev $ac_flags
287     then :
288     else
289         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
290 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
291 $ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir)
292         \$(INSTALL_DATA) $ac_dir/lib$ac_name.a \$(DESTDIR)\$(dlldir)/lib$ac_name.a
293 $ac_dir/__uninstall__::
294         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_name.a
295 install install-dev:: $ac_dir/__install__
296 __uninstall__: $ac_dir/__uninstall__"
297     fi
298
299     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__builddeps__: $ac_dir"
300     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: tools/widl tools/winebuild tools/winegcc include"
301 }
302
303 wine_fn_config_dll ()
304 {
305     ac_name=$[1]
306     ac_dir=dlls/$ac_name
307     ac_enable=$[2]
308     ac_flags=$[3]
309     ac_implib=${4:-$ac_name}
310     ac_file=$ac_dir/lib$ac_implib
311     ac_dll=$ac_name
312     ac_deps="tools/widl tools/winebuild tools/winegcc include"
313     ac_implibflags=""
314
315     case $ac_name in
316       *16) ac_implibflags=" -m16" ;;
317       *.*) ;;
318       *)   ac_dll=$ac_dll.dll ;;
319     esac
320
321     wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" dlls/Makedll.rules
322
323     AS_VAR_IF([$ac_enable],[no],
324               dnl enable_win16 is special in that it disables import libs too
325               [test "$ac_enable" != enable_win16 || return 0
326                wine_fn_has_flag implib $ac_flags && wine_fn_all_dir_rules $ac_dir dlls/Makedll.rules],
327
328               [wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
329 "$ac_dir: __builddeps__
330 manpages htmlpages sgmlpages xmlpages:: $ac_dir/Makefile
331         @cd $ac_dir && \$(MAKE) \$[@]"
332
333         if wine_fn_has_flag install-lib $ac_flags
334         then :
335         else
336             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
337 ".PHONY: $ac_dir/__install-lib__ $ac_dir/__uninstall__
338 install install-lib:: $ac_dir/__install-lib__
339 __uninstall__: $ac_dir/__uninstall__"
340             if test -n "$DLLEXT"
341             then
342                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
343 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
344         \$(INSTALL_PROGRAM) $ac_dir/$ac_dll$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT
345         \$(INSTALL_DATA) $ac_dir/$ac_dll.fake \$(DESTDIR)\$(fakedlldir)/$ac_dll
346 $ac_dir/__uninstall__::
347         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_dll"
348             else
349                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
350 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
351         \$(INSTALL_PROGRAM) $ac_dir/$ac_dll \$(DESTDIR)\$(dlldir)/$ac_dll
352 $ac_dir/__uninstall__::
353         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_dll"
354             fi
355         fi
356
357         wine_fn_pot_rules $ac_dir $ac_flags])
358
359     if wine_fn_has_flag staticimplib $ac_flags
360     then
361         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
362 "__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT
363 $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps
364 $ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile
365         @cd $ac_dir && \$(MAKE) lib$ac_implib.def
366 $ac_file.$STATIC_IMPLIBEXT: $ac_dir/Makefile dummy
367         @cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT
368 .PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
369 $ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
370         \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
371 $ac_dir/__uninstall__::
372         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
373 install install-dev:: $ac_dir/__install-dev__
374 __uninstall__: $ac_dir/__uninstall__"
375
376         if test "$IMPLIBEXT" != "$STATIC_IMPLIBEXT"
377         then
378             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
379 "$ac_dir/__install-dev__:: $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir) __builddeps__
380         \$(INSTALL_DATA) $ac_file.$STATIC_IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT
381 $ac_dir/__uninstall__::
382         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
383         fi
384
385         if test "x$CROSSTEST_DISABLE" = x
386         then
387             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
388 "__builddeps__: $ac_file.cross.a
389 $ac_file.cross.a: $ac_dir/Makefile dummy
390         @cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a"
391         fi
392
393     elif wine_fn_has_flag implib $ac_flags
394     then
395         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
396 "__builddeps__: $ac_file.$IMPLIBEXT
397 $ac_file.def: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
398         \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
399 $ac_file.a: $ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
400         \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec
401 .PHONY: $ac_dir/__install-dev__ $ac_dir/__uninstall__
402 $ac_dir/__install-dev__:: $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)
403         \$(INSTALL_DATA) $ac_file.$IMPLIBEXT \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
404 $ac_dir/__uninstall__::
405         \$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
406 install install-dev:: $ac_dir/__install-dev__
407 __uninstall__: $ac_dir/__uninstall__"
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/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
413         \$(WINEBUILD) \$(CROSSTARGET:%=-b %)$ac_implibflags -w --implib -o \$[@] --export \$(srcdir)/$ac_dir/$ac_name.spec"
414         fi
415
416         if test "$ac_name" != "$ac_implib"
417         then
418             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
419 "__builddeps__: dlls/lib$ac_implib.$IMPLIBEXT
420 dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
421         \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
422 clean::
423         \$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
424             if test "x$CROSSTEST_DISABLE" = x
425             then
426                 wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
427 "__builddeps__: dlls/lib$ac_implib.cross.a
428 dlls/lib$ac_implib.cross.a: $ac_file.cross.a
429         \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.cross.a \$[@]"
430             fi
431         fi
432     fi
433 }
434
435 wine_fn_config_program ()
436 {
437     ac_name=$[1]
438     ac_dir=programs/$ac_name
439     ac_enable=$[2]
440     ac_flags=$[3]
441     ac_program=$ac_name
442
443     case $ac_name in
444       *.*) ;;
445       *)   ac_program=$ac_program.exe ;;
446     esac
447
448     wine_fn_config_makefile $ac_dir $ac_enable "$ac_flags" programs/Makeprog.rules
449
450     AS_VAR_IF([$ac_enable],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
451 "$ac_dir: __builddeps__"
452
453     wine_fn_pot_rules $ac_dir $ac_flags
454
455     wine_fn_has_flag install $ac_flags || return
456     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
457 ".PHONY: $ac_dir/__install__ $ac_dir/__uninstall__
458 install install-lib:: $ac_dir/__install__
459 __uninstall__: $ac_dir/__uninstall__"
460
461     if test -n "$DLLEXT"
462     then
463         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
464 "$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(dlldir) \$(DESTDIR)\$(fakedlldir)
465         \$(INSTALL_PROGRAM) $ac_dir/$ac_program$DLLEXT \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT
466         \$(INSTALL_DATA) $ac_dir/$ac_program.fake \$(DESTDIR)\$(fakedlldir)/$ac_program
467 $ac_dir/__uninstall__::
468         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program$DLLEXT \$(DESTDIR)\$(fakedlldir)/$ac_program"
469
470         if test "x$enable_tools" != xno && wine_fn_has_flag installbin $ac_flags
471         then
472             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
473 "$ac_dir/__install__:: tools \$(DESTDIR)\$(bindir)
474         \$(INSTALL_SCRIPT) tools/wineapploader \$(DESTDIR)\$(bindir)/$ac_name
475 $ac_dir/__uninstall__::
476         \$(RM) \$(DESTDIR)\$(bindir)/$ac_name"
477         fi
478     else
479         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
480 "$ac_dir/__install-lib__:: $ac_dir \$(DESTDIR)\$(dlldir)
481         \$(INSTALL_PROGRAM) $ac_dir/$ac_program \$(DESTDIR)\$(dlldir)/$ac_program
482 $ac_dir/__uninstall__::
483         \$(RM) \$(DESTDIR)\$(dlldir)/$ac_program"
484     fi
485
486     if test "x$enable_tools" != xno && wine_fn_has_flag manpage $ac_flags
487     then
488         wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
489 "$ac_dir/__install__:: $ac_dir \$(DESTDIR)\$(mandir)/man\$(prog_manext)
490         \$(INSTALL_DATA) $ac_dir/$ac_name.man \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)
491 $ac_dir/__uninstall__::
492         \$(RM) \$(DESTDIR)\$(mandir)/man\$(prog_manext)/$ac_name.\$(prog_manext)"
493     fi])
494 }
495
496 wine_fn_config_test ()
497 {
498     ac_dir=$[1]
499     ac_name=$[2]
500     ac_flags=$[3]
501     wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
502     wine_fn_all_dir_rules $ac_dir Maketest.rules
503
504     AS_VAR_IF([enable_tests],[no],,[wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
505 "all: $ac_dir
506 .PHONY: $ac_dir
507 $ac_dir: $ac_dir/Makefile programs/winetest/Makefile __builddeps__ dummy
508         @cd $ac_dir && \$(MAKE)
509 programs/winetest: $ac_dir
510 check test: $ac_dir/__test__
511 .PHONY: $ac_dir/__test__
512 $ac_dir/__test__: dummy
513         @cd $ac_dir && \$(MAKE) test
514 testclean::
515         \$(RM) $ac_dir/*.ok"
516
517         if test "x$CROSSTEST_DISABLE" = x
518         then
519             wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
520 "crosstest: $ac_dir/__crosstest__
521 .PHONY: $ac_dir/__crosstest__
522 $ac_dir/__crosstest__: $ac_dir/Makefile __builddeps__ dummy
523         @cd $ac_dir && \$(MAKE) crosstest"
524         fi])
525 }
526
527 wine_fn_config_tool ()
528 {
529     ac_dir=$[1]
530     ac_flags=$[2]
531     AS_VAR_IF([enable_tools],[no],[return 0])
532
533     wine_fn_config_makefile $ac_dir enable_tools $ac_flags
534
535     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "__tooldeps__: $ac_dir"
536     wine_fn_append_rule ALL_MAKEFILE_DEPENDS "$ac_dir: libs/port"
537     case $ac_dir in
538       tools/winebuild) wine_fn_append_rule ALL_MAKEFILE_DEPENDS "\$(WINEBUILD): $ac_dir" ;;
539     esac
540 }
541
542 wine_fn_config_makerules ()
543 {
544     ac_rules=$[1]
545     ac_deps=$[2]
546     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
547 "$ac_rules: $ac_rules.in $ac_deps config.status
548         @./config.status $ac_rules
549 distclean::
550         \$(RM) $ac_rules"
551 }
552
553 wine_fn_config_symlink ()
554 {
555     ac_link=$[1]
556     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
557 "$ac_link:
558         @./config.status $ac_link
559 distclean::
560         \$(RM) $ac_link"
561 }
562
563 if test "x$CROSSTEST_DISABLE" != x
564 then
565     wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
566 "crosstest:
567         @echo \"crosstest is not supported (mingw not installed?)\" && false"
568 fi])
569
570 dnl **** Define helper function to append a file to a makefile file list ****
571 dnl
572 dnl Usage: WINE_APPEND_FILE(var,file)
573 dnl
574 AC_DEFUN([WINE_APPEND_FILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_file $1 "$2"])
575
576 dnl **** Define helper function to append a rule to a makefile command list ****
577 dnl
578 dnl Usage: WINE_APPEND_RULE(var,rule)
579 dnl
580 AC_DEFUN([WINE_APPEND_RULE],[AC_REQUIRE([WINE_CONFIG_HELPERS])wine_fn_append_rule $1 "$2"])
581
582 dnl **** Create nonexistent directories from config.status ****
583 dnl
584 dnl Usage: WINE_CONFIG_EXTRA_DIR(dirname)
585 dnl
586 AC_DEFUN([WINE_CONFIG_EXTRA_DIR],
587 [AC_CONFIG_COMMANDS([$1],[test -d "$1" || { AC_MSG_NOTICE([creating $1]); AS_MKDIR_P("$1"); }])])
588
589 dnl **** Create symlinks from config.status ****
590 dnl
591 dnl Usage: WINE_CONFIG_SYMLINK(name,target,enable)
592 dnl
593 AC_DEFUN([WINE_CONFIG_SYMLINK],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
594 m4_ifval([$3],[if test "x$[$3]" != xno; then
595 ])AC_CONFIG_LINKS([$1:]m4_default([$2],[$1]))dnl
596 m4_if([$2],,[test "$srcdir" = "." || ])wine_fn_config_symlink $1[]m4_ifval([$3],[
597 fi])])
598
599 dnl **** Create a make rules file from config.status ****
600 dnl
601 dnl Usage: WINE_CONFIG_MAKERULES(file,var,deps)
602 dnl
603 AC_DEFUN([WINE_CONFIG_MAKERULES],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
604 wine_fn_config_makerules $1 $3
605 $2=$1
606 AC_SUBST_FILE([$2])dnl
607 AC_CONFIG_FILES([$1])])
608
609 dnl **** Create a makefile from config.status ****
610 dnl
611 dnl Usage: WINE_CONFIG_MAKEFILE(file,enable,flags)
612 dnl
613 AC_DEFUN([WINE_CONFIG_MAKEFILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
614 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
615 wine_fn_config_makefile [$1] ac_enable [$3]dnl
616 AS_VAR_POPDEF([ac_enable])])
617
618 dnl **** Create a dll makefile from config.status ****
619 dnl
620 dnl Usage: WINE_CONFIG_DLL(name,enable,flags,implib)
621 dnl
622 AC_DEFUN([WINE_CONFIG_DLL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
623 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
624 wine_fn_config_dll [$1] ac_enable [$3] [$4]dnl
625 AS_VAR_POPDEF([ac_enable])])
626
627 dnl **** Create a program makefile from config.status ****
628 dnl
629 dnl Usage: WINE_CONFIG_PROGRAM(name,enable,flags)
630 dnl
631 AC_DEFUN([WINE_CONFIG_PROGRAM],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
632 AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
633 wine_fn_config_program [$1] ac_enable [$3]dnl
634 AS_VAR_POPDEF([ac_enable])])
635
636 dnl **** Create a test makefile from config.status ****
637 dnl
638 dnl Usage: WINE_CONFIG_TEST(dir,flags)
639 dnl
640 AC_DEFUN([WINE_CONFIG_TEST],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
641 m4_pushdef([ac_suffix],m4_if(m4_substr([$1],0,9),[programs/],[.exe_test],[_test]))dnl
642 m4_pushdef([ac_name],[m4_bpatsubst([$1],[.*/\(.*\)/tests$],[\1])])dnl
643 wine_fn_config_test $1 ac_name[]ac_suffix [$2]dnl
644 m4_popdef([ac_suffix])dnl
645 m4_popdef([ac_name])])
646
647 dnl **** Create a static lib makefile from config.status ****
648 dnl
649 dnl Usage: WINE_CONFIG_LIB(name,flags)
650 dnl
651 AC_DEFUN([WINE_CONFIG_LIB],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
652 wine_fn_config_lib [$1] [$2]])
653
654 dnl **** Create a tool makefile from config.status ****
655 dnl
656 dnl Usage: WINE_CONFIG_TOOL(name,flags)
657 dnl
658 AC_DEFUN([WINE_CONFIG_TOOL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
659 wine_fn_config_tool [$1] [$2]])
660
661 dnl **** Add a message to the list displayed at the end ****
662 dnl
663 dnl Usage: WINE_NOTICE(notice)
664 dnl Usage: WINE_NOTICE_WITH(with_flag, test, notice)
665 dnl Usage: WINE_WARNING(warning)
666 dnl Usage: WINE_WARNING_WITH(with_flag, test, warning)
667 dnl Usage: WINE_PRINT_MESSAGES
668 dnl
669 AC_DEFUN([WINE_NOTICE],[AS_VAR_APPEND([wine_notices],["|$1"])])
670 AC_DEFUN([WINE_WARNING],[AS_VAR_APPEND([wine_warnings],["|$1"])])
671
672 AC_DEFUN([WINE_NOTICE_WITH],[AS_IF([$2],[case "x$with_$1" in
673   x)   WINE_NOTICE([$3]) ;;
674   xno) ;;
675   *)   AC_MSG_ERROR([$3
676 This is an error since --with-$1 was requested.]) ;;
677 esac])])
678
679 AC_DEFUN([WINE_WARNING_WITH],[AS_IF([$2],[case "x$with_$1" in
680   x)   WINE_WARNING([$3]) ;;
681   xno) ;;
682   *)   AC_MSG_ERROR([$3
683 This is an error since --with-$1 was requested.]) ;;
684 esac])])
685
686 AC_DEFUN([WINE_ERROR_WITH],[AS_IF([$2],[case "x$with_$1" in
687   xno) ;;
688   *)   AC_MSG_ERROR([$3
689 Use the --without-$1 option if you really want this.]) ;;
690 esac])])
691
692 AC_DEFUN([WINE_PRINT_MESSAGES],[ac_save_IFS="$IFS"
693 if test "x$wine_notices != "x; then
694     echo >&AS_MESSAGE_FD
695     IFS="|"
696     for msg in $wine_notices; do
697         IFS="$ac_save_IFS"
698         if test -n "$msg"; then
699             AC_MSG_NOTICE([$msg])
700         fi
701     done
702 fi
703 IFS="|"
704 for msg in $wine_warnings; do
705     IFS="$ac_save_IFS"
706     if test -n "$msg"; then
707         echo >&2
708         AC_MSG_WARN([$msg])
709     fi
710 done
711 IFS="$ac_save_IFS"])
712
713 dnl Local Variables:
714 dnl compile-command: "autoreconf --warnings=all"
715 dnl End: