File: configure.in

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (803 lines) | stat: -rw-r--r-- 20,064 bytes parent folder | download
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
dnl $Id: configure.in,v 1.143 2002/02/24 11:04:22 goba Exp $

dnl autoconf initialisation
AC_INIT()
SRCDIR=$srcdir
AC_SUBST(SRCDIR)

dnl debug output
echo "file versions"
for file in $srcdir/*.in; do
  fgrep '$Id' $file | head -1 | sed -e"s/^.*: //g" | sed -e"s/200.\/.*$//g"
done
echo "configure options: $@" 
echo

dnl {{{ check for support programs

dnl {{{   check for PHP

dnl use given argument, if any, else search in path 
AC_ARG_WITH(php,
[  --with-php=PATH         Look for PHP executable needed for helper scripts],
[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for php])
    if test -x $withval; then
      PHP=$withval
      AC_MSG_RESULT($PHP)
    else
      PHP=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: not an executable file])
    fi
  else
    AC_PATH_PROGS(PHP,"php php4",no)
  fi
],[
  AC_PATH_PROGS(PHP,"php php4",no)
]
)
if test $PHP = "no"; then
  AC_MSG_WARN([no PHP binary found])
else
  AC_MSG_CHECKING([php version])
  PHPVERSION=`$PHP -qv`
  if test "yes" = `echo '<?php echo phpversion()>3?"yes":"no"; ?>' | $PHP -q`; then
    AC_MSG_RESULT($PHPVERSION ok)
  else
    AC_MSG_RESULT($PHPVERSION)
    AC_MSG_WARN([PHP version 4.0.0 or newer needed])
    PHP=no
  fi
fi
AC_SUBST(PHP)

dnl }}}

dnl {{{   check for the OpenJade DSSSL parser

dnl use given argument, if any, else search in path 

AC_ARG_WITH(jade,
[  --with-jade=PATH        Look for jade or openjade executable],[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for jade])
    if test -x $withval; then
      JADE=$withval
      AC_MSG_RESULT($JADE)
    else
      JADE=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: not an executable file])
    fi
  else
    if test -e ../phpdoc-tools/jade/jade.exe ; then
      AC_MSG_CHECKING([for jade])
      JADE=../phpdoc-tools/jade/jade.exe
      AC_MSG_RESULT($JADE)
    else
      AC_PATH_PROG(OPENJADE,"openjade",no)
      if test $OPENJADE = "no"; then
        AC_PATH_PROG(JADE,"jade",no)
      else
        JADE=$OPENJADE
      fi
    fi
  fi
],[
  if test -e ../phpdoc-tools/jade/jade.exe ; then
    AC_MSG_CHECKING([for jade])
    JADE=../phpdoc-tools/jade/jade.exe
    AC_MSG_RESULT($JADE)
  else
    AC_PATH_PROG(OPENJADE,"openjade",no)
    if test $OPENJADE = "no"; then
      AC_PATH_PROG(JADE,"jade",no)
    else
      JADE=$OPENJADE
    fi
   fi
]
)
AC_SUBST(JADE)

dnl }}}

dnl {{{   check for nsgmls

AC_ARG_WITH(nsgmls,
[  --with-nsgmls=PATH      Look for nsgmls executable],[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for nsgmls])
    if test -x $withval; then
      NSGMLS=$withval
      AC_MSG_RESULT($NSGMLS)
    else
      NSGMLS=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: not an executable file])
    fi
  else
    if test -e ../phpdoc-tools/jade/nsgmls.exe ; then
      AC_MSG_CHECKING([for nsgmls])
      NSGMLS=../phpdoc-tools/jade/nsgmls.exe
      AC_MSG_RESULT($NSGMLS)
    else
      AC_PATH_PROG(NSGMLS,"nsgmls",no)
    fi
  fi
],[
  if test -e ../phpdoc-tools/jade/nsgmls.exe ; then
    AC_MSG_CHECKING([for nsgmls])
    NSGMLS=../phpdoc-tools/jade/nsgmls.exe
    AC_MSG_RESULT($NSGMLS)
  else
    AC_PATH_PROG(NSGMLS,"nsgmls",no)
  fi
]
)
AC_SUBST(NSGMLS)

dnl }}}

dnl {{{   check for Java
dnl use given argument, if any, else search in path 

AC_ARG_WITH(java,
[  --with-java=PATH        Look for JAVA executable],
[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for java])
    if test -x $withval -a -f $withval
    then
      JAVA=$withval
      AC_MSG_RESULT($JAVA)
    elif test -x $withval/bin/java
    then
      JAVA=$withval/bin/java
      AC_MSG_RESULT($JAVA)
    elif test -x $withval/bin/jre
    then
      JAVA=$withval/bin/java
      AC_MSG_RESULT($JAVA)
    else
      JAVA=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: no java binary found])
    fi
  else
    AC_PATH_PROGS(JAVA,"java jre",no)
  fi
],[
  AC_PATH_PROGS(JAVA,"java jre",no)
]
)
if test $JAVA = "no"; then
  AC_MSG_WARN([no JAVA binary found])
fi
AC_SUBST(JAVA)

dnl }}}

dnl }}}

dnl {{{ check for DocBook stuff

dnl {{{   check for docbook DTD

dnl AC_MSG_CHECKING(for DocBook doctype)
dnl check_catalog_files() {
dnl    for catalog in $@; do
dnl     DBDT=`grep -E '^PUBLIC.*"docbook.dtd".*$' $catalog 2>/dev/null | cut -d'"' -f 2 `
dnl     if test -n "$DBDT" ; then
dnl         DOCBOOK_DOCTYPE=$DBDT
dnl         return 1
dnl     fi  
dnl     MORECATS=`grep -i '^catalog' $catalog 2>/dev/null | cut -d'"' -f 2`
dnl     if test -n "$MORECATS" ; then
dnl        if check_catalog_files $MORECATS ; then
dnl          return 1
dnl        else 
dnl          return 0
dnl        fi
dnl     fi
dnl     return 0
dnl    done
dnl    return 0
dnl }
dnl if test -n "$SGML_CATALOG_FILES" ; then
dnl    CATFILES=`echo $SGML_CATALOG_FILES | sed -e 's/:/ /'g`
dnl    check_catalog_files $CATFILES
dnl fi
dnl if test -n "$DOCBOOK_DOCTYPE"; then
dnl    AC_MSG_RESULT(got $DOCBOOK_DOCTYPE)
dnl else 
dnl    DOCBOOK_DOCTYPE="-//Davenport//DTD DocBook V3.0//EN"
dnl    AC_MSG_RESULT(defaulting to $DOCBOOK_DOCTYPE)
dnl fi 


if grep -q methodsynopsis $srcdir/en/functions/array.xml; then
	DOCBOOK_DOCTYPE="-//OASIS//DTD DocBook XML V4.1.2//EN"
	DOCBOOK_VERSION="4.1.2"
else
	DOCBOOK_DOCTYPE="-//Norman Walsh//DTD DocBk XML V3.1.7//EN"
	DOCBOOK_VERSION="3.1.7"
fi
AC_SUBST(DOCBOOK_DOCTYPE)
AC_SUBST(DOCBOOK_VERSION)

dnl }}}

dnl {{{   check for DSSSL stylesheets

AC_MSG_CHECKING(for docbook.dsl)

AC_ARG_WITH(dsssl,
[  --with-dsssl=[DIR]      Look for DSSSL stylesheets in the specified directory],
[
  if test -f "$withval/html/docbook.dsl" ; then
    DOCBOOK_HTML=$withval/html/docbook.dsl
    DOCBOOK_PRINT=$withval/print/docbook.dsl
    AC_MSG_RESULT(in $withval)
  fi
],[
  for dir1 in $srcdir/phpdoc-tools/dsssl \
              $srcdir/../phpdoc-tools/dsssl \
              /usr/share/sgml \
              /usr/local/share/sgml \
              /usr/lib/sgml \
              /usr/lib/dsssl \
              /usr/local/lib/sgml \
              /usr/local/lib/dsssl \
              /opt/sgml/lib 
  do
    for dir2 in docbook \
                docbook/dsssl-stylesheets \
                docbook/dsssl/modular \
                docbook/stylesheet/dsssl/modular \
                docbk30/dsl \
                docbkdsl \
                stylesheets/docbook \
                stylesheets/nwalsh-modular 
    do
      if test -f "$dir1/$dir2/html/docbook.dsl"; then
        DOCBOOK_HTML="$dir1/$dir2/html/docbook.dsl"
        DOCBOOK_PRINT="$dir1/$dir2/print/docbook.dsl"
        AC_MSG_RESULT(autodetected: $dir1/$dir2)
        break
      fi
    done
    if test ! -z "$DOCBOOK_HTML"; then break; fi
  done
])
if test -z "$DOCBOOK_HTML"; then
    AC_MSG_RESULT(not found)
fi

AC_SUBST(DOCBOOK_HTML)
AC_SUBST(DOCBOOK_PRINT)

dnl }}}

dnl {{{   check for XSLT stylesheets

AC_MSG_CHECKING(for docbook.xsl)

AC_ARG_WITH(xsl,
[  --with-xsl=[DIR]        Look for XSL stylesheets in the specified DIR],
[
  if test -f "$withval/html/docbook.xsl"; then
    DOCBOOKXSL_BIGHTML=$withval/html/docbook.xsl
    DOCBOOKXSL_HTML=$withval/html/chunk.xsl
    DOCBOOKXSL_PRINT=$withval/fo/docbook.xsl
    AC_MSG_RESULT(in $withval)
  fi
],[
   for dir in \
        $srcdir/phpdoc-tools/xsl \
        $srcdir/phpdoc-tools/xsl/docbook \
        $srcdir/../phpdoc-tools/xsl \
        $srcdir/../phpdoc-tools/xsl/docbook \
        /usr/share/sgml/docbkxsl 
    do
        if test -f "$dir/html/docbook.xsl"; then
            DOCBOOKXSL_BIGHTML=$dir/html/docbook.xsl
            DOCBOOKXSL_HTML=$dir/html/chunk.xsl
            DOCBOOKXSL_PRINT=$dir/fo/docbook.xsl
            AC_MSG_RESULT(autodetected: $dir)            
            break
        fi
		done
])
if test -z "$DOCBOOKXSL_BIGHTML"; then
    AC_MSG_RESULT(not found)
fi
AC_SUBST(DOCBOOKXSL_BIGHTML)
AC_SUBST(DOCBOOKXSL_HTML)
AC_SUBST(DOCBOOKXSL_PRINT)

dnl }}}

dnl {{{   manual XSLT stylesheets option [temp] 

AC_MSG_CHECKING(for manually specified docbook.xsl)

AC_ARG_WITH(mxsl,
[  --with-mxsl=[DIR]        Look for XSL stylesheets in the manually specified DIR],
[
  DOCBOOKXSL_BIGHTML=$withval/html/docbook.xsl
  DOCBOOKXSL_HTML=$withval/html/chunk.xsl
  DOCBOOKXSL_PRINT=$withval/fo/docbook.xsl
  AC_MSG_RESULT(in $withval)
])
if test -z "$DOCBOOKXSL_BIGHTML"; then
    AC_MSG_RESULT(not found)
fi
AC_SUBST(DOCBOOKXSL_BIGHTML)
AC_SUBST(DOCBOOKXSL_HTML)
AC_SUBST(DOCBOOKXSL_PRINT)

dnl }}}

if test -z "$DOCBOOK_HTML" -a -z "$DOCBOOKXSL_HTML"; then
  AC_MSG_ERROR(WARNING!!! NO STYLESHEETS FOUND - WON'T WORK THIS WAY)
fi

dnl {{{   check for catalog files

dnl Do something smart to find catalog-files
CATALOG=""

dnl SuSE 6.2/6.3 need this
if test -e /usr/share/sgml/CATALOG.docbk30
then
  CATALOG="$CATALOG -c /usr/share/sgml/CATALOG.docbk30"
fi

dnl For windows (and maybe *nix too?) users lacking catalog-files

dnl jade catalog file
# how about using JADEPATH? You should replace the last 4 chars ('jade') with catalog
if test -e ../phpdoc-tools/jade/catalog
then
  CATALOG="$CATALOG -c ../phpdoc-tools/jade/catalog"
fi

dnl iso-ents catalog file
if test -e ../phpdoc-tools/iso-entities/catalog
then
  CATALOG="$CATALOG -c ../phpdoc-tools/iso-entities/catalog"
fi

dnl dsssl catalog file
if test -e ../phpdoc-tools/dsssl/docbook/catalog
then
  CATALOG="$CATALOG -c ../phpdoc-tools/dsssl/docbook/catalog"
fi

AC_SUBST(CATALOG)

dnl }}}

dnl }}}

dnl {{{ check for additional docs and sources

dnl {{{ check for PHP sourcecode

AC_MSG_CHECKING(for PHP source path)
AC_ARG_WITH(source,
[  --with-source=[DIR]     Look at the specified source directory],
[
  if test -d "$withval" ; then
    PHP_SOURCE=$withval
  else
    PHP_SOURCE=$srcdir/../php4
  fi
],[
  PHP_SOURCE=$srcdir/../php4
])
if test ! -d $PHP_SOURCE; then
	PHP_SOURCE=no
fi
AC_MSG_RESULT($PHP_SOURCE)
AC_SUBST(PHP_SOURCE)

dnl }}}

dnl {{{ check for ZendEngine API documentation to include

AC_MSG_CHECKING(for ZendAPI)

AC_ARG_WITH(zendapi,
[  --with-zendapi=[DIR]    Look for ZendAPI documentation in the specified directory],
[
  if test -f "$withval/Extending_Zend.xml" ; then
    ZENDAPI=$withval
  fi
],[
  ZENDAPI="not found"
  for dir in \
    $srcdir/en/ZendAPI \
    $srcdir/ZendAPI \
    $srcdir/../ZendAPI
  do
    if test -f "$dir/Extending_Zend.xml"; then
      ZENDAPI="$dir"
      break
    fi
  done
  if test -d "$ZENDAPI"; then
    ZEND_FIGURES="cp -r $ZENDAPI/figures ."
  else
    ZEND_FIGURES=""
  fi
])

AC_MSG_RESULT($ZENDAPI)
AC_SUBST(ZEND_FIGURES)

dnl }}}

dnl {{{ enable Windows HTML Help only pages in build

AC_MSG_CHECKING(for chmonly inclusion)

AC_ARG_WITH(chm,
[  --with-chm=yes          Enable Windows HTML Help Edition pages],
[
  if test "$withval" = "yes"; then
    CHMENABLED=yes
    AC_MSG_RESULT([enabled])
  else
    CHMENABLED=no
    AC_MSG_RESULT([disabled])
  fi
],[
  CHMENABLED=no
  AC_MSG_RESULT([disabled (default)])
])

dnl }}}

dnl }}}

dnl {{{ language specific stuff

AC_MSG_CHECKING(for language)

PHP_BUILD_DATE=`date '+%Y-%m-%d'`
AC_ARG_WITH(lang,
[  --with-lang=LANG        Choose a language to work with],[
  if test "$withval" = "yes"; then
    LANG=en
    AC_MSG_RESULT([en (default)])
  else
    if test ! -d "$srcdir/$withval"; then
      AC_MSG_RESULT()
      AC_MSG_ERROR(Language \"$withval\" not supported!)
    fi
       
    PHP_BUILD_DATE=`date '+%d-%m-%Y'`

    case $withval in
      kr)
        LANG="ko"
        LANGDIR="kr"
      ;;
      hk)
        LANG="zh_hk"
        LANGDIR="hk"
      ;;
      tw)
        LANG="zh_tw"
        LANGDIR="tw"
      ;;
      *)
        LANG=$withval
        LANGDIR=$withval
    esac
    AC_MSG_RESULT( $withval )
  fi
],[
  LANG=en
  LANGDIR=en
  AC_MSG_RESULT([en (default)])
])
AC_SUBST(LANG)
AC_SUBST(LANGDIR)
AC_SUBST(PHP_BUILD_DATE)

MANUAL="php_manual_$LANG"
AC_SUBST(MANUAL)

dnl localize paper size by language
dnl (instead of using system-dependant default)
case "$LANG" in
  ar|cs|de|hu|it|ja|ko|pl|ro|tr|zh_hk)
    PAPER_TYPE="A4"
    PDF_PAPER_TYPE="a4"
    ;;
  *)
    PAPER_TYPE="USletter"
    PDF_PAPER_TYPE="letter"
    ;;
esac
AC_SUBST(PAPER_TYPE)
AC_SUBST(PDF_PAPER_TYPE)


dnl localize order of number and element name
dnl in some headers autogenerated by jade
case "$LANG" in
  hu|ko) NUMBER_FIRST="#t" ;;
  *) NUMBER_FIRST="#f" ;;
esac
AC_SUBST(NUMBER_FIRST)


dnl optionaly reduce margins to save some trees life
AC_MSG_CHECKING(for treesaving)
AC_ARG_WITH(treesaving,
[  --with-treesaving       Save trees by setting pagesize and margins],
[
  TREESAVING="#t";
  LEFT_MARGIN="(define %left-margin% 4pi)";   
  RIGHT_MARGIN="(define %right-margin% 3pi)";
  TOP_MARGIN="(define %top-margin% 3pi)";
  HEADER_MARGIN="(define %header-margin% 2pi)";
  FOOTER_MARGIN="(define %footer-margin% 2pi)";
  BOTTOM_MARGIN="(define %bottom-margin% 3pi)";
  LINE_SPACING="(define %line-spacing-factor% 1.2)";
  HEAD_BEFORE="(define %head-before-factor% 0.6)";
  HEAD_AFTER="(define %head-after-factor% 0.3)";
  BODY_START="(define %body-start-indent% 3pi)";
  BLOCK_SEP="(define %block-sep% (* %para-sep% 1.2))";
],[ 
  TREESAVING="#f";
  LEFT_MARGIN="";   
  RIGHT_MARGIN="";
  TOP_MARGIN="";
  HEADER_MARGIN="";
  FOOTER_MARGIN=""; 
  BOTTOM_MARGIN=""; 
  LINE_SPACING="";
  HEAD_BEFORE="";
  HEAD_AFTER="";
  BODY_START="";
  BLOCK_SEP="";
])
AC_SUBST(LEFT_MARGIN)
AC_SUBST(RIGHT_MARGIN)
AC_SUBST(TOP_MARGIN)
AC_SUBST(HEADER_MARGIN)
AC_SUBST(FOOTER_MARGIN)
AC_SUBST(BOTTOM_MARGIN)
AC_SUBST(LINE_SPACING)
AC_SUBST(HEAD_BEFORE)
AC_SUBST(HEAD_AFTER)
AC_SUBST(BODY_START)
AC_SUBST(BLOCK_SEP)
AC_SUBST(TREESAVING)
echo "saving trees: $TREESAVING";

case "$LANG" in
  ja|tw|ko) ENCODING="UTF-8";;
  zh_hk) ENCODING="big5";;
  cs|hu|pl|ro) ENCODING="ISO-8859-2";;
  ar) ENCODING="ISO-8859-6";;
  tr) ENCODING="ISO-8859-9";;
  he) ENCODING="iso-8859-8";;
  *) ENCODING="ISO-8859-1";;
esac
AC_SUBST(ENCODING)

dnl localize the PalmPilot DOC title
case "$LANG" in
  de) PALMDOCTITLE="'PHP Handbuch'";;
  es) PALMDOCTITLE="'Manual de PHP'";;
  fr) PALMDOCTITLE="'Manuel PHP'";;
  hu) PALMDOCTITLE="'PHP Kziknyv'";;
  it) PALMDOCTITLE="'Manuale PHP'";;
  nl) PALMDOCTITLE="'PHP Handleiding'";;
  pl) PALMDOCTITLE="'Podrcznik PHP'";;
  pt_BR) PALMDOCTITLE="'Manual do PHP'";;
  ro) PALMDOCTITLE="'Manual PHP'";;
# tr) PALMDOCTITLE="";;
  zh_hk) PALMDOCTITLE="PHP U";;
  *) PALMDOCTITLE="'PHP Manual'";;
esac
AC_SUBST(PALMDOCTITLE)

HTMLHELP_ENCODING=$ENCODING

case "$ENCODING" in
  UTF-8)
    SP_OPTIONS="SP_ENCODING=XML SP_CHARSET_FIXED=YES"
    ;;
  big5)
    SP_OPTIONS="SP_ENCODING=big5 SP_CHARSET_FIXED=YES"
    ;;
  ISO-8859-2)
    SP_OPTIONS="SP_ENCODING=ISO-8859-2"
    HTMLHELP_ENCODING="windows-1250"
    ;;
  ISO-8859-6)
    SP_OPTIONS="SP_ENCODING=ISO-8859-6"
    HTMLHELP_ENCODING="windows-1256"
    ;;
  ISO-8859-8)
    SP_OPTIONS="SP_ENCODING=ISO-8859-8"
    HTMLHELP_ENCODING="windows-1255"
    ;;
  ISO-8859-9)
    SP_OPTIONS="SP_ENCODING=ISO-8859-9"
    HTMLHELP_ENCODING="windows-1254"
    ;;
  *)
    SP_OPTIONS=""
    ;;
esac

AC_SUBST(SP_OPTIONS)

AC_SUBST(HTMLHELP_ENCODING)

dnl }}}

dnl {{{ check for some common sources of trouble

dnl sanity checks for SuSE 6.x
if test -e /usr/share/sgml/docbk30/docbook.dcl 
then
  if grep -n "NAMELEN.\+44" /usr/share/sgml/docbk30/docbook.dcl /dev/null
  then
    AC_MSG_WARN(please change this to e.g. 'NAMELEN 54' in /usr/share/sgml/docbk30/docbook.dcl )
  fi
  if grep -n "OMITTAG.\+NO" /usr/share/sgml/docbk30/docbook.dcl /dev/null
  then
    AC_MSG_WARN(please change this to 'OMITTAG YES' in /usr/share/sgml/docbk30/docbook.dcl )
  fi

dnl look for tex bug in print stylesheet
  if test -e /usr/share/sgml/docbkdsl/print/dbprint.dsl
  then 
    if test 2 -eq  `grep -c tex  /usr/share/sgml/docbkdsl/print/dbprint.dsl`
    then
      if fgrep -q 'country: (dsssl-country-code)' /usr/share/sgml/docbkdsl/print/dbprint.dsl
      then  
        if ! grep -q ';;.*country:' /usr/share/sgml/docbkdsl/print/dbprint.dsl
        then
          AC_MSG_WARN(to prevent a tex bug you should comment out )
          AC_MSG_WARN('country: (dsssl-country-code)' )
          AC_MSG_WARN(in /usr/share/sgml/docbkdsl/print/dbprint.dsl )
          AC_MSG_WARN(or update your DSSSL-Stylesheets)
          AC_MSG_WARN(to at least version 1.54)
        fi
      fi
    fi
  fi
fi

dnl }}}

dnl {{{ makefile targets for configure-generated files

rm -f autogenerated_rules
(
for file in `find . -name "*.in"`; do
  case "$file" in
    ./configure.in)
      echo  configure: configure.in
      printf '\t autoconf'
      echo
      ;;
    ./manual.xml.in)
      ;;
    *)
      echo `dirname $file`/`basename $file .in`: '$(srcdir)'/$file ./config.status
      printf '\t CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status'
      echo
  esac
done
) > autogenerated_rules
AUTOGENERATED_RULES=autogenerated_rules
AC_SUBST_FILE(AUTOGENERATED_RULES)
rm -f autogenerated_rules

dnl }}}

dnl {{{ generate output files 

dnl {{{ find all *.in files and process them with AC_OUTPUT
for infile in `find $srcdir -name "*.in"` 
do 
	if test `basename $infile` != "configure.in"
	then
		outfile=`basename $infile .in`
		outdir=`dirname $infile`
		outdir=`echo $outdir/ | sed -e"s|$srcdir/||"`
		OUTFILES="$OUTFILES ./$outdir$outfile"
	fi
done
AC_OUTPUT($OUTFILES)
find . -name "*.sh" | xargs chmod u+x 
dnl }}}

dnl {{{ generate entity mapping file for translation support

dnl check for files and translations, create chapter entities
echo creating entities/chapters.ent
rm -f entities/chapters.ent
DEPEND_FILES=""
echo "<!-- DON'T TOUCH - AUTOGENERATED BY ./configure -->" > entities/chapters.ent
if test -d "$ZENDAPI"; then
  echo  >> entities/chapters.ent
  echo "<!-- begin ZendAPI integration -->" >> entities/chapters.ent
  echo "<!ENTITY % zend.defs SYSTEM \"$ZENDAPI/Extending_Zend.ent\">" >> entities/chapters.ent
  echo "<!ENTITY zendapi.toc SYSTEM \"$ZENDAPI/Extending_Zend.xml\">" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo "%zend.defs;"  >> entities/chapters.ent
  echo "<!-- end ZendAPI integration -->" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " Zend part included"
else
  echo "<!-- ZendAPI not found -->" >> entities/chapters.ent
  echo "<!ENTITY zendapi.toc \"\">" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " Zend part not found"
fi
if test "$CHMENABLED" = "yes"; then
  echo "<!-- chmonly pages inclusion enabled -->" >> entities/chapters.ent
  echo "<!ENTITY chmonly SYSTEM 'chmonly.xml'>" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " CHM inclusion enabled"
else
  echo "<!-- chmonly pages inclusion disabled -->" >> entities/chapters.ent
  echo "<!ENTITY chmonly ''>" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " CHM inclusion disabled"
fi
if test -f "$srcdir/$LANGDIR/chapters/install.xml"; then
  echo "<!-- old install.xml found in language dir -->" >> entities/chapters.ent
  echo "<!ENTITY chapters.install SYSTEM '$srcdir/$LANGDIR/chapters/install.xml'>" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " Using install.xml in language dir"
else
  echo "<!-- old install.xml not found in language dir -->" >> entities/chapters.ent
  echo "<!ENTITY chapters.install SYSTEM 'installpart.xml'>" >> entities/chapters.ent
  echo  >> entities/chapters.ent
  echo " Using the install part from installpart.xml"
fi
for file in `find $srcdir/en -name "*.xml" | sed -e"s%^$srcdir\/en\/%%g" | sort`
do 
  name=`echo $file | sed -e"s/\//./g" -e"s/.xml$//g" -e "s/_/-/g"`
  if test -f $srcdir/$LANGDIR/$file  
  then
    file=$srcdir/$LANGDIR/$file 
  else
    file=$srcdir/en/$file
    echo " Untranslated $file (`wc -l <$file | tr -d ' '` lines)"
  fi
  DEPEND_FILES="$DEPEND_FILES $file"
  echo "<!ENTITY $name     SYSTEM \"$file\">" >> entities/chapters.ent
done
echo "<!ENTITY global.function-index  SYSTEM \"./funcindex.xml\">" >> entities/chapters.ent

chmod a-w entities/chapters.ent

dnl }}}

dnl {{{ check for missing IDs and ENTITYs in translation

echo creating entities/missing-entities.ent and entities/missing-ids.xml
rm -f entities/missing*
chmod u+x scripts/missing-entities.sh
scripts/missing-entities.sh

dnl }}}

dnl }}}