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