]>
Commit | Line | Data |
---|---|---|
1 | dnl --------------------------------------------------------------------------- | |
2 | dnl | |
3 | dnl Purpose: Cursom macros for autoconf configure script. | |
4 | dnl Authoer: Vadim Zeitlin | |
5 | dnl Created: 26.05.99 | |
6 | dnl Version: $Id$ | |
7 | dnl --------------------------------------------------------------------------- | |
8 | ||
9 | dnl =========================================================================== | |
10 | dnl include automake macros | |
11 | dnl =========================================================================== | |
12 | ||
13 | dnl Like AC_CONFIG_HEADER, but automatically create stamp file. | |
14 | AC_DEFUN(AM_CONFIG_HEADER, | |
15 | [AC_PREREQ([2.12]) | |
16 | AC_CONFIG_HEADER([$1]) | |
17 | dnl When config.status generates a header, we must update the stamp-h file. | |
18 | dnl This file resides in the same directory as the config header | |
19 | dnl that is generated. We must strip everything past the first ":", | |
20 | dnl and everything past the last "/". | |
21 | AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl | |
22 | ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, | |
23 | <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, | |
24 | <<am_indx=1 | |
25 | for am_file in <<$1>>; do | |
26 | case " <<$>>CONFIG_HEADERS " in | |
27 | *" <<$>>am_file "*<<)>> | |
28 | echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx | |
29 | ;; | |
30 | esac | |
31 | am_indx=`expr "<<$>>am_indx" + 1` | |
32 | done<<>>dnl>>) | |
33 | changequote([,]))]) | |
34 | ||
35 | # Do all the work for Automake. This macro actually does too much -- | |
36 | # some checks are only needed if your package does certain things. | |
37 | # But this isn't really a big deal. | |
38 | ||
39 | # serial 1 | |
40 | ||
41 | dnl Usage: | |
42 | dnl AM_INIT_AUTOMAKE(package,version, [no-define]) | |
43 | ||
44 | AC_DEFUN(AM_INIT_AUTOMAKE, | |
45 | [AC_REQUIRE([AC_PROG_INSTALL]) | |
46 | PACKAGE=[$1] | |
47 | AC_SUBST(PACKAGE) | |
48 | VERSION=[$2] | |
49 | AC_SUBST(VERSION) | |
50 | dnl test to see if srcdir already configured | |
51 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then | |
52 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) | |
53 | fi | |
54 | ifelse([$3],, | |
55 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") | |
56 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) | |
57 | AC_REQUIRE([AM_SANITY_CHECK]) | |
58 | AC_REQUIRE([AC_ARG_PROGRAM]) | |
59 | dnl FIXME This is truly gross. | |
60 | missing_dir=`cd $ac_aux_dir && pwd` | |
61 | AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) | |
62 | AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) | |
63 | AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) | |
64 | AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) | |
65 | AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) | |
66 | AC_REQUIRE([AC_PROG_MAKE_SET])]) | |
67 | ||
68 | ||
69 | # serial 1 | |
70 | ||
71 | AC_DEFUN(AM_PROG_INSTALL, | |
72 | [AC_REQUIRE([AC_PROG_INSTALL]) | |
73 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' | |
74 | AC_SUBST(INSTALL_SCRIPT)dnl | |
75 | ]) | |
76 | ||
77 | # | |
78 | # Check to make sure that the build environment is sane. | |
79 | # | |
80 | ||
81 | AC_DEFUN(AM_SANITY_CHECK, | |
82 | [AC_MSG_CHECKING([whether build environment is sane]) | |
83 | # Just in case | |
84 | sleep 1 | |
85 | echo timestamp > conftestfile | |
86 | # Do `set' in a subshell so we don't clobber the current shell's | |
87 | # arguments. Must try -L first in case configure is actually a | |
88 | # symlink; some systems play weird games with the mod time of symlinks | |
89 | # (eg FreeBSD returns the mod time of the symlink's containing | |
90 | # directory). | |
91 | if ( | |
92 | set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` | |
93 | if test "[$]*" = "X"; then | |
94 | # -L didn't work. | |
95 | set X `ls -t $srcdir/configure conftestfile` | |
96 | fi | |
97 | if test "[$]*" != "X $srcdir/configure conftestfile" \ | |
98 | && test "[$]*" != "X conftestfile $srcdir/configure"; then | |
99 | ||
100 | # If neither matched, then we have a broken ls. This can happen | |
101 | # if, for instance, CONFIG_SHELL is bash and it inherits a | |
102 | # broken ls alias from the environment. This has actually | |
103 | # happened. Such a system could not be considered "sane". | |
104 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken | |
105 | alias in your environment]) | |
106 | fi | |
107 | ||
108 | test "[$]2" = conftestfile | |
109 | ) | |
110 | then | |
111 | # Ok. | |
112 | : | |
113 | else | |
114 | AC_MSG_ERROR([newly created file is older than distributed files! | |
115 | Check your system clock]) | |
116 | fi | |
117 | rm -f conftest* | |
118 | AC_MSG_RESULT(yes)]) | |
119 | ||
120 | dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) | |
121 | dnl The program must properly implement --version. | |
122 | AC_DEFUN(AM_MISSING_PROG, | |
123 | [AC_MSG_CHECKING(for working $2) | |
124 | # Run test in a subshell; some versions of sh will print an error if | |
125 | # an executable is not found, even if stderr is redirected. | |
126 | # Redirect stdin to placate older versions of autoconf. Sigh. | |
127 | if ($2 --version) < /dev/null > /dev/null 2>&1; then | |
128 | $1=$2 | |
129 | AC_MSG_RESULT(found) | |
130 | else | |
131 | $1="$3/missing $2" | |
132 | AC_MSG_RESULT(missing) | |
133 | fi | |
134 | AC_SUBST($1)]) | |
135 | ||
136 | ||
137 | dnl AM_PROG_LEX | |
138 | dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT | |
139 | AC_DEFUN(AM_PROG_LEX, | |
140 | [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) | |
141 | AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") | |
142 | AC_PROG_LEX | |
143 | AC_DECL_YYTEXT]) | |
144 | ||
145 | ||
146 | # serial 29 AM_PROG_LIBTOOL | |
147 | AC_DEFUN(AM_PROG_LIBTOOL, | |
148 | [AC_REQUIRE([AM_ENABLE_SHARED])dnl | |
149 | AC_REQUIRE([AM_ENABLE_STATIC])dnl | |
150 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
151 | AC_REQUIRE([AC_CANONICAL_BUILD])dnl | |
152 | AC_REQUIRE([AC_PROG_RANLIB])dnl | |
153 | AC_REQUIRE([AC_PROG_CC])dnl | |
154 | AC_REQUIRE([AM_PROG_LD])dnl | |
155 | AC_REQUIRE([AM_PROG_NM])dnl | |
156 | AC_REQUIRE([AM_SYS_NM_PARSE])dnl | |
157 | AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl | |
158 | AC_REQUIRE([AC_PROG_LN_S])dnl | |
159 | dnl | |
160 | # Always use our own libtool. | |
161 | LIBTOOL='$(SHELL) $(top_builddir)/libtool' | |
162 | AC_SUBST(LIBTOOL)dnl | |
163 | ||
164 | # Check for any special flags to pass to ltconfig. | |
165 | libtool_flags= | |
166 | test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" | |
167 | test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" | |
168 | test "$silent" = yes && libtool_flags="$libtool_flags --silent" | |
169 | test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" | |
170 | test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" | |
171 | ||
172 | # Some flags need to be propagated to the compiler or linker for good | |
173 | # libtool support. | |
174 | case "$host" in | |
175 | *-*-irix6*) | |
176 | # Find out which ABI we are using. | |
177 | echo '[#]line __oline__ "configure"' > conftest.$ac_ext | |
178 | if AC_TRY_EVAL(ac_compile); then | |
179 | case "`/usr/bin/file conftest.o`" in | |
180 | *32-bit*) | |
181 | LD="${LD-ld} -32" | |
182 | ;; | |
183 | *N32*) | |
184 | LD="${LD-ld} -n32" | |
185 | ;; | |
186 | *64-bit*) | |
187 | LD="${LD-ld} -64" | |
188 | ;; | |
189 | esac | |
190 | fi | |
191 | rm -rf conftest* | |
192 | ;; | |
193 | ||
194 | *-*-sco3.2v5*) | |
195 | # On SCO OpenServer 5, we need -belf to get full-featured binaries. | |
196 | SAVE_CFLAGS="$CFLAGS" | |
197 | CFLAGS="$CFLAGS -belf" | |
198 | AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, | |
199 | [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) | |
200 | if test x"$lt_cv_cc_needs_belf" != x"yes"; then | |
201 | # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf | |
202 | CFLAGS="$SAVE_CFLAGS" | |
203 | fi | |
204 | ;; | |
205 | ||
206 | *-*-cygwin32*) | |
207 | AM_SYS_LIBTOOL_CYGWIN32 | |
208 | ;; | |
209 | ||
210 | esac | |
211 | ||
212 | # enable the --disable-libtool-lock switch | |
213 | ||
214 | AC_ARG_ENABLE(libtool-lock, | |
215 | [ --disable-libtool-lock force libtool not to do file locking], | |
216 | need_locks=$enableval, | |
217 | need_locks=yes) | |
218 | ||
219 | if test x"$need_locks" = xno; then | |
220 | libtool_flags="$libtool_flags --disable-lock" | |
221 | fi | |
222 | ||
223 | ||
224 | # Actually configure libtool. ac_aux_dir is where install-sh is found. | |
225 | CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ | |
226 | LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ | |
227 | DLLTOOL="$DLLTOOL" AS="$AS" \ | |
228 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ | |
229 | $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ | |
230 | || AC_MSG_ERROR([libtool configure failed]) | |
231 | ||
232 | # Redirect the config.log output again, so that the ltconfig log is not | |
233 | # clobbered by the next message. | |
234 | exec 5>>./config.log | |
235 | ]) | |
236 | ||
237 | # AM_ENABLE_SHARED - implement the --enable-shared flag | |
238 | # Usage: AM_ENABLE_SHARED[(DEFAULT)] | |
239 | # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to | |
240 | # `yes'. | |
241 | AC_DEFUN(AM_ENABLE_SHARED, | |
242 | [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl | |
243 | AC_ARG_ENABLE(shared, | |
244 | changequote(<<, >>)dnl | |
245 | << --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT], | |
246 | changequote([, ])dnl | |
247 | [p=${PACKAGE-default} | |
248 | case "$enableval" in | |
249 | yes) enable_shared=yes ;; | |
250 | no) enable_shared=no ;; | |
251 | *) | |
252 | enable_shared=no | |
253 | # Look at the argument we got. We use all the common list separators. | |
254 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," | |
255 | for pkg in $enableval; do | |
256 | if test "X$pkg" = "X$p"; then | |
257 | enable_shared=yes | |
258 | fi | |
259 | done | |
260 | IFS="$ac_save_ifs" | |
261 | ;; | |
262 | esac], | |
263 | enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl | |
264 | ]) | |
265 | ||
266 | # AM_DISABLE_SHARED - set the default shared flag to --disable-shared | |
267 | AC_DEFUN(AM_DISABLE_SHARED, | |
268 | [AM_ENABLE_SHARED(no)]) | |
269 | ||
270 | # AM_DISABLE_STATIC - set the default static flag to --disable-static | |
271 | AC_DEFUN(AM_DISABLE_STATIC, | |
272 | [AM_ENABLE_STATIC(no)]) | |
273 | ||
274 | # AM_ENABLE_STATIC - implement the --enable-static flag | |
275 | # Usage: AM_ENABLE_STATIC[(DEFAULT)] | |
276 | # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to | |
277 | # `yes'. | |
278 | AC_DEFUN(AM_ENABLE_STATIC, | |
279 | [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl | |
280 | AC_ARG_ENABLE(static, | |
281 | changequote(<<, >>)dnl | |
282 | << --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT], | |
283 | changequote([, ])dnl | |
284 | [p=${PACKAGE-default} | |
285 | case "$enableval" in | |
286 | yes) enable_static=yes ;; | |
287 | no) enable_static=no ;; | |
288 | *) | |
289 | enable_static=no | |
290 | # Look at the argument we got. We use all the common list separators. | |
291 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," | |
292 | for pkg in $enableval; do | |
293 | if test "X$pkg" = "X$p"; then | |
294 | enable_static=yes | |
295 | fi | |
296 | done | |
297 | IFS="$ac_save_ifs" | |
298 | ;; | |
299 | esac], | |
300 | enable_static=AM_ENABLE_STATIC_DEFAULT)dnl | |
301 | ]) | |
302 | ||
303 | ||
304 | # AM_PROG_LD - find the path to the GNU or non-GNU linker | |
305 | AC_DEFUN(AM_PROG_LD, | |
306 | [AC_ARG_WITH(gnu-ld, | |
307 | [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], | |
308 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) | |
309 | AC_REQUIRE([AC_PROG_CC])dnl | |
310 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
311 | AC_REQUIRE([AC_CANONICAL_BUILD])dnl | |
312 | ac_prog=ld | |
313 | if test "$ac_cv_prog_gcc" = yes; then | |
314 | # Check if gcc -print-prog-name=ld gives a path. | |
315 | AC_MSG_CHECKING([for ld used by GCC]) | |
316 | ac_prog=`($CC -print-prog-name=ld) 2>&5` | |
317 | case "$ac_prog" in | |
318 | # Accept absolute paths. | |
319 | changequote(,)dnl | |
320 | /* | [A-Za-z]:/*) | |
321 | # Canonicalize the path of ld | |
322 | re_direlt='/[^/][^/]*/\.\./' | |
323 | sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' | |
324 | changequote([,])dnl | |
325 | while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do | |
326 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` | |
327 | done | |
328 | case "$host_os" in | |
329 | cygwin*) | |
330 | # Convert to a UNC path for cygwin | |
331 | test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` | |
332 | ;; | |
333 | *) | |
334 | test -z "$LD" && LD="$ac_prog" | |
335 | ;; | |
336 | esac | |
337 | ;; | |
338 | ## | |
339 | ## FIXME: The code fails later on if we try to use an $LD with | |
340 | ## '\\' path separators. | |
341 | ## | |
342 | changequote(,)dnl | |
343 | [A-Za-z]:[\\]*) | |
344 | # Canonicalize the path of ld | |
345 | re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)' | |
346 | sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' | |
347 | changequote([,])dnl | |
348 | sub_uncdir='s%\\%/%g' | |
349 | while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do | |
350 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"` | |
351 | done | |
352 | case "$host_os" in | |
353 | cygwin*) | |
354 | # Convert to a UNC path for cygwin | |
355 | test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"` | |
356 | ;; | |
357 | *) | |
358 | test -z "$LD" && LD="$ac_prog" | |
359 | ;; | |
360 | esac | |
361 | ;; | |
362 | "") | |
363 | # If it fails, then pretend we aren't using GCC. | |
364 | ac_prog=ld | |
365 | ;; | |
366 | *) | |
367 | # If it is relative, then search for the first ld in PATH. | |
368 | with_gnu_ld=unknown | |
369 | ;; | |
370 | esac | |
371 | elif test "$with_gnu_ld" = yes; then | |
372 | AC_MSG_CHECKING([for GNU ld]) | |
373 | else | |
374 | AC_MSG_CHECKING([for non-GNU ld]) | |
375 | fi | |
376 | AC_CACHE_VAL(ac_cv_path_LD, | |
377 | [if test -z "$LD"; then | |
378 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
379 | for ac_dir in $PATH; do | |
380 | test -z "$ac_dir" && ac_dir=. | |
381 | if test -f "$ac_dir/$ac_prog"; then | |
382 | ac_cv_path_LD="$ac_dir/$ac_prog" | |
383 | # Check to see if the program is GNU ld. I'd rather use --version, | |
384 | # but apparently some GNU ld's only accept -v. | |
385 | # Break only if it was the GNU/non-GNU ld that we prefer. | |
386 | if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then | |
387 | test "$with_gnu_ld" != no && break | |
388 | else | |
389 | test "$with_gnu_ld" != yes && break | |
390 | fi | |
391 | fi | |
392 | done | |
393 | IFS="$ac_save_ifs" | |
394 | else | |
395 | ac_cv_path_LD="$LD" # Let the user override the test with a path. | |
396 | fi]) | |
397 | LD="$ac_cv_path_LD" | |
398 | if test -n "$LD"; then | |
399 | AC_MSG_RESULT($LD) | |
400 | else | |
401 | AC_MSG_RESULT(no) | |
402 | fi | |
403 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | |
404 | AC_SUBST(LD) | |
405 | AM_PROG_LD_GNU | |
406 | ]) | |
407 | ||
408 | AC_DEFUN(AM_PROG_LD_GNU, | |
409 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, | |
410 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. | |
411 | if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then | |
412 | ac_cv_prog_gnu_ld=yes | |
413 | else | |
414 | ac_cv_prog_gnu_ld=no | |
415 | fi]) | |
416 | ]) | |
417 | ||
418 | # AM_PROG_NM - find the path to a BSD-compatible name lister | |
419 | AC_DEFUN(AM_PROG_NM, | |
420 | [AC_MSG_CHECKING([for BSD-compatible nm]) | |
421 | AC_CACHE_VAL(ac_cv_path_NM, | |
422 | [if test -n "$NM"; then | |
423 | # Let the user override the test. | |
424 | ac_cv_path_NM="$NM" | |
425 | else | |
426 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
427 | for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do | |
428 | test -z "$ac_dir" && ac_dir=. | |
429 | if test -f $ac_dir/nm; then | |
430 | # Check to see if the nm accepts a BSD-compat flag. | |
431 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: | |
432 | # nm: unknown option "B" ignored | |
433 | if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then | |
434 | ac_cv_path_NM="$ac_dir/nm -B" | |
435 | elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then | |
436 | ac_cv_path_NM="$ac_dir/nm -p" | |
437 | else | |
438 | ac_cv_path_NM="$ac_dir/nm" | |
439 | fi | |
440 | break | |
441 | fi | |
442 | done | |
443 | IFS="$ac_save_ifs" | |
444 | test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm | |
445 | fi]) | |
446 | NM="$ac_cv_path_NM" | |
447 | AC_MSG_RESULT([$NM]) | |
448 | AC_SUBST(NM) | |
449 | ]) | |
450 | ||
451 | # AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed | |
452 | # by C symbol name from nm. | |
453 | AC_DEFUN(AM_SYS_NM_PARSE, | |
454 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
455 | AC_REQUIRE([AM_PROG_NM])dnl | |
456 | # Check for command to grab the raw symbol name followed by C symbol from nm. | |
457 | AC_MSG_CHECKING([command to parse $NM output]) | |
458 | AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, | |
459 | [# These are sane defaults that work on at least a few old systems. | |
460 | # {They come from Ultrix. What could be older than Ultrix?!! ;)} | |
461 | ||
462 | changequote(,)dnl | |
463 | # Character class describing NM global symbol codes. | |
464 | ac_symcode='[BCDEGRSTU]' | |
465 | ||
466 | # Regexp to match symbols that can be accessed directly from C. | |
467 | ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' | |
468 | ||
469 | # Transform the above into a raw symbol and a C symbol. | |
470 | ac_symxfrm='\1 \1' | |
471 | ||
472 | # Define system-specific variables. | |
473 | case "$host_os" in | |
474 | aix*) | |
475 | ac_symcode='[BCDTU]' | |
476 | ;; | |
477 | sunos* | cygwin32* | mingw32*) | |
478 | ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)' | |
479 | ac_symxfrm='_\1 \1' | |
480 | ;; | |
481 | irix*) | |
482 | # Cannot use undefined symbols on IRIX because inlined functions mess us up. | |
483 | ac_symcode='[BCDEGRST]' | |
484 | ;; | |
485 | solaris*) | |
486 | ac_symcode='[BDTU]' | |
487 | ;; | |
488 | esac | |
489 | ||
490 | # If we're using GNU nm, then use its standard symbol codes. | |
491 | if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then | |
492 | ac_symcode='[ABCDGISTUW]' | |
493 | fi | |
494 | ||
495 | case "$host_os" in | |
496 | cygwin32* | mingw32*) | |
497 | # We do not want undefined symbols on cygwin32. The user must | |
498 | # arrange to define them via -l arguments. | |
499 | ac_symcode='[ABCDGISTW]' | |
500 | ;; | |
501 | esac | |
502 | changequote([,])dnl | |
503 | ||
504 | # Write the raw and C identifiers. | |
505 | ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'" | |
506 | ||
507 | # Check to see that the pipe works correctly. | |
508 | ac_pipe_works=no | |
509 | cat > conftest.$ac_ext <<EOF | |
510 | #ifdef __cplusplus | |
511 | extern "C" { | |
512 | #endif | |
513 | char nm_test_var; | |
514 | void nm_test_func(){} | |
515 | #ifdef __cplusplus | |
516 | } | |
517 | #endif | |
518 | int main(){nm_test_var='a';nm_test_func;return 0;} | |
519 | EOF | |
520 | if AC_TRY_EVAL(ac_compile); then | |
521 | # Now try to grab the symbols. | |
522 | ac_nlist=conftest.nm | |
523 | if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then | |
524 | ||
525 | # Try sorting and uniquifying the output. | |
526 | if sort "$ac_nlist" | uniq > "$ac_nlist"T; then | |
527 | mv -f "$ac_nlist"T "$ac_nlist" | |
528 | ac_wcout=`wc "$ac_nlist" 2>/dev/null` | |
529 | changequote(,)dnl | |
530 | ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` | |
531 | changequote([,])dnl | |
532 | (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1 | |
533 | else | |
534 | rm -f "$ac_nlist"T | |
535 | ac_count=-1 | |
536 | fi | |
537 | ||
538 | # Make sure that we snagged all the symbols we need. | |
539 | if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then | |
540 | if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then | |
541 | cat <<EOF > conftest.c | |
542 | #ifdef __cplusplus | |
543 | extern "C" { | |
544 | #endif | |
545 | ||
546 | EOF | |
547 | # Now generate the symbol file. | |
548 | sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c | |
549 | ||
550 | cat <<EOF >> conftest.c | |
551 | #if defined (__STDC__) && __STDC__ | |
552 | # define __ptr_t void * | |
553 | #else | |
554 | # define __ptr_t char * | |
555 | #endif | |
556 | ||
557 | /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ | |
558 | int dld_preloaded_symbol_count = $ac_count; | |
559 | ||
560 | /* The mapping between symbol names and symbols. */ | |
561 | struct { | |
562 | char *name; | |
563 | __ptr_t address; | |
564 | } | |
565 | changequote(,)dnl | |
566 | dld_preloaded_symbols[] = | |
567 | changequote([,])dnl | |
568 | { | |
569 | EOF | |
570 | sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c | |
571 | cat <<\EOF >> conftest.c | |
572 | {0, (__ptr_t) 0} | |
573 | }; | |
574 | ||
575 | #ifdef __cplusplus | |
576 | } | |
577 | #endif | |
578 | EOF | |
579 | # Now try linking the two files. | |
580 | mv conftest.$ac_objext conftestm.$ac_objext | |
581 | ac_save_LIBS="$LIBS" | |
582 | ac_save_CFLAGS="$CFLAGS" | |
583 | LIBS="conftestm.$ac_objext" | |
584 | CFLAGS="$CFLAGS$no_builtin_flag" | |
585 | if AC_TRY_EVAL(ac_link) && test -s conftest; then | |
586 | ac_pipe_works=yes | |
587 | else | |
588 | echo "configure: failed program was:" >&AC_FD_CC | |
589 | cat conftest.c >&AC_FD_CC | |
590 | fi | |
591 | LIBS="$ac_save_LIBS" | |
592 | CFLAGS="$ac_save_CFLAGS" | |
593 | else | |
594 | echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC | |
595 | fi | |
596 | else | |
597 | echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC | |
598 | fi | |
599 | else | |
600 | echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC | |
601 | fi | |
602 | else | |
603 | echo "$progname: failed program was:" >&AC_FD_CC | |
604 | cat conftest.c >&AC_FD_CC | |
605 | fi | |
606 | rm -rf conftest* | |
607 | ||
608 | # Do not use the global_symbol_pipe unless it works. | |
609 | test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe= | |
610 | ]) | |
611 | ||
612 | ac_result=yes | |
613 | if test -z "$ac_cv_sys_global_symbol_pipe"; then | |
614 | ac_result=no | |
615 | fi | |
616 | AC_MSG_RESULT($ac_result) | |
617 | ]) | |
618 | ||
619 | # AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32 | |
620 | AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32, | |
621 | [AC_CHECK_TOOL(DLLTOOL, dlltool, false) | |
622 | AC_CHECK_TOOL(AS, as, false) | |
623 | ]) | |
624 | ||
625 | # AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols | |
626 | # with an underscore? | |
627 | AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, | |
628 | [AC_REQUIRE([AM_PROG_NM])dnl | |
629 | AC_REQUIRE([AM_SYS_NM_PARSE])dnl | |
630 | AC_MSG_CHECKING([for _ prefix in compiled symbols]) | |
631 | AC_CACHE_VAL(ac_cv_sys_symbol_underscore, | |
632 | [ac_cv_sys_symbol_underscore=no | |
633 | cat > conftest.$ac_ext <<EOF | |
634 | void nm_test_func(){} | |
635 | int main(){nm_test_func;return 0;} | |
636 | EOF | |
637 | if AC_TRY_EVAL(ac_compile); then | |
638 | # Now try to grab the symbols. | |
639 | ac_nlist=conftest.nm | |
640 | if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then | |
641 | # See whether the symbols have a leading underscore. | |
642 | if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then | |
643 | ac_cv_sys_symbol_underscore=yes | |
644 | else | |
645 | if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then | |
646 | : | |
647 | else | |
648 | echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC | |
649 | fi | |
650 | fi | |
651 | else | |
652 | echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC | |
653 | fi | |
654 | else | |
655 | echo "configure: failed program was:" >&AC_FD_CC | |
656 | cat conftest.c >&AC_FD_CC | |
657 | fi | |
658 | rm -rf conftest* | |
659 | ]) | |
660 | AC_MSG_RESULT($ac_cv_sys_symbol_underscore) | |
661 | if test x$ac_cv_sys_symbol_underscore = xyes; then | |
662 | AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1, | |
663 | [define if compiled symbols have a leading underscore]) | |
664 | fi | |
665 | ]) | |
666 | ||
667 | ||
668 | dnl =========================================================================== | |
669 | dnl GKT+ version test | |
670 | dnl =========================================================================== | |
671 | ||
672 | dnl --------------------------------------------------------------------------- | |
673 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
674 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
675 | dnl --------------------------------------------------------------------------- | |
676 | dnl | |
677 | AC_DEFUN(AM_PATH_GTK, | |
678 | [dnl | |
679 | dnl Get the cflags and libraries from the gtk-config script | |
680 | dnl | |
681 | AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed], | |
682 | gtk_config_prefix="$withval", gtk_config_prefix="") | |
683 | AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed], | |
684 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
685 | ||
686 | if test x$gtk_config_exec_prefix != x ; then | |
687 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
688 | if test x${GTK_CONFIG+set} != xset ; then | |
689 | GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | |
690 | fi | |
691 | fi | |
692 | if test x$gtk_config_prefix != x ; then | |
693 | gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
694 | if test x${GTK_CONFIG+set} != xset ; then | |
695 | GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | |
696 | fi | |
697 | fi | |
698 | ||
699 | AC_PATH_PROG(GTK_CONFIG, gtk-config, no) | |
700 | min_gtk_version=ifelse([$1], ,0.99.7,$1) | |
701 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
702 | no_gtk="" | |
703 | if test "$GTK_CONFIG" != "no" ; then | |
704 | GTK_CFLAGS=`$GTK_CONFIG --cflags` | |
705 | GTK_LIBS=`$GTK_CONFIG --libs` | |
706 | ac_save_CFLAGS="$CFLAGS" | |
707 | ac_save_LIBS="$LIBS" | |
708 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
709 | LIBS="$LIBS $GTK_LIBS" | |
710 | dnl | |
711 | dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
712 | dnl checks the results of gtk-config to some extent) | |
713 | dnl | |
714 | AC_TRY_RUN([ | |
715 | #include <gtk/gtk.h> | |
716 | #include <stdio.h> | |
717 | ||
718 | int | |
719 | main () | |
720 | { | |
721 | int major, minor, micro; | |
722 | ||
723 | if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { | |
724 | printf("%s, bad version string\n", "$min_gtk_version"); | |
725 | exit(1); | |
726 | } | |
727 | ||
728 | if (gtk_minor_version == 1) return FALSE; | |
729 | ||
730 | return !((gtk_major_version > major) || | |
731 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
732 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))); | |
733 | } | |
734 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
735 | CFLAGS="$ac_save_CFLAGS" | |
736 | LIBS="$ac_save_LIBS" | |
737 | else | |
738 | no_gtk=yes | |
739 | fi | |
740 | if test "x$no_gtk" = x ; then | |
741 | AC_MSG_RESULT(yes) | |
742 | ifelse([$2], , :, [$2]) | |
743 | else | |
744 | AC_MSG_RESULT(no) | |
745 | GTK_CFLAGS="" | |
746 | GTK_LIBS="" | |
747 | ifelse([$3], , :, [$3]) | |
748 | fi | |
749 | AC_SUBST(GTK_CFLAGS) | |
750 | AC_SUBST(GTK_LIBS) | |
751 | ]) | |
752 | ||
753 | dnl =========================================================================== | |
754 | dnl macros to find the a file in the list of include/lib paths | |
755 | dnl =========================================================================== | |
756 | ||
757 | dnl --------------------------------------------------------------------------- | |
758 | dnl call AC_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes | |
759 | dnl to the full name of the file that was found or leaves it empty if not found | |
760 | dnl --------------------------------------------------------------------------- | |
761 | AC_DEFUN(AC_PATH_FIND_INCLUDES, | |
762 | [ | |
763 | ac_find_includes= | |
764 | for ac_dir in $1; | |
765 | do | |
766 | if test -f "$ac_dir/$2"; then | |
767 | ac_find_includes=$ac_dir | |
768 | break | |
769 | fi | |
770 | done | |
771 | ]) | |
772 | ||
773 | dnl --------------------------------------------------------------------------- | |
774 | dnl call AC_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_includes | |
775 | dnl to the full name of the file that was found or leaves it empty if not found | |
776 | dnl --------------------------------------------------------------------------- | |
777 | AC_DEFUN(AC_PATH_FIND_LIBRARIES, | |
778 | [ | |
779 | ac_find_libraries= | |
780 | for ac_dir in $1; | |
781 | do | |
782 | for ac_extension in a so sl; do | |
783 | if test -f "$ac_dir/lib$2.$ac_extension"; then | |
784 | ac_find_libraries=$ac_dir | |
785 | break 2 | |
786 | fi | |
787 | done | |
788 | done | |
789 | ]) | |
790 | ||
791 | dnl --------------------------------------------------------------------------- | |
792 | dnl Path to include, already defined | |
793 | dnl --------------------------------------------------------------------------- | |
794 | AC_DEFUN(AC_INCLUDE_PATH_EXIST, | |
795 | [ | |
796 | ac_path_to_include=$1 | |
797 | echo "$2" | grep "\-I$1" > /dev/null | |
798 | result=$? | |
799 | if test $result = 0; then | |
800 | ac_path_to_include="" | |
801 | else | |
802 | ac_path_to_include="-I$1" | |
803 | fi | |
804 | ]) | |
805 | ||
806 | dnl --------------------------------------------------------------------------- | |
807 | dnl Path to link, already defined | |
808 | dnl --------------------------------------------------------------------------- | |
809 | AC_DEFUN(AC_LINK_PATH_EXIST, | |
810 | [ | |
811 | echo "$2" | grep "\-L$1" > /dev/null | |
812 | result=$? | |
813 | if test $result = 0; then | |
814 | ac_path_to_link="" | |
815 | else | |
816 | ac_path_to_link="-L$1" | |
817 | fi | |
818 | ]) | |
819 | ||
820 | dnl =========================================================================== | |
821 | dnl C++ features test | |
822 | dnl =========================================================================== | |
823 | ||
824 | dnl --------------------------------------------------------------------------- | |
825 | dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header | |
826 | dnl or only the old <iostream.h> one - it may be generally assumed that if | |
827 | dnl <iostream> exists, the other "new" headers (without .h) exist too. | |
828 | dnl | |
829 | dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling) | |
830 | dnl --------------------------------------------------------------------------- | |
831 | ||
832 | AC_DEFUN(WX_CPP_NEW_HEADERS, | |
833 | [ | |
834 | if test "$cross_compiling" = "yes"; then | |
835 | ifelse([$2], , :, [$2]) | |
836 | else | |
837 | AC_LANG_SAVE | |
838 | AC_LANG_CPLUSPLUS | |
839 | ||
840 | AC_CHECK_HEADERS(iostream) | |
841 | ||
842 | if test "x$HAVE_IOSTREAM" = x ; then | |
843 | ifelse([$2], , :, [$2]) | |
844 | else | |
845 | ifelse([$1], , :, [$1]) | |
846 | fi | |
847 | ||
848 | AC_LANG_RESTORE | |
849 | fi | |
850 | ]) | |
851 | ||
852 | dnl --------------------------------------------------------------------------- | |
853 | dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type | |
854 | dnl | |
855 | dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool | |
856 | dnl --------------------------------------------------------------------------- | |
857 | ||
858 | AC_DEFUN(WX_CPP_BOOL, | |
859 | [ | |
860 | AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool, | |
861 | [ | |
862 | AC_LANG_SAVE | |
863 | AC_LANG_CPLUSPLUS | |
864 | ||
865 | AC_TRY_RUN([ | |
866 | int main() | |
867 | { | |
868 | bool b = true; | |
869 | ||
870 | return 0; | |
871 | } | |
872 | ], | |
873 | [ | |
874 | AC_DEFINE(HAVE_BOOL) | |
875 | wx_cv_cpp_bool=yes | |
876 | ], | |
877 | wx_cv_cpp_bool=no, | |
878 | wx_cv_cpp_bool=no | |
879 | ) | |
880 | ||
881 | AC_LANG_RESTORE | |
882 | ]) | |
883 | ||
884 | if test "$wx_cv_cpp_bool" = "yes"; then | |
885 | AC_DEFINE(HAVE_BOOL) | |
886 | fi | |
887 | ]) | |
888 | ||
889 | dnl --------------------------------------------------------------------------- | |
890 | dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types, | |
891 | dnl i.e. whether we may overload operator[] on its argument type | |
892 | dnl --------------------------------------------------------------------------- | |
893 | ||
894 | AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT, | |
895 | [ | |
896 | AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int, | |
897 | [ | |
898 | AC_LANG_SAVE | |
899 | AC_LANG_CPLUSPLUS | |
900 | ||
901 | AC_TRY_RUN([ | |
902 | #include <stdlib.h> | |
903 | ||
904 | class S | |
905 | { | |
906 | public: | |
907 | S(char *s) { m_s = s; } | |
908 | ||
909 | char operator[](size_t n) const { return m_s[n]; } | |
910 | char operator[](int n) const { return m_s[n]; } | |
911 | ||
912 | private: | |
913 | char *m_s; | |
914 | }; | |
915 | ||
916 | int main() | |
917 | { | |
918 | S s("dummy"); | |
919 | size_t n1 = 2; | |
920 | int n2 = 3; | |
921 | ||
922 | return s[n1] == s[n2]; | |
923 | } | |
924 | ], | |
925 | AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) wx_cv_cpp_sizet_not_int=yes, | |
926 | wx_cv_cpp_sizet_not_int=no, | |
927 | wx_cv_cpp_sizet_not_int=no | |
928 | ) | |
929 | ||
930 | AC_LANG_RESTORE | |
931 | ]) | |
932 | ]) |