File: configure.in

package info (click to toggle)
php-doc 20081024-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 57,752 kB
  • ctags: 3,858
  • sloc: xml: 686,554; php: 19,446; perl: 610; cpp: 500; makefile: 336; sh: 114; awk: 28
file content (955 lines) | stat: -rw-r--r-- 21,782 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
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
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
dnl $Id: configure.in,v 1.251 2008/06/15 00:31:29 philip Exp $

dnl autoconf initialisation
AC_INIT()
SRCDIR=$srcdir
WORKDIR=`pwd`
AC_SUBST(SRCDIR)
AC_SUBST(WORKDIR)

dnl :: The autoconf and make tools are deprecated.
dnl :: All you need now is a recent version of PHP.
echo "Do not use configure or make to build or validate the PHP Manual sources.";
AC_MSG_ERROR([Instead, use "php configure.php -h"])

dnl debug output
echo "file versions"
for file in $srcdir/*.in; do
  fgrep '$Id' $file | head -n1 | sed -e"s/^.*: //g" | sed -e"s/200.\/.*$//g"
done
echo "configure options: $@" 
echo "source directory: $srcdir"
echo "working directory: $WORKDIR"
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
    if test -e ../phpdoc-tools/php.bat ; then
      AC_MSG_CHECKING([for php])
      PHP=../phpdoc-tools/php.bat
      AC_MSG_RESULT($PHP)
    else
      if test -e "$PHP_PEAR_BIN_DIR/cli/php" ; then
        AC_MSG_CHECKING([for php])
        PHP=`echo $PHP_PEAR_BIN_DIR/cli/php | tr '\\\\' '/'`
        AC_MSG_RESULT($PHP)
      else 
        AC_PATH_PROGS(PHP,[php php4],no)
      fi
    fi
  fi
],[
  if test -e ../phpdoc-tools/php.bat ; then
    AC_MSG_CHECKING([for php])
    PHP=../phpdoc-tools/php.bat
    AC_MSG_RESULT($PHP)
  else
    if test -e "$PHP_PEAR_BIN_DIR/cli/php" ; then
      AC_MSG_CHECKING([for php])
      PHP=`echo $PHP_PEAR_BIN_DIR/cli/php | tr '\\\\' '/'`
      AC_MSG_RESULT($PHP)
    else 
      AC_PATH_PROGS(PHP,[php php4],no)
    fi
  fi
]
)
if test "$PHP" == "no"; then
  AC_MSG_ERROR([no PHP binary found])
else
  AC_MSG_CHECKING([php version])
  PHPVERSION=`"$PHP" -q -f $srcdir/scripts/version.php`

  if test "yes" = `echo '<?php echo phpversion()>3?"yes":"no"; ?>' | "$PHP" -q`; then
    AC_MSG_RESULT($PHPVERSION)
  else
    AC_MSG_RESULT($PHPVERSION)
    AC_MSG_ERROR([PHP version 4.0.0 or newer needed])
    PHP=no
  fi
fi
AC_SUBST(PHP)

dnl }}}

dnl {{{
AC_ARG_WITH(phd,
[  --with-phd=PATH     Path to phd? (Default: "phd")],
[
  AC_MSG_CHECKING([for phd executable])
  if test $withval != "yes"; then
    if ! test -x $withval; then
      AC_MSG_ERROR($withval is not executable);
    else
	  PHD=$withval
    fi
  else
	  PHD=phd
  fi
  AC_MSG_RESULT($PHD)
],[
   PHD=phd
])
AC_SUBST(PHD)

dnl }}}

dnl {{{
AC_ARG_WITH(cygwin,
[  --with-cygwin=no     Running cygwin? (Default: no)],
[
  AC_MSG_RESULT([$withval])
  if test $withval != "yes"; then
    CYGWIN=0
  else
    CYGWIN=1
  fi
],[
   CYGWIN=0
])
AC_SUBST(CYGWIN)

dnl }}}

dnl {{{
AC_MSG_CHECKING(for php.ini path)
AC_ARG_WITH(inipath,
[  --with-inipath=PATH     specify path to php.ini file (default: ./scripts)],
[
    AC_MSG_RESULT([$withval])
    INIPATH="$withval"
],[
    AC_MSG_RESULT([./scripts])
        INIPATH="./scripts"
])

AC_SUBST(INIPATH)

dnl }}}

dnl {{{   check for the Jade or 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
      if test -e ../phpdoc-tools/openjade/openjade.exe ; then
        AC_MSG_CHECKING([for jade])
        JADE=../phpdoc-tools/openjade/openjade.exe
        AC_MSG_RESULT($JADE)
      else
        AC_PATH_PROGS(JADE,[openjade jade],no)
      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
    if test -e ../phpdoc-tools/openjade/openjade.exe ; then
      AC_MSG_CHECKING([for jade])
      JADE=../phpdoc-tools/openjade/openjade.exe
      AC_MSG_RESULT($JADE)
    else
      AC_PATH_PROGS(JADE,[openjade jade],no)
    fi
  fi
]
)
if test $JADE = "no"; then
  AC_MSG_WARN([can't find jade or openjade, DSSSL build wont work])
fi
if test `expr $JADE : ../phpdoc-tools` -ne 0; then
  WINJADE=1
else
  WINJADE=0
fi
AC_SUBST(JADE)
AC_SUBST(WINJADE)

dnl }}}

dnl {{{   check for nsgmls or onsgmls

AC_ARG_WITH(nsgmls,
[  --with-nsgmls=PATH      look for nsgmls or onsgmls 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
      if test -e ../phpdoc-tools/openjade/onsgmls.exe ; then
        AC_MSG_CHECKING([for nsgmls])
        NSGMLS=../phpdoc-tools/openjade/onsgmls.exe
        AC_MSG_RESULT($NSGMLS)
      else
        AC_PATH_PROGS(NSGMLS,[onsgmls nsgmls],no)
      fi
    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
    if test -e ../phpdoc-tools/openjade/onsgmls.exe ; then
      AC_MSG_CHECKING([for nsgmls])
      NSGMLS=../phpdoc-tools/openjade/onsgmls.exe
      AC_MSG_RESULT($NSGMLS)
    else
      AC_PATH_PROGS(NSGMLS,[onsgmls nsgmls],no)
    fi
  fi
]
)
if test $NSGMLS = "no"; then
  AC_MSG_WARN([can't find nsgmls or onsgmls, make test wont work])
fi
AC_SUBST(NSGMLS)

dnl }}}

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

AC_ARG_WITH(xsltproc,
[  --with-xsltproc=PATH    look for xsltproc],
[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for xsltproc])
    if test -x $withval -a -f $withval
    then
      XSLTPROC=$withval
      AC_MSG_RESULT($XSLTPROC)
    else
      XSLTPROC=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: not an executable file])
    fi
  else
    if test -e ../phpdoc-tools/libxml/xsltproc.exe ; then
      AC_MSG_CHECKING([for xsltproc])
      XSLTPROC=../phpdoc-tools/libxml/xsltproc.exe
      AC_MSG_RESULT($XSLTPROC)
    else
      AC_PATH_PROG(XSLTPROC,"xsltproc",no)
    fi
  fi
],[
  if test -e ../phpdoc-tools/libxml/xsltproc.exe ; then
    AC_MSG_CHECKING([for xsltproc])
    XSLTPROC=../phpdoc-tools/libxml/xsltproc.exe
    AC_MSG_RESULT($XSLTPROC)
  else
    AC_PATH_PROG(XSLTPROC,"xsltproc",no)
  fi
]
)
if test $XSLTPROC = "no"; then
  AC_MSG_ERROR([no xsltproc binary found, you need to install libxslt (libxslt 1.1.18 or better preferred)])
fi
AC_SUBST(XSLTPROC)

dnl }}}

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

AC_ARG_WITH(xmllint,
[  --with-xmllint=PATH     check for xmllint],
[
  if test $withval != "yes"; then
    AC_MSG_CHECKING([for xmllint])
    if test -x $withval -a -f $withval
    then
      XMLLINT=$withval
      AC_MSG_RESULT($XMLLINT)
    else
      XMLLINT=no
      AC_MSG_RESULT(no)
      AC_MSG_ERROR([$withval: no xmllint binary found])
    fi
  else
    if test -e ../phpdoc-tools/libxml/xmllint.exe ; then
      AC_MSG_CHECKING([for xmllint])
      XSLTPROC=../phpdoc-tools/libxml/xmllint.exe
      AC_MSG_RESULT($XMLLINT)
    else
      AC_PATH_PROG(XMLLINT,"xmllint",no)
    fi
  fi
],[
  if test -e ../phpdoc-tools/libxml/xmllint.exe ; then
    AC_MSG_CHECKING([for xmllint])
    XMLLINT=../phpdoc-tools/libxml/xmllint.exe
    AC_MSG_RESULT($XMLLINT)
  else
    AC_PATH_PROG(XMLLINT,"xmllint",no)
  fi
]
)
if test $XMLLINT = "no"; then
  AC_MSG_ERROR([no xmllint binary found. You'll need to install libxml2])
fi
AC_SUBST(XMLLINT)

dnl }}}

dnl }}}

dnl {{{ check for DocBook stuff

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
],[
   DOCBOOK_HTML="$srcdir/docbook/docbook-dsssl/html/docbook.dsl"
  DOCBOOK_PRINT="$srcdir/docbook/docbook-dsssl/print/docbook.dsl"
  AC_MSG_RESULT([$srcdir/docbook/docbook-dsssl (default)])
])
if test -z "$DOCBOOK_HTML"; then
    AC_MSG_RESULT(not found)
fi

AC_SUBST(DOCBOOK_HTML)
AC_SUBST(DOCBOOK_PRINT)

dnl }}}

dnl {{{   check for catalog files

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


dnl iso-ents catalog file
dnl The 4.1.2 DocBook DTD also includes entity files, but they cannot be used with Jade!
if test -e $srcdir/entities/ISO/catalog
then
  CATALOG="$CATALOG -c $srcdir/entities/ISO/catalog"
fi

dnl DSSSL catalog file
if test -e $srcdir/docbook/docbook-dsssl/catalog
then
  CATALOG="$CATALOG -c $srcdir/docbook/docbook-dsssl/catalog"
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
# !! JADEPATH may not properly be set on windows, so do not use it !!
if test -e ../phpdoc-tools/jade/catalog
then
  CATALOG="$CATALOG -c ../phpdoc-tools/jade/catalog"
fi
dnl SuSE openjade setup
if test -e /usr/share/sgml/CATALOG.docbk41
then
  CATALOG="$CATALOG -c /usr/share/sgml/CATALOG.docbk41"
fi
if test -e /usr/share/sgml/CATALOG.jade_dsl
then
  CATALOG="$CATALOG -c /usr/share/sgml/CATALOG.jade_dsl"
fi

dnl As a very last option, include default catalog files from phpdoc
dnl (imported from the openjade distribution)
if test -e $srcdir/phpbook/phpbook-dsssl/defaults/catalog
then
  CATALOG="$CATALOG -c $srcdir/phpbook/phpbook-dsssl/defaults/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
    for PHP_SOURCE in \
	$srcdir/../php-src \
	$srcdir/../php5 \
	$srcdir/../php4
    do
	if test -d $PHP_SOURCE; then
            break
	fi
    done
  fi
],[
  for PHP_SOURCE in \
      $srcdir/../php-src \
      $srcdir/../php5 \
      $srcdir/../php4
  do
      if test -d $PHP_SOURCE; then
          break
      fi
  done
])
if test ! -d $PHP_SOURCE; then
    PHP_SOURCE=no
fi
AC_MSG_RESULT($PHP_SOURCE)
AC_SUBST(PHP_SOURCE)

dnl }}}

dnl {{{ check for PEAR sources

AC_MSG_CHECKING(for PEAR source path)
AC_ARG_WITH(pear-source,
[  --with-pear-source=[DIR]  look at the specified PEAR directory],
[
  if test "$withval" = "yes"; then
    PEAR_SOURCE=$srcdir/../pear
    if test ! -d $PEAR_SOURCE; then
      PEAR_SOURCE=no
    fi  
  else
    PEAR_SOURCE=$withval
    if test ! -d $PEAR_SOURCE; then
      AC_MSG_ERROR(['$withval' is not a valid directory']) 
    fi
  fi
],[
  PEAR_SOURCE=no
])
AC_MSG_RESULT($PEAR_SOURCE)
AC_SUBST(PEAR_SOURCE)

dnl }}}

dnl {{{ check for PECL sources

AC_MSG_CHECKING(for PECL source path)
AC_ARG_WITH(pecl-source,
[  --with-pecl-source=[DIR]  look at the specified PECL directory],
[
  if test "$withval" = "yes"; then
    PECL_SOURCE=$srcdir/../pecl
    if test ! -d $PECL_SOURCE; then
      PECL_SOURCE=no
    fi  
  else
    PECL_SOURCE=$withval
    if test ! -d $PECL_SOURCE; then
      AC_MSG_ERROR(['$withval' is not a valid directory']) 
    fi
  fi
],[
  PECL_SOURCE=no
])
AC_MSG_RESULT($PECL_SOURCE)
AC_SUBST(PECL_SOURCE)

dnl }}}

dnl {{{ check for additional extension sources

AC_MSG_CHECKING(for additional PHP extensions)
AC_ARG_WITH(extension,
[  --with-extension=[DIR]    look at the specified extension directory],
[
  AC_MSG_RESULT($withval)
  list=`echo "$withval" | sed -e"s/,/ /g"`
  EXT_SOURCE="";
  for dir in $list; do
    if test -d "$dir/manual"; then
    AC_MSG_RESULT([  extension '$dir' ok])
      EXT_SOURCE="$EXT_SOURCE:$dir"
    else
      AC_MSG_WARN([  extension '$dir' ignored])
    fi
  done
])
if test "$EXT_SOURCE" = ""; then
  AC_MSG_RESULT([no])
fi
dnl }}}
AC_SUBST(EXT_SOURCE)

dnl {{{
AC_MSG_CHECKING(for CSS to use for html docs)
AC_ARG_WITH(htmlcss,
[  --with-htmlcss=URL      specify a CSS file to include in html docs],
[
    AC_MSG_RESULT([$withval])
    HTMLCSS="(define %stylesheet% \"$withval\")"
],[
    HTMLCSS=""
    AC_MSG_RESULT([none])
])

AC_SUBST(HTMLCSS)

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
    CHMONLY_INCL_BEGIN=""
    CHMONLY_INCL_END=""
    AC_MSG_RESULT([enabled])
  else
    CHMENABLED=no
    CHMONLY_INCL_BEGIN="<!--"
    CHMONLY_INCL_END="-->"
    AC_MSG_RESULT([disabled])
  fi
],[
  CHMENABLED=no
  CHMONLY_INCL_BEGIN="<!--"
  CHMONLY_INCL_END="-->"
  AC_MSG_RESULT([disabled (default)])
])

AC_SUBST(CHMONLY_INCL_BEGIN)
AC_SUBST(CHMONLY_INCL_END)

dnl }}}


dnl {{{ disable Internals documentation

AC_MSG_CHECKING(for internals docs exclusion)

AC_ARG_WITH(internals,
[  --without-internals     exclude internals documentation],
[
  INTERNALS_EXCL_BEGIN="<!--"
  INTERNALS_EXCL_END="-->"
  AC_MSG_RESULT([yes])
],[
  INTERNALS_EXCL_BEGIN=""
  INTERNALS_EXCL_END=""
  AC_MSG_RESULT([no (default)])
])

AC_SUBST(INTERNALS_EXCL_BEGIN)
AC_SUBST(INTERNALS_EXCL_END)

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"
    LANGWEB="en"
    MANUAL="php_manual_$LANG"
    AC_MSG_RESULT([en (default)])
  else
    if test ! -d "$srcdir/$withval"; then
      AC_MSG_RESULT()
      AC_MSG_ERROR(Language \"$withval\" not supported!)
    fi
       
    LANG_HACK_FOR_HE="no"
    HACK_RTL_LANGS_PAGES=""
    HACK_RTL_LANGS_PHPWEB=""
    case $withval in
      kr)
        LANG="ko"
        LANGWEB="ko"
        LANGDIR="kr"
      ;;
      ja)
        LANG="ja"
        LANGWEB="ja"
        LANGDIR="ja"
        PHP_BUILD_DATE=`date '+%Y/%m/%d'`
      ;;
      he)
        LANG="he"
        LANGWEB="he"
        LANG_HACK_FOR_HE="yes"
        HACK_RTL_LANGS_PAGES="$PHP $srcdir/scripts/rtlpatch/rtlpatch.php ./html"
        HACK_RTL_LANGS_PHPWEB="$PHP $srcdir/scripts/rtlpatch/rtlpatch.php ./php"
        LANGDIR="he"
      ;;
      hk)
        LANG="zh_hk"
        LANGWEB="zh_hk"
        LANGDIR="hk"
      ;;
      tw)
        LANG="zh_tw"
        LANGWEB="zh_tw"
        LANGDIR="tw"
      ;;
      zh)
        LANG="zh_cn"
        LANGWEB="zh_cn"
        LANGDIR="zh"
      ;;
      *)
        LANG=$withval
        LANGWEB=$withval
        LANGDIR=$withval
    esac
    AC_SUBST(HACK_RTL_LANGS_PAGES)
    AC_SUBST(HACK_RTL_LANGS_PHPWEB)
    MANUAL="php_manual_$withval"
    AC_MSG_RESULT( $withval )
  fi
],[
  LANG="en"
  LANGWEB="en"
  LANGDIR="en"
  MANUAL="php_manual_$LANG"
  AC_MSG_RESULT([en (default)])
])
AC_SUBST(LANG)
AC_SUBST(LANGWEB)
AC_SUBST(LANGDIR)
AC_SUBST(PHP_BUILD_DATE)
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|sk|tr|zh_hk|zh_tw|zh_cn)
    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
dnl this works is dsssl only for now
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
  zh_tw|zh_hk) ENCODING="big5";;
  zh_cn) ENCODING="gb2312";;
  cs|hu|ro|sk) ENCODING="ISO-8859-2";;
  ar) ENCODING="ISO-8859-6";;
  tr) ENCODING="ISO-8859-9";;
  he) ENCODING="ISO-8859-8";;
  el) ENCODING="ISO-8859-7";;
  *) ENCODING="UTF-8";;
esac
if test "$LANG_HACK_FOR_HE" = "yes"; then
  ENCODING="ISO-8859-8"
fi

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="'PHP Kilavuzu'";;
  zh_hk) PALMDOCTITLE="PHP U";;
  *) PALMDOCTITLE="'PHP Manual'";;
esac
AC_SUBST(PALMDOCTITLE)

HTMLHELP_ENCODING=$ENCODING
SP_OPTIONS="SP_ENCODING=XML SP_CHARSET_FIXED=YES"

case "$ENCODING" in
  ISO-8859-2)
    HTMLHELP_ENCODING="windows-1250"
    ;;
  ISO-8859-6)
    HTMLHELP_ENCODING="windows-1256"
    ;;
  ISO-8859-8)
    HTMLHELP_ENCODING="windows-1255"
    ;;
  ISO-8859-9)
    HTMLHELP_ENCODING="windows-1254"
    ;;
esac

ENCODING="UTF-8"
AC_SUBST(ENCODING)
AC_SUBST(SP_OPTIONS)

AC_SUBST(HTMLHELP_ENCODING)

dnl }}}

dnl {{{ additional options

AC_MSG_CHECKING(for verbose XSL builds)
AC_ARG_ENABLE(verbose-xsl,
[  --enable-verbose-xsl    make XSL targets output more progress information],
[
  XSL_PARAM_QUIET=0
  AC_MSG_RESULT([yes])
],[
  XSL_PARAM_QUIET=1
  AC_MSG_RESULT([no (default)])
])

AC_SUBST(XSL_PARAM_QUIET)

dnl {{{
AC_MSG_CHECKING([for preferred buildstyle (for partial build)])
AC_ARG_WITH(buildstyle,
[  --with-buildstyle=name  Which build style to use for partial builds (html|phpweb)],
[
  case $withval in
    html)
      PARTIAL_STYLESHEET="html.xsl";
      PARTIAL_STYLE="html";
      PARTIAL_PHD_THEME="chunkedhtml";
    ;;
    phpweb)
      PARTIAL_STYLESHEET="phpweb.xsl";
      PARTIAL_STYLE="php";
      PARTIAL_PHD_THEME="phpweb";
    ;;
    *)
      AC_MSG_RESULT([$withval])
      AC_MSG_ERROR([Only phpweb and html are recognized])
  esac

  AC_MSG_RESULT([$withval])
],[
  PARTIAL_STYLESHEET="html.xsl";
  PARTIAL_STYLE="html";
  PARTIAL_PHD_THEME="chunkedhtml";
  AC_MSG_RESULT([html (default)])
])

AC_SUBST(PARTIAL_STYLESHEET)
AC_SUBST(PARTIAL_STYLE)
AC_SUBST(PARTIAL_PHD_THEME)

dnl }}}

dnl }}}

dnl {{{ makefile targets for configure-generated files

rm -f autogenerated_rules


echo -n "checking for *.in files... "
if test -e infiles.cache ; then
    echo -n "(cached) "
    infiles=`cat infiles.cache | sed -e 's/\r\n/\n/g'`
else
    infiles=`find . -name "*.in"`
    `echo -n "$infiles" > infiles.cache`
fi

echo "done!"

(
for file in $infiles; 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 $infiles
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 ./scripts -name "*.sh" | tee find.log | xargs chmod u+x 
dnl }}}

dnl {{{ create default empty phpweb.ent file

rm -f ./entities/phpweb.ent
touch ./entities/phpweb.ent

dnl }}}

dnl {{{ generate entity mapping file, missing entities and IDs

dnl if we have PHP use it for all of these things
if test "$PHP" != "no"
then

 dnl create entity mapping file supporting Zend, CHM and other specialities
 "$PHP" -c $INIPATH -q ./scripts/file-entities.php
 
 dnl create missing-entities.ent and missing-ids.xml
 rm -f entities/missing*
 rm -f entities/missing-ids.xml
 "$PHP" -c $INIPATH -q ./scripts/missing-entities.php
 
else

  echo ERROR: configure process cannot continue, PHP is not found

fi

dnl }}}

dnl }}}