]>
Commit | Line | Data |
---|---|---|
3b396a26 | 1 | # generated automatically by aclocal 1.9.4 -*- Autoconf -*- |
8168de4c | 2 | |
810b94f0 | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
fe0895cf VS |
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. | |
8168de4c | 8 | |
fe0895cf VS |
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. | |
8168de4c | 13 | |
b040e242 | 14 | dnl --------------------------------------------------------------------------- |
810b94f0 | 15 | dnl Compiler detection macros by David Elliott |
b040e242 VS |
16 | dnl --------------------------------------------------------------------------- |
17 | ||
9273ffba | 18 | |
1d1af5ea | 19 | dnl =========================================================================== |
810b94f0 | 20 | dnl Macros to detect non-GNU compilers (MetroWerks, XLC) |
b040e242 VS |
21 | dnl =========================================================================== |
22 | ||
810b94f0 MW |
23 | dnl Based on autoconf _AC_LANG_COMPILER_GNU |
24 | AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS], | |
25 | [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler], | |
26 | [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks], | |
27 | [AC_TRY_COMPILE([],[#ifndef __MWERKS__ | |
28 | choke me | |
29 | #endif | |
30 | ], | |
31 | [bakefile_compiler_mwerks=yes], | |
32 | [bakefile_compiler_mwerks=no]) | |
33 | bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks | |
34 | ]) | |
b040e242 VS |
35 | ]) |
36 | ||
810b94f0 MW |
37 | dnl Loosely based on autoconf AC_PROG_CC |
38 | dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead. | |
39 | AC_DEFUN([AC_BAKEFILE_PROG_MWCC], | |
40 | [AC_LANG_PUSH(C) | |
41 | _AC_BAKEFILE_LANG_COMPILER_MWERKS | |
42 | MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes` | |
43 | AC_LANG_POP(C) | |
b040e242 VS |
44 | ]) |
45 | ||
810b94f0 MW |
46 | dnl Loosely based on autoconf AC_PROG_CXX |
47 | dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead. | |
48 | AC_DEFUN([AC_BAKEFILE_PROG_MWCXX], | |
49 | [AC_LANG_PUSH(C++) | |
50 | _AC_BAKEFILE_LANG_COMPILER_MWERKS | |
51 | MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes` | |
52 | AC_LANG_POP(C++) | |
b040e242 VS |
53 | ]) |
54 | ||
810b94f0 MW |
55 | dnl Based on autoconf _AC_LANG_COMPILER_GNU |
56 | AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC], | |
57 | [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler], | |
58 | [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc], | |
59 | [AC_TRY_COMPILE([],[#ifndef __xlC__ | |
60 | choke me | |
61 | #endif | |
62 | ], | |
63 | [wx_compiler_xlc=yes], | |
64 | [wx_compiler_xlc=no]) | |
65 | wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc | |
66 | ]) | |
986ecc86 VZ |
67 | ]) |
68 | ||
810b94f0 MW |
69 | dnl Loosely based on autoconf AC_PROG_CC |
70 | AC_DEFUN([AC_BAKEFILE_PROG_XLCC], | |
71 | [AC_LANG_PUSH(C) | |
72 | _AC_BAKEFILE_LANG_COMPILER_XLC | |
73 | XLCC=`test $wx_cv_c_compiler_xlc = yes && echo yes` | |
74 | AC_LANG_POP(C) | |
b040e242 VS |
75 | ]) |
76 | ||
810b94f0 MW |
77 | dnl Loosely based on autoconf AC_PROG_CXX |
78 | AC_DEFUN([AC_BAKEFILE_PROG_XLCXX], | |
79 | [AC_LANG_PUSH(C++) | |
80 | _AC_BAKEFILE_LANG_COMPILER_XLC | |
81 | XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes` | |
82 | AC_LANG_POP(C++) | |
2b5f62a0 VZ |
83 | ]) |
84 | ||
a9e5b1f0 MW |
85 | dnl Based on autoconf _AC_LANG_COMPILER_GNU |
86 | dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO) | |
87 | AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER], | |
88 | [ | |
89 | AC_LANG_PUSH($2) | |
90 | AC_CACHE_CHECK( | |
91 | [whether we are using the $1 $2 compiler], | |
92 | [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3], | |
93 | [AC_TRY_COMPILE( | |
94 | [], | |
95 | [ | |
96 | #ifndef $3 | |
97 | choke me | |
98 | #endif | |
99 | ], | |
100 | [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=yes], | |
101 | [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=no] | |
102 | ) | |
103 | ] | |
104 | ) | |
105 | AC_LANG_POP($2) | |
106 | if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3" = "xyes"; then | |
107 | :; $4 | |
108 | else | |
109 | :; $5 | |
110 | fi | |
111 | ]) | |
112 | ||
113 | dnl Loosely based on autoconf AC_PROG_CC | |
114 | AC_DEFUN([AC_BAKEFILE_PROG_SUNCC], | |
115 | [ | |
116 | _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes) | |
117 | ]) | |
118 | ||
119 | dnl Loosely based on autoconf AC_PROG_CC | |
120 | AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX], | |
121 | [ | |
122 | _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes) | |
123 | ]) | |
124 | ||
b040e242 VS |
125 | |
126 | dnl =========================================================================== | |
810b94f0 | 127 | dnl macros to detect specialty compiler options |
b040e242 VS |
128 | dnl =========================================================================== |
129 | ||
810b94f0 MW |
130 | dnl Figure out if we need to pass -ext o to compiler (MetroWerks) |
131 | AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO], | |
132 | [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto, | |
133 | dnl First create an empty conf test | |
134 | [AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) | |
135 | dnl Now remove .o and .c.o or .cc.o | |
136 | rm -f conftest.$ac_objext conftest.$ac_ext.o | |
137 | dnl Now compile the test | |
138 | AS_IF([AC_TRY_EVAL(ac_compile)], | |
139 | dnl If the test succeeded look for conftest.c.o or conftest.cc.o | |
140 | [for ac_file in `(ls conftest.* 2>/dev/null)`; do | |
141 | case $ac_file in | |
142 | conftest.$ac_ext.o) | |
143 | wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o" | |
144 | ;; | |
145 | *) | |
146 | ;; | |
147 | esac | |
148 | done], | |
149 | [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile]) | |
150 | ]) dnl AS_IF | |
b040e242 | 151 | |
810b94f0 MW |
152 | rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext |
153 | ]) dnl AC_CACHE_CHECK | |
b040e242 | 154 | |
810b94f0 MW |
155 | if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then |
156 | if test "[]_AC_LANG_ABBREV[]" = "c"; then | |
157 | CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS" | |
b040e242 | 158 | fi |
810b94f0 MW |
159 | if test "[]_AC_LANG_ABBREV[]" = "cxx"; then |
160 | CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS" | |
b7043674 | 161 | fi |
810b94f0 MW |
162 | fi |
163 | ]) dnl AC_DEFUN | |
b7043674 | 164 | |
90dd450c | 165 | |
810b94f0 MW |
166 | dnl =========================================================================== |
167 | dnl Macros to do all of the compiler detections as one macro | |
168 | dnl =========================================================================== | |
169 | AC_DEFUN([AC_BAKEFILE_PROG_CC], | |
170 | [ | |
171 | AC_PROG_CC | |
172 | AC_BAKEFILE_METROWERKS_EXTO | |
173 | dnl By the time we find out that we need -ext o some tests have failed. | |
174 | if test "x$wx_cv_c_exto" '!=' "x"; then | |
175 | unset ac_cv_prog_cc_g | |
176 | _AC_PROG_CC_G | |
177 | fi | |
178 | AC_BAKEFILE_PROG_MWCC | |
179 | AC_BAKEFILE_PROG_XLCC | |
180 | AC_BAKEFILE_PROG_SUNCC | |
90dd450c VZ |
181 | ]) |
182 | ||
810b94f0 | 183 | AC_DEFUN([AC_BAKEFILE_PROG_CXX], |
90dd450c | 184 | [ |
810b94f0 MW |
185 | AC_PROG_CXX |
186 | AC_BAKEFILE_METROWERKS_EXTO | |
187 | dnl By the time we find out that we need -ext o some tests have failed. | |
188 | if test "x$wx_cv_cxx_exto" '!=' "x"; then | |
189 | unset ac_cv_prog_cxx_g | |
190 | _AC_PROG_CXX_G | |
90dd450c | 191 | fi |
810b94f0 MW |
192 | AC_BAKEFILE_PROG_MWCXX |
193 | AC_BAKEFILE_PROG_XLCXX | |
194 | AC_BAKEFILE_PROG_SUNCXX | |
90dd450c VZ |
195 | ]) |
196 | ||
197 | ||
810b94f0 MW |
198 | dnl --------------------------------------------------------------------------- |
199 | dnl Support macros for makefiles generated by BAKEFILE. | |
200 | dnl --------------------------------------------------------------------------- | |
90dd450c | 201 | |
810b94f0 MW |
202 | dnl Lots of compiler & linker detection code contained here was taken from |
203 | dnl wxWindows configure.in script (see http://www.wxwindows.org) | |
b040e242 | 204 | |
521196a2 | 205 | |
08cd454f | 206 | |
2e350179 | 207 | dnl --------------------------------------------------------------------------- |
810b94f0 MW |
208 | dnl AC_BAKEFILE_GNUMAKE |
209 | dnl | |
210 | dnl Detects GNU make | |
2e350179 | 211 | dnl --------------------------------------------------------------------------- |
b040e242 | 212 | |
810b94f0 MW |
213 | AC_DEFUN([AC_BAKEFILE_GNUMAKE], |
214 | [ | |
215 | dnl does make support "-include" (only GNU make does AFAIK)? | |
216 | AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, | |
217 | [ | |
218 | if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | | |
219 | egrep -s GNU > /dev/null); then | |
220 | bakefile_cv_prog_makeisgnu="yes" | |
221 | else | |
222 | bakefile_cv_prog_makeisgnu="no" | |
223 | fi | |
2e350179 | 224 | ]) |
9e691f46 | 225 | |
810b94f0 MW |
226 | if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then |
227 | IF_GNU_MAKE="" | |
228 | else | |
229 | IF_GNU_MAKE="#" | |
230 | fi | |
231 | AC_SUBST(IF_GNU_MAKE) | |
6dcfc289 | 232 | ]) |
9e691f46 | 233 | |
810b94f0 MW |
234 | dnl --------------------------------------------------------------------------- |
235 | dnl AC_BAKEFILE_PLATFORM | |
236 | dnl | |
237 | dnl Detects platform and sets PLATFORM_XXX variables accordingly | |
238 | dnl --------------------------------------------------------------------------- | |
9e691f46 | 239 | |
810b94f0 MW |
240 | AC_DEFUN([AC_BAKEFILE_PLATFORM], |
241 | [ | |
242 | PLATFORM_UNIX=0 | |
243 | PLATFORM_WIN32=0 | |
244 | PLATFORM_MSDOS=0 | |
245 | PLATFORM_MAC=0 | |
246 | PLATFORM_MACOS=0 | |
247 | PLATFORM_MACOSX=0 | |
248 | PLATFORM_OS2=0 | |
249 | PLATFORM_BEOS=0 | |
6dcfc289 | 250 | |
810b94f0 MW |
251 | if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then |
252 | case "${BAKEFILE_HOST}" in | |
253 | *-*-mingw32* ) | |
254 | PLATFORM_WIN32=1 | |
2e350179 | 255 | ;; |
810b94f0 MW |
256 | *-pc-msdosdjgpp ) |
257 | PLATFORM_MSDOS=1 | |
2e350179 | 258 | ;; |
810b94f0 MW |
259 | *-pc-os2_emx | *-pc-os2-emx ) |
260 | PLATFORM_OS2=1 | |
261 | ;; | |
3e4ca115 | 262 | *-*-darwin* ) |
810b94f0 MW |
263 | PLATFORM_MAC=1 |
264 | PLATFORM_MACOSX=1 | |
265 | ;; | |
266 | *-*-beos* ) | |
267 | PLATFORM_BEOS=1 | |
268 | ;; | |
269 | powerpc-apple-macos* ) | |
270 | PLATFORM_MAC=1 | |
271 | PLATFORM_MACOS=1 | |
272 | ;; | |
273 | * ) | |
274 | PLATFORM_UNIX=1 | |
275 | ;; | |
276 | esac | |
277 | else | |
278 | case "$BAKEFILE_FORCE_PLATFORM" in | |
279 | win32 ) | |
280 | PLATFORM_WIN32=1 | |
281 | ;; | |
282 | msdos ) | |
283 | PLATFORM_MSDOS=1 | |
284 | ;; | |
285 | os2 ) | |
286 | PLATFORM_OS2=1 | |
287 | ;; | |
288 | darwin ) | |
289 | PLATFORM_MAC=1 | |
290 | PLATFORM_MACOSX=1 | |
291 | ;; | |
292 | unix ) | |
293 | PLATFORM_UNIX=1 | |
294 | ;; | |
295 | beos ) | |
296 | PLATFORM_BEOS=1 | |
297 | ;; | |
298 | * ) | |
299 | AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM]) | |
300 | ;; | |
301 | esac | |
6dcfc289 | 302 | fi |
2e350179 | 303 | |
810b94f0 MW |
304 | AC_SUBST(PLATFORM_UNIX) |
305 | AC_SUBST(PLATFORM_WIN32) | |
306 | AC_SUBST(PLATFORM_MSDOS) | |
307 | AC_SUBST(PLATFORM_MAC) | |
308 | AC_SUBST(PLATFORM_MACOS) | |
309 | AC_SUBST(PLATFORM_MACOSX) | |
310 | AC_SUBST(PLATFORM_OS2) | |
311 | AC_SUBST(PLATFORM_BEOS) | |
6dcfc289 | 312 | ]) |
2e350179 | 313 | |
8168de4c | 314 | |
810b94f0 MW |
315 | dnl --------------------------------------------------------------------------- |
316 | dnl AC_BAKEFILE_PLATFORM_SPECIFICS | |
6dcfc289 | 317 | dnl |
810b94f0 MW |
318 | dnl Sets misc platform-specific settings |
319 | dnl --------------------------------------------------------------------------- | |
3fd9c298 | 320 | |
810b94f0 MW |
321 | AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS], |
322 | [ | |
323 | AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf], | |
324 | [use OMF object format (OS/2)]), | |
325 | [bk_os2_use_omf="$enableval"]) | |
326 | ||
327 | case "${BAKEFILE_HOST}" in | |
328 | *-*-darwin* ) | |
329 | dnl For Unix to MacOS X porting instructions, see: | |
330 | dnl http://fink.sourceforge.net/doc/porting/porting.html | |
3b396a26 DE |
331 | if test "x$GCC" = "xyes"; then |
332 | CFLAGS="$CFLAGS -fno-common" | |
333 | CXXFLAGS="$CXXFLAGS -fno-common" | |
334 | fi | |
335 | if test "x$XLCC" = "xyes"; then | |
336 | CFLAGS="$CFLAGS -qnocommon" | |
337 | CXXFLAGS="$CXXFLAGS -qnocommon" | |
338 | fi | |
810b94f0 | 339 | ;; |
fe0895cf | 340 | |
810b94f0 MW |
341 | *-pc-os2_emx | *-pc-os2-emx ) |
342 | if test "x$bk_os2_use_omf" = "xyes" ; then | |
343 | AR=emxomfar | |
344 | RANLIB=: | |
345 | LDFLAGS="-Zomf $LDFLAGS" | |
346 | CFLAGS="-Zomf $CFLAGS" | |
347 | CXXFLAGS="-Zomf $CXXFLAGS" | |
348 | OS2_LIBEXT="lib" | |
349 | else | |
350 | OS2_LIBEXT="a" | |
351 | fi | |
352 | ;; | |
353 | ||
354 | i*86-*-beos* ) | |
355 | LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS" | |
356 | ;; | |
357 | esac | |
358 | ]) | |
fe0895cf | 359 | |
810b94f0 MW |
360 | dnl --------------------------------------------------------------------------- |
361 | dnl AC_BAKEFILE_SUFFIXES | |
362 | dnl | |
363 | dnl Detects shared various suffixes for shared libraries, libraries, programs, | |
364 | dnl plugins etc. | |
365 | dnl --------------------------------------------------------------------------- | |
fe0895cf | 366 | |
810b94f0 MW |
367 | AC_DEFUN([AC_BAKEFILE_SUFFIXES], |
368 | [ | |
369 | SO_SUFFIX="so" | |
370 | SO_SUFFIX_MODULE="so" | |
371 | EXEEXT="" | |
372 | LIBPREFIX="lib" | |
373 | LIBEXT=".a" | |
374 | DLLPREFIX="lib" | |
375 | DLLPREFIX_MODULE="" | |
376 | DLLIMP_SUFFIX="" | |
377 | dlldir="$libdir" | |
378 | ||
379 | case "${BAKEFILE_HOST}" in | |
380 | *-hp-hpux* ) | |
381 | SO_SUFFIX="sl" | |
382 | SO_SUFFIX_MODULE="sl" | |
383 | ;; | |
384 | *-*-aix* ) | |
385 | dnl quoting from | |
386 | dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: | |
387 | dnl Both archive libraries and shared libraries on AIX have an | |
388 | dnl .a extension. This will explain why you can't link with an | |
389 | dnl .so and why it works with the name changed to .a. | |
390 | SO_SUFFIX="a" | |
391 | SO_SUFFIX_MODULE="a" | |
392 | ;; | |
393 | *-*-cygwin* ) | |
394 | SO_SUFFIX="dll" | |
395 | SO_SUFFIX_MODULE="dll" | |
396 | DLLIMP_SUFFIX="dll.a" | |
397 | EXEEXT=".exe" | |
398 | DLLPREFIX="cyg" | |
399 | dlldir="$bindir" | |
400 | ;; | |
401 | *-*-mingw32* ) | |
402 | SO_SUFFIX="dll" | |
403 | SO_SUFFIX_MODULE="dll" | |
404 | DLLIMP_SUFFIX="dll.a" | |
405 | EXEEXT=".exe" | |
406 | DLLPREFIX="" | |
407 | dlldir="$bindir" | |
408 | ;; | |
409 | *-pc-msdosdjgpp ) | |
410 | EXEEXT=".exe" | |
411 | DLLPREFIX="" | |
412 | dlldir="$bindir" | |
413 | ;; | |
414 | *-pc-os2_emx | *-pc-os2-emx ) | |
415 | SO_SUFFIX="dll" | |
416 | SO_SUFFIX_MODULE="dll" | |
417 | DLLIMP_SUFFIX=$OS2_LIBEXT | |
418 | EXEEXT=".exe" | |
419 | DLLPREFIX="" | |
420 | LIBPREFIX="" | |
421 | LIBEXT=".$OS2_LIBEXT" | |
422 | dlldir="$bindir" | |
423 | ;; | |
3e4ca115 | 424 | *-*-darwin* ) |
810b94f0 MW |
425 | SO_SUFFIX="dylib" |
426 | SO_SUFFIX_MODULE="bundle" | |
427 | ;; | |
428 | esac | |
429 | ||
430 | if test "x$DLLIMP_SUFFIX" = "x" ; then | |
431 | DLLIMP_SUFFIX="$SO_SUFFIX" | |
fe0895cf | 432 | fi |
fe0895cf | 433 | |
810b94f0 MW |
434 | AC_SUBST(SO_SUFFIX) |
435 | AC_SUBST(SO_SUFFIX_MODULE) | |
436 | AC_SUBST(DLLIMP_SUFFIX) | |
437 | AC_SUBST(EXEEXT) | |
438 | AC_SUBST(LIBPREFIX) | |
439 | AC_SUBST(LIBEXT) | |
440 | AC_SUBST(DLLPREFIX) | |
441 | AC_SUBST(DLLPREFIX_MODULE) | |
442 | AC_SUBST(dlldir) | |
443 | ]) | |
fe0895cf | 444 | |
fe0895cf | 445 | |
810b94f0 MW |
446 | dnl --------------------------------------------------------------------------- |
447 | dnl AC_BAKEFILE_SHARED_LD | |
448 | dnl | |
449 | dnl Detects command for making shared libraries, substitutes SHARED_LD_CC | |
450 | dnl and SHARED_LD_CXX. | |
451 | dnl --------------------------------------------------------------------------- | |
452 | ||
453 | AC_DEFUN([AC_BAKEFILE_SHARED_LD], | |
454 | [ | |
455 | dnl the extra compiler flags needed for compilation of shared library | |
456 | PIC_FLAG="" | |
457 | if test "x$GCC" = "xyes"; then | |
458 | dnl the switch for gcc is the same under all platforms | |
459 | PIC_FLAG="-fPIC" | |
6dcfc289 | 460 | fi |
810b94f0 MW |
461 | |
462 | dnl Defaults for GCC and ELF .so shared libs: | |
463 | SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o" | |
464 | SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o" | |
465 | WINDOWS_IMPLIB=0 | |
fe0895cf | 466 | |
810b94f0 MW |
467 | case "${BAKEFILE_HOST}" in |
468 | *-hp-hpux* ) | |
469 | dnl default settings are good for gcc but not for the native HP-UX | |
470 | if test "x$GCC" != "xyes"; then | |
471 | dnl no idea why it wants it, but it does | |
472 | LDFLAGS="$LDFLAGS -L/usr/lib" | |
fe0895cf | 473 | |
810b94f0 MW |
474 | SHARED_LD_CC="${CC} -b -o" |
475 | SHARED_LD_CXX="${CXX} -b -o" | |
476 | PIC_FLAG="+Z" | |
477 | fi | |
478 | ;; | |
43948499 | 479 | |
810b94f0 MW |
480 | *-*-linux* ) |
481 | if test "x$GCC" != "xyes"; then | |
482 | AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc, | |
483 | [ | |
484 | AC_TRY_COMPILE([], | |
485 | [ | |
486 | #ifndef __INTEL_COMPILER | |
487 | #error Not icc | |
488 | #endif | |
489 | ], | |
490 | bakefile_cv_prog_icc=yes, | |
491 | bakefile_cv_prog_icc=no | |
492 | ) | |
493 | ]) | |
494 | if test "$bakefile_cv_prog_icc" = "yes"; then | |
495 | PIC_FLAG="-KPIC" | |
496 | fi | |
497 | fi | |
498 | ;; | |
2a879853 | 499 | |
810b94f0 MW |
500 | *-*-solaris2* ) |
501 | if test "x$GCC" != xyes ; then | |
502 | SHARED_LD_CC="${CC} -G -o" | |
503 | SHARED_LD_CXX="${CXX} -G -o" | |
504 | PIC_FLAG="-KPIC" | |
505 | fi | |
506 | ;; | |
fe0895cf | 507 | |
810b94f0 MW |
508 | *-*-darwin* ) |
509 | dnl Most apps benefit from being fully binded (its faster and static | |
510 | dnl variables initialized at startup work). | |
511 | dnl This can be done either with the exe linker flag -Wl,-bind_at_load | |
512 | dnl or with a double stage link in order to create a single module | |
513 | dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved | |
fe0895cf | 514 | |
810b94f0 MW |
515 | dnl If using newer dev tools then there is a -single_module flag that |
516 | dnl we can use to do this, otherwise we'll need to use a helper | |
517 | dnl script. Check the version of gcc to see which way we can go: | |
518 | AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [ | |
519 | AC_TRY_COMPILE([], | |
520 | [ | |
521 | #if (__GNUC__ < 3) || \ | |
522 | ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) | |
523 | #error old gcc | |
524 | #endif | |
525 | ], | |
526 | [ | |
527 | wx_cv_gcc31=yes | |
528 | ], | |
529 | [ | |
530 | wx_cv_gcc31=no | |
531 | ] | |
532 | ) | |
533 | ]) | |
534 | if test "$wx_cv_gcc31" = "no"; then | |
535 | AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH | |
536 | chmod +x shared-ld-sh | |
af8ebe8a | 537 | |
810b94f0 MW |
538 | dnl Use the shared-ld-sh helper script |
539 | SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" | |
540 | SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" | |
541 | SHARED_LD_CXX="$SHARED_LD_CC" | |
542 | SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" | |
543 | else | |
544 | dnl Use the -single_module flag and let the linker do it for us | |
545 | SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o" | |
546 | SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o" | |
547 | SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o" | |
548 | SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o" | |
549 | fi | |
131f235d | 550 | |
3b396a26 DE |
551 | if test "x$GCC" == "xyes"; then |
552 | PIC_FLAG="-dynamic -fPIC" | |
553 | fi | |
554 | if test "x$XLCC" = "xyes"; then | |
555 | PIC_FLAG="-dynamic -DPIC" | |
556 | fi | |
810b94f0 | 557 | ;; |
fe0895cf | 558 | |
810b94f0 MW |
559 | *-*-aix* ) |
560 | dnl default settings are ok for gcc | |
561 | if test "x$GCC" != "xyes"; then | |
562 | dnl the abs path below used to be hardcoded here so I guess it must | |
563 | dnl be some sort of standard location under AIX? | |
564 | AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, | |
565 | makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) | |
566 | dnl FIXME - what about makeCSharedLib? | |
567 | SHARED_LD_CC="$AIX_CC_LD -p 0 -o" | |
568 | SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" | |
569 | fi | |
570 | ;; | |
fe0895cf | 571 | |
810b94f0 MW |
572 | *-*-beos* ) |
573 | dnl can't use gcc under BeOS for shared library creation because it | |
574 | dnl complains about missing 'main' | |
575 | SHARED_LD_CC="${LD} -nostart -o" | |
576 | SHARED_LD_CXX="${LD} -nostart -o" | |
577 | ;; | |
fe0895cf | 578 | |
810b94f0 MW |
579 | *-*-irix* ) |
580 | dnl default settings are ok for gcc | |
581 | if test "x$GCC" != "xyes"; then | |
582 | PIC_FLAG="-KPIC" | |
583 | fi | |
584 | ;; | |
585 | ||
586 | *-*-cygwin* | *-*-mingw32* ) | |
587 | PIC_FLAG="" | |
588 | SHARED_LD_CC="\$(CC) -shared -o" | |
589 | SHARED_LD_CXX="\$(CXX) -shared -o" | |
590 | WINDOWS_IMPLIB=1 | |
591 | ;; | |
fe0895cf | 592 | |
810b94f0 MW |
593 | *-pc-os2_emx | *-pc-os2-emx ) |
594 | SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" | |
595 | SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" | |
596 | PIC_FLAG="" | |
597 | AC_BAKEFILE_CREATE_FILE_DLLAR_SH | |
598 | chmod +x dllar.sh | |
599 | ;; | |
600 | ||
601 | powerpc-apple-macos* | \ | |
602 | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ | |
603 | *-*-sunos4* | \ | |
604 | *-*-osf* | \ | |
605 | *-*-dgux5* | \ | |
606 | *-*-sysv5* | \ | |
607 | *-pc-msdosdjgpp ) | |
608 | dnl defaults are ok | |
609 | ;; | |
fe0895cf | 610 | |
810b94f0 MW |
611 | *) |
612 | AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) | |
613 | esac | |
fe0895cf | 614 | |
810b94f0 MW |
615 | if test "x$PIC_FLAG" != "x" ; then |
616 | PIC_FLAG="$PIC_FLAG -DPIC" | |
617 | fi | |
fe0895cf | 618 | |
810b94f0 MW |
619 | if test "x$SHARED_LD_MODULE_CC" = "x" ; then |
620 | SHARED_LD_MODULE_CC="$SHARED_LD_CC" | |
621 | fi | |
622 | if test "x$SHARED_LD_MODULE_CXX" = "x" ; then | |
623 | SHARED_LD_MODULE_CXX="$SHARED_LD_CXX" | |
624 | fi | |
2e350179 | 625 | |
810b94f0 MW |
626 | AC_SUBST(SHARED_LD_CC) |
627 | AC_SUBST(SHARED_LD_CXX) | |
628 | AC_SUBST(SHARED_LD_MODULE_CC) | |
629 | AC_SUBST(SHARED_LD_MODULE_CXX) | |
630 | AC_SUBST(PIC_FLAG) | |
631 | AC_SUBST(WINDOWS_IMPLIB) | |
632 | ]) | |
2e350179 | 633 | |
2e350179 | 634 | |
810b94f0 MW |
635 | dnl --------------------------------------------------------------------------- |
636 | dnl AC_BAKEFILE_SHARED_VERSIONS | |
637 | dnl | |
638 | dnl Detects linker options for attaching versions (sonames) to shared libs. | |
639 | dnl --------------------------------------------------------------------------- | |
2e350179 | 640 | |
810b94f0 MW |
641 | AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS], |
642 | [ | |
643 | USE_SOVERSION=0 | |
644 | USE_SOVERLINUX=0 | |
645 | USE_SOVERSOLARIS=0 | |
646 | USE_SOVERCYGWIN=0 | |
647 | USE_SOSYMLINKS=0 | |
648 | USE_MACVERSION=0 | |
649 | SONAME_FLAG= | |
2e350179 | 650 | |
810b94f0 MW |
651 | case "${BAKEFILE_HOST}" in |
652 | *-*-linux* | *-*-freebsd* ) | |
653 | SONAME_FLAG="-Wl,-soname," | |
654 | USE_SOVERSION=1 | |
655 | USE_SOVERLINUX=1 | |
656 | USE_SOSYMLINKS=1 | |
657 | ;; | |
2e350179 | 658 | |
810b94f0 MW |
659 | *-*-solaris2* ) |
660 | SONAME_FLAG="-h " | |
661 | USE_SOVERSION=1 | |
662 | USE_SOVERSOLARIS=1 | |
663 | USE_SOSYMLINKS=1 | |
664 | ;; | |
2e350179 | 665 | |
810b94f0 MW |
666 | *-*-darwin* ) |
667 | USE_MACVERSION=1 | |
668 | USE_SOVERSION=1 | |
669 | USE_SOSYMLINKS=1 | |
670 | ;; | |
2e350179 | 671 | |
810b94f0 MW |
672 | *-*-cygwin* ) |
673 | USE_SOVERSION=1 | |
674 | USE_SOVERCYGWIN=1 | |
675 | ;; | |
676 | esac | |
2e350179 | 677 | |
810b94f0 MW |
678 | AC_SUBST(USE_SOVERSION) |
679 | AC_SUBST(USE_SOVERLINUX) | |
680 | AC_SUBST(USE_SOVERSOLARIS) | |
681 | AC_SUBST(USE_SOVERCYGWIN) | |
682 | AC_SUBST(USE_MACVERSION) | |
683 | AC_SUBST(USE_SOSYMLINKS) | |
684 | AC_SUBST(SONAME_FLAG) | |
685 | ]) | |
2e350179 | 686 | |
2e350179 | 687 | |
810b94f0 MW |
688 | dnl --------------------------------------------------------------------------- |
689 | dnl AC_BAKEFILE_DEPS | |
6dcfc289 | 690 | dnl |
810b94f0 MW |
691 | dnl Detects available C/C++ dependency tracking options |
692 | dnl --------------------------------------------------------------------------- | |
2e350179 | 693 | |
810b94f0 MW |
694 | AC_DEFUN([AC_BAKEFILE_DEPS], |
695 | [ | |
696 | AC_MSG_CHECKING([for dependency tracking method]) | |
697 | DEPS_TRACKING=0 | |
6dcfc289 | 698 | |
810b94f0 MW |
699 | if test "x$GCC" = "xyes"; then |
700 | DEPSMODE=gcc | |
701 | DEPS_TRACKING=1 | |
702 | case "${BAKEFILE_HOST}" in | |
3e4ca115 | 703 | *-*-darwin* ) |
810b94f0 MW |
704 | dnl -cpp-precomp (the default) conflicts with -MMD option |
705 | dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) | |
706 | DEPSFLAG_GCC="-no-cpp-precomp -MMD" | |
707 | ;; | |
708 | * ) | |
709 | DEPSFLAG_GCC="-MMD" | |
710 | ;; | |
711 | esac | |
712 | AC_MSG_RESULT([gcc]) | |
713 | elif test "x$MWCC" = "xyes"; then | |
714 | DEPSMODE=mwcc | |
715 | DEPS_TRACKING=1 | |
716 | DEPSFLAG_MWCC="-MM" | |
717 | AC_MSG_RESULT([mwcc]) | |
718 | elif test "x$SUNCC" = "xyes"; then | |
719 | DEPSMODE=suncc | |
720 | DEPS_TRACKING=1 | |
721 | DEPSFLAG_SUNCC="-xM1" | |
722 | AC_MSG_RESULT([suncc]) | |
6dcfc289 | 723 | else |
810b94f0 | 724 | AC_MSG_RESULT([none]) |
6dcfc289 | 725 | fi |
810b94f0 MW |
726 | |
727 | if test $DEPS_TRACKING = 1 ; then | |
728 | AC_BAKEFILE_CREATE_FILE_BK_DEPS | |
729 | chmod +x bk-deps | |
730 | fi | |
731 | ||
732 | AC_SUBST(DEPS_TRACKING) | |
6dcfc289 | 733 | ]) |
2e350179 VS |
734 | |
735 | dnl --------------------------------------------------------------------------- | |
810b94f0 MW |
736 | dnl AC_BAKEFILE_CHECK_BASIC_STUFF |
737 | dnl | |
738 | dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" | |
739 | dnl or "install" | |
2e350179 VS |
740 | dnl --------------------------------------------------------------------------- |
741 | ||
810b94f0 MW |
742 | AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], |
743 | [ | |
744 | AC_PROG_RANLIB | |
745 | AC_PROG_INSTALL | |
746 | AC_PROG_LN_S | |
747 | ||
748 | AC_PROG_MAKE_SET | |
749 | AC_SUBST(MAKE_SET) | |
750 | ||
751 | AC_CHECK_TOOL(AR, ar, ar) | |
752 | AC_CHECK_TOOL(STRIP, strip, :) | |
753 | AC_CHECK_TOOL(NM, nm, :) | |
754 | ||
755 | case ${BAKEFILE_HOST} in | |
756 | *-hp-hpux* ) | |
757 | dnl HP-UX install doesn't handle the "-d" switch so don't | |
758 | dnl use it there | |
759 | INSTALL_DIR="mkdir -p" | |
760 | ;; | |
761 | *) INSTALL_DIR="$INSTALL -d" | |
762 | ;; | |
763 | esac | |
764 | AC_SUBST(INSTALL_DIR) | |
2e350179 | 765 | |
810b94f0 MW |
766 | LDFLAGS_GUI= |
767 | case ${BAKEFILE_HOST} in | |
768 | *-*-cygwin* | *-*-mingw32* ) | |
769 | LDFLAGS_GUI="-mwindows" | |
770 | esac | |
771 | AC_SUBST(LDFLAGS_GUI) | |
772 | ]) | |
2e350179 | 773 | |
2e350179 | 774 | |
6dcfc289 | 775 | dnl --------------------------------------------------------------------------- |
810b94f0 | 776 | dnl AC_BAKEFILE_RES_COMPILERS |
6dcfc289 | 777 | dnl |
810b94f0 | 778 | dnl Checks for presence of resource compilers for win32 or mac |
6dcfc289 DE |
779 | dnl --------------------------------------------------------------------------- |
780 | ||
810b94f0 | 781 | AC_DEFUN([AC_BAKEFILE_RES_COMPILERS], |
6dcfc289 | 782 | [ |
810b94f0 MW |
783 | RESCOMP= |
784 | SETFILE= | |
6dcfc289 | 785 | |
810b94f0 MW |
786 | case ${BAKEFILE_HOST} in |
787 | *-*-cygwin* | *-*-mingw32* ) | |
788 | dnl Check for win32 resources compiler: | |
789 | if test "$build" != "$host" ; then | |
790 | RESCOMP=$host_alias-windres | |
791 | else | |
792 | AC_CHECK_PROG(RESCOMP, windres, windres, windres) | |
793 | fi | |
794 | ;; | |
795 | ||
796 | *-*-darwin* | powerpc-apple-macos* ) | |
797 | AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez) | |
798 | AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) | |
799 | ;; | |
800 | esac | |
801 | ||
802 | AC_SUBST(RESCOMP) | |
803 | AC_SUBST(SETFILE) | |
2e350179 | 804 | ]) |
2e350179 VS |
805 | |
806 | dnl --------------------------------------------------------------------------- | |
810b94f0 | 807 | dnl AC_BAKEFILE_PRECOMP_HEADERS |
6dcfc289 | 808 | dnl |
810b94f0 | 809 | dnl Check for precompiled headers support (GCC >= 3.4) |
2e350179 VS |
810 | dnl --------------------------------------------------------------------------- |
811 | ||
810b94f0 | 812 | AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], |
2e350179 | 813 | [ |
2e350179 | 814 | |
810b94f0 MW |
815 | AC_ARG_ENABLE([precomp-headers], |
816 | AS_HELP_STRING([--disable-precomp-headers], | |
817 | [don't use precompiled headers even if compiler can]), | |
818 | [bk_use_pch="$enableval"]) | |
819 | ||
820 | GCC_PCH=0 | |
821 | ||
822 | if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then | |
823 | if test "x$GCC" = "xyes"; then | |
824 | dnl test if we have gcc-3.4: | |
825 | AC_MSG_CHECKING([if the compiler supports precompiled headers]) | |
826 | AC_TRY_COMPILE([], | |
827 | [ | |
828 | #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) | |
829 | #error "no pch support" | |
830 | #endif | |
831 | #if (__GNUC__ < 3) | |
832 | #error "no pch support" | |
833 | #endif | |
834 | #if (__GNUC__ == 3) && \ | |
835 | ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \ | |
836 | ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) | |
837 | #error "no pch support" | |
838 | #endif | |
839 | ], | |
840 | [ | |
841 | AC_MSG_RESULT([yes]) | |
842 | GCC_PCH=1 | |
843 | ], | |
844 | [ | |
845 | AC_MSG_RESULT([no]) | |
846 | ]) | |
847 | if test $GCC_PCH = 1 ; then | |
848 | AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH | |
849 | chmod +x bk-make-pch | |
850 | fi | |
851 | fi | |
6dcfc289 | 852 | fi |
2e350179 | 853 | |
810b94f0 | 854 | AC_SUBST(GCC_PCH) |
6dcfc289 | 855 | ]) |
fe0895cf | 856 | |
6dcfc289 | 857 | |
810b94f0 | 858 | |
6dcfc289 | 859 | dnl --------------------------------------------------------------------------- |
810b94f0 | 860 | dnl AC_BAKEFILE([autoconf_inc.m4 inclusion]) |
6dcfc289 | 861 | dnl |
810b94f0 MW |
862 | dnl To be used in configure.in of any project using Bakefile-generated mks |
863 | dnl | |
864 | dnl Behaviour can be modified by setting following variables: | |
865 | dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to | |
866 | dnl to perform check for basic tools like ranlib | |
867 | dnl BAKEFILE_HOST set this to override host detection, defaults | |
868 | dnl to ${host} | |
869 | dnl BAKEFILE_FORCE_PLATFORM set to override platform detection | |
870 | dnl | |
871 | dnl Example usage: | |
872 | dnl | |
873 | dnl AC_BAKEFILE([FOO(autoconf_inc.m4)]) | |
874 | dnl | |
875 | dnl (replace FOO with m4_include above, aclocal would die otherwise) | |
876 | dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing | |
877 | dnl we can do...) | |
6dcfc289 DE |
878 | dnl --------------------------------------------------------------------------- |
879 | ||
810b94f0 | 880 | AC_DEFUN([AC_BAKEFILE], |
6dcfc289 | 881 | [ |
810b94f0 | 882 | AC_PREREQ(2.58) |
6dcfc289 | 883 | |
810b94f0 MW |
884 | if test "x$BAKEFILE_HOST" = "x"; then |
885 | BAKEFILE_HOST="${host}" | |
886 | fi | |
49b0a3aa | 887 | |
810b94f0 MW |
888 | if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then |
889 | AC_BAKEFILE_CHECK_BASIC_STUFF | |
890 | fi | |
891 | AC_BAKEFILE_GNUMAKE | |
892 | AC_BAKEFILE_PLATFORM | |
893 | AC_BAKEFILE_PLATFORM_SPECIFICS | |
894 | AC_BAKEFILE_SUFFIXES | |
895 | AC_BAKEFILE_SHARED_LD | |
896 | AC_BAKEFILE_SHARED_VERSIONS | |
897 | AC_BAKEFILE_DEPS | |
898 | AC_BAKEFILE_RES_COMPILERS | |
fe0895cf | 899 | |
c9469659 | 900 | BAKEFILE_BAKEFILE_M4_VERSION="0.1.9" |
810b94f0 MW |
901 | |
902 | dnl includes autoconf_inc.m4: | |
903 | $1 | |
6dcfc289 | 904 | |
810b94f0 MW |
905 | if test "$BAKEFILE_AUTOCONF_INC_M4_VERSION" = "" ; then |
906 | AC_MSG_ERROR([No version found in autoconf_inc.m4 - bakefile macro was changed to take additional argument, perhaps configure.in wasn't updated (see the documentation)?]) | |
907 | fi | |
908 | ||
909 | if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then | |
910 | AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.]) | |
6dcfc289 | 911 | fi |
6dcfc289 | 912 | ]) |
810b94f0 | 913 | |
45842500 | 914 | |
6dcfc289 | 915 | dnl --------------------------------------------------------------------------- |
810b94f0 | 916 | dnl Embedded copies of helper scripts follow: |
6dcfc289 | 917 | dnl --------------------------------------------------------------------------- |
45842500 | 918 | |
810b94f0 | 919 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH], |
6dcfc289 | 920 | [ |
810b94f0 MW |
921 | dnl ===================== dllar.sh begins here ===================== |
922 | dnl (Created by merge-scripts.py from dllar.sh | |
923 | dnl file do not edit here!) | |
924 | D='$' | |
925 | cat <<EOF >dllar.sh | |
926 | #!/bin/sh | |
927 | # | |
928 | # dllar - a tool to build both a .dll and an .a file | |
929 | # from a set of object (.o) files for EMX/OS2. | |
930 | # | |
931 | # Written by Andrew Zabolotny, bit@freya.etu.ru | |
932 | # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de | |
933 | # | |
934 | # This script will accept a set of files on the command line. | |
935 | # All the public symbols from the .o files will be exported into | |
936 | # a .DEF file, then linker will be run (through gcc) against them to | |
937 | # build a shared library consisting of all given .o files. All libraries | |
938 | # (.a) will be first decompressed into component .o files then act as | |
939 | # described above. You can optionally give a description (-d "description") | |
940 | # which will be put into .DLL. To see the list of accepted options (as well | |
941 | # as command-line format) simply run this program without options. The .DLL | |
942 | # is built to be imported by name (there is no guarantee that new versions | |
943 | # of the library you build will have same ordinals for same symbols). | |
944 | # | |
945 | # dllar is free software; you can redistribute it and/or modify | |
946 | # it under the terms of the GNU General Public License as published by | |
947 | # the Free Software Foundation; either version 2, or (at your option) | |
948 | # any later version. | |
949 | # | |
950 | # dllar is distributed in the hope that it will be useful, | |
951 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
952 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
953 | # GNU General Public License for more details. | |
954 | # | |
955 | # You should have received a copy of the GNU General Public License | |
956 | # along with dllar; see the file COPYING. If not, write to the Free | |
957 | # Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
958 | # 02111-1307, USA. | |
45842500 | 959 | |
810b94f0 MW |
960 | # To successfuly run this program you will need: |
961 | # - Current drive should have LFN support (HPFS, ext2, network, etc) | |
962 | # (Sometimes dllar generates filenames which won't fit 8.3 scheme) | |
963 | # - gcc | |
964 | # (used to build the .dll) | |
965 | # - emxexp | |
966 | # (used to create .def file from .o files) | |
967 | # - emximp | |
968 | # (used to create .a file from .def file) | |
969 | # - GNU text utilites (cat, sort, uniq) | |
970 | # used to process emxexp output | |
971 | # - GNU file utilities (mv, rm) | |
972 | # - GNU sed | |
973 | # - lxlite (optional, see flag below) | |
974 | # (used for general .dll cleanup) | |
975 | # | |
45842500 | 976 | |
810b94f0 | 977 | flag_USE_LXLITE=1; |
fe0895cf | 978 | |
810b94f0 MW |
979 | # |
980 | # helper functions | |
981 | # basnam, variant of basename, which does _not_ remove the path, _iff_ | |
982 | # second argument (suffix to remove) is given | |
983 | basnam(){ | |
984 | case ${D}# in | |
985 | 1) | |
986 | echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//' | |
987 | ;; | |
988 | 2) | |
989 | echo ${D}1 | sed 's/'${D}2'${D}//' | |
990 | ;; | |
991 | *) | |
992 | echo "error in basnam ${D}*" | |
993 | exit 8 | |
994 | ;; | |
995 | esac | |
996 | } | |
6ff53182 | 997 | |
810b94f0 MW |
998 | # Cleanup temporary files and output |
999 | CleanUp() { | |
1000 | cd ${D}curDir | |
1001 | for i in ${D}inputFiles ; do | |
1002 | case ${D}i in | |
1003 | *!) | |
1004 | rm -rf \`basnam ${D}i !\` | |
1005 | ;; | |
1006 | *) | |
1007 | ;; | |
1008 | esac | |
1009 | done | |
f93ca9fd | 1010 | |
810b94f0 MW |
1011 | # Kill result in case of failure as there is just to many stupid make/nmake |
1012 | # things out there which doesn't do this. | |
1013 | if @<:@ ${D}# -eq 0 @:>@; then | |
1014 | rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile | |
1015 | fi | |
1016 | } | |
fe0895cf | 1017 | |
810b94f0 MW |
1018 | # Print usage and exit script with rc=1. |
1019 | PrintHelp() { | |
1020 | echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@' | |
1021 | echo ' @<:@-name-mangler-script script.sh@:>@' | |
1022 | echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@' | |
1023 | echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"' | |
1024 | echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@' | |
1025 | echo ' @<:@*.o@:>@ @<:@*.a@:>@' | |
1026 | echo '*> "output_file" should have no extension.' | |
1027 | echo ' If it has the .o, .a or .dll extension, it is automatically removed.' | |
1028 | echo ' The import library name is derived from this and is set to "name".a,' | |
1029 | echo ' unless overridden by -import' | |
1030 | echo '*> "importlib_name" should have no extension.' | |
1031 | echo ' If it has the .o, or .a extension, it is automatically removed.' | |
1032 | echo ' This name is used as the import library name and may be longer and' | |
1033 | echo ' more descriptive than the DLL name which has to follow the old ' | |
1034 | echo ' 8.3 convention of FAT.' | |
1035 | echo '*> "script.sh may be given to override the output_file name by a' | |
1036 | echo ' different name. It is mainly useful if the regular make process' | |
1037 | echo ' of some package does not take into account OS/2 restriction of' | |
1038 | echo ' DLL name lengths. It takes the importlib name as input and is' | |
1039 | echo ' supposed to procude a shorter name as output. The script should' | |
1040 | echo ' expect to get importlib_name without extension and should produce' | |
1041 | echo ' a (max.) 8 letter name without extension.' | |
1042 | echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)' | |
1043 | echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)' | |
1044 | echo ' These flags will be put at the start of GCC command line.' | |
1045 | echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.' | |
1046 | echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define' | |
1047 | echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".' | |
1048 | echo ' If the last character of a symbol is "*", all symbols beginning' | |
1049 | echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).' | |
1050 | echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or' | |
1051 | echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.' | |
1052 | echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s' | |
1053 | echo ' C runtime DLLs.' | |
1054 | echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.' | |
1055 | echo '*> All other switches (for example -L./ or -lmylib) will be passed' | |
1056 | echo ' unchanged to GCC at the end of command line.' | |
1057 | echo '*> If you create a DLL from a library and you do not specify -o,' | |
1058 | echo ' the basename for DLL and import library will be set to library name,' | |
1059 | echo ' the initial library will be renamed to 'name'_s.a (_s for static)' | |
1060 | echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial' | |
1061 | echo ' library will be renamed into gcc_s.a.' | |
1062 | echo '--------' | |
1063 | echo 'Example:' | |
1064 | echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord' | |
1065 | echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"' | |
1066 | CleanUp | |
1067 | exit 1 | |
1068 | } | |
3fd9c298 | 1069 | |
810b94f0 MW |
1070 | # Execute a command. |
1071 | # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script. | |
1072 | # @Uses Whatever CleanUp() uses. | |
1073 | doCommand() { | |
1074 | echo "${D}*" | |
1075 | eval ${D}* | |
1076 | rcCmd=${D}? | |
3fd9c298 | 1077 | |
810b94f0 MW |
1078 | if @<:@ ${D}rcCmd -ne 0 @:>@; then |
1079 | echo "command failed, exit code="${D}rcCmd | |
1080 | CleanUp | |
1081 | exit ${D}rcCmd | |
1082 | fi | |
1083 | } | |
6dcfc289 DE |
1084 | |
1085 | # main routine | |
1086 | # setup globals | |
1087 | cmdLine=${D}* | |
1088 | outFile="" | |
1089 | outimpFile="" | |
1090 | inputFiles="" | |
1091 | renameScript="" | |
1092 | description="" | |
1093 | CC=gcc.exe | |
1094 | CFLAGS="-s -Zcrtdll" | |
1095 | EXTRA_CFLAGS="" | |
1096 | EXPORT_BY_ORDINALS=0 | |
1097 | exclude_symbols="" | |
1098 | library_flags="" | |
1099 | curDir=\`pwd\` | |
1100 | curDirS=curDir | |
1101 | case ${D}curDirS in | |
1102 | */) | |
1103 | ;; | |
1104 | *) | |
1105 | curDirS=${D}{curDirS}"/" | |
1106 | ;; | |
1107 | esac | |
1108 | # Parse commandline | |
1109 | libsToLink=0 | |
1110 | omfLinking=0 | |
1111 | while @<:@ ${D}1 @:>@; do | |
1112 | case ${D}1 in | |
1113 | -ord*) | |
1114 | EXPORT_BY_ORDINALS=1; | |
1115 | ;; | |
1116 | -o*) | |
1117 | shift | |
1118 | outFile=${D}1 | |
1119 | ;; | |
1120 | -i*) | |
1121 | shift | |
1122 | outimpFile=${D}1 | |
1123 | ;; | |
1124 | -name-mangler-script) | |
1125 | shift | |
1126 | renameScript=${D}1 | |
1127 | ;; | |
1128 | -d*) | |
1129 | shift | |
1130 | description=${D}1 | |
1131 | ;; | |
1132 | -f*) | |
1133 | shift | |
1134 | CFLAGS=${D}1 | |
1135 | ;; | |
1136 | -c*) | |
1137 | shift | |
1138 | CC=${D}1 | |
1139 | ;; | |
1140 | -h*) | |
1141 | PrintHelp | |
1142 | ;; | |
1143 | -ex*) | |
1144 | shift | |
1145 | exclude_symbols=${D}{exclude_symbols}${D}1" " | |
1146 | ;; | |
1147 | -libf*) | |
1148 | shift | |
1149 | library_flags=${D}{library_flags}${D}1" " | |
1150 | ;; | |
1151 | -nocrt*) | |
1152 | CFLAGS="-s" | |
1153 | ;; | |
1154 | -nolxl*) | |
1155 | flag_USE_LXLITE=0 | |
1156 | ;; | |
1157 | -* | /*) | |
1158 | case ${D}1 in | |
1159 | -L* | -l*) | |
1160 | libsToLink=1 | |
1161 | ;; | |
1162 | -Zomf) | |
1163 | omfLinking=1 | |
1164 | ;; | |
1165 | *) | |
1166 | ;; | |
1167 | esac | |
1168 | EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 | |
1169 | ;; | |
1170 | *.dll) | |
1171 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`" | |
1172 | if @<:@ ${D}omfLinking -eq 1 @:>@; then | |
1173 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib" | |
1174 | else | |
1175 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a" | |
1176 | fi | |
1177 | ;; | |
1178 | *) | |
1179 | found=0; | |
1180 | if @<:@ ${D}libsToLink -ne 0 @:>@; then | |
1181 | EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 | |
1182 | else | |
1183 | for file in ${D}1 ; do | |
1184 | if @<:@ -f ${D}file @:>@; then | |
1185 | inputFiles="${D}{inputFiles} ${D}file" | |
1186 | found=1 | |
1187 | fi | |
1188 | done | |
1189 | if @<:@ ${D}found -eq 0 @:>@; then | |
1190 | echo "ERROR: No file(s) found: "${D}1 | |
1191 | exit 8 | |
1192 | fi | |
1193 | fi | |
1194 | ;; | |
1195 | esac | |
1196 | shift | |
1197 | done # iterate cmdline words | |
1198 | ||
1199 | # | |
1200 | if @<:@ -z "${D}inputFiles" @:>@; then | |
1201 | echo "dllar: no input files" | |
1202 | PrintHelp | |
1203 | fi | |
1204 | ||
1205 | # Now extract all .o files from .a files | |
1206 | newInputFiles="" | |
1207 | for file in ${D}inputFiles ; do | |
1208 | case ${D}file in | |
1209 | *.a | *.lib) | |
1210 | case ${D}file in | |
1211 | *.a) | |
1212 | suffix=".a" | |
1213 | AR="ar" | |
1214 | ;; | |
1215 | *.lib) | |
1216 | suffix=".lib" | |
1217 | AR="emxomfar" | |
1218 | EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf" | |
1219 | ;; | |
1220 | *) | |
1221 | ;; | |
1222 | esac | |
1223 | dirname=\`basnam ${D}file ${D}suffix\`"_%" | |
1224 | mkdir ${D}dirname | |
1225 | if @<:@ ${D}? -ne 0 @:>@; then | |
1226 | echo "Failed to create subdirectory ./${D}dirname" | |
1227 | CleanUp | |
1228 | exit 8; | |
1229 | fi | |
1230 | # Append '!' to indicate archive | |
1231 | newInputFiles="${D}newInputFiles ${D}{dirname}!" | |
1232 | doCommand "cd ${D}dirname; ${D}AR x ../${D}file" | |
1233 | cd ${D}curDir | |
1234 | found=0; | |
1235 | for subfile in ${D}dirname/*.o* ; do | |
1236 | if @<:@ -f ${D}subfile @:>@; then | |
1237 | found=1 | |
1238 | if @<:@ -s ${D}subfile @:>@; then | |
1239 | # FIXME: This should be: is file size > 32 byte, _not_ > 0! | |
1240 | newInputFiles="${D}newInputFiles ${D}subfile" | |
1241 | fi | |
1242 | fi | |
1243 | done | |
1244 | if @<:@ ${D}found -eq 0 @:>@; then | |
1245 | echo "WARNING: there are no files in archive \\'${D}file\\'" | |
1246 | fi | |
1247 | ;; | |
1248 | *) | |
1249 | newInputFiles="${D}{newInputFiles} ${D}file" | |
1250 | ;; | |
1251 | esac | |
1252 | done | |
1253 | inputFiles="${D}newInputFiles" | |
1254 | ||
1255 | # Output filename(s). | |
1256 | do_backup=0; | |
1257 | if @<:@ -z ${D}outFile @:>@; then | |
1258 | do_backup=1; | |
1259 | set outFile ${D}inputFiles; outFile=${D}2 | |
1260 | fi | |
1261 | ||
1262 | # If it is an archive, remove the '!' and the '_%' suffixes | |
1263 | case ${D}outFile in | |
1264 | *_%!) | |
1265 | outFile=\`basnam ${D}outFile _%!\` | |
1266 | ;; | |
1267 | *) | |
1268 | ;; | |
1269 | esac | |
1270 | case ${D}outFile in | |
1271 | *.dll) | |
1272 | outFile=\`basnam ${D}outFile .dll\` | |
1273 | ;; | |
1274 | *.DLL) | |
1275 | outFile=\`basnam ${D}outFile .DLL\` | |
1276 | ;; | |
1277 | *.o) | |
1278 | outFile=\`basnam ${D}outFile .o\` | |
1279 | ;; | |
1280 | *.obj) | |
1281 | outFile=\`basnam ${D}outFile .obj\` | |
1282 | ;; | |
1283 | *.a) | |
1284 | outFile=\`basnam ${D}outFile .a\` | |
1285 | ;; | |
1286 | *.lib) | |
1287 | outFile=\`basnam ${D}outFile .lib\` | |
1288 | ;; | |
1289 | *) | |
1290 | ;; | |
1291 | esac | |
1292 | case ${D}outimpFile in | |
1293 | *.a) | |
1294 | outimpFile=\`basnam ${D}outimpFile .a\` | |
1295 | ;; | |
1296 | *.lib) | |
1297 | outimpFile=\`basnam ${D}outimpFile .lib\` | |
1298 | ;; | |
1299 | *) | |
1300 | ;; | |
1301 | esac | |
1302 | if @<:@ -z ${D}outimpFile @:>@; then | |
1303 | outimpFile=${D}outFile | |
1304 | fi | |
1305 | defFile="${D}{outFile}.def" | |
1306 | arcFile="${D}{outimpFile}.a" | |
1307 | arcFile2="${D}{outimpFile}.lib" | |
1308 | ||
1309 | #create ${D}dllFile as something matching 8.3 restrictions, | |
1310 | if @<:@ -z ${D}renameScript @:>@ ; then | |
1311 | dllFile="${D}outFile" | |
1312 | else | |
1313 | dllFile=\`${D}renameScript ${D}outimpFile\` | |
1314 | fi | |
1315 | ||
1316 | if @<:@ ${D}do_backup -ne 0 @:>@ ; then | |
1317 | if @<:@ -f ${D}arcFile @:>@ ; then | |
1318 | doCommand "mv ${D}arcFile ${D}{outFile}_s.a" | |
1319 | fi | |
1320 | if @<:@ -f ${D}arcFile2 @:>@ ; then | |
1321 | doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib" | |
1322 | fi | |
1323 | fi | |
1324 | ||
1325 | # Extract public symbols from all the object files. | |
1326 | tmpdefFile=${D}{defFile}_% | |
1327 | rm -f ${D}tmpdefFile | |
1328 | for file in ${D}inputFiles ; do | |
1329 | case ${D}file in | |
1330 | *!) | |
1331 | ;; | |
1332 | *) | |
1333 | doCommand "emxexp -u ${D}file >> ${D}tmpdefFile" | |
1334 | ;; | |
1335 | esac | |
1336 | done | |
1337 | ||
1338 | # Create the def file. | |
1339 | rm -f ${D}defFile | |
1340 | echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile | |
1341 | dllFile="${D}{dllFile}.dll" | |
1342 | if @<:@ ! -z ${D}description @:>@; then | |
1343 | echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile | |
1344 | fi | |
1345 | echo "EXPORTS" >> ${D}defFile | |
3fd9c298 | 1346 | |
6dcfc289 DE |
1347 | doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%" |
1348 | grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile | |
3fd9c298 | 1349 | |
6dcfc289 DE |
1350 | # Checks if the export is ok or not. |
1351 | for word in ${D}exclude_symbols; do | |
1352 | grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}% | |
1353 | mv ${D}{tmpdefFile}% ${D}tmpdefFile | |
1354 | done | |
3fd9c298 | 1355 | |
3fd9c298 | 1356 | |
6dcfc289 DE |
1357 | if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then |
1358 | sed "=" < ${D}tmpdefFile | \\ | |
1359 | sed ' | |
1360 | N | |
1361 | : loop | |
1362 | s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/ | |
1363 | t loop | |
1364 | ' > ${D}{tmpdefFile}% | |
1365 | grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile | |
1366 | else | |
1367 | rm -f ${D}{tmpdefFile}% | |
1368 | fi | |
1369 | cat ${D}tmpdefFile >> ${D}defFile | |
1370 | rm -f ${D}tmpdefFile | |
3fd9c298 | 1371 | |
6dcfc289 DE |
1372 | # Do linking, create implib, and apply lxlite. |
1373 | gccCmdl=""; | |
1374 | for file in ${D}inputFiles ; do | |
1375 | case ${D}file in | |
1376 | *!) | |
1377 | ;; | |
810b94f0 MW |
1378 | *) |
1379 | gccCmdl="${D}gccCmdl ${D}file" | |
1380 | ;; | |
1381 | esac | |
1382 | done | |
1383 | doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS" | |
1384 | touch "${D}{outFile}.dll" | |
1385 | ||
1386 | doCommand "emximp -o ${D}arcFile ${D}defFile" | |
1387 | if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then | |
1388 | add_flags=""; | |
1389 | if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then | |
1390 | add_flags="-ynd" | |
1391 | fi | |
1392 | doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile" | |
1393 | fi | |
1394 | doCommand "emxomf -s -l ${D}arcFile" | |
1395 | ||
1396 | # Successful exit. | |
1397 | CleanUp 1 | |
1398 | exit 0 | |
1399 | EOF | |
1400 | dnl ===================== dllar.sh ends here ===================== | |
1401 | ]) | |
1402 | ||
1403 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS], | |
1404 | [ | |
1405 | dnl ===================== bk-deps begins here ===================== | |
1406 | dnl (Created by merge-scripts.py from bk-deps | |
1407 | dnl file do not edit here!) | |
1408 | D='$' | |
1409 | cat <<EOF >bk-deps | |
1410 | #!/bin/sh | |
1411 | ||
1412 | # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf | |
1413 | # script. It is used to track C/C++ files dependencies in portable way. | |
1414 | # | |
1415 | # Permission is given to use this file in any way. | |
1416 | ||
1417 | DEPSMODE=${DEPSMODE} | |
1418 | DEPSDIR=.deps | |
1419 | DEPSFLAG_GCC="${DEPSFLAG_GCC}" | |
1420 | DEPSFLAG_MWCC="${DEPSFLAG_MWCC}" | |
1421 | DEPSFLAG_SUNCC="${DEPSFLAG_SUNCC}" | |
1422 | ||
1423 | mkdir -p ${D}DEPSDIR | |
1424 | ||
1425 | if test ${D}DEPSMODE = gcc ; then | |
1426 | ${D}* ${D}{DEPSFLAG_GCC} | |
1427 | status=${D}? | |
1428 | if test ${D}{status} != 0 ; then | |
1429 | exit ${D}{status} | |
1430 | fi | |
1431 | # move created file to the location we want it in: | |
1432 | while test ${D}# -gt 0; do | |
1433 | case "${D}1" in | |
1434 | -o ) | |
1435 | shift | |
1436 | objfile=${D}1 | |
1437 | ;; | |
1438 | -* ) | |
1439 | ;; | |
1440 | * ) | |
1441 | srcfile=${D}1 | |
1442 | ;; | |
1443 | esac | |
1444 | shift | |
1445 | done | |
1446 | depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\` | |
1447 | depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\` | |
1448 | if test -f ${D}depfile ; then | |
1449 | sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d | |
1450 | rm -f ${D}depfile | |
1451 | else | |
1452 | depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\` | |
1453 | if test -f ${D}depfile ; then | |
1454 | sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d | |
1455 | rm -f ${D}depfile | |
1456 | fi | |
1457 | fi | |
1458 | exit 0 | |
1459 | elif test ${D}DEPSMODE = mwcc ; then | |
1460 | ${D}* | |
1461 | status=${D}? | |
1462 | if test ${D}{status} != 0 ; then | |
1463 | exit ${D}{status} | |
1464 | fi | |
1465 | # Run mwcc again with -MM and redirect into the dep file we want | |
1466 | # NOTE: We can't use shift here because we need ${D}* to be valid | |
1467 | prevarg= | |
1468 | for arg in ${D}* ; do | |
1469 | if test "${D}prevarg" = "-o"; then | |
1470 | objfile=${D}arg | |
1471 | else | |
1472 | case "${D}arg" in | |
1473 | -* ) | |
1474 | ;; | |
1475 | * ) | |
1476 | srcfile=${D}arg | |
1477 | ;; | |
1478 | esac | |
1479 | fi | |
1480 | prevarg="${D}arg" | |
1481 | done | |
1482 | ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d | |
1483 | exit 0 | |
1484 | elif test ${D}DEPSMODE = suncc; then | |
1485 | ${D}* || exit | |
1486 | # Run compiler again with deps flag and redirect into the dep file. | |
1487 | # It doesn't work if the '-o FILE' option is used, but without it the | |
1488 | # dependency file will contain the wrong name for the object. So it is | |
1489 | # removed from the command line, and the dep file is fixed with sed. | |
1490 | cmd="" | |
1491 | while test ${D}# -gt 0; do | |
1492 | case "${D}1" in | |
1493 | -o ) | |
1494 | shift | |
1495 | objfile=${D}1 | |
1496 | ;; | |
1497 | * ) | |
1498 | eval arg${D}#=\\${D}1 | |
1499 | cmd="${D}cmd \\${D}arg${D}#" | |
1500 | ;; | |
1501 | esac | |
1502 | shift | |
1503 | done | |
1504 | eval "${D}cmd ${D}DEPSFLAG_SUNCC" | sed "s|.*:|${D}objfile:|" >${D}{DEPSDIR}/${D}{objfile}.d | |
1505 | exit 0 | |
1506 | else | |
1507 | ${D}* | |
1508 | exit ${D}? | |
1509 | fi | |
1510 | EOF | |
1511 | dnl ===================== bk-deps ends here ===================== | |
1512 | ]) | |
1513 | ||
1514 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH], | |
1515 | [ | |
1516 | dnl ===================== shared-ld-sh begins here ===================== | |
1517 | dnl (Created by merge-scripts.py from shared-ld-sh | |
1518 | dnl file do not edit here!) | |
1519 | D='$' | |
1520 | cat <<EOF >shared-ld-sh | |
1521 | #!/bin/sh | |
1522 | #----------------------------------------------------------------------------- | |
1523 | #-- Name: distrib/mac/shared-ld-sh | |
1524 | #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X | |
1525 | #-- Author: Gilles Depeyrot | |
1526 | #-- Copyright: (c) 2002 Gilles Depeyrot | |
1527 | #-- Licence: any use permitted | |
1528 | #----------------------------------------------------------------------------- | |
1529 | ||
1530 | verbose=0 | |
1531 | args="" | |
1532 | objects="" | |
1533 | linking_flag="-dynamiclib" | |
1534 | ldargs="-r -keep_private_externs -nostdlib" | |
1535 | ||
1536 | while test ${D}# -gt 0; do | |
1537 | case ${D}1 in | |
1538 | ||
1539 | -v) | |
1540 | verbose=1 | |
1541 | ;; | |
1542 | ||
1543 | -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) | |
1544 | # collect these options and values | |
1545 | args="${D}{args} ${D}1 ${D}2" | |
1546 | shift | |
1547 | ;; | |
1548 | ||
1549 | -s|-Wl,*) | |
1550 | # collect these load args | |
1551 | ldargs="${D}{ldargs} ${D}1" | |
b5715bdd | 1552 | ;; |
810b94f0 MW |
1553 | |
1554 | -l*|-L*|-flat_namespace|-headerpad_max_install_names) | |
1555 | # collect these options | |
1556 | args="${D}{args} ${D}1" | |
1557 | ;; | |
1558 | ||
1559 | -dynamiclib|-bundle) | |
1560 | linking_flag="${D}1" | |
1561 | ;; | |
1562 | ||
1563 | -*) | |
1564 | echo "shared-ld: unhandled option '${D}1'" | |
1565 | exit 1 | |
1566 | ;; | |
1567 | ||
1568 | *.o | *.a | *.dylib) | |
1569 | # collect object files | |
1570 | objects="${D}{objects} ${D}1" | |
1571 | ;; | |
1572 | ||
1573 | *) | |
1574 | echo "shared-ld: unhandled argument '${D}1'" | |
1575 | exit 1 | |
6dcfc289 | 1576 | ;; |
810b94f0 | 1577 | |
6dcfc289 | 1578 | esac |
810b94f0 | 1579 | shift |
6dcfc289 | 1580 | done |
3fd9c298 | 1581 | |
810b94f0 MW |
1582 | status=0 |
1583 | ||
1584 | # | |
1585 | # Link one module containing all the others | |
1586 | # | |
1587 | if test ${D}{verbose} = 1; then | |
1588 | echo "c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o" | |
1589 | fi | |
1590 | c++ ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o | |
1591 | status=${D}? | |
1592 | ||
1593 | # | |
1594 | # Link the shared library from the single module created, but only if the | |
1595 | # previous command didn't fail: | |
1596 | # | |
1597 | if test ${D}{status} = 0; then | |
1598 | if test ${D}{verbose} = 1; then | |
1599 | echo "c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args}" | |
6dcfc289 | 1600 | fi |
810b94f0 MW |
1601 | c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args} |
1602 | status=${D}? | |
6dcfc289 | 1603 | fi |
3fd9c298 | 1604 | |
810b94f0 MW |
1605 | # |
1606 | # Remove intermediate module | |
1607 | # | |
1608 | rm -f master.${D}${D}.o | |
1609 | ||
1610 | exit ${D}status | |
6dcfc289 | 1611 | EOF |
810b94f0 | 1612 | dnl ===================== shared-ld-sh ends here ===================== |
6dcfc289 | 1613 | ]) |
3fd9c298 | 1614 | |
810b94f0 | 1615 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH], |
6dcfc289 | 1616 | [ |
810b94f0 MW |
1617 | dnl ===================== bk-make-pch begins here ===================== |
1618 | dnl (Created by merge-scripts.py from bk-make-pch | |
6dcfc289 DE |
1619 | dnl file do not edit here!) |
1620 | D='$' | |
810b94f0 | 1621 | cat <<EOF >bk-make-pch |
6dcfc289 DE |
1622 | #!/bin/sh |
1623 | ||
1624 | # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf | |
810b94f0 | 1625 | # script. It is used to generated precompiled headers. |
6dcfc289 DE |
1626 | # |
1627 | # Permission is given to use this file in any way. | |
1628 | ||
810b94f0 MW |
1629 | outfile="${D}{1}" |
1630 | header="${D}{2}" | |
1631 | shift | |
1632 | shift | |
1633 | ||
1634 | compiler= | |
1635 | headerfile= | |
1636 | while test ${D}{#} -gt 0; do | |
1637 | case "${D}{1}" in | |
1638 | -I* ) | |
1639 | incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\` | |
1640 | if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then | |
1641 | headerfile="${D}{incdir}/${D}{header}" | |
1642 | fi | |
1643 | ;; | |
1644 | esac | |
1645 | compiler="${D}{compiler} ${D}{1}" | |
1646 | shift | |
1647 | done | |
1648 | ||
1649 | if test "x${D}{headerfile}" = "x" ; then | |
1650 | echo "error: can't find header ${D}{header} in include paths" >2 | |
1651 | else | |
1652 | if test -f ${D}{outfile} ; then | |
1653 | rm -f ${D}{outfile} | |
1654 | else | |
1655 | mkdir -p \`dirname ${D}{outfile}\` | |
1656 | fi | |
1657 | depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d" | |
1658 | mkdir -p .deps | |
1659 | # can do this because gcc is >= 3.4: | |
1660 | ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" | |
1661 | exit ${D}{?} | |
1662 | fi | |
1663 | EOF | |
1664 | dnl ===================== bk-make-pch ends here ===================== | |
1665 | ]) | |
1666 | ||
1667 | dnl | |
1668 | dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
1669 | dnl | |
1670 | AC_DEFUN(AM_PATH_CPPUNIT, | |
1671 | [ | |
1672 | ||
1673 | AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], | |
1674 | cppunit_config_prefix="$withval", cppunit_config_prefix="") | |
1675 | AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], | |
1676 | cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") | |
1677 | ||
1678 | if test x$cppunit_config_exec_prefix != x ; then | |
1679 | cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" | |
1680 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
1681 | CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config | |
1682 | fi | |
1683 | fi | |
1684 | if test x$cppunit_config_prefix != x ; then | |
1685 | cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" | |
1686 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
1687 | CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config | |
1688 | fi | |
1689 | fi | |
1690 | ||
1691 | AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) | |
1692 | cppunit_version_min=$1 | |
1693 | ||
1694 | AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) | |
1695 | no_cppunit="" | |
1696 | if test "$CPPUNIT_CONFIG" = "no" ; then | |
1697 | no_cppunit=yes | |
1698 | else | |
1699 | CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` | |
1700 | CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` | |
1701 | cppunit_version=`$CPPUNIT_CONFIG --version` | |
1702 | ||
1703 | cppunit_major_version=`echo $cppunit_version | \ | |
1704 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1705 | cppunit_minor_version=`echo $cppunit_version | \ | |
1706 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1707 | cppunit_micro_version=`echo $cppunit_version | \ | |
1708 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1709 | ||
1710 | cppunit_major_min=`echo $cppunit_version_min | \ | |
1711 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1712 | cppunit_minor_min=`echo $cppunit_version_min | \ | |
1713 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1714 | cppunit_micro_min=`echo $cppunit_version_min | \ | |
1715 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1716 | ||
1717 | cppunit_version_proper=`expr \ | |
1718 | $cppunit_major_version \> $cppunit_major_min \| \ | |
1719 | $cppunit_major_version \= $cppunit_major_min \& \ | |
1720 | $cppunit_minor_version \> $cppunit_minor_min \| \ | |
1721 | $cppunit_major_version \= $cppunit_major_min \& \ | |
1722 | $cppunit_minor_version \= $cppunit_minor_min \& \ | |
1723 | $cppunit_micro_version \>= $cppunit_micro_min ` | |
1724 | ||
1725 | if test "$cppunit_version_proper" = "1" ; then | |
1726 | AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) | |
1727 | else | |
1728 | AC_MSG_RESULT(no) | |
1729 | no_cppunit=yes | |
1730 | fi | |
1731 | fi | |
1732 | ||
1733 | if test "x$no_cppunit" = x ; then | |
1734 | ifelse([$2], , :, [$2]) | |
1735 | else | |
1736 | CPPUNIT_CFLAGS="" | |
1737 | CPPUNIT_LIBS="" | |
1738 | ifelse([$3], , :, [$3]) | |
1739 | fi | |
1740 | ||
1741 | AC_SUBST(CPPUNIT_CFLAGS) | |
1742 | AC_SUBST(CPPUNIT_LIBS) | |
1743 | ]) | |
1744 | ||
1745 | ||
1746 | ||
1747 | ||
1748 | # Configure paths for GTK+ | |
1749 | # Owen Taylor 1997-2001 | |
1750 | ||
1751 | dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
1752 | dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, | |
1753 | dnl pass to pkg-config | |
1754 | dnl | |
1755 | AC_DEFUN([AM_PATH_GTK_2_0], | |
1756 | [dnl | |
1757 | dnl Get the cflags and libraries from pkg-config | |
1758 | dnl | |
1759 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], | |
1760 | , enable_gtktest=yes) | |
1761 | ||
1762 | pkg_config_args=gtk+-2.0 | |
1763 | for module in . $4 | |
1764 | do | |
1765 | case "$module" in | |
1766 | gthread) | |
1767 | pkg_config_args="$pkg_config_args gthread-2.0" | |
1768 | ;; | |
1769 | esac | |
1770 | done | |
1771 | ||
1772 | no_gtk="" | |
1773 | ||
1774 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
1775 | ||
1776 | if test x$PKG_CONFIG != xno ; then | |
1777 | if pkg-config --atleast-pkgconfig-version 0.7 ; then | |
1778 | : | |
1779 | else | |
1780 | echo "*** pkg-config too old; version 0.7 or better required." | |
1781 | no_gtk=yes | |
1782 | PKG_CONFIG=no | |
1783 | fi | |
1784 | else | |
1785 | no_gtk=yes | |
1786 | fi | |
1787 | ||
1788 | min_gtk_version=ifelse([$1], ,2.0.0,$1) | |
1789 | AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) | |
1790 | ||
1791 | if test x$PKG_CONFIG != xno ; then | |
1792 | ## don't try to run the test against uninstalled libtool libs | |
1793 | if $PKG_CONFIG --uninstalled $pkg_config_args; then | |
1794 | echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" | |
1795 | enable_gtktest=no | |
1796 | fi | |
1797 | ||
1798 | if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then | |
1799 | : | |
1800 | else | |
1801 | no_gtk=yes | |
1802 | fi | |
1803 | fi | |
1804 | ||
1805 | if test x"$no_gtk" = x ; then | |
1806 | GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` | |
1807 | GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` | |
1808 | gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
1809 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1810 | gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
1811 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1812 | gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
1813 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1814 | if test "x$enable_gtktest" = "xyes" ; then | |
1815 | ac_save_CFLAGS="$CFLAGS" | |
1816 | ac_save_LIBS="$LIBS" | |
1817 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
1818 | LIBS="$GTK_LIBS $LIBS" | |
1819 | dnl | |
1820 | dnl Now check if the installed GTK+ is sufficiently new. (Also sanity | |
1821 | dnl checks the results of pkg-config to some extent) | |
1822 | dnl | |
1823 | rm -f conf.gtktest | |
1824 | AC_TRY_RUN([ | |
1825 | #include <gtk/gtk.h> | |
1826 | #include <stdio.h> | |
1827 | #include <stdlib.h> | |
1828 | ||
1829 | int | |
1830 | main () | |
1831 | { | |
1832 | int major, minor, micro; | |
1833 | char *tmp_version; | |
1834 | ||
1835 | system ("touch conf.gtktest"); | |
6dcfc289 | 1836 | |
810b94f0 MW |
1837 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
1838 | tmp_version = g_strdup("$min_gtk_version"); | |
1839 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
1840 | printf("%s, bad version string\n", "$min_gtk_version"); | |
1841 | exit(1); | |
1842 | } | |
6dcfc289 | 1843 | |
810b94f0 MW |
1844 | if ((gtk_major_version != $gtk_config_major_version) || |
1845 | (gtk_minor_version != $gtk_config_minor_version) || | |
1846 | (gtk_micro_version != $gtk_config_micro_version)) | |
1847 | { | |
1848 | printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
1849 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
1850 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
1851 | printf ("*** was found! If pkg-config was correct, then it is best\n"); | |
1852 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
1853 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
1854 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
1855 | printf("*** required on your system.\n"); | |
1856 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | |
1857 | printf("*** to point to the correct configuration files\n"); | |
1858 | } | |
1859 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
1860 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
1861 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
1862 | { | |
1863 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
1864 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
1865 | printf("*** library (version %d.%d.%d)\n", | |
1866 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
1867 | } | |
1868 | else | |
1869 | { | |
1870 | if ((gtk_major_version > major) || | |
1871 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
1872 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
1873 | { | |
1874 | return 0; | |
1875 | } | |
1876 | else | |
1877 | { | |
1878 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
1879 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
1880 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
1881 | major, minor, micro); | |
1882 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
1883 | printf("***\n"); | |
1884 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
1885 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | |
1886 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
1887 | printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); | |
1888 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | |
1889 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
1890 | printf("*** so that the correct libraries are found at run-time))\n"); | |
1891 | } | |
1892 | } | |
1893 | return 1; | |
1894 | } | |
1895 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
1896 | CFLAGS="$ac_save_CFLAGS" | |
1897 | LIBS="$ac_save_LIBS" | |
1898 | fi | |
1899 | fi | |
1900 | if test "x$no_gtk" = x ; then | |
1901 | AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) | |
1902 | ifelse([$2], , :, [$2]) | |
1903 | else | |
1904 | AC_MSG_RESULT(no) | |
1905 | if test "$PKG_CONFIG" = "no" ; then | |
1906 | echo "*** A new enough version of pkg-config was not found." | |
1907 | echo "*** See http://pkgconfig.sourceforge.net" | |
1908 | else | |
1909 | if test -f conf.gtktest ; then | |
1910 | : | |
1911 | else | |
1912 | echo "*** Could not run GTK+ test program, checking why..." | |
1913 | ac_save_CFLAGS="$CFLAGS" | |
1914 | ac_save_LIBS="$LIBS" | |
1915 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
1916 | LIBS="$LIBS $GTK_LIBS" | |
1917 | AC_TRY_LINK([ | |
1918 | #include <gtk/gtk.h> | |
1919 | #include <stdio.h> | |
1920 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
1921 | [ echo "*** The test program compiled, but did not run. This usually means" | |
1922 | echo "*** that the run-time linker is not finding GTK+ or finding the wrong" | |
1923 | echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" | |
1924 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
1925 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
1926 | echo "*** is required on your system" | |
1927 | echo "***" | |
1928 | echo "*** If you have an old version installed, it is best to remove it, although" | |
1929 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | |
1930 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
1931 | echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) | |
1932 | CFLAGS="$ac_save_CFLAGS" | |
1933 | LIBS="$ac_save_LIBS" | |
1934 | fi | |
1935 | fi | |
1936 | GTK_CFLAGS="" | |
1937 | GTK_LIBS="" | |
1938 | ifelse([$3], , :, [$3]) | |
1939 | fi | |
1940 | AC_SUBST(GTK_CFLAGS) | |
1941 | AC_SUBST(GTK_LIBS) | |
1942 | rm -f conf.gtktest | |
2e350179 | 1943 | ]) |
3fd9c298 | 1944 | |
810b94f0 MW |
1945 | # Configure paths for GTK+ |
1946 | # Owen Taylor 97-11-3 | |
3fd9c298 | 1947 | |
810b94f0 MW |
1948 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
1949 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
1950 | dnl | |
1951 | AC_DEFUN(AM_PATH_GTK, | |
1952 | [dnl | |
1953 | dnl Get the cflags and libraries from the gtk-config script | |
1954 | dnl | |
1955 | AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], | |
1956 | gtk_config_prefix="$withval", gtk_config_prefix="") | |
1957 | AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], | |
1958 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
1959 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], | |
1960 | , enable_gtktest=yes) | |
3fd9c298 | 1961 | |
810b94f0 MW |
1962 | for module in . $4 |
1963 | do | |
1964 | case "$module" in | |
1965 | gthread) | |
1966 | gtk_config_args="$gtk_config_args gthread" | |
1967 | ;; | |
1968 | esac | |
1969 | done | |
1970 | ||
1971 | if test x$gtk_config_exec_prefix != x ; then | |
1972 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
1973 | if test x${GTK_CONFIG+set} != xset ; then | |
1974 | GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | |
1975 | fi | |
1976 | fi | |
1977 | if test x$gtk_config_prefix != x ; then | |
1978 | gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
1979 | if test x${GTK_CONFIG+set} != xset ; then | |
1980 | GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | |
1981 | fi | |
1982 | fi | |
3fd9c298 | 1983 | |
810b94f0 MW |
1984 | AC_PATH_PROG(GTK_CONFIG, gtk-config, no) |
1985 | min_gtk_version=ifelse([$1], ,0.99.7,$1) | |
1986 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
1987 | no_gtk="" | |
1988 | if test "$GTK_CONFIG" = "no" ; then | |
1989 | no_gtk=yes | |
1990 | else | |
1991 | GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` | |
1992 | GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` | |
1993 | gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
1994 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1995 | gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
1996 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1997 | gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
1998 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1999 | if test "x$enable_gtktest" = "xyes" ; then | |
2000 | ac_save_CFLAGS="$CFLAGS" | |
2001 | ac_save_LIBS="$LIBS" | |
2002 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2003 | LIBS="$GTK_LIBS $LIBS" | |
2004 | dnl | |
2005 | dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
2006 | dnl checks the results of gtk-config to some extent | |
2007 | dnl | |
2008 | rm -f conf.gtktest | |
2009 | AC_TRY_RUN([ | |
2010 | #include <gtk/gtk.h> | |
2011 | #include <stdio.h> | |
2012 | #include <stdlib.h> | |
3fd9c298 | 2013 | |
810b94f0 MW |
2014 | int |
2015 | main () | |
2016 | { | |
2017 | int major, minor, micro; | |
2018 | char *tmp_version; | |
3fd9c298 | 2019 | |
810b94f0 | 2020 | system ("touch conf.gtktest"); |
3fd9c298 | 2021 | |
810b94f0 MW |
2022 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
2023 | tmp_version = g_strdup("$min_gtk_version"); | |
2024 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
2025 | printf("%s, bad version string\n", "$min_gtk_version"); | |
2026 | exit(1); | |
2027 | } | |
3fd9c298 | 2028 | |
810b94f0 MW |
2029 | if ((gtk_major_version != $gtk_config_major_version) || |
2030 | (gtk_minor_version != $gtk_config_minor_version) || | |
2031 | (gtk_micro_version != $gtk_config_micro_version)) | |
2032 | { | |
2033 | printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
2034 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
2035 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2036 | printf ("*** was found! If gtk-config was correct, then it is best\n"); | |
2037 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
2038 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
2039 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
2040 | printf("*** required on your system.\n"); | |
2041 | printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); | |
2042 | printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); | |
2043 | printf("*** before re-running configure\n"); | |
2044 | } | |
2045 | #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) | |
2046 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
2047 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
2048 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
2049 | { | |
2050 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
2051 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
2052 | printf("*** library (version %d.%d.%d)\n", | |
2053 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2054 | } | |
2055 | #endif /* defined (GTK_MAJOR_VERSION) ... */ | |
2056 | else | |
2057 | { | |
2058 | if ((gtk_major_version > major) || | |
2059 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
2060 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
2061 | { | |
2062 | return 0; | |
2063 | } | |
2064 | else | |
2065 | { | |
2066 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
2067 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2068 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
2069 | major, minor, micro); | |
2070 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
2071 | printf("***\n"); | |
2072 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
2073 | printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); | |
2074 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
2075 | printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); | |
2076 | printf("*** correct copy of gtk-config. (In this case, you will have to\n"); | |
2077 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
2078 | printf("*** so that the correct libraries are found at run-time))\n"); | |
2079 | } | |
2080 | } | |
2081 | return 1; | |
2082 | } | |
2083 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
2084 | CFLAGS="$ac_save_CFLAGS" | |
2085 | LIBS="$ac_save_LIBS" | |
2086 | fi | |
2087 | fi | |
2088 | if test "x$no_gtk" = x ; then | |
2089 | AC_MSG_RESULT(yes) | |
2090 | ifelse([$2], , :, [$2]) | |
2091 | else | |
2092 | AC_MSG_RESULT(no) | |
2093 | if test "$GTK_CONFIG" = "no" ; then | |
2094 | echo "*** The gtk-config script installed by GTK could not be found" | |
2095 | echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | |
2096 | echo "*** your path, or set the GTK_CONFIG environment variable to the" | |
2097 | echo "*** full path to gtk-config." | |
2098 | else | |
2099 | if test -f conf.gtktest ; then | |
2100 | : | |
2101 | else | |
2102 | echo "*** Could not run GTK test program, checking why..." | |
2103 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2104 | LIBS="$LIBS $GTK_LIBS" | |
2105 | AC_TRY_LINK([ | |
2106 | #include <gtk/gtk.h> | |
2107 | #include <stdio.h> | |
2108 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
2109 | [ echo "*** The test program compiled, but did not run. This usually means" | |
2110 | echo "*** that the run-time linker is not finding GTK or finding the wrong" | |
2111 | echo "*** version of GTK. If it is not finding GTK, you'll need to set your" | |
2112 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
2113 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
2114 | echo "*** is required on your system" | |
2115 | echo "***" | |
2116 | echo "*** If you have an old version installed, it is best to remove it, although" | |
2117 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" | |
2118 | echo "***" | |
2119 | echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" | |
2120 | echo "*** came with the system with the command" | |
2121 | echo "***" | |
2122 | echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
2123 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
2124 | echo "*** exact error that occured. This usually means GTK was incorrectly installed" | |
2125 | echo "*** or that you have moved GTK since it was installed. In the latter case, you" | |
2126 | echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) | |
2127 | CFLAGS="$ac_save_CFLAGS" | |
2128 | LIBS="$ac_save_LIBS" | |
2129 | fi | |
2130 | fi | |
2131 | GTK_CFLAGS="" | |
2132 | GTK_LIBS="" | |
2133 | ifelse([$3], , :, [$3]) | |
2134 | fi | |
2135 | AC_SUBST(GTK_CFLAGS) | |
2136 | AC_SUBST(GTK_LIBS) | |
2137 | rm -f conf.gtktest | |
2138 | ]) | |
3fd9c298 | 2139 | |
3fd9c298 | 2140 | |
810b94f0 MW |
2141 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) |
2142 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page | |
2143 | dnl also defines GSTUFF_PKG_ERRORS on error | |
2144 | AC_DEFUN(PKG_CHECK_MODULES, [ | |
2145 | succeeded=no | |
3fd9c298 | 2146 | |
810b94f0 MW |
2147 | if test -z "$PKG_CONFIG"; then |
2148 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
2149 | fi | |
3fd9c298 | 2150 | |
810b94f0 MW |
2151 | if test "$PKG_CONFIG" = "no" ; then |
2152 | echo "*** The pkg-config script could not be found. Make sure it is" | |
2153 | echo "*** in your path, or set the PKG_CONFIG environment variable" | |
2154 | echo "*** to the full path to pkg-config." | |
2155 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." | |
2156 | else | |
2157 | PKG_CONFIG_MIN_VERSION=0.9.0 | |
2158 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then | |
2159 | AC_MSG_CHECKING(for $2) | |
fe0895cf | 2160 | |
810b94f0 MW |
2161 | if $PKG_CONFIG --exists "$2" ; then |
2162 | AC_MSG_RESULT(yes) | |
2163 | succeeded=yes | |
6ff53182 | 2164 | |
810b94f0 MW |
2165 | AC_MSG_CHECKING($1_CFLAGS) |
2166 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` | |
2167 | AC_MSG_RESULT($$1_CFLAGS) | |
6dcfc289 | 2168 | |
810b94f0 MW |
2169 | AC_MSG_CHECKING($1_LIBS) |
2170 | $1_LIBS=`$PKG_CONFIG --libs "$2"` | |
2171 | AC_MSG_RESULT($$1_LIBS) | |
2172 | else | |
2173 | $1_CFLAGS="" | |
2174 | $1_LIBS="" | |
2175 | ## If we have a custom action on failure, don't print errors, but | |
2176 | ## do set a variable so people can do so. | |
2177 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
2178 | ifelse([$4], ,echo $$1_PKG_ERRORS,) | |
2179 | fi | |
6ff53182 | 2180 | |
810b94f0 MW |
2181 | AC_SUBST($1_CFLAGS) |
2182 | AC_SUBST($1_LIBS) | |
2183 | else | |
2184 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." | |
2185 | echo "*** See http://www.freedesktop.org/software/pkgconfig" | |
2186 | fi | |
2187 | fi | |
6ff53182 | 2188 | |
810b94f0 MW |
2189 | if test $succeeded = yes; then |
2190 | ifelse([$3], , :, [$3]) | |
2191 | else | |
2192 | ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) | |
2193 | fi | |
2194 | ]) | |
6ff53182 | 2195 | |
94acd38e | 2196 | |
6dcfc289 | 2197 | |
810b94f0 MW |
2198 | # Configure paths for SDL |
2199 | # Sam Lantinga 9/21/99 | |
2200 | # stolen from Manish Singh | |
2201 | # stolen back from Frank Belew | |
2202 | # stolen from Manish Singh | |
2203 | # Shamelessly stolen from Owen Taylor | |
2e350179 | 2204 | |
810b94f0 MW |
2205 | dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
2206 | dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS | |
670ec357 | 2207 | dnl |
810b94f0 MW |
2208 | AC_DEFUN([AM_PATH_SDL], |
2209 | [dnl | |
2210 | dnl Get the cflags and libraries from the sdl-config script | |
670ec357 | 2211 | dnl |
810b94f0 MW |
2212 | AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], |
2213 | sdl_prefix="$withval", sdl_prefix="") | |
2214 | AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], | |
2215 | sdl_exec_prefix="$withval", sdl_exec_prefix="") | |
2216 | AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], | |
2217 | , enable_sdltest=yes) | |
670ec357 | 2218 | |
810b94f0 MW |
2219 | if test x$sdl_exec_prefix != x ; then |
2220 | sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" | |
2221 | if test x${SDL_CONFIG+set} != xset ; then | |
2222 | SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config | |
670ec357 VS |
2223 | fi |
2224 | fi | |
810b94f0 MW |
2225 | if test x$sdl_prefix != x ; then |
2226 | sdl_args="$sdl_args --prefix=$sdl_prefix" | |
2227 | if test x${SDL_CONFIG+set} != xset ; then | |
2228 | SDL_CONFIG=$sdl_prefix/bin/sdl-config | |
670ec357 VS |
2229 | fi |
2230 | fi | |
2231 | ||
810b94f0 MW |
2232 | AC_REQUIRE([AC_CANONICAL_TARGET]) |
2233 | PATH="$prefix/bin:$prefix/usr/bin:$PATH" | |
2234 | AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) | |
2235 | min_sdl_version=ifelse([$1], ,0.11.0,$1) | |
2236 | AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) | |
2237 | no_sdl="" | |
2238 | if test "$SDL_CONFIG" = "no" ; then | |
2239 | no_sdl=yes | |
670ec357 | 2240 | else |
810b94f0 MW |
2241 | SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` |
2242 | SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` | |
670ec357 | 2243 | |
810b94f0 | 2244 | sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ |
670ec357 | 2245 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
810b94f0 | 2246 | sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ |
670ec357 | 2247 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
810b94f0 | 2248 | sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ |
670ec357 | 2249 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
810b94f0 MW |
2250 | if test "x$enable_sdltest" = "xyes" ; then |
2251 | ac_save_CFLAGS="$CFLAGS" | |
2252 | ac_save_CXXFLAGS="$CXXFLAGS" | |
2253 | ac_save_LIBS="$LIBS" | |
2254 | CFLAGS="$CFLAGS $SDL_CFLAGS" | |
2255 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" | |
2256 | LIBS="$LIBS $SDL_LIBS" | |
2257 | dnl | |
2258 | dnl Now check if the installed SDL is sufficiently new. (Also sanity | |
2259 | dnl checks the results of sdl-config to some extent | |
2260 | dnl | |
2261 | rm -f conf.sdltest | |
2262 | AC_TRY_RUN([ | |
2263 | #include <stdio.h> | |
2264 | #include <stdlib.h> | |
2265 | #include <string.h> | |
2266 | #include "SDL.h" | |
670ec357 | 2267 | |
810b94f0 MW |
2268 | char* |
2269 | my_strdup (char *str) | |
2270 | { | |
2271 | char *new_str; | |
2272 | ||
2273 | if (str) | |
2274 | { | |
2275 | new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); | |
2276 | strcpy (new_str, str); | |
2277 | } | |
2278 | else | |
2279 | new_str = NULL; | |
2280 | ||
2281 | return new_str; | |
2282 | } | |
670ec357 | 2283 | |
810b94f0 MW |
2284 | int main (int argc, char *argv[]) |
2285 | { | |
2286 | int major, minor, micro; | |
2287 | char *tmp_version; | |
670ec357 | 2288 | |
810b94f0 MW |
2289 | /* This hangs on some systems (?) |
2290 | system ("touch conf.sdltest"); | |
2291 | */ | |
2292 | { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } | |
670ec357 | 2293 | |
810b94f0 MW |
2294 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
2295 | tmp_version = my_strdup("$min_sdl_version"); | |
2296 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
2297 | printf("%s, bad version string\n", "$min_sdl_version"); | |
2298 | exit(1); | |
2299 | } | |
2300 | ||
2301 | if (($sdl_major_version > major) || | |
2302 | (($sdl_major_version == major) && ($sdl_minor_version > minor)) || | |
2303 | (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) | |
2304 | { | |
2305 | return 0; | |
2306 | } | |
2307 | else | |
2308 | { | |
2309 | printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); | |
2310 | printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); | |
2311 | printf("*** best to upgrade to the required version.\n"); | |
2312 | printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); | |
2313 | printf("*** to point to the correct copy of sdl-config, and remove the file\n"); | |
2314 | printf("*** config.cache before re-running configure\n"); | |
2315 | return 1; | |
2316 | } | |
2317 | } | |
2318 | ||
2319 | ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
2320 | CFLAGS="$ac_save_CFLAGS" | |
2321 | CXXFLAGS="$ac_save_CXXFLAGS" | |
2322 | LIBS="$ac_save_LIBS" | |
2323 | fi | |
2324 | fi | |
2325 | if test "x$no_sdl" = x ; then | |
2326 | AC_MSG_RESULT(yes) | |
670ec357 VS |
2327 | ifelse([$2], , :, [$2]) |
2328 | else | |
810b94f0 MW |
2329 | AC_MSG_RESULT(no) |
2330 | if test "$SDL_CONFIG" = "no" ; then | |
2331 | echo "*** The sdl-config script installed by SDL could not be found" | |
2332 | echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" | |
2333 | echo "*** your path, or set the SDL_CONFIG environment variable to the" | |
2334 | echo "*** full path to sdl-config." | |
2335 | else | |
2336 | if test -f conf.sdltest ; then | |
2337 | : | |
2338 | else | |
2339 | echo "*** Could not run SDL test program, checking why..." | |
2340 | CFLAGS="$CFLAGS $SDL_CFLAGS" | |
2341 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" | |
2342 | LIBS="$LIBS $SDL_LIBS" | |
2343 | AC_TRY_LINK([ | |
2344 | #include <stdio.h> | |
2345 | #include "SDL.h" | |
2346 | ||
2347 | int main(int argc, char *argv[]) | |
2348 | { return 0; } | |
2349 | #undef main | |
2350 | #define main K_and_R_C_main | |
2351 | ], [ return 0; ], | |
2352 | [ echo "*** The test program compiled, but did not run. This usually means" | |
2353 | echo "*** that the run-time linker is not finding SDL or finding the wrong" | |
2354 | echo "*** version of SDL. If it is not finding SDL, you'll need to set your" | |
2355 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
2356 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
2357 | echo "*** is required on your system" | |
2358 | echo "***" | |
2359 | echo "*** If you have an old version installed, it is best to remove it, although" | |
2360 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
2361 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
2362 | echo "*** exact error that occured. This usually means SDL was incorrectly installed" | |
2363 | echo "*** or that you have moved SDL since it was installed. In the latter case, you" | |
2364 | echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) | |
2365 | CFLAGS="$ac_save_CFLAGS" | |
2366 | CXXFLAGS="$ac_save_CXXFLAGS" | |
2367 | LIBS="$ac_save_LIBS" | |
2368 | fi | |
2369 | fi | |
2370 | SDL_CFLAGS="" | |
2371 | SDL_LIBS="" | |
670ec357 VS |
2372 | ifelse([$3], , :, [$3]) |
2373 | fi | |
810b94f0 MW |
2374 | AC_SUBST(SDL_CFLAGS) |
2375 | AC_SUBST(SDL_LIBS) | |
2376 | rm -f conf.sdltest | |
670ec357 VS |
2377 | ]) |
2378 | ||
810b94f0 | 2379 | m4_include([acinclude.m4]) |