]>
Commit | Line | Data |
---|---|---|
1 | # generated automatically by aclocal 1.7.2 -*- Autoconf -*- | |
2 | ||
3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 | |
4 | # Free Software Foundation, Inc. | |
5 | # This file is free software; the Free Software Foundation | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
8 | ||
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
13 | ||
14 | dnl --------------------------------------------------------------------------- | |
15 | dnl | |
16 | dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker, | |
17 | dnl Vadim Zeitlin and Ron Lee | |
18 | dnl | |
19 | dnl This script is under the wxWindows licence. | |
20 | dnl | |
21 | dnl Version: $Id$ | |
22 | dnl --------------------------------------------------------------------------- | |
23 | ||
24 | dnl =========================================================================== | |
25 | dnl macros to find the a file in the list of include/lib paths | |
26 | dnl =========================================================================== | |
27 | ||
28 | dnl --------------------------------------------------------------------------- | |
29 | dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes | |
30 | dnl to the full name of the file that was found or leaves it empty if not found | |
31 | dnl --------------------------------------------------------------------------- | |
32 | AC_DEFUN([WX_PATH_FIND_INCLUDES], | |
33 | [ | |
34 | ac_find_includes= | |
35 | for ac_dir in $1 /usr/include; | |
36 | do | |
37 | if test -f "$ac_dir/$2"; then | |
38 | ac_find_includes=$ac_dir | |
39 | break | |
40 | fi | |
41 | done | |
42 | ]) | |
43 | ||
44 | dnl --------------------------------------------------------------------------- | |
45 | dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries | |
46 | dnl to the full name of the file that was found or leaves it empty if not found | |
47 | dnl --------------------------------------------------------------------------- | |
48 | AC_DEFUN([WX_PATH_FIND_LIBRARIES], | |
49 | [ | |
50 | ac_find_libraries= | |
51 | for ac_dir in $1 /usr/lib; | |
52 | do | |
53 | for ac_extension in a so sl dylib; do | |
54 | if test -f "$ac_dir/lib$2.$ac_extension"; then | |
55 | ac_find_libraries=$ac_dir | |
56 | break 2 | |
57 | fi | |
58 | done | |
59 | done | |
60 | ]) | |
61 | ||
62 | dnl --------------------------------------------------------------------------- | |
63 | dnl Path to include, already defined | |
64 | dnl --------------------------------------------------------------------------- | |
65 | AC_DEFUN([WX_INCLUDE_PATH_EXIST], | |
66 | [ | |
67 | dnl never add -I/usr/include to the CPPFLAGS | |
68 | if test "x$1" = "x/usr/include"; then | |
69 | ac_path_to_include="" | |
70 | else | |
71 | echo "$2" | grep "\-I$1" > /dev/null | |
72 | result=$? | |
73 | if test $result = 0; then | |
74 | ac_path_to_include="" | |
75 | else | |
76 | ac_path_to_include=" -I$1" | |
77 | fi | |
78 | fi | |
79 | ]) | |
80 | ||
81 | dnl --------------------------------------------------------------------------- | |
82 | dnl Path to link, already defined | |
83 | dnl --------------------------------------------------------------------------- | |
84 | AC_DEFUN([WX_LINK_PATH_EXIST], | |
85 | [ | |
86 | echo "$2" | grep "\-L$1" > /dev/null | |
87 | result=$? | |
88 | if test $result = 0; then | |
89 | ac_path_to_link="" | |
90 | else | |
91 | ac_path_to_link=" -L$1" | |
92 | fi | |
93 | ]) | |
94 | ||
95 | dnl =========================================================================== | |
96 | dnl C++ features test | |
97 | dnl =========================================================================== | |
98 | ||
99 | dnl --------------------------------------------------------------------------- | |
100 | dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header | |
101 | dnl or only the old <iostream.h> one - it may be generally assumed that if | |
102 | dnl <iostream> exists, the other "new" headers (without .h) exist too. | |
103 | dnl | |
104 | dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling) | |
105 | dnl --------------------------------------------------------------------------- | |
106 | ||
107 | AC_DEFUN([WX_CPP_NEW_HEADERS], | |
108 | [ | |
109 | if test "$cross_compiling" = "yes"; then | |
110 | ifelse([$2], , :, [$2]) | |
111 | else | |
112 | AC_LANG_SAVE | |
113 | AC_LANG_CPLUSPLUS | |
114 | ||
115 | AC_CHECK_HEADERS(iostream) | |
116 | ||
117 | if test "$ac_cv_header_iostream" = "yes" ; then | |
118 | ifelse([$1], , :, [$1]) | |
119 | else | |
120 | ifelse([$2], , :, [$2]) | |
121 | fi | |
122 | ||
123 | AC_LANG_RESTORE | |
124 | fi | |
125 | ]) | |
126 | ||
127 | dnl --------------------------------------------------------------------------- | |
128 | dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type | |
129 | dnl | |
130 | dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool | |
131 | dnl --------------------------------------------------------------------------- | |
132 | ||
133 | AC_DEFUN([WX_CPP_BOOL], | |
134 | [ | |
135 | AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool, | |
136 | [ | |
137 | AC_LANG_SAVE | |
138 | AC_LANG_CPLUSPLUS | |
139 | ||
140 | AC_TRY_COMPILE( | |
141 | [ | |
142 | ], | |
143 | [ | |
144 | bool b = true; | |
145 | ||
146 | return 0; | |
147 | ], | |
148 | [ | |
149 | wx_cv_cpp_bool=yes | |
150 | ], | |
151 | [ | |
152 | wx_cv_cpp_bool=no | |
153 | ] | |
154 | ) | |
155 | ||
156 | AC_LANG_RESTORE | |
157 | ]) | |
158 | ||
159 | if test "$wx_cv_cpp_bool" = "yes"; then | |
160 | AC_DEFINE(HAVE_BOOL) | |
161 | fi | |
162 | ]) | |
163 | ||
164 | dnl --------------------------------------------------------------------------- | |
165 | dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit | |
166 | dnl keyword and defines HAVE_EXPLICIT if this is the case | |
167 | dnl --------------------------------------------------------------------------- | |
168 | ||
169 | AC_DEFUN([WX_CPP_EXPLICIT], | |
170 | [ | |
171 | AC_CACHE_CHECK([if C++ compiler supports the explicit keyword], | |
172 | wx_cv_explicit, | |
173 | [ | |
174 | AC_LANG_SAVE | |
175 | AC_LANG_CPLUSPLUS | |
176 | ||
177 | dnl do the test in 2 steps: first check that the compiler knows about the | |
178 | dnl explicit keyword at all and then verify that it really honours it | |
179 | AC_TRY_COMPILE( | |
180 | [ | |
181 | class Foo { public: explicit Foo(int) {} }; | |
182 | ], | |
183 | [ | |
184 | return 0; | |
185 | ], | |
186 | [ | |
187 | AC_TRY_COMPILE( | |
188 | [ | |
189 | class Foo { public: explicit Foo(int) {} }; | |
190 | static void TakeFoo(const Foo& foo) { } | |
191 | ], | |
192 | [ | |
193 | TakeFoo(17); | |
194 | return 0; | |
195 | ], | |
196 | wx_cv_explicit=no, | |
197 | wx_cv_explicit=yes | |
198 | ) | |
199 | ], | |
200 | wx_cv_explicit=no | |
201 | ) | |
202 | ||
203 | AC_LANG_RESTORE | |
204 | ]) | |
205 | ||
206 | if test "$wx_cv_explicit" = "yes"; then | |
207 | AC_DEFINE(HAVE_EXPLICIT) | |
208 | fi | |
209 | ]) | |
210 | ||
211 | dnl --------------------------------------------------------------------------- | |
212 | dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling | |
213 | dnl --------------------------------------------------------------------------- | |
214 | ||
215 | AC_DEFUN([WX_C_BIGENDIAN], | |
216 | [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian, | |
217 | [ac_cv_c_bigendian=unknown | |
218 | # See if sys/param.h defines the BYTE_ORDER macro. | |
219 | AC_TRY_COMPILE([#include <sys/types.h> | |
220 | #include <sys/param.h>], [ | |
221 | #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | |
222 | bogus endian macros | |
223 | #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. | |
224 | AC_TRY_COMPILE([#include <sys/types.h> | |
225 | #include <sys/param.h>], [ | |
226 | #if BYTE_ORDER != BIG_ENDIAN | |
227 | not big endian | |
228 | #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) | |
229 | if test $ac_cv_c_bigendian = unknown; then | |
230 | AC_TRY_RUN([main () { | |
231 | /* Are we little or big endian? From Harbison&Steele. */ | |
232 | union | |
233 | { | |
234 | long l; | |
235 | char c[sizeof (long)]; | |
236 | } u; | |
237 | u.l = 1; | |
238 | exit (u.c[sizeof (long) - 1] == 1); | |
239 | }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown]) | |
240 | fi]) | |
241 | if test $ac_cv_c_bigendian = unknown; then | |
242 | AC_MSG_WARN([Assuming little-endian target machine - this may be overriden by adding the line "ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}" to config.cache file]) | |
243 | fi | |
244 | if test $ac_cv_c_bigendian = yes; then | |
245 | AC_DEFINE(WORDS_BIGENDIAN) | |
246 | fi | |
247 | ]) | |
248 | ||
249 | dnl --------------------------------------------------------------------------- | |
250 | dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file | |
251 | dnl --------------------------------------------------------------------------- | |
252 | ||
253 | AC_DEFUN([WX_ARG_CACHE_INIT], | |
254 | [ | |
255 | wx_arg_cache_file="configarg.cache" | |
256 | echo "loading argument cache $wx_arg_cache_file" | |
257 | rm -f ${wx_arg_cache_file}.tmp | |
258 | touch ${wx_arg_cache_file}.tmp | |
259 | touch ${wx_arg_cache_file} | |
260 | ]) | |
261 | ||
262 | AC_DEFUN([WX_ARG_CACHE_FLUSH], | |
263 | [ | |
264 | echo "saving argument cache $wx_arg_cache_file" | |
265 | mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file} | |
266 | ]) | |
267 | ||
268 | dnl this macro checks for a three-valued command line --with argument: | |
269 | dnl possible arguments are 'yes', 'no', 'sys', or 'builtin' | |
270 | dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name) | |
271 | AC_DEFUN([WX_ARG_SYS_WITH], | |
272 | [ | |
273 | AC_MSG_CHECKING([for --with-$1]) | |
274 | no_cache=0 | |
275 | AC_ARG_WITH($1, [$2], | |
276 | [ | |
277 | if test "$withval" = yes; then | |
278 | ac_cv_use_$1='$3=yes' | |
279 | elif test "$withval" = no; then | |
280 | ac_cv_use_$1='$3=no' | |
281 | elif test "$withval" = sys; then | |
282 | ac_cv_use_$1='$3=sys' | |
283 | elif test "$withval" = builtin; then | |
284 | ac_cv_use_$1='$3=builtin' | |
285 | else | |
286 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
287 | fi | |
288 | ], | |
289 | [ | |
290 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
291 | if test "x$LINE" != x ; then | |
292 | eval "DEFAULT_$LINE" | |
293 | else | |
294 | no_cache=1 | |
295 | fi | |
296 | ||
297 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
298 | ]) | |
299 | ||
300 | eval "$ac_cv_use_$1" | |
301 | if test "$no_cache" != 1; then | |
302 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
303 | fi | |
304 | ||
305 | if test "$$3" = yes; then | |
306 | AC_MSG_RESULT(yes) | |
307 | elif test "$$3" = no; then | |
308 | AC_MSG_RESULT(no) | |
309 | elif test "$$3" = sys; then | |
310 | AC_MSG_RESULT([system version]) | |
311 | elif test "$$3" = builtin; then | |
312 | AC_MSG_RESULT([builtin version]) | |
313 | else | |
314 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
315 | fi | |
316 | ]) | |
317 | ||
318 | dnl this macro checks for a command line argument and caches the result | |
319 | dnl usage: WX_ARG_WITH(option, helpmessage, variable-name) | |
320 | AC_DEFUN([WX_ARG_WITH], | |
321 | [ | |
322 | AC_MSG_CHECKING([for --with-$1]) | |
323 | no_cache=0 | |
324 | AC_ARG_WITH($1, [$2], | |
325 | [ | |
326 | if test "$withval" = yes; then | |
327 | ac_cv_use_$1='$3=yes' | |
328 | else | |
329 | ac_cv_use_$1='$3=no' | |
330 | fi | |
331 | ], | |
332 | [ | |
333 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
334 | if test "x$LINE" != x ; then | |
335 | eval "DEFAULT_$LINE" | |
336 | else | |
337 | no_cache=1 | |
338 | fi | |
339 | ||
340 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
341 | ]) | |
342 | ||
343 | eval "$ac_cv_use_$1" | |
344 | if test "$no_cache" != 1; then | |
345 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
346 | fi | |
347 | ||
348 | if test "$$3" = yes; then | |
349 | AC_MSG_RESULT(yes) | |
350 | else | |
351 | AC_MSG_RESULT(no) | |
352 | fi | |
353 | ]) | |
354 | ||
355 | dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH | |
356 | dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring) | |
357 | dnl | |
358 | dnl enablestring is a hack and allows to show "checking for --disable-foo" | |
359 | dnl message when running configure instead of the default "checking for | |
360 | dnl --enable-foo" one whih is useful for the options enabled by default | |
361 | AC_DEFUN([WX_ARG_ENABLE], | |
362 | [ | |
363 | enablestring=$4 | |
364 | AC_MSG_CHECKING([for --${enablestring:-enable}-$1]) | |
365 | no_cache=0 | |
366 | AC_ARG_ENABLE($1, [$2], | |
367 | [ | |
368 | if test "$enableval" = yes; then | |
369 | ac_cv_use_$1='$3=yes' | |
370 | else | |
371 | ac_cv_use_$1='$3=no' | |
372 | fi | |
373 | ], | |
374 | [ | |
375 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
376 | if test "x$LINE" != x ; then | |
377 | eval "DEFAULT_$LINE" | |
378 | else | |
379 | no_cache=1 | |
380 | fi | |
381 | ||
382 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
383 | ]) | |
384 | ||
385 | eval "$ac_cv_use_$1" | |
386 | if test "$no_cache" != 1; then | |
387 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
388 | fi | |
389 | ||
390 | if test "$$3" = yes; then | |
391 | AC_MSG_RESULT(yes) | |
392 | else | |
393 | AC_MSG_RESULT(no) | |
394 | fi | |
395 | ]) | |
396 | ||
397 | ||
398 | dnl =========================================================================== | |
399 | dnl Linker features test | |
400 | dnl =========================================================================== | |
401 | ||
402 | dnl --------------------------------------------------------------------------- | |
403 | dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned | |
404 | dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use | |
405 | dnl version script file named versionfile | |
406 | dnl | |
407 | dnl call WX_VERSIONED_SYMBOLS(versionfile) | |
408 | dnl --------------------------------------------------------------------------- | |
409 | AC_DEFUN([WX_VERSIONED_SYMBOLS], | |
410 | [ | |
411 | found_versioning=no | |
412 | ||
413 | dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards | |
414 | dnl in the script. | |
415 | dnl dnl Check for known non-gcc cases: | |
416 | dnl case "${host}" in | |
417 | dnl *-*-solaris2* ) | |
418 | dnl if test "x$GCC" != "xyes" ; then | |
419 | dnl LDFLAGS_VERSIONING="-M $1" | |
420 | dnl found_versioning=yes | |
421 | dnl fi | |
422 | dnl ;; | |
423 | dnl esac | |
424 | ||
425 | dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC): | |
426 | if test $found_versioning = no ; then | |
427 | AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script, | |
428 | [ | |
429 | echo "VER_1 { *; };" >conftest.sym | |
430 | echo "int main() { return 0; }" >conftest.cpp | |
431 | ||
432 | if AC_TRY_COMMAND([ | |
433 | $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp | |
434 | -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then | |
435 | if test -s conftest.stderr ; then | |
436 | wx_cv_version_script=no | |
437 | else | |
438 | wx_cv_version_script=yes | |
439 | fi | |
440 | else | |
441 | wx_cv_version_script=no | |
442 | fi | |
443 | rm -f conftest.output conftest.stderr conftest.sym conftest.cpp | |
444 | ]) | |
445 | if test $wx_cv_version_script = yes ; then | |
446 | LDFLAGS_VERSIONING="-Wl,--version-script,$1" | |
447 | fi | |
448 | fi | |
449 | ]) | |
450 | ||
451 | ||
452 | dnl =========================================================================== | |
453 | dnl "3rd party" macros included here because they are not widely available | |
454 | dnl =========================================================================== | |
455 | ||
456 | dnl --------------------------------------------------------------------------- | |
457 | dnl test for availability of iconv() | |
458 | dnl --------------------------------------------------------------------------- | |
459 | ||
460 | dnl From Bruno Haible. | |
461 | ||
462 | AC_DEFUN([AM_ICONV], | |
463 | [ | |
464 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
465 | dnl those with the standalone portable GNU libiconv installed). | |
466 | ||
467 | AC_ARG_WITH([libiconv-prefix], | |
468 | [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ | |
469 | for dir in `echo "$withval" | tr : ' '`; do | |
470 | if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi | |
471 | if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi | |
472 | done | |
473 | ]) | |
474 | ||
475 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | |
476 | am_cv_func_iconv="no, consider installing GNU libiconv" | |
477 | am_cv_lib_iconv=no | |
478 | AC_TRY_LINK([#include <stdlib.h> | |
479 | #include <iconv.h>], | |
480 | [iconv_t cd = iconv_open("",""); | |
481 | iconv(cd,NULL,NULL,NULL,NULL); | |
482 | iconv_close(cd);], | |
483 | am_cv_func_iconv=yes) | |
484 | if test "$am_cv_func_iconv" != yes; then | |
485 | am_save_LIBS="$LIBS" | |
486 | LIBS="$LIBS -liconv" | |
487 | AC_TRY_LINK([#include <stdlib.h> | |
488 | #include <iconv.h>], | |
489 | [iconv_t cd = iconv_open("",""); | |
490 | iconv(cd,NULL,NULL,NULL,NULL); | |
491 | iconv_close(cd);], | |
492 | am_cv_lib_iconv=yes | |
493 | am_cv_func_iconv=yes) | |
494 | LIBS="$am_save_LIBS" | |
495 | fi | |
496 | ]) | |
497 | if test "$am_cv_func_iconv" = yes; then | |
498 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | |
499 | AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const, | |
500 | AC_TRY_COMPILE([ | |
501 | #include <stdlib.h> | |
502 | #include <iconv.h> | |
503 | extern | |
504 | #ifdef __cplusplus | |
505 | "C" | |
506 | #endif | |
507 | #if defined(__STDC__) || defined(__cplusplus) | |
508 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
509 | #else | |
510 | size_t iconv(); | |
511 | #endif | |
512 | ], | |
513 | [], | |
514 | wx_cv_func_iconv_const="no", | |
515 | wx_cv_func_iconv_const="yes" | |
516 | ) | |
517 | ) | |
518 | ||
519 | iconv_const= | |
520 | if test "x$wx_cv_func_iconv_const" = "xyes"; then | |
521 | iconv_const="const" | |
522 | fi | |
523 | ||
524 | AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const, | |
525 | [Define as const if the declaration of iconv() needs const.]) | |
526 | fi | |
527 | LIBICONV= | |
528 | if test "$am_cv_lib_iconv" = yes; then | |
529 | LIBICONV="-liconv" | |
530 | fi | |
531 | AC_SUBST(LIBICONV) | |
532 | ]) | |
533 | ||
534 | dnl --------------------------------------------------------------------------- | |
535 | dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x) | |
536 | dnl --------------------------------------------------------------------------- | |
537 | ||
538 | dnl WX_SYS_LARGEFILE_TEST | |
539 | dnl | |
540 | dnl NB: original autoconf test was checking if compiler supported 6 bit off_t | |
541 | dnl arithmetic properly but this failed miserably with gcc under Linux | |
542 | dnl whereas the system still supports 64 bit files, so now simply check | |
543 | dnl that off_t is big enough | |
544 | define(WX_SYS_LARGEFILE_TEST, | |
545 | [typedef struct { | |
546 | unsigned int field: sizeof(off_t) == 8; | |
547 | } wxlf; | |
548 | ]) | |
549 | ||
550 | ||
551 | dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR) | |
552 | define(WX_SYS_LARGEFILE_MACRO_VALUE, | |
553 | [ | |
554 | AC_CACHE_CHECK([for $1 value needed for large files], [$3], | |
555 | [ | |
556 | AC_TRY_COMPILE([#define $1 $2 | |
557 | #include <sys/types.h>], | |
558 | WX_SYS_LARGEFILE_TEST, | |
559 | [$3=$2], | |
560 | [$3=no]) | |
561 | ] | |
562 | ) | |
563 | ||
564 | if test "$$3" != no; then | |
565 | wx_largefile=yes | |
566 | AC_DEFINE_UNQUOTED([$1], [$$3]) | |
567 | fi | |
568 | ]) | |
569 | ||
570 | ||
571 | dnl AC_SYS_LARGEFILE | |
572 | dnl ---------------- | |
573 | dnl By default, many hosts won't let programs access large files; | |
574 | dnl one must use special compiler options to get large-file access to work. | |
575 | dnl For more details about this brain damage please see: | |
576 | dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html | |
577 | AC_DEFUN([AC_SYS_LARGEFILE], | |
578 | [AC_ARG_ENABLE(largefile, | |
579 | [ --disable-largefile omit support for large files]) | |
580 | if test "$enable_largefile" != no; then | |
581 | dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ... | |
582 | dnl _LARGE_FILES -- for AIX | |
583 | wx_largefile=no | |
584 | WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits) | |
585 | if test "x$wx_largefile" != "xyes"; then | |
586 | WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files) | |
587 | fi | |
588 | ||
589 | AC_MSG_CHECKING(if large file support is available) | |
590 | if test "x$wx_largefile" = "xyes"; then | |
591 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT) | |
592 | fi | |
593 | AC_MSG_RESULT($wx_largefile) | |
594 | fi | |
595 | ]) | |
596 | ||
597 | ||
598 | dnl Available from the GNU Autoconf Macro Archive at: | |
599 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html | |
600 | dnl | |
601 | AC_DEFUN([AC_CXX_CONST_CAST], | |
602 | [AC_CACHE_CHECK(whether the compiler supports const_cast<>, | |
603 | ac_cv_cxx_const_cast, | |
604 | [AC_LANG_SAVE | |
605 | AC_LANG_CPLUSPLUS | |
606 | AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;], | |
607 | ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no) | |
608 | AC_LANG_RESTORE | |
609 | ]) | |
610 | if test "$ac_cv_cxx_const_cast" = yes; then | |
611 | AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>]) | |
612 | fi | |
613 | ]) | |
614 | ||
615 | # Configure paths for GTK+ | |
616 | # Owen Taylor 1997-2001 | |
617 | ||
618 | dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
619 | dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, | |
620 | dnl pass to pkg-config | |
621 | dnl | |
622 | AC_DEFUN(AM_PATH_GTK_2_0, | |
623 | [dnl | |
624 | dnl Get the cflags and libraries from pkg-config | |
625 | dnl | |
626 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], | |
627 | , enable_gtktest=yes) | |
628 | ||
629 | pkg_config_args=gtk+-2.0 | |
630 | for module in . $4 | |
631 | do | |
632 | case "$module" in | |
633 | gthread) | |
634 | pkg_config_args="$pkg_config_args gthread-2.0" | |
635 | ;; | |
636 | esac | |
637 | done | |
638 | ||
639 | no_gtk="" | |
640 | ||
641 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
642 | ||
643 | if test x$PKG_CONFIG != xno ; then | |
644 | if pkg-config --atleast-pkgconfig-version 0.7 ; then | |
645 | : | |
646 | else | |
647 | echo *** pkg-config too old; version 0.7 or better required. | |
648 | no_gtk=yes | |
649 | PKG_CONFIG=no | |
650 | fi | |
651 | else | |
652 | no_gtk=yes | |
653 | fi | |
654 | ||
655 | min_gtk_version=ifelse([$1], ,2.0.0,$1) | |
656 | AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) | |
657 | ||
658 | if test x$PKG_CONFIG != xno ; then | |
659 | ## don't try to run the test against uninstalled libtool libs | |
660 | if $PKG_CONFIG --uninstalled $pkg_config_args; then | |
661 | echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" | |
662 | enable_gtktest=no | |
663 | fi | |
664 | ||
665 | if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then | |
666 | : | |
667 | else | |
668 | no_gtk=yes | |
669 | fi | |
670 | fi | |
671 | ||
672 | if test x"$no_gtk" = x ; then | |
673 | GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` | |
674 | GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` | |
675 | gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
676 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
677 | gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
678 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
679 | gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
680 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
681 | if test "x$enable_gtktest" = "xyes" ; then | |
682 | ac_save_CFLAGS="$CFLAGS" | |
683 | ac_save_LIBS="$LIBS" | |
684 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
685 | LIBS="$GTK_LIBS $LIBS" | |
686 | dnl | |
687 | dnl Now check if the installed GTK+ is sufficiently new. (Also sanity | |
688 | dnl checks the results of pkg-config to some extent) | |
689 | dnl | |
690 | rm -f conf.gtktest | |
691 | AC_TRY_RUN([ | |
692 | #include <gtk/gtk.h> | |
693 | #include <stdio.h> | |
694 | #include <stdlib.h> | |
695 | ||
696 | int | |
697 | main () | |
698 | { | |
699 | int major, minor, micro; | |
700 | char *tmp_version; | |
701 | ||
702 | system ("touch conf.gtktest"); | |
703 | ||
704 | /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
705 | tmp_version = g_strdup("$min_gtk_version"); | |
706 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
707 | printf("%s, bad version string\n", "$min_gtk_version"); | |
708 | exit(1); | |
709 | } | |
710 | ||
711 | if ((gtk_major_version != $gtk_config_major_version) || | |
712 | (gtk_minor_version != $gtk_config_minor_version) || | |
713 | (gtk_micro_version != $gtk_config_micro_version)) | |
714 | { | |
715 | printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
716 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
717 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
718 | printf ("*** was found! If pkg-config was correct, then it is best\n"); | |
719 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
720 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
721 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
722 | printf("*** required on your system.\n"); | |
723 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | |
724 | printf("*** to point to the correct configuration files\n"); | |
725 | } | |
726 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
727 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
728 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
729 | { | |
730 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
731 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
732 | printf("*** library (version %d.%d.%d)\n", | |
733 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
734 | } | |
735 | else | |
736 | { | |
737 | if ((gtk_major_version > major) || | |
738 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
739 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
740 | { | |
741 | return 0; | |
742 | } | |
743 | else | |
744 | { | |
745 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
746 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
747 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
748 | major, minor, micro); | |
749 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
750 | printf("***\n"); | |
751 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
752 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | |
753 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
754 | printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); | |
755 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | |
756 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
757 | printf("*** so that the correct libraries are found at run-time))\n"); | |
758 | } | |
759 | } | |
760 | return 1; | |
761 | } | |
762 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
763 | CFLAGS="$ac_save_CFLAGS" | |
764 | LIBS="$ac_save_LIBS" | |
765 | fi | |
766 | fi | |
767 | if test "x$no_gtk" = x ; then | |
768 | AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) | |
769 | ifelse([$2], , :, [$2]) | |
770 | else | |
771 | AC_MSG_RESULT(no) | |
772 | if test "$PKG_CONFIG" = "no" ; then | |
773 | echo "*** A new enough version of pkg-config was not found." | |
774 | echo "*** See http://pkgconfig.sourceforge.net" | |
775 | else | |
776 | if test -f conf.gtktest ; then | |
777 | : | |
778 | else | |
779 | echo "*** Could not run GTK+ test program, checking why..." | |
780 | ac_save_CFLAGS="$CFLAGS" | |
781 | ac_save_LIBS="$LIBS" | |
782 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
783 | LIBS="$LIBS $GTK_LIBS" | |
784 | AC_TRY_LINK([ | |
785 | #include <gtk/gtk.h> | |
786 | #include <stdio.h> | |
787 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
788 | [ echo "*** The test program compiled, but did not run. This usually means" | |
789 | echo "*** that the run-time linker is not finding GTK+ or finding the wrong" | |
790 | echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" | |
791 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
792 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
793 | echo "*** is required on your system" | |
794 | echo "***" | |
795 | echo "*** If you have an old version installed, it is best to remove it, although" | |
796 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | |
797 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
798 | echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) | |
799 | CFLAGS="$ac_save_CFLAGS" | |
800 | LIBS="$ac_save_LIBS" | |
801 | fi | |
802 | fi | |
803 | GTK_CFLAGS="" | |
804 | GTK_LIBS="" | |
805 | ifelse([$3], , :, [$3]) | |
806 | fi | |
807 | AC_SUBST(GTK_CFLAGS) | |
808 | AC_SUBST(GTK_LIBS) | |
809 | rm -f conf.gtktest | |
810 | ]) | |
811 | ||
812 | # Configure paths for GTK+ | |
813 | # Owen Taylor 97-11-3 | |
814 | ||
815 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
816 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
817 | dnl | |
818 | AC_DEFUN(AM_PATH_GTK, | |
819 | [dnl | |
820 | dnl Get the cflags and libraries from the gtk-config script | |
821 | dnl | |
822 | AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], | |
823 | gtk_config_prefix="$withval", gtk_config_prefix="") | |
824 | AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], | |
825 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
826 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], | |
827 | , enable_gtktest=yes) | |
828 | ||
829 | for module in . $4 | |
830 | do | |
831 | case "$module" in | |
832 | gthread) | |
833 | gtk_config_args="$gtk_config_args gthread" | |
834 | ;; | |
835 | esac | |
836 | done | |
837 | ||
838 | if test x$gtk_config_exec_prefix != x ; then | |
839 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
840 | if test x${GTK_CONFIG+set} != xset ; then | |
841 | GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | |
842 | fi | |
843 | fi | |
844 | if test x$gtk_config_prefix != x ; then | |
845 | gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
846 | if test x${GTK_CONFIG+set} != xset ; then | |
847 | GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | |
848 | fi | |
849 | fi | |
850 | ||
851 | AC_PATH_PROG(GTK_CONFIG, gtk-config, no) | |
852 | min_gtk_version=ifelse([$1], ,0.99.7,$1) | |
853 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
854 | no_gtk="" | |
855 | if test "$GTK_CONFIG" = "no" ; then | |
856 | no_gtk=yes | |
857 | else | |
858 | GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` | |
859 | GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` | |
860 | gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
861 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
862 | gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
863 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
864 | gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
865 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
866 | if test "x$enable_gtktest" = "xyes" ; then | |
867 | ac_save_CFLAGS="$CFLAGS" | |
868 | ac_save_LIBS="$LIBS" | |
869 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
870 | LIBS="$GTK_LIBS $LIBS" | |
871 | dnl | |
872 | dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
873 | dnl checks the results of gtk-config to some extent | |
874 | dnl | |
875 | rm -f conf.gtktest | |
876 | AC_TRY_RUN([ | |
877 | #include <gtk/gtk.h> | |
878 | #include <stdio.h> | |
879 | #include <stdlib.h> | |
880 | ||
881 | int | |
882 | main () | |
883 | { | |
884 | int major, minor, micro; | |
885 | char *tmp_version; | |
886 | ||
887 | system ("touch conf.gtktest"); | |
888 | ||
889 | /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
890 | tmp_version = g_strdup("$min_gtk_version"); | |
891 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
892 | printf("%s, bad version string\n", "$min_gtk_version"); | |
893 | exit(1); | |
894 | } | |
895 | ||
896 | if ((gtk_major_version != $gtk_config_major_version) || | |
897 | (gtk_minor_version != $gtk_config_minor_version) || | |
898 | (gtk_micro_version != $gtk_config_micro_version)) | |
899 | { | |
900 | printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
901 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
902 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
903 | printf ("*** was found! If gtk-config was correct, then it is best\n"); | |
904 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
905 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
906 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
907 | printf("*** required on your system.\n"); | |
908 | printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); | |
909 | printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); | |
910 | printf("*** before re-running configure\n"); | |
911 | } | |
912 | #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) | |
913 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
914 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
915 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
916 | { | |
917 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
918 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
919 | printf("*** library (version %d.%d.%d)\n", | |
920 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
921 | } | |
922 | #endif /* defined (GTK_MAJOR_VERSION) ... */ | |
923 | else | |
924 | { | |
925 | if ((gtk_major_version > major) || | |
926 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
927 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
928 | { | |
929 | return 0; | |
930 | } | |
931 | else | |
932 | { | |
933 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
934 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
935 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
936 | major, minor, micro); | |
937 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
938 | printf("***\n"); | |
939 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
940 | printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); | |
941 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
942 | printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); | |
943 | printf("*** correct copy of gtk-config. (In this case, you will have to\n"); | |
944 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
945 | printf("*** so that the correct libraries are found at run-time))\n"); | |
946 | } | |
947 | } | |
948 | return 1; | |
949 | } | |
950 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
951 | CFLAGS="$ac_save_CFLAGS" | |
952 | LIBS="$ac_save_LIBS" | |
953 | fi | |
954 | fi | |
955 | if test "x$no_gtk" = x ; then | |
956 | AC_MSG_RESULT(yes) | |
957 | ifelse([$2], , :, [$2]) | |
958 | else | |
959 | AC_MSG_RESULT(no) | |
960 | if test "$GTK_CONFIG" = "no" ; then | |
961 | echo "*** The gtk-config script installed by GTK could not be found" | |
962 | echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | |
963 | echo "*** your path, or set the GTK_CONFIG environment variable to the" | |
964 | echo "*** full path to gtk-config." | |
965 | else | |
966 | if test -f conf.gtktest ; then | |
967 | : | |
968 | else | |
969 | echo "*** Could not run GTK test program, checking why..." | |
970 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
971 | LIBS="$LIBS $GTK_LIBS" | |
972 | AC_TRY_LINK([ | |
973 | #include <gtk/gtk.h> | |
974 | #include <stdio.h> | |
975 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
976 | [ echo "*** The test program compiled, but did not run. This usually means" | |
977 | echo "*** that the run-time linker is not finding GTK or finding the wrong" | |
978 | echo "*** version of GTK. If it is not finding GTK, you'll need to set your" | |
979 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
980 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
981 | echo "*** is required on your system" | |
982 | echo "***" | |
983 | echo "*** If you have an old version installed, it is best to remove it, although" | |
984 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" | |
985 | echo "***" | |
986 | echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" | |
987 | echo "*** came with the system with the command" | |
988 | echo "***" | |
989 | echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
990 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
991 | echo "*** exact error that occured. This usually means GTK was incorrectly installed" | |
992 | echo "*** or that you have moved GTK since it was installed. In the latter case, you" | |
993 | echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) | |
994 | CFLAGS="$ac_save_CFLAGS" | |
995 | LIBS="$ac_save_LIBS" | |
996 | fi | |
997 | fi | |
998 | GTK_CFLAGS="" | |
999 | GTK_LIBS="" | |
1000 | ifelse([$3], , :, [$3]) | |
1001 | fi | |
1002 | AC_SUBST(GTK_CFLAGS) | |
1003 | AC_SUBST(GTK_LIBS) | |
1004 | rm -f conf.gtktest | |
1005 | ]) | |
1006 | ||
1007 | ||
1008 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) | |
1009 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page | |
1010 | dnl also defines GSTUFF_PKG_ERRORS on error | |
1011 | AC_DEFUN(PKG_CHECK_MODULES, [ | |
1012 | succeeded=no | |
1013 | ||
1014 | if test -z "$PKG_CONFIG"; then | |
1015 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
1016 | fi | |
1017 | ||
1018 | if test "$PKG_CONFIG" = "no" ; then | |
1019 | echo "*** The pkg-config script could not be found. Make sure it is" | |
1020 | echo "*** in your path, or set the PKG_CONFIG environment variable" | |
1021 | echo "*** to the full path to pkg-config." | |
1022 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." | |
1023 | else | |
1024 | PKG_CONFIG_MIN_VERSION=0.9.0 | |
1025 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then | |
1026 | AC_MSG_CHECKING(for $2) | |
1027 | ||
1028 | if $PKG_CONFIG --exists "$2" ; then | |
1029 | AC_MSG_RESULT(yes) | |
1030 | succeeded=yes | |
1031 | ||
1032 | AC_MSG_CHECKING($1_CFLAGS) | |
1033 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` | |
1034 | AC_MSG_RESULT($$1_CFLAGS) | |
1035 | ||
1036 | AC_MSG_CHECKING($1_LIBS) | |
1037 | $1_LIBS=`$PKG_CONFIG --libs "$2"` | |
1038 | AC_MSG_RESULT($$1_LIBS) | |
1039 | else | |
1040 | $1_CFLAGS="" | |
1041 | $1_LIBS="" | |
1042 | ## If we have a custom action on failure, don't print errors, but | |
1043 | ## do set a variable so people can do so. | |
1044 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
1045 | ifelse([$4], ,echo $$1_PKG_ERRORS,) | |
1046 | fi | |
1047 | ||
1048 | AC_SUBST($1_CFLAGS) | |
1049 | AC_SUBST($1_LIBS) | |
1050 | else | |
1051 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." | |
1052 | echo "*** See http://www.freedesktop.org/software/pkgconfig" | |
1053 | fi | |
1054 | fi | |
1055 | ||
1056 | if test $succeeded = yes; then | |
1057 | ifelse([$3], , :, [$3]) | |
1058 | else | |
1059 | 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]) | |
1060 | fi | |
1061 | ]) | |
1062 | ||
1063 | ||
1064 | ||
1065 | dnl --------------------------------------------------------------------------- | |
1066 | dnl Support macros for makefiles generated by BAKEFILE. | |
1067 | dnl --------------------------------------------------------------------------- | |
1068 | ||
1069 | dnl Lots of compiler & linker detection code contained here was taken from | |
1070 | dnl wxWindows configure.in script (see http://www.wxwindows.org) | |
1071 | ||
1072 | ||
1073 | ||
1074 | dnl --------------------------------------------------------------------------- | |
1075 | dnl AC_BAKEFILE_GNUMAKE | |
1076 | dnl | |
1077 | dnl Detects GNU make | |
1078 | dnl --------------------------------------------------------------------------- | |
1079 | ||
1080 | AC_DEFUN(AC_BAKEFILE_GNUMAKE, | |
1081 | [ | |
1082 | dnl does make support "-include" (only GNU make does AFAIK)? | |
1083 | AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, | |
1084 | [ | |
1085 | if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | | |
1086 | egrep -s GNU > /dev/null); then | |
1087 | bakefile_cv_prog_makeisgnu="yes" | |
1088 | else | |
1089 | bakefile_cv_prog_makeisgnu="no" | |
1090 | fi | |
1091 | ]) | |
1092 | ||
1093 | if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then | |
1094 | IF_GNU_MAKE="" | |
1095 | else | |
1096 | IF_GNU_MAKE="#" | |
1097 | fi | |
1098 | AC_SUBST(IF_GNU_MAKE) | |
1099 | ]) | |
1100 | ||
1101 | dnl --------------------------------------------------------------------------- | |
1102 | dnl AC_BAKEFILE_PLATFORM | |
1103 | dnl | |
1104 | dnl Detects platform and sets PLATFORM_XXX variables accordingly | |
1105 | dnl --------------------------------------------------------------------------- | |
1106 | ||
1107 | AC_DEFUN(AC_BAKEFILE_PLATFORM, | |
1108 | [ | |
1109 | PLATFORM_UNIX=0 | |
1110 | PLATFORM_WIN32=0 | |
1111 | PLATFORM_MSDOS=0 | |
1112 | PLATFORM_MAC=0 | |
1113 | PLATFORM_MACOSX=0 | |
1114 | ||
1115 | case "${host}" in | |
1116 | *-*-cygwin* | *-*-mingw32* ) | |
1117 | PLATFORM_WIN32=1 | |
1118 | ;; | |
1119 | *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx ) | |
1120 | PLATFORM_MSDOS=1 | |
1121 | ;; | |
1122 | powerpc-*-darwin* ) | |
1123 | PLATFORM_MAC=1 | |
1124 | PLATFORM_MACOSX=1 | |
1125 | ;; | |
1126 | * ) | |
1127 | PLATFORM_UNIX=1 | |
1128 | ;; | |
1129 | esac | |
1130 | ||
1131 | AC_SUBST(PLATFORM_UNIX) | |
1132 | AC_SUBST(PLATFORM_WIN32) | |
1133 | AC_SUBST(PLATFORM_MSDOS) | |
1134 | AC_SUBST(PLATFORM_MAC) | |
1135 | AC_SUBST(PLATFORM_MACOSX) | |
1136 | ]) | |
1137 | ||
1138 | ||
1139 | ||
1140 | dnl --------------------------------------------------------------------------- | |
1141 | dnl AC_BAKEFILE_SUFFIXES | |
1142 | dnl | |
1143 | dnl Detects shared various suffixes for shared libraries, libraries, programs, | |
1144 | dnl plugins etc. | |
1145 | dnl --------------------------------------------------------------------------- | |
1146 | ||
1147 | AC_DEFUN(AC_BAKEFILE_SUFFIXES, | |
1148 | [ | |
1149 | SO_SUFFIX="so" | |
1150 | SO_SUFFIX_MODULE="so" | |
1151 | EXEEXT="" | |
1152 | DLLPREFIX=lib | |
1153 | DLLPREFIX_MODULE= | |
1154 | ||
1155 | case "${host}" in | |
1156 | *-hp-hpux* ) | |
1157 | SO_SUFFIX="sl" | |
1158 | SO_SUFFIX_MODULE="sl" | |
1159 | ;; | |
1160 | *-*-aix* ) | |
1161 | dnl quoting from | |
1162 | dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: | |
1163 | dnl Both archive libraries and shared libraries on AIX have an | |
1164 | dnl .a extension. This will explain why you can't link with an | |
1165 | dnl .so and why it works with the name changed to .a. | |
1166 | SO_SUFFIX="a" | |
1167 | SO_SUFFIX_MODULE="a" | |
1168 | ;; | |
1169 | *-*-cygwin* | *-*-mingw32* ) | |
1170 | SO_SUFFIX="dll" | |
1171 | SO_SUFFIX_MODULE="dll" | |
1172 | EXEEXT=".exe" | |
1173 | DLLPREFIX="" | |
1174 | ;; | |
1175 | *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx ) | |
1176 | EXEEXT=".exe" | |
1177 | DLLPREFIX="" | |
1178 | ;; | |
1179 | powerpc-*-darwin* ) | |
1180 | SO_SUFFIX="dylib" | |
1181 | SO_SUFFIX_MODULE="bundle" | |
1182 | ;; | |
1183 | esac | |
1184 | ||
1185 | AC_SUBST(SO_SUFFIX) | |
1186 | AC_SUBST(SO_SUFFIX_MODULE) | |
1187 | AC_SUBST(EXEEXT) | |
1188 | AC_SUBST(DLLPREFIX) | |
1189 | AC_SUBST(DLLPREFIX_MODULE) | |
1190 | ]) | |
1191 | ||
1192 | ||
1193 | dnl --------------------------------------------------------------------------- | |
1194 | dnl AC_BAKEFILE_SHARED_LD | |
1195 | dnl | |
1196 | dnl Detects command for making shared libraries, substitutes SHARED_LD_CC | |
1197 | dnl and SHARED_LD_CXX. | |
1198 | dnl --------------------------------------------------------------------------- | |
1199 | ||
1200 | AC_DEFUN(AC_BAKEFILE_SHARED_LD, | |
1201 | [ | |
1202 | dnl Defaults for GCC and ELF .so shared libs: | |
1203 | SHARED_LD_CC="\$(CC) -shared -o" | |
1204 | SHARED_LD_CXX="\$(CXX) -shared -o" | |
1205 | ||
1206 | dnl the extra compiler flags needed for compilation of shared library | |
1207 | if test "x$GCC" = "xyes"; then | |
1208 | dnl the switch for gcc is the same under all platforms | |
1209 | PIC_FLAG="-fPIC" | |
1210 | fi | |
1211 | ||
1212 | case "${host}" in | |
1213 | *-hp-hpux* ) | |
1214 | dnl default settings are good for gcc but not for the native HP-UX | |
1215 | if test "x$GCC" = "xyes"; then | |
1216 | dnl -o flag must be after PIC flag | |
1217 | SHARED_LD_CC="${CC} -shared ${PIC_FLAG} -o" | |
1218 | SHARED_LD_CXX="${CXX} -shared ${PIC_FLAG} -o" | |
1219 | else | |
1220 | dnl no idea why it wants it, but it does | |
1221 | LDFLAGS="$LDFLAGS -L/usr/lib" | |
1222 | ||
1223 | SHARED_LD_CC="${CC} -b -o" | |
1224 | SHARED_LD_CXX="${CXX} -b -o" | |
1225 | PIC_FLAG="+Z" | |
1226 | fi | |
1227 | ;; | |
1228 | ||
1229 | *-*-linux* ) | |
1230 | if test "x$GCC" != "xyes"; then | |
1231 | AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc, | |
1232 | [ | |
1233 | AC_TRY_COMPILE([], | |
1234 | [ | |
1235 | #ifndef __INTEL_COMPILER | |
1236 | #error Not icc | |
1237 | #endif | |
1238 | ], | |
1239 | bakefile_cv_prog_icc=yes, | |
1240 | bakefile_cv_prog_icc=no | |
1241 | ) | |
1242 | ]) | |
1243 | if test "$bakefile_cv_prog_icc" = "yes"; then | |
1244 | PIC_FLAG="-KPIC" | |
1245 | fi | |
1246 | fi | |
1247 | ;; | |
1248 | ||
1249 | *-*-solaris2* ) | |
1250 | if test "x$GCC" != xyes ; then | |
1251 | SHARED_LD_CC="${CC} -G -o" | |
1252 | SHARED_LD_CXX="${CXX} -G -o" | |
1253 | PIC_FLAG="-KPIC" | |
1254 | fi | |
1255 | ;; | |
1256 | ||
1257 | *-*-darwin* ) | |
1258 | dnl For Unix to MacOS X porting instructions, see: | |
1259 | dnl http://fink.sourceforge.net/doc/porting/porting.html | |
1260 | CFLAGS="$CFLAGS -fno-common" | |
1261 | CXXFLAGS="$CXXFLAGS -fno-common" | |
1262 | ||
1263 | dnl Most apps benefit from being fully binded (its faster and static | |
1264 | dnl variables initialized at startup work). | |
1265 | dnl This can be done either with the exe linker flag -Wl,-bind_at_load | |
1266 | dnl or with a double stage link in order to create a single module | |
1267 | dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved | |
1268 | ||
1269 | cat <<EOF >shared-ld-sh | |
1270 | #!/bin/sh | |
1271 | #----------------------------------------------------------------------------- | |
1272 | #-- Name: distrib/mac/shared-ld-sh | |
1273 | #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X | |
1274 | #-- Author: Gilles Depeyrot | |
1275 | #-- Copyright: (c) 2002 Gilles Depeyrot | |
1276 | #-- Licence: any use permitted | |
1277 | #----------------------------------------------------------------------------- | |
1278 | ||
1279 | verbose=0 | |
1280 | args="" | |
1281 | objects="" | |
1282 | linking_flag="-dynamiclib" | |
1283 | ||
1284 | while test \${#} -gt 0; do | |
1285 | case \${1} in | |
1286 | ||
1287 | -v) | |
1288 | verbose=1 | |
1289 | ;; | |
1290 | ||
1291 | -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) | |
1292 | # collect these options and values | |
1293 | args="\${args} \${1} \${2}" | |
1294 | shift | |
1295 | ;; | |
1296 | ||
1297 | -l*|-L*|-flat_namespace) | |
1298 | # collect these options | |
1299 | args="\${args} \${1}" | |
1300 | ;; | |
1301 | ||
1302 | -dynamiclib|-bundle) | |
1303 | linking_flag="\${1}" | |
1304 | ;; | |
1305 | ||
1306 | -*) | |
1307 | echo "shared-ld: unhandled option '\${1}'" | |
1308 | exit 1 | |
1309 | ;; | |
1310 | ||
1311 | *.o | *.a | *.dylib) | |
1312 | # collect object files | |
1313 | objects="\${objects} \${1}" | |
1314 | ;; | |
1315 | ||
1316 | *) | |
1317 | echo "shared-ld: unhandled argument '\${1}'" | |
1318 | exit 1 | |
1319 | ;; | |
1320 | ||
1321 | esac | |
1322 | shift | |
1323 | done | |
1324 | ||
1325 | # | |
1326 | # Link one module containing all the others | |
1327 | # | |
1328 | if test \${verbose} = 1; then | |
1329 | echo "c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o" | |
1330 | fi | |
1331 | c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o | |
1332 | status=\$? | |
1333 | if test \${status} != 0; then | |
1334 | exit \${status} | |
1335 | fi | |
1336 | ||
1337 | # | |
1338 | # Link the shared library from the single module created | |
1339 | # | |
1340 | if test \${verbose} = 1; then | |
1341 | echo "cc \${linking_flag} master.\$\$.o \${args}" | |
1342 | fi | |
1343 | c++ \${linking_flag} master.\$\$.o \${args} | |
1344 | status=\$? | |
1345 | if test \${status} != 0; then | |
1346 | exit \${status} | |
1347 | fi | |
1348 | ||
1349 | # | |
1350 | # Remove intermediate module | |
1351 | # | |
1352 | rm -f master.\$\$.o | |
1353 | ||
1354 | exit 0 | |
1355 | EOF | |
1356 | chmod +x shared-ld-sh | |
1357 | ||
1358 | SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -undefined suppress -flat_namespace -o" | |
1359 | SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -undefined suppress -flat_namespace -o" | |
1360 | SHARED_LD_CXX="$SHARED_LD_CC" | |
1361 | SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" | |
1362 | PIC_FLAG="-dynamic -fPIC" | |
1363 | dnl FIXME - what about C libs? Gilles says to use c++ because it doesn't | |
1364 | dnl matter for C projects and matters for C++ ones | |
1365 | dnl FIXME - newer devel tools have linker flag to do this, the script | |
1366 | dnl is not necessary - detect! | |
1367 | ;; | |
1368 | ||
1369 | *-*-aix* ) | |
1370 | dnl default settings are ok for gcc | |
1371 | if test "x$GCC" != "xyes"; then | |
1372 | dnl the abs path below used to be hardcoded here so I guess it must | |
1373 | dnl be some sort of standard location under AIX? | |
1374 | AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, | |
1375 | makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) | |
1376 | dnl FIXME - what about makeCSharedLib? | |
1377 | SHARED_LD_CC="$AIX_CC_LD -p 0 -o" | |
1378 | SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" | |
1379 | fi | |
1380 | ;; | |
1381 | ||
1382 | *-*-beos* ) | |
1383 | dnl can't use gcc under BeOS for shared library creation because it | |
1384 | dnl complains about missing 'main' | |
1385 | SHARED_LD_CC="${LD} -shared -o" | |
1386 | SHARED_LD_CXX="${LD} -shared -o" | |
1387 | ;; | |
1388 | ||
1389 | *-*-irix* ) | |
1390 | dnl default settings are ok for gcc | |
1391 | if test "x$GCC" != "xyes"; then | |
1392 | PIC_FLAG="-KPIC" | |
1393 | fi | |
1394 | ;; | |
1395 | ||
1396 | *-*-cygwin* | *-*-mingw32* ) | |
1397 | PIC_FLAG="" | |
1398 | ;; | |
1399 | ||
1400 | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ | |
1401 | *-*-sunos4* | \ | |
1402 | *-*-osf* | \ | |
1403 | *-*-dgux5* | \ | |
1404 | *-*-sysv5* ) | |
1405 | dnl defaults are ok | |
1406 | ;; | |
1407 | ||
1408 | *) | |
1409 | AC_MSG_ERROR(unknown system type $host.) | |
1410 | esac | |
1411 | ||
1412 | if test "x$SHARED_LD_MODULE_CC" = "x" ; then | |
1413 | SHARED_LD_MODULE_CC="$SHARED_LD_CC" | |
1414 | fi | |
1415 | if test "x$SHARED_LD_MODULE_CXX" = "x" ; then | |
1416 | SHARED_LD_MODULE_CC="$SHARED_LD_CXX" | |
1417 | fi | |
1418 | ||
1419 | AC_SUBST(SHARED_LD_CC) | |
1420 | AC_SUBST(SHARED_LD_CXX) | |
1421 | AC_SUBST(SHARED_LD_MODULE_CC) | |
1422 | AC_SUBST(SHARED_LD_MODULE_CXX) | |
1423 | AC_SUBST(PIC_FLAG) | |
1424 | ]) | |
1425 | ||
1426 | ||
1427 | dnl --------------------------------------------------------------------------- | |
1428 | dnl AC_BAKEFILE_SHARED_VERSIONS | |
1429 | dnl | |
1430 | dnl Detects linker options for attaching versions (sonames) to shared libs. | |
1431 | dnl --------------------------------------------------------------------------- | |
1432 | ||
1433 | AC_DEFUN(AC_BAKEFILE_SHARED_VERSIONS, | |
1434 | [ | |
1435 | USE_SOVERSION=0 | |
1436 | USE_SOVERLINUX=0 | |
1437 | USE_SOVERSOLARIS=0 | |
1438 | USE_SOSYMLINKS=0 | |
1439 | USE_MACVERSION=0 | |
1440 | SONAME_FLAG= | |
1441 | ||
1442 | case "${host}" in | |
1443 | *-*-linux* ) | |
1444 | SONAME_FLAG="-Wl,-soname," | |
1445 | USE_SOVERSION=1 | |
1446 | USE_SOVERLINUX=1 | |
1447 | USE_SOSYMLINKS=1 | |
1448 | ;; | |
1449 | ||
1450 | *-*-solaris2* ) | |
1451 | SONAME_FLAG="-h " | |
1452 | USE_SOVERSION=1 | |
1453 | USE_SOVERSOLARIS=1 | |
1454 | USE_SOSYMLINKS=1 | |
1455 | ;; | |
1456 | ||
1457 | *-*-darwin* ) | |
1458 | USE_MACVERSION=1 | |
1459 | USE_SOVERSION=1 | |
1460 | USE_SOSYMLINKS=1 | |
1461 | ;; | |
1462 | esac | |
1463 | ||
1464 | AC_SUBST(USE_SOVERSION) | |
1465 | AC_SUBST(USE_SOVERLINUX) | |
1466 | AC_SUBST(USE_SOVERSOLARIS) | |
1467 | AC_SUBST(USE_MACVERSION) | |
1468 | AC_SUBST(USE_SOSYMLINKS) | |
1469 | AC_SUBST(SONAME_FLAG) | |
1470 | ]) | |
1471 | ||
1472 | ||
1473 | dnl --------------------------------------------------------------------------- | |
1474 | dnl AC_BAKEFILE_DEPS | |
1475 | dnl | |
1476 | dnl Detects available C/C++ dependency tracking options | |
1477 | dnl --------------------------------------------------------------------------- | |
1478 | ||
1479 | AC_DEFUN(AC_BAKEFILE_DEPS, | |
1480 | [ | |
1481 | AC_MSG_CHECKING([for dependency tracking method]) | |
1482 | DEPS_TRACKING=0 | |
1483 | ||
1484 | if test "x$GCC" = "xyes"; then | |
1485 | DEPSMODE=gcc | |
1486 | DEPS_TRACKING=1 | |
1487 | case "${host}" in | |
1488 | powerpc-*-darwin* ) | |
1489 | dnl -cpp-precomp (the default) conflicts with -MMD option | |
1490 | dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) | |
1491 | DEPSFLAG_GCC="-no-cpp-precomp -MMD" | |
1492 | ;; | |
1493 | * ) | |
1494 | DEPSFLAG_GCC="-MMD" | |
1495 | ;; | |
1496 | esac | |
1497 | AC_MSG_RESULT([gcc]) | |
1498 | else | |
1499 | AC_MSG_RESULT([none]) | |
1500 | fi | |
1501 | ||
1502 | if test $DEPS_TRACKING = 1 ; then | |
1503 | cat <<EOF >bk-deps | |
1504 | #!/bin/sh | |
1505 | ||
1506 | # This script is part of Bakefile (http://bakefile.sf.net) autoconf script. | |
1507 | # It is used to track C/C++ files dependencies in portable way. | |
1508 | # | |
1509 | # Permission is given to use this file in any way. | |
1510 | ||
1511 | DEPSMODE=$DEPSMODE | |
1512 | DEPSDIR=.deps | |
1513 | DEPSFLAG_GCC="$DEPSFLAG_GCC" | |
1514 | ||
1515 | mkdir -p \$DEPSDIR | |
1516 | ||
1517 | if test \$DEPSMODE = gcc ; then | |
1518 | \${*} \${DEPSFLAG_GCC} | |
1519 | status=\${?} | |
1520 | if test \${status} != 0 ; then | |
1521 | exit \${status} | |
1522 | fi | |
1523 | # move created file to the location we want it in: | |
1524 | while test \${#} -gt 0; do | |
1525 | case "\${1}" in | |
1526 | -o ) | |
1527 | shift | |
1528 | objfile=\${1} | |
1529 | ;; | |
1530 | -* ) | |
1531 | ;; | |
1532 | * ) | |
1533 | srcfile=\${1} | |
1534 | ;; | |
1535 | esac | |
1536 | shift | |
1537 | done | |
1538 | depfile=\`basename \$srcfile | sed -e 's/\..*$/.d/g'\` | |
1539 | depobjname=\`echo \$depfile |sed -e 's/\.d/.o/g'\` | |
1540 | if test -f \$depfile ; then | |
1541 | sed -e "s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d | |
1542 | rm -f \$depfile | |
1543 | else | |
1544 | depfile=\`basename \$objfile | sed -e 's/\..*$/.d/g'\` | |
1545 | if test -f \$depfile ; then | |
1546 | sed -e "/^\$objfile/! s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d | |
1547 | rm -f \$depfile | |
1548 | fi | |
1549 | fi | |
1550 | exit 0 | |
1551 | else | |
1552 | \${*} | |
1553 | exit \${?} | |
1554 | fi | |
1555 | EOF | |
1556 | chmod +x bk-deps | |
1557 | fi | |
1558 | ||
1559 | AC_SUBST(DEPS_TRACKING) | |
1560 | ]) | |
1561 | ||
1562 | dnl --------------------------------------------------------------------------- | |
1563 | dnl AC_BAKEFILE_CHECK_BASIC_STUFF | |
1564 | dnl | |
1565 | dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" | |
1566 | dnl or "install" | |
1567 | dnl --------------------------------------------------------------------------- | |
1568 | ||
1569 | AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF, | |
1570 | [ | |
1571 | AC_PROG_RANLIB | |
1572 | AC_PROG_INSTALL | |
1573 | AC_PROG_LN_S | |
1574 | ||
1575 | AC_PROG_MAKE_SET | |
1576 | AC_SUBST(MAKE_SET) | |
1577 | ||
1578 | if test "$build" != "$host" ; then | |
1579 | AR=$host_alias-ar | |
1580 | STRIP=$host_alias-strip | |
1581 | else | |
1582 | AC_CHECK_PROG(AR, ar, ar, ar) | |
1583 | AC_CHECK_PROG(STRIP, strip, strip, true) | |
1584 | fi | |
1585 | ||
1586 | case ${host} in | |
1587 | *-hp-hpux* ) | |
1588 | INSTALL_DIR="mkdir" | |
1589 | ;; | |
1590 | *) INSTALL_DIR="$INSTALL -d" | |
1591 | ;; | |
1592 | esac | |
1593 | AC_SUBST(INSTALL_DIR) | |
1594 | ||
1595 | LDFLAGS_GUI= | |
1596 | case ${host} in | |
1597 | *-*-cygwin* | *-*-mingw32* ) | |
1598 | LDFLAGS_GUI="-Wl,--subsystem,windows -mwindows" | |
1599 | esac | |
1600 | AC_SUBST(LDFLAGS_GUI) | |
1601 | ]) | |
1602 | ||
1603 | ||
1604 | dnl --------------------------------------------------------------------------- | |
1605 | dnl AC_BAKEFILE_RES_COMPILERS | |
1606 | dnl | |
1607 | dnl Checks for presence of resource compilers for win32 or mac | |
1608 | dnl --------------------------------------------------------------------------- | |
1609 | ||
1610 | AC_DEFUN(AC_BAKEFILE_RES_COMPILERS, | |
1611 | [ | |
1612 | RESCOMP= | |
1613 | SETFILE= | |
1614 | ||
1615 | case ${host} in | |
1616 | *-*-cygwin* | *-*-mingw32* ) | |
1617 | dnl Check for win32 resources compiler: | |
1618 | if test "$build" != "$host" ; then | |
1619 | RESCOMP=$host_alias-windres | |
1620 | else | |
1621 | AC_CHECK_PROG(RESCOMP, windres, windres, windres) | |
1622 | fi | |
1623 | ;; | |
1624 | ||
1625 | *-*-darwin* ) | |
1626 | AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez) | |
1627 | AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) | |
1628 | ;; | |
1629 | esac | |
1630 | ||
1631 | AC_SUBST(RESCOMP) | |
1632 | AC_SUBST(SETFILE) | |
1633 | ]) | |
1634 | ||
1635 | dnl --------------------------------------------------------------------------- | |
1636 | dnl AC_BAKEFILE | |
1637 | dnl | |
1638 | dnl To be used in configure.in of any project using Bakefile-generated mks | |
1639 | dnl --------------------------------------------------------------------------- | |
1640 | ||
1641 | AC_DEFUN(AC_BAKEFILE, | |
1642 | [ | |
1643 | if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then | |
1644 | AC_BAKEFILE_CHECK_BASIC_STUFF | |
1645 | fi | |
1646 | AC_BAKEFILE_GNUMAKE | |
1647 | AC_BAKEFILE_PLATFORM | |
1648 | AC_BAKEFILE_SUFFIXES | |
1649 | AC_BAKEFILE_SHARED_LD | |
1650 | AC_BAKEFILE_SHARED_VERSIONS | |
1651 | AC_BAKEFILE_DEPS | |
1652 | AC_BAKEFILE_RES_COMPILERS | |
1653 | ||
1654 | builtin(include, autoconf_inc.m4) | |
1655 | ]) | |
1656 |