Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 88879d4664
Fetching contributors…

Cannot retrieve contributors at this time

file 877 lines (840 sloc) 32.448 kb
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 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#

#
# Configuration source for Tsukurimashou
# Copyright (C) 2011, 2012 Matthew Skala
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# As a special exception, if you create a document which uses this font, and
# embed this font or unaltered portions of this font into the document, this
# font does not by itself cause the resulting document to be covered by the
# GNU General Public License. This exception does not however invalidate any
# other reasons why the document might be covered by the GNU General Public
# License. If you modify this font, you may extend this exception to your
# version of the font, but you are not obligated to do so. If you do not
# wish to do so, delete this exception statement from your version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Matthew Skala
# http://ansuz.sooke.bc.ca/
# mskala@ansuz.sooke.bc.ca
#

#
############################################################################
#
# Override Autoconf's argument parsing - must be done here,
# before AC_INIT has a chance to run
#

# General macro for editing a definition
m4_define([TSUKU_DEFINITION_SUBST],
          [m4_define([$1],
                     m4_bpatsubst(m4_dquote(m4_defn([$1])),
                                  [$2],
                                  [$3]))])

# Delete an option from the argument parser
m4_define([TSUKU_DELETE_CMDLINE_OPTION],
          [TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [\
  -$1[^)]*)\
.*;;\
  -$1=\*[^)]*)\
.*;;\
],
                                  [\
  # Deleted $1 option\
])
           TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [\
  -$1[^)]*)\
    # Obsolete.*\
.*;;\
],
                                  [\
  # Deleted obsolete $1 option\
])
           ])

# exec-prefix is special because it's an install dir option without "dir"
TSUKU_DELETE_CMDLINE_OPTION([exec-prefix])
TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                         [for ac_var in\([^#]*\)\bexec_prefix\b],
                         [for ac_var in\1])

# Delete unwanted non-install-dir options
TSUKU_DELETE_CMDLINE_OPTION([gas])
TSUKU_DELETE_CMDLINE_OPTION([nfp])
TSUKU_DELETE_CMDLINE_OPTION([program-prefix])
TSUKU_DELETE_CMDLINE_OPTION([program-suffix])
TSUKU_DELETE_CMDLINE_OPTION([program-transform-name])
# may as well do this now - removes some processing and a help stanza
AC_DEFUN([AC_ARG_PROGRAM],[])
TSUKU_DELETE_CMDLINE_OPTION([-x])
TSUKU_DELETE_CMDLINE_OPTION([x-includes])
TSUKU_DELETE_CMDLINE_OPTION([x-libraries])

# Delete an install dir option from both parser and help
m4_define([TSUKU_DELETE_INSTDIR_OPTION],
          [TSUKU_DELETE_CMDLINE_OPTION([$1dir])
           TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [for ac_var in\([^#]*\).\b$1dir\b],
                                  [for ac_var in\1])
           TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                                  [ --$1dir=DIR.*\
],
                                  [])])

# Delete nearly all of the default install dirs
TSUKU_DELETE_INSTDIR_OPTION([bin])
TSUKU_DELETE_INSTDIR_OPTION([data])
TSUKU_DELETE_INSTDIR_OPTION([dvi])
TSUKU_DELETE_INSTDIR_OPTION([html])
TSUKU_DELETE_INSTDIR_OPTION([include])
TSUKU_DELETE_INSTDIR_OPTION([info])
TSUKU_DELETE_INSTDIR_OPTION([lib])
TSUKU_DELETE_INSTDIR_OPTION([libexec])
TSUKU_DELETE_INSTDIR_OPTION([info])
TSUKU_DELETE_INSTDIR_OPTION([locale])
TSUKU_DELETE_INSTDIR_OPTION([localstate])
TSUKU_DELETE_INSTDIR_OPTION([man])
TSUKU_DELETE_INSTDIR_OPTION([oldinclude])
TSUKU_DELETE_INSTDIR_OPTION([ps])
TSUKU_DELETE_INSTDIR_OPTION([sbin])
TSUKU_DELETE_INSTDIR_OPTION([sharedstate])
TSUKU_DELETE_INSTDIR_OPTION([sysconf])

# generate a "case" pattern matching chunk
# TSUKU_CASE_PATTERN_CHUNK(option,shortest,before,after)
m4_define([TSUKU_CASE_PATTERN_CHUNK],
  [$3$1$4[]m4_if([$1],[$2],[],
  [TSUKU_CASE_PATTERN_CHUNK(m4_substr($1,0,m4_eval(m4_len($1)-1)),
      [$2],[$3],[$4])])])

# Add a new installation directory
# TSUKU_ADD_INSTDIR_OPTION(dirname,under,default,help,abbrev,casebefore)
m4_define([TSUKU_ADD_INSTDIR_OPTION],
          [TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [AC_SUBST(\[$2\].*)dnl\
],
                                  [\&AC_SUBST([$1dir],['${$2}/$3'])dnl\
])
           TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                                  [\
\(.*--$2=.*\)\
],
                                  m4_expand([\
\1\
AS_HELP_STRING([--$1dir=DIR],m4_expand([$4 @<:@m4_toupper([$2])/$3@:>@]))\
]))
           TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [\
\(.*$6.*\)\
],
                                  [\
  -$1dir[]TSUKU_CASE_PATTERN_CHUNK([$1dir],[$5],[ | --],[])@:}@
    ac_prev=$1dir ;;
  -$1dir=*TSUKU_CASE_PATTERN_CHUNK([$1dir],[$5],[ | --],[=*])@:}@
    $1dir=$ac_optarg ;;\
\
\1\
])
           TSUKU_DEFINITION_SUBST([_AC_INIT_PARSE_ARGS],
                                  [for ac_var in\([^#]*.\b$2\)\b],
                                  [for ac_var in\1 $1dir])])

# Add our new directories
TSUKU_ADD_INSTDIR_OPTION([font],[datarootdir],[fonts],[fonts],
  [f],[obsolete gas option])
TSUKU_ADD_INSTDIR_OPTION([otf],[fontdir],[OTF],[OpenType fonts],
  [ot],[ --prefix ])

# Reduce the ridiculous verbosity of Autoconf's help message
TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                       [ to adapt to many kinds of systems],[])
TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                       [of some of the useful variables],
                       [of some useful variables])
TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                       [Defaults for the options are specified in brackets],
                       [Defaults are specified in brackets])
TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                       [\barch.*-independent \b],
                       [])
TSUKU_DEFINITION_SUBST([_AC_INIT_HELP],
                       [\
.*(\[--exec-prefix=EPREFIX.*\
.*\])\(.\)[^:]*\
Fine tuning of the installation directories:\
],
                       [\1\
])

#
############################################################################
#
# Autoconf initialization
#
AC_PREREQ([2.63])
AC_INIT([Tsukurimashou],
[0.6], [mskala@ansuz.sooke.bc.ca], [tsukurimashou],
[[http://en.sourceforge.jp/projects/tsukurimashou/]])
AC_PRESERVE_HELP_ORDER
AM_INIT_AUTOMAKE([foreign check-news dist-zip no-dist-gzip
  silent-rules subdir-objects])
AC_CONFIG_SRCDIR([hamlog/hamlog])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_REVISION([$Id: configure.ac 1459 2012-06-18 12:44:00Z mskala $])
AC_COPYRIGHT([Copyright (C) 2011, 2012 Matthew Skala])
AC_SUBST([release_date],["June 18, 2012"])
AM_SILENT_RULES
#
############################################################################
#
# Checks for programs.
#
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_GREP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PATH_PROG([AUTOCONF],[autoconf])
AC_PATH_PROG([AUTOMAKE],[automake])
AC_PATH_PROGS([CHECKSUM],[sha256sum sha1sum md5sum cksum wc],[no])
AC_ARG_VAR([EXPECT],[Expect])
AC_PATH_PROG([EXPECT],[expect])
AM_CONDITIONAL([COND_EXPECT],[test '!' "x$EXPECT" = "x"])
AC_ARG_VAR([FONTFORGE],[Fontforge])
AC_PATH_PROG([FONTFORGE],[fontforge])
AC_PATH_TOOL([GDB],[gdb])
AX_CHECK_GNU_MAKE
AC_PATH_PROG([GZIP],[gzip])
AC_ARG_VAR([MPOST],[MetaPost])
AC_PATH_PROG([MPOST],[mpost])
AC_ARG_VAR([PERL],[Perl])
AC_PATH_PROG([PERL],[perl])
AC_PATH_PROGS([PROLOG],[pl swipl eclipse gprolog],[])
AC_ARG_VAR([XDVIPDFMX],[xdvipdfmx])
AC_PATH_PROG([XDVIPDFMX],[xdvipdfmx])
AC_ARG_VAR([XELATEX],[XeLaTeX])
AC_PATH_PROG([XELATEX],[xelatex])
#
############################################################################
#
# Checks for libraries.
#
AC_CHECK_LIB([m], [pow])
#
############################################################################
#
# Checks for header files.
#
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h])
AX_CREATE_STDINT_H
#
############################################################################
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_TYPE_INT64_T
AC_FUNC_OBSTACK
AC_TYPE_UINT16_T
AC_TYPE_UINT64_T
#
############################################################################
#
# Checks for library functions.
#
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([strchr strdup strerror strrchr strstr strtol strtoul])
#
############################################################################
#
# Checks for system services
#
AC_SYS_LONG_FILE_NAMES
AX_AM_JOBSERVER
#
############################################################################
#
# User-settable options
#
# Define user options
#
AC_ARG_ENABLE([build-hacking],
  [AS_HELP_STRING([--disable-build-hacking],
    [turn off Autotools compatibility test])],
    [],
    [enable_build_hacking="test "])
AC_ARG_ENABLE([chars],
  [AS_HELP_STRING([--enable-chars[=TAGS]],
    [character set(s) to build [all]])],
    [],
    [enable_chars=all])
AC_ARG_ENABLE([colour-build],
  [AS_HELP_STRING([--disable-colour-build],
    [turn off ANSI colour in build scripts])],
    [],
    [enable_colour_build=yes])
AC_ARG_ENABLE([color-build],[dnl],[],[enable_color_build=yes])
AC_ARG_ENABLE([docs],
  [AS_HELP_STRING([--disable-docs],
    [turn off PDF documentation])],
    [],
    [enable_docs=yes])
AC_ARG_ENABLE([ff-debug],
  [AS_HELP_STRING([--disable-ff-debug],
    [turn off Fontforge debuggery warning])],
    [],
    [enable_ff_debug="test "])
AC_ARG_ENABLE([kanji-chart],
  [AS_HELP_STRING([--enable-kanji-chart],
    [kanji coverage chart [auto]])],
    [],
    [enable_kanji_chart=auto])
AC_ARG_ENABLE([ot-features],
  [AS_HELP_STRING([--enable-ot-features[=TAGS]],
    [OpenType feature(s) to include [all,-pfed]])],
    [],
    [ot_feature_default_warn=yes
     enable_ot_features='all,-pfed'])
AC_ARG_ENABLE([proofs],
  [AS_HELP_STRING([--enable-proofs=[yes|no|book]],
    [proofs and pretty-printed source [no]])],
    [],
    [enable_proofs=no])
AC_ARG_ENABLE([proportional],
  [AS_HELP_STRING([--disable-proportional],
    [turn off proportionally spaced, kerned fonts])],
    [],
    [enable_proportional=yes])
AC_ARG_ENABLE([styles],
  [AS_HELP_STRING([--enable-styles[=TAGS]],
    [type style(s) to build [tsuku]])],
    [],
    [enable_styles=tsuku])
AC_ARG_WITH([kanjidic2],
  [AS_HELP_STRING([--with-kanjidic2=PATH],
    [gzipped KANJIDIC2 database [auto]])],
    [],
    [with_kanjidic2=auto])
AC_ARG_WITH([prolog],
  [AS_HELP_STRING([--with-prolog=PATH],
    [Prolog interpreter [auto]])],
    [],
    [with_prolog=auto])
#
# Process user options
#
tsu_colour=yes
AS_IF([test "x$enable_colour_build" = "xyes"],
  [],[tsu_colour=no])
AS_IF([test "x$enable_color_build" = "xyes"],
  [],[tsu_colour=no])
AM_CONDITIONAL([COND_COLOUR],[test '!' "$tsu_colour" = no])
#
AC_SUBST([enable_chars])
#
AM_CONDITIONAL([COND_DOCS],[test '!' "$enable_docs" = no])
AC_SUBST([enable_docs])
#
AC_SUBST([enable_ot_features])
#
AS_IF([test "x$prefix" = "xNONE"],[prefix="$ac_default_prefix"])
AS_IF([test "$with_kanjidic2" = "auto"],[
AC_MSG_CHECKING([for KANJIDIC2])
AS_IF([test "x$GZIP" = x],
      [with_kanjidic2=no
       AC_MSG_RESULT([can't, no gzip])],
      [m4_foreach_w([kdcheckpath],m4_expand([$srcdir $srcdir/doc dnl
$prefix/dict $prefix/share dnl
/dict /share /usr/dict /usr/share/dict /usr/local/dict dnl
/usr/local/share/dict $HOME $HOME/dict]),[
       AS_IF([test "$with_kanjidic2" = "auto"],
             [AS_IF([test -r "kdcheckpath/kanjidic2.xml.gz"],
                    [with_kanjidic2="kdcheckpath/kanjidic2.xml.gz"])])])
       AS_IF([test "$with_kanjidic2" = "auto"],[with_kanjidic2=no])
       AC_MSG_RESULT([$with_kanjidic2])
       ])
])
AM_CONDITIONAL([COND_KANJIDIC2], [test '!' "$with_kanjidic2" = no])
AC_SUBST([with_kanjidic2])
#
AS_IF([test "x$enable_kanji_chart" = "xauto"],
  [AS_IF([test "$with_kanjidic2" = "no"],
    [enable_kanji_chart=no],[enable_kanji_chart=yes])])
AM_CONDITIONAL([COND_KANJI_CHART], [test '!' "$enable_kanji_chart" = no])
AC_SUBST([enable_kanji_chart])
#
AS_IF([test "x$enable_silent_rules" = "x"],
  [enable_silent_rules=yes
   AM_DEFAULT_VERBOSITY=0])
#
AC_MSG_CHECKING([Prolog type])
tsu_prolog_style=unknown
case "x$with_prolog" in #(((((
  xno) :
    AC_MSG_RESULT([no])
    AS_ECHO(["Tsukurimashou must have some sort of logic programming environment in order"])
    AS_ECHO(["to build at all; --with-prolog=no is not allowed. Use --with-prolog=hamlog"])
    AS_ECHO(["to use the included Hamlog interpreter, or leave --with-prolog out entirely"])
    AS_ECHO(["(or =auto) for autodetection."])
    AC_MSG_ERROR([cannot proceed]) ;;
  xauto) :
    AS_IF([test "x$PROLOG" = "x"],
      [PROLOG="$PERL ./hamlog"
       tsu_prolog_style=hamlog]) ;;
  xyes) :
    AS_IF([test "x$PROLOG" = "x"],
      [PROLOG="$PERL ./hamlog"
       tsu_prolog_style=hamlog]) ;;
  xhamlog) :
    PROLOG="$PERL ./hamlog"
    tsu_prolog_style=hamlog ;;
  *) :
    PROLOG="$with_prolog" ;;
esac;
AS_IF([test "$tsu_prolog_style" = "unknown" \
  && test '!' "x$with_prolog" = "x$PROLOG"],[
case "$PROLOG" in #(
  *eclipse*) :
    PROLOG="$PERL ./hamlog"
    tsu_prolog_style=hamlog
    eclipse_prolog_warn=yes
  ;;
esac;
])
AS_IF([test "$tsu_prolog_style" = "unknown"],[
  prolog_version_result="`echo halt. | \
    $PROLOG -e 'get_flag(version,X),write(eclipse),write(X),halt.' 2>&1`"
  case "x$prolog_version_result" in #(((
    *SWI-Prolog*) :
      tsu_prolog_style=swi ;;
    *eclipse*) :
      tsu_prolog_style=eclipse ;;
    *GNU\ Prolog*) :
      tsu_prolog_style=gnu ;;
    *Hamlog*) :
      tsu_prolog_style=hamlog ;;
  esac;
])
AC_MSG_RESULT([$tsu_prolog_style])
AM_CONDITIONAL([COND_PROLOG_HAMLOG],[test "$tsu_prolog_style" = hamlog])
AM_CONDITIONAL([COND_PROLOG_SWI],[test "$tsu_prolog_style" = swi])
AM_CONDITIONAL([COND_PROLOG_GNU],[test "$tsu_prolog_style" = gnu])
AM_CONDITIONAL([COND_PROLOG_ECLIPSE],[test "$tsu_prolog_style" = eclipse])
#
AM_CONDITIONAL([COND_PROOFS], [test '!' "$enable_proofs" = no])
AM_CONDITIONAL([COND_BOOKPROOFS], [test "$enable_proofs" = book])
#
AM_CONDITIONAL([COND_PROPORTIONAL], [test '!' "$enable_proportional" = no])
AC_SUBST([enable_proportional])
#
AC_SUBST([enable_styles])
#
############################################################################
#
# Arch packaging
#
AC_MSG_CHECKING([whether we can make a PKGBUILD])
know_distsums=yes
case "x$CHECKSUM" in #((((
  *sha256sum) :
    checksum_type=sha256sum ;;
  *sha1sum) :
    checksum_type=sha1sum ;;
  *md5sum) :
    checksum_type=md5sum ;;
  no) :
    know_distsums=no ;;
  esac;
AS_IF([test '!' "x$know_distsums" = "xno"],
  [AS_IF([test "x$with_kanjidic2" = "xno"],
     [know_distsums=no],
     [distsum_kd=`$CHECKSUM $with_kanjidic2 | sed 's/[ ]\+.*$//'`])
   know_distsums=no
   m4_foreach_w([tsucheckver],m4_expand([dnl
0.1pre 0.1 0.2pre 0.2 0.3pre 0.3 0.4pre 0.4 0.5pre 0.5 dnl
0.6pre 0.6 0.7pre 0.7 0.8pre 0.8 0.9pre 0.9 0.10pre 0.10 dnl
0.11pre 0.11 0.12pre 0.12 0.13pre 0.13 0.14pre 0.14 0.15pre 0.15 dnl
1.1pre 1.1 1.2pre 1.2 1.3pre 1.3 1.4pre 1.4 1.5pre 1.5 dnl
1.6pre 1.6 1.7pre 1.7 1.8pre 1.8 1.9pre 1.9 1.10pre 1.10 dnl
1.11pre 1.11 1.12pre 1.12 1.13pre 1.13 1.14pre 1.14 1.15pre 1.15 dnl
2.1pre 2.1 2.2pre 2.2 2.3pre 2.3 2.4pre 2.4 2.5pre 2.5 dnl
2.6pre 2.6 2.7pre 2.7 2.8pre 2.8 2.9pre 2.9 2.10pre 2.10 dnl
2.11pre 2.11 2.12pre 2.12 2.13pre 2.13 2.14pre 2.14 2.15pre 2.15]),[
   AS_IF([test -s tsukurimashou-tsucheckver.zip],
     [pkgbuild_version=tsucheckver
      distsum_tsuku=`$CHECKSUM tsukurimashou-tsucheckver.zip \
        | sed 's/[ ]\+.*$//'`
      know_distsums="yes, tsucheckver"])
   ])])
AC_SUBST([checksum_type])
AC_SUBST([distsum_tsuku])
AC_SUBST([distsum_kd])
AC_SUBST([pkgbuild_version])
AS_IF([test '!' "x$know_distsums" = "xno"],[AC_CONFIG_FILES([PKGBUILD])])
AC_MSG_RESULT([$know_distsums])
#
############################################################################
#
# Evaluate what we can and can't do
#

can_build=yes

AC_MSG_CHECKING([core prerequisites])
can_core=yes
AS_IF([test "x$FONTFORGE" = "x" || test '!' -r "$FONTFORGE"],
  [missing_fontforge=yes
   can_core=no])
AS_IF([test "x$_cv_gnu_make_command" = "x"],
  [missing_gmake=yes
   can_core=no])
AS_IF([test "x$MPOST" = "x"],
  [missing_mpost=yes
   can_core=no],
  [mpost_version=`$MPOST --version | $PERL -ne 'print $1 if /MetaPost\s+(@<:@0-9.@:>@+)/'`
   AS_VERSION_COMPARE([$mpost_version],[1.501],
     [mpost_version_warn=yes])
   ])
AS_IF([test "x$PERL" = "x"],
  [missing_perl=yes
   can_core=no])
AS_IF([test "$tsu_prolog_style" = "unknown"],
  [missing_prolog=yes
   can_core=no])
AS_IF([test '!' "$ac_cv_sys_long_file_names" = "yes"],[can_core=no])
AS_IF([test "$can_core" = "no"],[can_build=no])
AC_MSG_RESULT([$can_core])

AC_MSG_CHECKING([proportional spacing prerequisites])
can_proportional=yes
AS_IF([test "x$CC" = "x"],
  [missing_cc=yes
   can_proportional=no])
AS_IF([test "$enable_proportional" = "yes" && test "$can_proportional" = "no"],
  [can_build=no])
AC_MSG_RESULT([$can_proportional])

AC_MSG_CHECKING([PDF documentation prerequisites])
can_docs=yes
AS_IF([test "x$XDVIPDFMX" = "x"],
  [missing_xdvipdfmx=yes
   can_docs=no])
AS_IF([test "x$XELATEX" = "x"],
  [missing_xelatex=yes
   can_docs=no],
  [kprcs=`kpsewhich pgfrcs.code.tex`
   pgf_version=`cat $kprcs /dev/null | $PERL -ne 'print $1 if /^@<:@^%@:>@+pgfversion\{(.*)\}/'`
   AS_VERSION_COMPARE([$pgf_version],[2.00],
     [missing_pgf_version=yes
      can_docs=no])
   ])
AS_IF([test '!' "$enable_proportional" = "yes" \
  || test '!' "$can_proportional" = "yes"],
  [missing_proportional=yes
   can_docs=no])
AS_IF([test "$enable_docs" = "yes" && test "$can_docs" = "no"],
  [can_build=no])
AC_MSG_RESULT([$can_docs])

AC_MSG_CHECKING([kanji chart prerequisites])
can_kanji_chart=yes
AS_IF([test "x$XDVIPDFMX" = "x"],
  [missing_xdvipdfmx=yes
   can_kanji_chart=no])
AS_IF([test "x$XELATEX" = "x"],
  [missing_xelatex=yes
   can_kanji_chart=no])
AS_IF([test "$with_kanjidic2" = "no"],
  [missing_kanjidic2=yes
   can_kanji_chart=no])
AS_IF([test '!' "$enable_proportional" = "yes" \
  || test '!' "$can_proportional" = "yes"],
  [missing_proportional=yes
   can_kanji_chart=no])
AS_IF([test "$enable_kanji_chart" = "yes" && test "$can_kanji_chart" = "no"],
  [can_build=no])
AC_MSG_RESULT([$can_kanji_chart])

AC_MSG_CHECKING([proof prerequisites])
can_proofs=yes
AS_IF([test "x$XDVIPDFMX" = "x"],
  [missing_xdvipdfmx=yes
   can_proofs=no])
AS_IF([test "x$XELATEX" = "x"],
  [missing_xelatex=yes
   can_proofs=no],
  [kprcs=`kpsewhich pgfrcs.code.tex`
   pgf_version=`cat $kprcs /dev/null | $PERL -ne 'print $1 if /^@<:@^%@:>@+pgfversion\{(.*)\}/'`
   AS_VERSION_COMPARE([$pgf_version],[2.00],
     [missing_pgf_version=yes
      can_proofs=no])
   ])
AS_IF([test '!' "$enable_proportional" = "yes" \
  || test '!' "$can_proportional" = "yes"],
  [missing_proportional=yes
   can_proofs=no])
AS_IF([test '!' "$enable_proofs" = "no" && test "$can_proofs" = "no"],
  [can_build=no])
AC_MSG_RESULT([$can_proofs])

AC_MSG_CHECKING([whether PGF 2.10 workaround is needed])
need_pgf_workaround=no
AS_VERSION_COMPARE([$pgf_version],[2.10],[],[need_pgf_workaround=yes])
AM_CONDITIONAL([COND_PGFWORKAROUND],[test "x$need_pgf_workaround" = "xyes"])
AC_MSG_RESULT([$need_pgf_workaround])

AC_MSG_CHECKING([safety of silent build rules])
can_silent_rules=yes
AS_IF([test "x$EXPECT" = "x"],
  [missing_expect=yes
   can_silent_rules=no])
AC_MSG_RESULT([$can_silent_rules])

AC_MSG_CHECKING([Fontforge debuggery])
can_ffdebug=yes
AS_IF([test "x$FONTFORGE" = "x" || test '!' -r "$FONTFORGE"],
  [missing_fontforge=yes
   can_ffdebug=no])
AS_IF([test "x$CC" = "x"],
  [missing_cc=yes
   can_ffdebug=no])
AS_IF([test "x$GREP" = "x"],
  [missing_grep=yes
   can_ffdebug=no])
AS_IF([test "x$GDB" = "x"],
  [missing_gdb=yes
   can_ffdebug=no])
AS_IF([test "$can_ffdebug" = "yes"],
  [gdb_result=`echo q | $GDB -q -n -s $FONTFORGE | $GREP 'no debug'`
   AS_IF([test "x$gdb_result" = "x"],[],
     [missing_ff_debugsymbols=yes
      can_ffdebug=no])])
AC_MSG_RESULT([$can_ffdebug])

AC_MSG_CHECKING([build-system hackability])
can_bshack=yes
AS_IF([test "x$AUTOCONF" = "x"],
  [missing_autoconf=yes
   can_bshack=no])
AS_IF([test "x$AUTOMAKE" = "x"],
  [missing_automake=yes
   can_bshack=no])
AS_IF([test "x$PERL" = "x" || test "x$AUTOCONF" = "x"],[],
  [autoconf_version=dnl
`autoconf --version | perl -ne 'print $1 if /^autoconf.*(\d+\.\d+)/'`
   AS_VERSION_COMPARE([$autoconf_version],[2.65],
     [missing_autoconf_version=yes
      can_bshack=no])
   AS_VERSION_COMPARE([$autoconf_version],[2.75],[],[],
     [excessive_autoconf_version=yes
      can_bshack=no])])
AC_MSG_RESULT([$can_bshack])
#
############################################################################
#
# Generate output
#
AC_SUBST([andt],[])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_COMMANDS([fix-makefile],
  [$PERL -i -pe \
's/ZZZZHACKZZZZ\s*=\s*//;$_="" if /\$\(error This Makefile must be /;'\
's#(\$\(AUTOMAKE\) --foreign( Makefile)?)(?! && ./config)#'\
'\1 && \$(SHELL) ./config.status fix-makefile#;'\
's#config\.status \$\@ \$\(am__depfiles_maybe\)#'\
'config.status \$\@ fix-makefile \$(am__depfiles_maybe)#;' \
   Makefile
   rm -f pfb-stamp chl-stamp],
  [PERL=$PERL])
AC_OUTPUT
#
############################################################################
#
# Display a status table
#
AS_ECHO([])
TSU_COLOURISE([Configuration status],[5])AS_ECHO([])
AS_ECHO([])
TSU_COLOURISE([Component Want Can],[7])AS_ECHO([])
TSU_TABLE_LINE([Tsukurimashou core ],[always ],[yes],[$can_core])
TSU_TABLE_LINE([proportional spacing ],[$enable_proportional],
  [$enable_proportional],[$can_proportional])
TSU_TABLE_LINE([PDF documentation ],[$enable_docs],
  [$enable_docs],[$can_docs])
TSU_TABLE_LINE([kanji coverage chart ],[$enable_kanji_chart],
  [$enable_kanji_chart],[$can_kanji_chart])
AS_IF([test "x$enable_proofs" = "xbook"],
  [TSU_TABLE_LINE([proofs ],[book ],[book ],
     [$can_proofs])],
  [TSU_TABLE_LINE([proofs ],[$enable_proofs],
     [$enable_proofs],[$can_proofs])])
AS_IF([test "x$enable_jobserver" = "xno"],
  [TSU_TABLE_LINE([parallel build jobs ],[no],[no],[yes])],
  [wantline=`$PERL -e 'printf "%-8s","'$enable_jobserver/$CPU_COUNT'"'`
   TSU_TABLE_LINE([parallel build jobs ],[$wantline],[yes],
     [yes])])
TSU_TABLE_LINE([silent build rules ],[$enable_silent_rules],
  [$enable_silent_rules],[$can_silent_rules])
TSU_TABLE_LINE([fontforge debugging ],[$enable_ff_debug],
  [no],[$can_ffdebug])
TSU_TABLE_LINE([build-system hacking ],[$enable_build_hacking],
  [no],[$can_bshack])
AS_ECHO([])
AS_ECHO_N(["Character selection "])
TSU_COLOURISE([$enable_chars],[6])AS_ECHO([])
AS_ECHO_N(["Type style selection "])
TSU_COLOURISE([$enable_styles],[6])AS_ECHO([])
AS_ECHO_N(["OpenType features "])
TSU_COLOURISE([$enable_ot_features],[6])AS_ECHO([])

#
# Warn about missing prerequisites
#

AS_IF([test "$can_core" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for the Tsukurimashou core are missing:"])
   AS_IF([test "$missing_fontforge" = "yes"],
     [AS_ECHO([" Fontforge http://fontforge.sourceforge.net/"])])
   AS_IF([test "$missing_gmake" = "yes"],
     [AS_ECHO([" GNU make (others won't work) http://www.gnu.org/software/make/"])])
   AS_IF([test "$missing_mpost" = "yes"],
     [AS_ECHO([" MetaPost http://foundry.supelec.fr/gf/project/metapost/"])])
   AS_IF([test "$missing_perl" = "yes"],
     [AS_ECHO([" Perl http://www.perl.org/"])])
   AS_IF([test "$missing_prolog" = "yes"],
     [AS_ECHO([" logic programming (should be built-in, did you override?)"])])
   AS_IF([test '!' "$ac_cv_sys_long_file_names" = "yes"],
     [AS_ECHO([" long filename support"])])
   AS_ECHO(["Without the above it is not possible to build Tsukurimashou at all."])
   ])

AS_IF([test "x$mpost_version_warn" = "xyes"],
  [AS_ECHO([])
   AS_ECHO(["Warning: your MetaPost is version $mpost_version, and it probably has"])
   AS_ECHO(["a limit of 2^25 \"independent variable instances.\" It may fail when"])
   AS_ECHO(["performing long computations, as in the experimental blackletter fonts."])
   AS_ECHO(["Upgrading to at least version 1.501 will raise the limit to 2^31 (a"])
   AS_ECHO(["factor of 64) and increase the chances of successful compilation, but"])
   AS_ECHO(["unfortunately, as of this writing there is no version of MetaPost that"])
   AS_ECHO(["removes the limit entirely."])])

AS_IF([test "x$eclipse_prolog_warn" = "xyes"],
  [AS_ECHO([])
   AS_ECHO(["Warning: configure detected something that might possibly be the"])
   AS_ECHO(["ECLiPSe-CLP logic programming system, but could not be positively"])
   AS_ECHO(["identified as such. It is more likely the popular multilanguage IDE also"])
   AS_ECHO(["called Eclipse. To avoid accidentally invoking a heavy GUI program"])
   AS_ECHO(["during configuration, configure will not investigate further and will"])
   AS_ECHO(["use the included (but very slow) Hamlog interpreter instead. To"])
   AS_ECHO(["override this decision or disable this message, specify an appropriate"])
   AS_ECHO(["--with-prolog option."])])

AS_IF([test "x$ot_feature_default_warn" = "xyes"],
  [AS_ECHO([])
   AS_ECHO(["No choice of OpenType features was selected, so using all,-pfed by"])
   AS_ECHO(["default. Please consider using --enable-ot-features=all to attach"])
   AS_ECHO(["detailed information about your installation to the generated fonts;"])
   AS_ECHO(["that is recommended, but not default because some people might consider"])
   AS_ECHO(["it a privacy threat. See the documentation for more information, and"])
   AS_ECHO(["see txt/fontlog.txt after building to read the information that would"])
   AS_ECHO(["have been attached. This message will go away with any use of the"])
   AS_ECHO(["--enable-ot-features option, such as --enable-ot-features=all,-pfed"])
   AS_ECHO(["to affirmatively choose the default value."])])

AS_IF([test '!' "x$enable_proportional" = "xno" \
  && test "$can_proportional" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for proportional spacing and kerning are missing:"])
   AS_IF([test "$missing_cc" = "yes"],
     [AS_ECHO([" Any C compiler"])])
   AS_ECHO(["Without the above it is not possible to build proportionally spaced fonts."])
   AS_ECHO(["Use the --disable-proportional option, or install all prerequisites."])
   ])

AS_IF([test '!' "x$enable_docs" = "xno" && test "$can_docs" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for building PDF documentation are missing:"])
   AS_IF([test "$missing_xdvipdfmx" = "yes"],
     [AS_ECHO([" xdvipdfmx http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_xelatex" = "yes"],
     [AS_ECHO([" XeLaTeX http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_pgf_version" = "yes"],
     [AS_ECHO([" PGF/TikZ (>=2.00) http://pgf.sf.net/"])])
   AS_IF([test "$missing_proportional" = "yes"],
     [AS_ECHO([" proportional spacing and kerning must be enabled and buildable"])])
   AS_ECHO(["Without the above it is not possible to build this component. Use"])
   AS_ECHO(["the --disable-docs option, or install all prerequisites."])
   ])

AS_IF([test '!' "x$enable_kanji_chart" = "xno" && test "$can_kanji_chart" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for building the kanji chart are missing:"])
   AS_IF([test "$missing_xdvipdfmx" = "yes"],
     [AS_ECHO([" xdvipdfmx http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_xelatex" = "yes"],
     [AS_ECHO([" XeLaTeX http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_kanjidic2" = "yes"],
     [AS_ECHO([" KANJIDIC2 http://www.csse.monash.edu.au/~jwb/kanjidic2/"])])
   AS_IF([test "$missing_proportional" = "yes"],
     [AS_ECHO([" proportional spacing and kerning must be enabled and buildable"])])
   AS_ECHO(["Without the above it is not possible to build this component. Use"])
   AS_ECHO(["the --disable-kanji-chart option, or install all prerequisites."])
   ])

AS_IF([test '!' "x$enable_proofs" = "xno" && test "$can_proofs" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for building proofs and pretty-printed source"])
   AS_ECHO(["code are missing:"])
   AS_IF([test "$missing_xdvipdfmx" = "yes"],
     [AS_ECHO([" xdvipdfmx http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_xelatex" = "yes"],
     [AS_ECHO([" XeLaTeX http://scripts.sil.org/xetex"])])
   AS_IF([test "$missing_pgf_version" = "yes"],
     [AS_ECHO([" PGF/TikZ (>=2.00) http://pgf.sf.net/"])])
   AS_IF([test "$missing_proportional" = "yes"],
     [AS_ECHO([" proportional spacing and kerning must be enabled and buildable"])])
   AS_ECHO(["Without the above it is not possible to build this component. Use"])
   AS_ECHO(["the --disable-proofs option, or install all prerequisites."])
   ])

AS_IF([test '!' "x$enable_silent_rules" = "xno" \
  && test "$can_silent_rules" = "no"],
  [AS_ECHO([])
   AS_ECHO(["Silent build rules are enabled (which is the default and recommended)"])
   AS_ECHO(["but Expect was not found. This situation is dangerous because if mkfont1"])
   AS_ECHO(["fails during the build, it may sit waiting for input without producing"])
   AS_ECHO(["a message. Install Expect from http://sourceforge.net/projects/expect/ ,"])
   AS_ECHO(["let configure know where it is through the EXPECT environment variable if"])
   AS_ECHO(["it is not in your PATH, use --disable-silent-rules, or accept the risk of"])
   AS_ECHO(["this type of failure."])
   ])

AS_IF([test '!' "x$enable_ff_debug" = "xno" && test "$can_ffdebug" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for debugging Fontforge are missing:"])
   AS_IF([test "$missing_fontforge" = "yes"],
     [AS_ECHO([" Fontforge itself!"])])
   AS_IF([test "$missing_cc" = "yes"],
     [AS_ECHO([" a C compiler of some description"])])
   AS_IF([test "$missing_grep" = "yes"],
     [AS_ECHO([" grep (needed for the symbol test)"])])
   AS_IF([test "$missing_gdb" = "yes"],
     [AS_ECHO([" gdb http://www.gnu.org/software/gdb/"])])
   AS_IF([test "$missing_ff_debugsymbols" = "yes"],
     [AS_ECHO([" Fontforge was compiled without debug symbols"])])
   AS_ECHO(["When Fontforge inevitably breaks, you'll be sorry. Use --disable-ff-debug"])
   AS_ECHO(["to turn off this message without solving the problem."])
   ])

AS_IF([test '!' "x$enable_build_hacking" = "xno" && test "$can_bshack" = "no"],
  [AS_ECHO([])
   AS_ECHO(["One or more prerequisites for hacking the build system are missing:"])
   AS_IF([test "$missing_autoconf" = "yes"],
     [AS_ECHO([" GNU Autoconf http://www.gnu.org/software/autoconf/"])])
   AS_IF([test "$missing_autoconf_version" = "yes"],
     [AS_ECHO([" Your Autoconf is older than 2.65; it may or may not work."])])
   AS_IF([test "$excessive_autoconf_version" = "yes"],
     [AS_ECHO([" Your Autoconf is more than 10 minor versions newer than version 2.65,"])
      AS_ECHO([" whose internals this code was designed to subvert; beware."])])
   AS_IF([test "$missing_automake" = "yes"],
     [AS_ECHO([" GNU Automake http://www.gnu.org/software/automake/"])])
   AS_ECHO(["Unless you intend to hack the build system, and know what that means,"])
   AS_ECHO(["this condition is harmless. Use --disable-build-hacking to turn off"])
   AS_ECHO(["this message."])
   ])

#
# Prognosticate
#

AS_ECHO([])
AS_ECHO_N(["With the current configuration, the build is expected to "])
AS_IF([test "$can_build" = "yes"],
  [TSU_COLOURISE([SUCCEED],[2])],
  [TSU_COLOURISE([FAIL],[1])])
AS_ECHO(["."])
Something went wrong with that request. Please try again.