1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
|
dnl configure.ac for MCPP 2003/11, 2008/11 kmatsui
dnl Process this file with autoconf to produce a configure script.
dnl WARNING: This script does not assume cross-compiling.
dnl To cross-compile you must edit here and there of this file.
AC_INIT( mcpp, 2.7.2, kmatsui@t3.rim.or.jp)
AC_CONFIG_SRCDIR( src/main.c)
AM_CONFIG_HEADER( src/config.h)
AC_CONFIG_AUX_DIR( config)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE( no-dependencies)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_EGREP
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
dnl WARNING: Configure must check the characteristics of target compiler.
dnl MCPP may modify the behavior of the target compiler-system.
dnl You must uninstall MCPP before re-configuring.
AC_MSG_CHECKING( [whether the cpp is target preprocessor])
mcpp=`$CPP $CFLAGS -xc -v /dev/null 2>&1 | grep 'MCPP'`
if test "x$mcpp" != x; then
AC_MSG_ERROR( Do 'make uninstall' before configuring again.)
fi
AC_MSG_RESULT( yes)
dnl Define host system and target system
case $host_os in
linux*)
AC_DEFINE( [HOST_SYSTEM], [SYS_LINUX], [Define the host system.])
ac_c_define_HOST_SYSTEM=[SYS_LINUX]
;;
freebsd*)
AC_DEFINE( [HOST_SYSTEM], [SYS_FREEBSD])
ac_c_define_HOST_SYSTEM=[SYS_FREEBSD]
;;
darwin*)
AC_DEFINE( [HOST_SYSTEM], [SYS_MAC])
ac_c_define_HOST_SYSTEM=[SYS_MAC]
;;
cygwin*)
AC_DEFINE( [HOST_SYSTEM], [SYS_CYGWIN])
ac_c_define_HOST_SYSTEM=[SYS_CYGWIN]
;;
mingw*)
AC_DEFINE( [HOST_SYSTEM], [SYS_MINGW])
ac_c_define_HOST_SYSTEM=[SYS_MINGW]
;;
*)
AC_MSG_WARN( [Unsupported host OS, assuming to be an UNIX variant])
AC_DEFINE( [HOST_SYSTEM], [SYS_UNIX])
ac_c_define_HOST_SYSTEM=[SYS_UNIX]
;;
esac
host_system=$ac_c_define_HOST_SYSTEM
case $target_os in
linux*)
AC_DEFINE( [SYSTEM], [SYS_LINUX], [Define the target system.])
;;
freebsd*)
AC_DEFINE( [SYSTEM], [SYS_FREEBSD])
;;
darwin*)
AC_DEFINE( [SYSTEM], [SYS_MAC])
;;
cygwin*)
AC_DEFINE( [SYSTEM], [SYS_CYGWIN])
;;
mingw*)
AC_DEFINE( [SYSTEM], [SYS_MINGW])
;;
*)
AC_MSG_WARN( Unsupported target OS, assuming to be an UNIX variant)
AC_DEFINE( [SYSTEM], [SYS_UNIX])
;;
esac
## --enable-replace-cpp option
AC_ARG_ENABLE( replace-cpp,
AC_HELP_STRING( [--enable-replace-cpp],
[Replace the resident preprocessor with mcpp]),
, ## the compiler name will be defined later
AC_DEFINE( [COMPILER], [INDEPENDENT], [Define the target compiler.])
## else define COMPILER as INDEPENDENT
)
## Generally this configure does not support cross-compiling.
## Nevertheless, it can configure cross-compiler of Apple-GCC (i686 vs ppc).
if test x$enable_replace_cpp = xyes \
&& test $ac_c_define_HOST_SYSTEM = SYS_MAC \
&& test $host_cpu != $target_cpu; then
## Enable to build mcpp into cross-compiler of Apple-GCC
## --with-target-cc option
AC_ARG_WITH( target_cc,
AC_HELP_STRING( [--with-target-cc],
[Specify the target compiler to build mcpp into on Mac OS X]),
if test x${withval+set} = xset; then
target_cc=$withval
target_name=`echo $target_cc | sed 's/-gcc.*$//'`
if test $target_name != $target_alias; then
AC_MSG_ERROR( [The argument of --with-target-cc option conflicts with --target option.])
fi
AC_SUBST( [target_cc])
fi
)
fi
dnl Define a target specific macro.
AC_MSG_CHECKING( for target cpu)
## These are not predefined macros of MCPP. MCPP will define predefined macros
## on compile time based on the CPU macro, and possibly redefine them at an
## execution time.
case $target_cpu in
x86_64|amd64)
Target_Cpu=x86_64
;;
i?86*)
Target_Cpu=i386
;;
powerpc64|ppc64)
Target_Cpu=ppc64
;;
powerpc|ppc|ppc7400)
Target_Cpu=ppc
;;
*)
Target_Cpu=$target_cpu
;;
esac
AC_MSG_RESULT( $Target_Cpu)
AC_DEFINE_UNQUOTED( [CPU], "$Target_Cpu", [Define the cpu-specific-macro.])
## Build into cross-compiler on Mac OS
if test x$enable_replace_cpp = xyes \
&& test $ac_c_define_HOST_SYSTEM = SYS_MAC \
&& test x${target_cc+set} = xset; then
arch_opt="-arch $Target_Cpu"
fi
dnl Checks for header files.
AC_CHECK_HEADERS( [unistd.h, stdint.h, inttypes.h])
dnl Checks for typedefs, and compiler characteristics.
AC_CHECK_TYPES( [intmax_t, long long])
dnl Check for library functions.
AC_CHECK_FUNCS( [stpcpy])
dnl Checks for some system characteristics.
AC_CACHE_CHECK(if the cases of filename are folded,
ac_cv_fname_fold,
[touch hJkL
[ac_cv_fname_fold=no]
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <stdio.h>
#include <errno.h>
void exit();
int main( void)
{
if (fopen( "HjKl", "r") == NULL)
exit( errno);
else
exit( 0);
} ])],
[ac_cv_fname_fold=yes],
[],
AC_MSG_WARN( cannot run on cross-compiling so assumes that the cases of filename are not folded.)
)
rm hJkL],
)
if test x$ac_cv_fname_fold = xyes; then
AC_DEFINE( [FNAME_FOLD], 1,
[Define if the cases of file name are folded.])
fi
dnl Checks for some host compiler characteristics.
AC_DEFINE_UNQUOTED( [OBJEXT], ["$ac_cv_objext"],
[Define the suffix of object file.])
dnl Check printf length modifier of the longest integer.
# AC_CHECK_MOD_LL( modifier, additional include header)
# Try the printf length modifier for the longest integer.
# The redundant sscanf() is for some compilers which cannot handle
# long long integer token.
AC_DEFUN([AC_CHECK_MOD_LL], [
AC_CACHE_CHECK([printf length modifier for the longest integer],
[ac_cv_c_printf_modifier],
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
$3
int main( void)
{ char buf@<:@ 20@:>@;
$1 num;
sscanf( "1234567890123456789", "%$2d", &num);
sprintf( buf, "%$2d", num);
assert( strcmp( buf, "1234567890123456789") == 0);
exit( 0);
} ])],
[ac_cv_c_printf_modifier=$2],
,
AC_MSG_WARN( cannot run on cross-compiling so assumes the length modifier of long long is "%ll")
AC_DEFINE( [LL_FORM], "ll",
[Define printf length modifier for the longest integer.])
[ac_cv_c_printf_modifier=ll]
)
)
] )
if test x$ac_cv_type_intmax_t = xyes; then
AC_CHECK_MOD_LL([intmax_t], [j], [#include <stdint.h>])
if test $ac_c_define_HOST_SYSTEM = SYS_CYGWIN \
|| test $ac_c_define_HOST_SYSTEM = SYS_MINGW; then
sleep 1 # wait for cleanup
fi
fi
if test x$ac_cv_type_long_long = xyes; then
for modifier in ll I64 q L
do
AC_CHECK_MOD_LL([long long], ${modifier})
if test x${ac_cv_c_printf_modifier+set} = xset; then
break
fi
if test $ac_c_define_HOST_SYSTEM = SYS_CYGWIN \
|| test $ac_c_define_HOST_SYSTEM = SYS_MINGW; then
sleep 1 # wait for cleanup
fi
done
fi
if test x${ac_cv_c_printf_modifier+set} = xset; then
AC_DEFINE_UNQUOTED( [LL_FORM], "$ac_cv_c_printf_modifier",
[Define printf length modifier for the longest integer.])
fi
if test $ac_c_define_HOST_SYSTEM = SYS_FREEBSD && \
test x$mcpp_ac_c_define_SYSTEM_SP_STD != x__FreeBSD__; then
fbsd_ver=`echo '__FreeBSD__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ .*//'`
AC_DEFINE_UNQUOTED( [SYSTEM_EXT_VAL], "$fbsd_ver",
[Define the version of FreeBSD.])
fi
if test x$ac_cv_c_compiler_gnu = xyes; then
AC_DEFINE( [HOST_COMPILER], [GNUC], [Define the host compiler.])
AC_DEFINE( [HOST_CMP_NAME], "GCC", [Define the host compiler name.])
AC_MSG_CHECKING( for value of __GNUC__)
gcc_maj_ver=`echo '__GNUC__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ *//'`
AC_MSG_RESULT( $gcc_maj_ver)
AC_DEFINE_UNQUOTED( [GCC_MAJOR_VERSION], "$gcc_maj_ver",
[Define gcc major version.])
AC_MSG_CHECKING( for value of __GNUC_MINOR__)
gcc_min_ver=`echo __GNUC_MINOR__ | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ *//'`
AC_MSG_RESULT( $gcc_min_ver)
AC_DEFINE_UNQUOTED( [GCC_MINOR_VERSION], "$gcc_min_ver",
[Define gcc minor version.])
cw=`pwd`
if test x$srcdir = "x." || test x$srcdir = x; then
src_dir=$cw
else
src_dir=$srcdir
fi
if test $ac_c_define_HOST_SYSTEM = SYS_CYGWIN; then
AC_CACHE_CHECK( the root directory,
ac_cv_cygwin_root,
[ac_cv_cygwin_root=`$src_dir/config/cygwin_root`]
)
AC_DEFINE_UNQUOTED( [CYGWIN_ROOT_DIRECTORY], "$ac_cv_cygwin_root",
[Define root directory of CYGWIN.])
fi
if test $ac_c_define_HOST_SYSTEM = SYS_MINGW; then
AC_CACHE_CHECK( the root directory,
ac_cv_msys_root,
cd /tmp
cat > getcwd.c <<\_EOF
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
int main( int argc, char ** argv)
{ char buf@<:@ PATH_MAX@:>@;
getcwd( buf, PATH_MAX);
puts( buf);
return 0;
}
_EOF
$CC getcwd.c
cd /
[ac_cv_msys_root=`$src_dir/config/mingw_root`]
)
AC_CACHE_CHECK( the /mingw directory,
ac_cv_mingw_dir,
cd /mingw
[ac_cv_mingw_dir=`$src_dir/config/mingw_root`]
)
cd $cw
rm -f /tmp/getcwd.c /tmp/a.exe
AC_DEFINE_UNQUOTED( [MSYS_ROOT_DIRECTORY], "$ac_cv_msys_root",
[Define root directory of MSYS.])
AC_DEFINE_UNQUOTED( [MINGW_DIRECTORY], "$ac_cv_mingw_dir",
[Define /mingw directory.])
fi
else # not gcc
# mcpp_AC_C_DEFINE( SYSTEM | CPU | COMPILER, STD | OLD, $enableval)
# Specify the target-specific predefined macro.
AC_DEFUN([mcpp_AC_C_DEFINE], [
name=`echo $3 | sed 's/=.*//'`
mcpp_macro=$1_SP_$2
stripped_mcpp_macro=`echo $mcpp_macro | sed 's/STD//'`
if test x$stripped_mcpp_macro != x$mcpp_macro; then
stripped_name=`echo $name | sed 's/^_//'`
if test x$stripped_name = x$name; then
AC_MSG_ERROR( The macro name '$name' should begin with '_'.)
fi
else
stripped_name=`echo $name | sed 's/^@<:@A-Za-z@:>@//'`
if test x$stripped_name = x$name; then
AC_MSG_ERROR( The macro name '$name' should begin with an alphabetic letter.)
fi
fi
if test x$name = x$3; then
[replace=1]
else
[replace=`echo $3 | sed 's/^.*=//'`]
fi
AC_DEFINE_UNQUOTED( [$mcpp_macro], "$name")
AC_DEFINE_UNQUOTED( [${mcpp_macro}_VAL], "$replace")
mcpp_ac_c_define_$1_$2=$name
])
# mcpp_AC_C_PREDEF( SYSTEM | CPU | COMPILER, STD | OLD, additional description)
# Specify the target-specific predefined macro via mcpp_AC_C_DEFINE.
AC_DEFUN([mcpp_AC_C_PREDEF], [
AC_ARG_ENABLE( $1-$2-macro,
AC_HELP_STRING( --enable-$1-$2-macro=name@<:@=replace@:>@,
[specify the $1-specific $2-style predefined macro. $3]),
if test x$enableval = xyes || test x$enableval = xno; then
AC_MSG_ERROR( This option requires an argument as 'name@<:@=replace@:>@'.)
fi
mcpp_AC_C_DEFINE( $1, $2, $enableval)
AH_TEMPLATE( [$1_SP_$2],
[Define the name of $1-specific $2-style predefined macro.])
AH_TEMPLATE( [$1_SP_$2_VAL],
[Define the value of $1-specific $2-style predefined macro.])
)
])
mcpp_AC_C_PREDEF( [SYSTEM], [STD],
[In all this and the following 5 options,
'STD'-style name begins with an '_',
'OLD'-style name begins with an alphabetic and
if '=replace' is missing the macro is defined as 1.]
)
mcpp_AC_C_PREDEF( [SYSTEM], [OLD])
mcpp_AC_C_PREDEF( [CPU], [STD])
mcpp_AC_C_PREDEF( [CPU], [OLD])
mcpp_AC_C_PREDEF( [COMPILER], [STD])
mcpp_AC_C_PREDEF( [COMPILER], [OLD])
fi
## MacOS has "framework" directories.
if test $ac_c_define_HOST_SYSTEM = SYS_MAC; then
AC_MSG_CHECKING( for the MacOS-specific framework directory)
frameworks=`$CPP $CFLAGS $arch_opt -xc -v /dev/null 2>&1 | sed 's/^ *//' | sed 's/ .*$//' | $EGREP '/Frameworks$'`
n=1
for dir in $frameworks
do
case $n in
1) framework1=$dir;;
2) framework2=$dir;;
3) framework3=$dir;;
esac
let n=n+1
done
if test x${framework1+set} = xset; then
AC_DEFINE_UNQUOTED( [FRAMEWORK1], "$framework1",
[Define MacOS-specific framework directory 1.])
AC_MSG_RESULT( $framework1)
else
AC_MSG_RESULT( none)
fi
if test x${framework2+set} = xset; then
AC_DEFINE_UNQUOTED( [FRAMEWORK2], "$framework2",
[Define MacOS-specific framework directory 2.])
AC_MSG_RESULT( $framework2)
fi
if test x${framework3+set} = xset; then
AC_DEFINE_UNQUOTED( [FRAMEWORK3], "$framework3",
[Define MacOS-specific framework directory 3.])
AC_MSG_RESULT( $framework3)
fi
fi ## SYS_MAC
## --enable-mcpplib option
AC_ARG_ENABLE( mcpplib,
AC_HELP_STRING( [--enable-mcpplib],
[Build libmcpp rather than stand-alone mcpp])
)
if test x$enable_mcpplib = xyes; then ## mcpplib mode
AC_DEFINE( [MCPP_LIB], 1, [Define if build libmcpp])
if test x$enable_replace_cpp = xyes; then
AC_MSG_WARN( Ignores enable-replace-cpp option)
[enable_replace_cpp=no]
fi
else
if test x$enable_replace_cpp = xyes; then ## replace-cpp mode
dnl Check the characteristics of target compiler.
dnl Note: The following 3 hundred and more lines are for replace-cpp-mode.
dnl Target-compiler-specific configuration need these lines.
dnl These lines are not used in compiler-independent configuration.
dnl Check which header file CPP includes,
dnl relative to CURRENT or SOURCE directory.
# AC_C_INCLUDE_PREF( CURRENT | SOURCE | NEXT)
# Check the include preference ('NEXT' means CURRENT & SOURCE)
AC_DEFUN([AC_C_INCLUDE_PREF], [
AC_EGREP_CPP( $1, [
#include "../next/header.h"
],
[ac_cv_c_include_pref=$1],
)
])
AC_CACHE_CHECK( include preference - relative to current or source directory,
ac_cv_c_include_pref,
mkdir mcpp-tmp
cd mcpp-tmp
mkdir dir ../next ../next/dir
echo '#include "dir/what.h"' > ../next/header.h
echo '#include "next.h"' >> ../next/header.h
echo 'CURRENT' > dir/what.h
echo 'SOURCE' > ../next/dir/what.h
echo 'NEXT' > ../next/next.h
AC_C_INCLUDE_PREF( [SOURCE])
if test x$ac_cv_c_include_pref != xSOURCE; then
AC_C_INCLUDE_PREF( [CURRENT])
if test x$ac_cv_c_include_pref = xCURRENT; then
AC_C_INCLUDE_PREF( [NEXT])
if test x$ac_cv_c_include_pref = xNEXT; then
[ac_cv_c_include_pref="(CURRENT & SOURCE)"]
fi
else
AC_MSG_ERROR( Failed to include header file.)
fi
fi
cd ..
rm -rf mcpp-tmp next
if test $ac_c_define_HOST_SYSTEM = SYS_CYGWIN \
|| test $ac_c_define_HOST_SYSTEM = SYS_MINGW; then
sleep 1 # wait for cleanup
fi
)
AC_DEFINE_UNQUOTED( [SEARCH_INIT], $ac_cv_c_include_pref,
[Define include preference.])
AC_CACHE_CHECK(if the argument of pragma is macro expanded,
ac_cv_c_pragma_is_expanded,
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#define once
#pragma once
])],
[ac_cv_c_pragma_is_expanded=no],
[ac_cv_c_pragma_is_expanded=yes]
)
)
if test x$ac_cv_c_pragma_is_expanded = xyes; then
AC_DEFINE( [EXPAND_PRAGMA], 1,
[Define if the argument of pragma is macro expanded.])
fi
AC_CACHE_CHECK( if digraphs can be used,
ac_cv_c_digraph,
[AC_PREPROC_IFELSE([AC_LANG_SOURCE([
%:if 1
%:endif])],
[ac_cv_c_digraph=yes],
[ac_cv_c_digraph=no]
)]
)
if test x$ac_cv_c_digraph = xyes; then
AC_DEFINE( [HAVE_DIGRAPHS], 1, [Define if digraphs are available.])
fi
AC_CACHE_CHECK( preprocessor output format of line directive,
ac_cv_c_line_format,
[ac_cv_c_line_format=\"`echo '#line 4321' | $CPP - | grep 432 | sed 's/432.*$//'`\"]
## Note: the output line number may be 4320 on GCC 2.* or other preprocessors.
)
AC_DEFINE_UNQUOTED( [LINE_PREFIX], $ac_cv_c_line_format,
[Define output format of line directive.])
if test "x$ac_cv_c_line_format" = "x\"#line \""; then
ac_cv_c_std_line_prefix=1
else
ac_cv_c_std_line_prefix=0
fi
AC_DEFINE_UNQUOTED( [STD_LINE_PREFIX], $ac_cv_c_std_line_prefix,
[Define whether output format of line directive is C source style.])
AC_CACHE_CHECK( default value of __STDC__,
ac_cv_c_stdc,
[stdc=`echo '__STDC__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ .*//'`]
if test x"$stdc" = x"__STDC__"; then
[ac_cv_c_stdc=0]
else
[ac_cv_c_stdc=$stdc]
fi
)
AC_DEFINE_UNQUOTED( [STDC], $ac_cv_c_stdc,
[Define the default value of __STDC__.])
AC_CACHE_CHECK( default value of __STDC_VERSION__,
ac_cv_c_stdc_ver,
[stdc_ver=`echo '__STDC_VERSION__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ .*//'`]
if test x"$stdc_ver" = x"__STDC_VERSION__"; then
[ac_cv_c_stdc_ver=0]
else
[ac_cv_c_stdc_ver=$stdc_ver]
fi
)
AC_DEFINE_UNQUOTED( [STDC_VERSION], $ac_cv_c_stdc_ver,
[Define the default value of __STDC_VERSION__.])
if test x${ac_cv_c_compiler_gnu} != xyes; then
# Specify the compiler's name
AC_ARG_WITH( compiler-name,
AC_HELP_STRING( [--with-compiler-name=NAME],
[specify the compiler name which is used as the definition of COMPILER macro]),
AC_DEFINE_UNQUOTED( [COMPILER], $compiler_name, [specify the compiler name]),
AC_MSG_ERROR( --with-compiler-name=NAME option should be specified to define [COMPILER] macro.)
)
# Specify the C++ header file directory
AC_ARG_WITH( cxx-include-dir,
AC_HELP_STRING( [--with-cxx-include-dir=directory],
[specify the C++ include directory by absolute path [[none]]]),
[case "${withval}" in
[\\/]* | [A-Za-z]:[\\/]*)
cxx_include_dir=`echo $withval | sed 's,/$,,'; 's,\\$,,'`
AC_DEFINE_UNQUOTED( [CPLUS_INCLUDE_DIR1], $cxx_include_dir,
[Define the C++ include directory.])
;;
*) AC_MSG_ERROR( $withval should be an absolute path.) ;;
esac]
)
fi # not gcc
dnl Define compiler specific elements.
AC_MSG_NOTICE( checking for some compiler specific elements)
# Define GCC specific elements.
if test x$ac_cv_c_compiler_gnu = xyes; then
AC_DEFINE( [COMPILER], [GNUC], [Define the target compiler.])
cpp_call=`$CPP $CFLAGS $arch_opt -xc -v /dev/null 2>&1 | $EGREP '/cpp|/cc1' | sed 's/^ *//; s/ .*//'`
AC_MSG_CHECKING( for the directory to install mcpp)
cpp_name=`expr $cpp_call : '.*/\(.*\)'`
bindir=`expr $cpp_call : "\(.*\)/$cpp_name"`
AC_MSG_RESULT( $bindir)
AC_PATH_PROG( [gcc_path], [$CC], , [$PATH])
cc_path=`echo $CC | $EGREP "/"`
if test x$cc_path != x; then
AC_MSG_ERROR( [Environment variables CC and CXX for GCC-specific-build should not contain a directory part.]);
fi
## force to set $prefix to GCC's prefix
## (i.e. "/usr/local" of "/usr/local/bin/gcc")
gcc_prefix=`echo $gcc_path | $EGREP "/bin/$CC\$" | sed "s,/bin/$CC\$,,"`
if test "x$gcc_prefix" != xNONE; then
if test "x$prefix" != xNONE && "x$gcc_prefix" != "x$prefix"; then
AC_MSG_WARN( [Ignored --prefix option, since it conflicts with GCC path])
fi
prefix=$gcc_prefix
else
if test "x$prefix" = xNONE; then
prefix=$ac_default_prefix
fi
fi
lang_save=$LANG
export LANG=C
AC_MSG_CHECKING( for the compiler-specific C include directory)
exclude="^/usr(/local|)/include\$|^${prefix}(/local|)/include\$|/Frameworks|End of search list"
c_include_dirs=`$CPP $CFLAGS $arch_opt -xc -v /dev/null 2>&1 | sed '1,/<...> search starts here/d' | sed '/End of search list/q' | sed 's/^ *//' | $EGREP -v "$exclude"`
n=1
for dir in $c_include_dirs
do
case $n in
1) c_include_dir1=$dir;;
2) c_include_dir2=$dir;;
3) c_include_dir3=$dir;;
esac
let n=n+1
done
if test x${c_include_dir1+set} = xset; then
AC_DEFINE_UNQUOTED( [C_INCLUDE_DIR1], "$c_include_dir1",
[Define compiler-specific C include directory 1.])
AC_MSG_RESULT( $c_include_dir1)
else
AC_MSG_RESULT( none)
fi
if test x${c_include_dir2+set} = xset; then
AC_DEFINE_UNQUOTED( [C_INCLUDE_DIR2], "$c_include_dir2",
[Define compiler-specific C include directory 2.])
AC_MSG_RESULT( $c_include_dir2)
fi
if test x${c_include_dir3+set} = xset; then
AC_DEFINE_UNQUOTED( [C_INCLUDE_DIR3], "$c_include_dir3",
[Define compiler-specific C include directory 3.])
AC_MSG_RESULT( $c_include_dir3)
fi
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG_PUSH( C++)
AC_MSG_CHECKING( for the compiler-specific C++ include directory)
exclude="^/usr(/local|)/include\$|^${prefix}(/local|)/include\$|/Frameworks|^${c_include_dir1}\$|^${c_include_dir2}\$|^${c_include_dir3}\$"
cxx_include_dirs=`${CXXCPP} ${CXXFLAGS} $arch_opt -xc++ -v /dev/null 2>&1 | sed '1,/<...> search starts here/d' | sed '/End of search list/q' | sed '/End of search list/d' | sed 's/^ *//' | $EGREP -v "$exclude"`
n=1
for dir in ${cxx_include_dirs}
do
case $n in
1) cxx_include_dir1=$dir;;
2) cxx_include_dir2=$dir;;
3) cxx_include_dir3=$dir;;
4) cxx_include_dir4=$dir;;
esac
let n=n+1
done
if test x${cxx_include_dir1+set} = xset; then
AC_DEFINE_UNQUOTED( [CPLUS_INCLUDE_DIR1], "$cxx_include_dir1",
[Define compiler-specific C++ include directory 1.])
AC_MSG_RESULT( $cxx_include_dir1)
fi
if test x${cxx_include_dir2+set} = xset; then
AC_DEFINE_UNQUOTED( [CPLUS_INCLUDE_DIR2], "$cxx_include_dir2",
[Define compiler-specific C++ include directory 2.])
AC_MSG_RESULT( $cxx_include_dir2)
fi
if test x${cxx_include_dir3+set} = xset; then
AC_DEFINE_UNQUOTED( [CPLUS_INCLUDE_DIR3], "$cxx_include_dir3",
[Define compiler-specific C++ include directory 3.])
AC_MSG_RESULT( $cxx_include_dir3)
fi
if test x${cxx_include_dir4+set} = xset; then
AC_DEFINE_UNQUOTED( [CPLUS_INCLUDE_DIR4], "$cxx_include_dir4",
[Define compiler-specific C++ include directory 4.])
AC_MSG_RESULT( $cxx_include_dir4)
fi
AC_LANG_POP( C++)
export LANG=$lang_save
## the directory into which mcpp_g*.h header files are generated
## '/mcpp-gcc' will be appended to 'inc_dir'
if test $ac_c_define_HOST_SYSTEM = SYS_MINGW; then
inc_dir=$c_include_dir2
else
if test x${c_include_dir1+set} = xset; then
inc_dir=$c_include_dir1
else
inc_dir="$prefix"/include
fi
fi
AC_DEFINE_UNQUOTED( [INC_DIR], "$inc_dir",
[Define include directory to install mcpp_g*.h header files.])
AC_SUBST( [CPPFLAGS])
AC_SUBST( [host_system])
AC_SUBST( [Target_Cpu])
AC_SUBST( [inc_dir])
AC_SUBST( [gcc_maj_ver])
AC_SUBST( [gcc_min_ver])
AC_SUBST( [cpp_call])
AC_PROG_LN_S
if test x$gcc_maj_ver = x2; then
AC_CACHE_CHECK(for value of predefined macro '__SIZE_TYPE__',
mcpp_cv_size_type,
[mcpp_cv_size_type=`echo '__SIZE_TYPE__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ *//'`]
)
AC_DEFINE_UNQUOTED([COMPILER_SP1_VAL], "$mcpp_cv_size_type",
[Define the type of size_t.])
AC_CACHE_CHECK(for value of predefined macro '__PTRDIFF_TYPE__',
mcpp_cv_ptrdiff_type,
[mcpp_cv_ptrdiff_type=`echo '__PTRDIFF_TYPE__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ *$//'`]
)
AC_DEFINE_UNQUOTED([COMPILER_SP2_VAL], "$mcpp_cv_ptrdiff_type",
[Define the type of ptrdiff_t.])
AC_CACHE_CHECK(for value of predefined macro '__WCHAR_TYPE__',
mcpp_cv_wchar_type,
[mcpp_cv_wchar_type=`echo '__WCHAR_TYPE__' | $CPP - | sed 's/^ *//' | $EGREP -v '^#|^$' | sed 's/ *$//'`]
)
AC_DEFINE_UNQUOTED( [COMPILER_SP3_VAL], "$mcpp_cv_wchar_type",
[Define the type of wchar_t.])
fi
fi
## Handling of multi-byte characters containing '0x5c' codes:
## These tests cannot be executed without appropriate options for the
## compiler. So, here we define all of these macros as FALSE.
## User should edit config.h by hand after executing this script.
## These should be 0 for GCC at least upto V.4.1.
AC_DEFINE( [SJIS_IS_ESCAPE_FREE], 0,
[Define if '0x5c' in SJIS multi-byte character is safe.])
AC_DEFINE( [ISO2022_JP_IS_ESCAPE_FREE], 0,
[Define if '0x5c' in ISO2022-JP multi-byte character is safe.])
AC_DEFINE( [BIGFIVE_IS_ESCAPE_FREE], 0,
[Define if '0x5c' in BIG5 multi-byte character is safe.])
fi ## replace-cpp mode
fi ## build-cpp mode or replace-cpp mode
AC_ARG_WITH( [gcc-testsuite-dir],
AC_HELP_STRING( [--with-gcc-testsuite-dir=directory],
[specify the gcc testsuite directory to do make check.
e.g. /usr/src/rpm/SOURCES/gcc-2.95.4/gcc/testsuite,
/usr/local/src/gcc-3.2/gcc/testsuite, etc.
The testsuite of mcpp uses gcc testsuite, hence needs gcc source
or at least gcc testsuite.
This option needs --enable-replace-cpp option.]),
if test x${withval+set} = xset; then
if test x$enable_replace_cpp = xyes; then
[gcc_testsuite_dir=`echo $withval | sed 's,/$,,'`]
else
AC_MSG_ERROR( [--with-gcc-testsuite-dir option requires --enable-replace-cpp option.])
fi
else
AC_MSG_ERROR( [--with-gcc-testsuite-dir option requires an argument.])
fi
)
AC_SUBST( [gcc_testsuite_dir])
AM_CONDITIONAL( [GNUC], test x$ac_cv_c_compiler_gnu = xyes)
AM_CONDITIONAL( [MCPP_LIB], test x$enable_mcpplib = xyes)
AM_CONDITIONAL( [REPLACE_CPP], test x$enable_replace_cpp = xyes)
AM_CONDITIONAL( [MINGW], test $ac_c_define_HOST_SYSTEM = SYS_MINGW)
dnl Final output.
AC_OUTPUT( Makefile src/Makefile tests/Makefile)
|