fixed OSX resources invalid path
[wxWidgets.git] / samples / aclocal.m4
1 # generated automatically by aclocal 1.7.2 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 dnl ---------------------------------------------------------------------------
15 dnl Support macros for makefiles generated by BAKEFILE.
16 dnl ---------------------------------------------------------------------------
17
18 dnl Lots of compiler & linker detection code contained here was taken from
19 dnl wxWindows configure.in script (see http://www.wxwindows.org)
20
21
22
23 dnl ---------------------------------------------------------------------------
24 dnl AC_BAKEFILE_GNUMAKE
25 dnl
26 dnl Detects GNU make
27 dnl ---------------------------------------------------------------------------
28
29 AC_DEFUN(AC_BAKEFILE_GNUMAKE,
30 [
31     dnl does make support "-include" (only GNU make does AFAIK)?
32     AC_CACHE_CHECK([if make is GNU make], wx_cv_prog_makeisgnu,
33     [
34         if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null |
35                 egrep -s GNU > /dev/null); then
36             bakefile_cv_prog_makeisgnu="yes"
37         else
38             bakefile_cv_prog_makeisgnu="no"
39         fi
40     ])
41
42     if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then
43         IF_GNU_MAKE=""
44     else
45         IF_GNU_MAKE="#"
46     fi
47     AC_SUBST(IF_GNU_MAKE)
48 ])
49
50 dnl ---------------------------------------------------------------------------
51 dnl AC_BAKEFILE_PLATFORM
52 dnl
53 dnl Detects platform and sets PLATFORM_XXX variables accordingly
54 dnl ---------------------------------------------------------------------------
55
56 AC_DEFUN(AC_BAKEFILE_PLATFORM,
57 [
58     PLATFORM_UNIX=0
59     PLATFORM_WIN32=0
60     PLATFORM_MSDOS=0
61     PLATFORM_MAC=0
62     PLATFORM_MACOSX=0
63     
64     case "${host}" in
65         *-*-cygwin* | *-*-mingw32* )
66             PLATFORM_WIN32=1
67         ;;
68         *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
69             PLATFORM_MSDOS=1
70         ;;
71         powerpc-*-darwin* )
72             PLATFORM_MAC=1
73             PLATFORM_MACOSX=1
74         ;;
75         * )
76             PLATFORM_UNIX=1
77         ;;
78     esac
79
80     AC_SUBST(PLATFORM_UNIX)
81     AC_SUBST(PLATFORM_WIN32)
82     AC_SUBST(PLATFORM_MSDOS)
83     AC_SUBST(PLATFORM_MAC)
84     AC_SUBST(PLATFORM_MACOSX)
85 ])
86
87
88
89 dnl ---------------------------------------------------------------------------
90 dnl AC_BAKEFILE_SUFFIXES
91 dnl
92 dnl Detects shared various suffixes for shared libraries, libraries, programs,
93 dnl plugins etc.
94 dnl ---------------------------------------------------------------------------
95
96 AC_DEFUN(AC_BAKEFILE_SUFFIXES,
97 [
98     SO_SUFFIX="so"
99     EXEEXT=""
100     DLLPREFIX=lib
101     
102     case "${host}" in
103         *-hp-hpux* )
104             SO_SUFFIX="sl"
105         ;;
106         *-*-aix* )
107             dnl quoting from
108             dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html:
109             dnl     Both archive libraries and shared libraries on AIX have an
110             dnl     .a extension. This will explain why you can't link with an
111             dnl     .so and why it works with the name changed to .a.
112             SO_SUFFIX="a"
113         ;;
114         *-*-cygwin* | *-*-mingw32* )
115             SO_SUFFIX="dll"
116             EXEEXT=".exe"
117             DLLPREFIX=""
118         ;;
119         *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx )
120             EXEEXT=".exe"
121             DLLPREFIX=""
122         ;;
123         powerpc-*-darwin* )
124             SO_SUFFIX="dylib"
125         ;;
126     esac
127
128     AC_SUBST(SO_SUFFIX)
129     AC_SUBST(EXEEXT)
130     AC_SUBST(DLLPREFIX)
131 ])
132
133
134 dnl ---------------------------------------------------------------------------
135 dnl AC_BAKEFILE_SHARED_LD
136 dnl
137 dnl Detects command for making shared libraries, substitutes SHARED_LD_CC
138 dnl and SHARED_LD_CXX.
139 dnl ---------------------------------------------------------------------------
140
141 AC_DEFUN(AC_BAKEFILE_SHARED_LD,
142 [
143     dnl Defaults for GCC and ELF .so shared libs:
144     SHARED_LD_CC="\$(CC) -shared -o"
145     SHARED_LD_CXX="\$(CXX) -shared -o"
146
147     dnl the extra compiler flags needed for compilation of shared library
148     if test "x$GCC" = "xyes"; then
149         dnl the switch for gcc is the same under all platforms
150         PIC_FLAG="-fPIC"
151     fi
152
153     case "${host}" in
154       *-hp-hpux* )
155         dnl default settings are good for gcc but not for the native HP-UX
156         if test "x$GCC" = "xyes"; then
157             dnl -o flag must be after PIC flag
158             SHARED_LD_CC="${CC} -shared ${PIC_FLAG} -o"
159             SHARED_LD_CXX="${CXX} -shared ${PIC_FLAG} -o"
160         else
161             dnl no idea why it wants it, but it does
162             LDFLAGS="$LDFLAGS -L/usr/lib"
163
164             SHARED_LD_CC="${CC} -b -o"
165             SHARED_LD_CXX="${CXX} -b -o"
166             PIC_FLAG="+Z"
167         fi
168       ;;
169
170       *-*-linux* )
171         if test "x$GCC" != "xyes"; then
172             AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc,
173             [
174                 AC_TRY_COMPILE([],
175                     [
176                         #ifndef __INTEL_COMPILER
177                         #error Not icc
178                         #endif
179                     ],
180                     bakefile_cv_prog_icc=yes,
181                     bakefile_cv_prog_icc=no
182                 )
183             ])
184             if test "$bakefile_cv_prog_icc" = "yes"; then
185                 PIC_FLAG="-KPIC"
186             fi
187         fi
188       ;;
189
190       *-*-solaris2* )
191         if test "x$GCC" != xyes ; then
192             SHARED_LD_CC="${CC} -G -o"
193             SHARED_LD_CXX="${CXX} -G -o"
194             PIC_FLAG="-KPIC"
195         fi
196       ;;
197
198       *-*-darwin* )
199         dnl For Unix to MacOS X porting instructions, see:
200         dnl http://fink.sourceforge.net/doc/porting/porting.html
201         CFLAGS="$CFLAGS -fno-common"
202         CXXFLAGS="$CXXFLAGS -fno-common"
203         
204         dnl Most apps benefit from being fully binded (its faster and static
205         dnl variables initialized at startup work).
206         dnl This can be done either with the exe linker flag -Wl,-bind_at_load
207         dnl or with a double stage link in order to create a single module
208         dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
209
210         cat <<EOF >shared-ld-sh
211 #!/bin/sh
212 #-----------------------------------------------------------------------------
213 #-- Name:        distrib/mac/shared-ld-sh
214 #-- Purpose:     Link a mach-o dynamic shared library for Darwin / Mac OS X
215 #-- Author:      Gilles Depeyrot
216 #-- Copyright:   (c) 2002 Gilles Depeyrot
217 #-- Licence:     any use permitted
218 #-----------------------------------------------------------------------------
219
220 verbose=0
221 args=""
222 objects=""
223
224 while test \${#} -gt 0; do
225     case \${1} in
226
227        -v)
228         verbose=1
229         ;;
230
231        -o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
232         # collect these options and values
233         args="\${args} \${1} \${2}"
234         shift
235         ;;
236
237        -l*|-L*|-flat_namespace)
238         # collect these options
239         args="\${args} \${1}"
240         ;;
241
242        -dynamiclib)
243         # skip these options
244         ;;
245
246        -*)
247         echo "shared-ld: unhandled option '\${1}'"
248         exit 1
249         ;;
250
251         *.o | *.a)
252         # collect object files
253         objects="\${objects} \${1}"
254         ;;
255
256         *)
257         echo "shared-ld: unhandled argument '\${1}'"
258         exit 1
259         ;;
260
261     esac
262     shift
263 done
264
265 #
266 # Link one module containing all the others
267 #
268 if test \${verbose} = 1; then
269     echo "c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o"
270 fi
271 c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o
272 status=\$?
273 if test \${status} != 0; then
274     exit \${status}
275 fi
276
277 #
278 # Link the shared library from the single module created
279 #
280 if test \${verbose} = 1; then
281     echo "cc -dynamiclib master.\$\$.o \${args}"
282 fi
283 c++ -dynamiclib master.\$\$.o \${args}
284 status=\$?
285 if test \${status} != 0; then
286     exit \${status}
287 fi
288
289 #
290 # Remove intermediate module
291 #
292 rm -f master.\$\$.o
293
294 exit 0
295 EOF
296         chmod +x shared-ld-sh
297
298         SHARED_LD_CC="`pwd`/shared-ld-sh -undefined suppress -flat_namespace -o"
299         SHARED_LD_CXX="$SHARED_LD_CC"
300         PIC_FLAG="-dynamic -fPIC"
301         dnl FIXME - what about C libs? Gilles says to use c++ because it doesn't
302         dnl         matter for C projects and matters for C++ ones
303         dnl FIXME - newer devel tools have linker flag to do this, the script
304         dnl         is not necessary - detect!
305       ;;
306
307       *-*-aix* )
308         dnl default settings are ok for gcc
309         if test "x$GCC" != "xyes"; then
310             dnl the abs path below used to be hardcoded here so I guess it must
311             dnl be some sort of standard location under AIX?
312             AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib,
313                           makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib)
314             dnl FIXME - what about makeCSharedLib?            
315             SHARED_LD_CC="$AIX_CC_LD -p 0 -o"
316             SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o"
317         fi
318       ;;
319
320       *-*-beos* )
321         dnl can't use gcc under BeOS for shared library creation because it
322         dnl complains about missing 'main'
323         SHARED_LD_CC="${LD} -shared -o"
324         SHARED_LD_CXX="${LD} -shared -o"
325       ;;
326
327       *-*-irix* )
328         dnl default settings are ok for gcc
329         if test "x$GCC" != "xyes"; then
330             PIC_FLAG="-KPIC"
331         fi
332       ;;
333       
334       *-*-cygwin* | *-*-mingw32* )
335         PIC_FLAG=""
336       ;;
337       
338       *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
339       *-*-sunos4* | \
340       *-*-osf* | \
341       *-*-dgux5* | \
342       *-*-sysv5* )
343         dnl defaults are ok
344       ;;
345
346       *)
347         AC_MSG_ERROR(unknown system type $host.)
348     esac
349
350     AC_SUBST(SHARED_LD_CC)
351     AC_SUBST(SHARED_LD_CXX)
352     AC_SUBST(PIC_FLAG)
353 ])
354
355
356 dnl ---------------------------------------------------------------------------
357 dnl AC_BAKEFILE_SHARED_VERSIONS
358 dnl
359 dnl Detects linker options for attaching versions (sonames) to shared  libs.
360 dnl ---------------------------------------------------------------------------
361
362 AC_DEFUN(AC_BAKEFILE_SHARED_VERSIONS,
363 [
364     USE_SOVERSION=0
365     USE_SOVERLINUX=0
366     USE_SOVERSOLARIS=0
367     USE_SOSYMLINKS=0
368     USE_MACVERSION=0
369     SONAME_FLAG=
370
371     case "${host}" in
372       *-*-linux* )
373         SONAME_FLAG="-Wl,-soname,"
374         USE_SOVERSION=1
375         USE_SOVERLINUX=1
376         USE_SOSYMLINKS=1
377       ;;
378
379       *-*-solaris2* )
380         SONAME_FLAG="-h "
381         USE_SOVERSION=1
382         USE_SOVERSOLARIS=1
383         USE_SOSYMLINKS=1
384       ;;
385
386       *-*-darwin* )
387         USE_MACVERSION=1
388         USE_SOVERSION=1
389         USE_SOSYMLINKS=1
390       ;;      
391     esac
392
393     AC_SUBST(USE_SOVERSION)
394     AC_SUBST(USE_SOVERLINUX)
395     AC_SUBST(USE_SOVERSOLARIS)
396     AC_SUBST(USE_MACVERSION)
397     AC_SUBST(USE_SOSYMLINKS)
398     AC_SUBST(SONAME_FLAG)
399 ])
400
401
402 dnl ---------------------------------------------------------------------------
403 dnl AC_BAKEFILE_DEPS
404 dnl
405 dnl Detects available C/C++ dependency tracking options
406 dnl ---------------------------------------------------------------------------
407
408 AC_DEFUN(AC_BAKEFILE_DEPS,
409 [
410     DEPS_TYPE=no
411     if test "x$GCC" = "xyes"; then
412         DEPS_TYPE=gcc
413     fi
414     
415     AC_SUBST(DEPS_TYPE)
416 ])
417
418 dnl ---------------------------------------------------------------------------
419 dnl AC_BAKEFILE_CHECK_BASIC_STUFF
420 dnl
421 dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib"
422 dnl or "install"
423 dnl ---------------------------------------------------------------------------
424
425 AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF,
426 [
427     AC_PROG_RANLIB
428     AC_PROG_INSTALL
429     AC_PROG_LN_S
430
431     AC_PROG_MAKE_SET
432     AC_SUBST(MAKE_SET)
433     
434     if test "$build" != "$host" ; then
435         AR=$host_alias-ar
436         STRIP=$host_alias-strip
437     else
438         AC_CHECK_PROG(AR, ar, ar, ar)
439         AC_CHECK_PROG(STRIP, strip, strip, true)
440     fi
441
442     case ${host} in
443         *-hp-hpux* )
444             INSTALL_DIR="mkdir"
445             ;;
446         *)  INSTALL_DIR="$INSTALL -d"
447             ;;
448     esac
449     AC_SUBST(INSTALL_DIR)
450 ])
451
452
453 dnl ---------------------------------------------------------------------------
454 dnl AC_BAKEFILE_RES_COMPILERS
455 dnl
456 dnl Checks for presence of resource compilers for win32 or mac
457 dnl ---------------------------------------------------------------------------
458
459 AC_DEFUN(AC_BAKEFILE_RES_COMPILERS,
460 [
461     RESCOMP=
462     SETFILE=
463
464     case ${host} in 
465         *-*-cygwin* | *-*-mingw32* )
466             dnl Check for win32 resources compiler:
467             if test "$build" != "$host" ; then
468                 RESCOMP=$host_alias-windres
469             else
470                 AC_CHECK_PROG(RESCOMP, windres, windres, windres)
471             fi
472          ;;
473  
474       *-*-darwin* )
475             AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez)
476             AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
477         ;;
478     esac
479
480     AC_SUBST(RESCOMP)
481     AC_SUBST(SETFILE)
482 ])
483
484 dnl ---------------------------------------------------------------------------
485 dnl AC_BAKEFILE
486 dnl
487 dnl To be used in configure.in of any project using Bakefile-generated mks
488 dnl ---------------------------------------------------------------------------
489
490 AC_DEFUN(AC_BAKEFILE,
491 [
492     if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then
493         AC_BAKEFILE_CHECK_BASIC_STUFF
494     fi
495     AC_BAKEFILE_GNUMAKE
496     AC_BAKEFILE_PLATFORM
497     AC_BAKEFILE_SUFFIXES
498     AC_BAKEFILE_SHARED_LD
499     AC_BAKEFILE_SHARED_VERSIONS
500     AC_BAKEFILE_DEPS
501     AC_BAKEFILE_RES_COMPILERS
502
503     builtin(include, autoconf_inc.m4)
504 ])
505