Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / contrib / idn / idnkit-1.0-src / patch / bind9 / bind-9.2.2-patch
blob602adc6955a1db97a601541d591f2e2e8c410c33
1 IDN patch for bind-9.2.2
2 ========================
5 This is a patch file for ISC BIND 9.2.2 to make it work with
6 internationalized domain names.  With this patch you'll get IDN-aware
7 dig/host/nslookup.
9 To apply this patch, you should go to the top directory of the BIND
10 distribution (where you see `README' file), then invoke `patch'
11 command like this:
13         % patch -p0 < this-file
15 Then follow the instructions described in `README.idnkit' to compile
16 and install.
19 Index: README.idnkit
20 diff -c /dev/null mdn/othersrc/bind9/README.idnkit:1.3
21 *** README.idnkit       Tue Mar 11 08:55:20 2003
22 --- README.idnkit       Mon Mar 10 09:47:41 2003
23 ***************
24 *** 0 ****
25 --- 1,113 ----
26
27 +                       BIND-9 IDN patch
28
29 +              Japan Network Information Center (JPNIC)
30
31
32 + * What is this patch for?
33
34 + This patch adds internationalized domain name (IDN) support to BIND-9.
35 + You'll get internationalized version of dig/host/nslookup commands.
36
37 +     + internationalized dig/host/nslookup
38 +       dig/host/nslookup accepts non-ASCII domain names in the local
39 +       codeset (such as Shift JIS, Big5 or ISO8859-1) determined by
40 +       the locale information.  The domain names are normalized and
41 +       converted to the encoding on the DNS protocol, and sent to DNS
42 +       servers.  The replies are converted back to the local codeset
43 +       and displayed.
44
45
46 + * Compilation & installation
47
48 + 0. Prerequisite
49
50 + You have to build and install idnkit before building this patched version
51 + of bind-9.
52
53 + 1. Running configure script
54
55 + Run `configure' in the top directory.  See `README' for the
56 + configuration options.
57
58 + This patch adds the following 4 options to `configure'.  You should
59 + at least specify `--with-idn' option to enable IDN support.
60
61 +     --with-idn[=IDN_PREFIX]
62 +       To enable IDN support, you have to specify `--with-idn' option.
63 +       The argument IDN_PREFIX is the install prefix of idnkit.  If
64 +       IDN_PREFIX is omitted, PREFIX (derived from `--prefix=PREFIX')
65 +       is assumed.
66
67 +     --with-libiconv[=LIBICONV_PREFIX]
68 +       Specify this option if idnkit you have installed links GNU
69 +       libiconv.  The argument LIBICONV_PREFIX is install prefix of
70 +       GNU libiconv.  If the argument is omitted, PREFIX (derived
71 +       from `--prefix=PREFIX') is assumed.
72
73 +       `--with-libiconv' is shorthand option for GNU libiconv.
74
75 +           --with-libiconv=/usr/local
76
77 +       This is equivalent to:
78
79 +           --with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
80
81 +       `--with-libiconv' assumes that your C compiler has `-R'
82 +       option, and that the option adds the specified run-time path
83 +       to an exacutable binary.  If `-R' option of your compiler has
84 +       different meaning, or your compiler lacks the option, you
85 +       should use `--with-iconv' option instead.  Binary command
86 +       without run-time path information might be unexecutable.
87 +       In that case, you would see an error message like:
88
89 +           error in loading shared libraries: libiconv.so.2: cannot
90 +           open shared object file
91
92 +       If both `--with-libiconv' and `--with-iconv' options are
93 +       specified, `--with-iconv' is prior to `--with-libiconv'.
94
95 +     --with-iconv=ICONV_LIBSPEC
96 +       If your libc doens't provide iconv(), you need to specify the
97 +       library containing iconv() with this option.  `ICONV_LIBSPEC'
98 +       is the argument(s) to `cc' or `ld' to link the library, for
99 +       example, `--with-iconv="-L/usr/local/lib -liconv"'.
100 +       You don't need to specify the header file directory for "iconv.h"
101 +       to the compiler, as it isn't included directly by bind-9 with
102 +       this patch.
104 +     --with-idnlib=IDN_LIBSPEC
105 +       With this option, you can explicitly specify the argument(s)
106 +       to `cc' or `ld' to link the idnkit's library, `libidnkit'.  If
107 +       this option is not specified, `-L${PREFIX}/lib -lidnkit' is
108 +       assumed, where ${PREFIX} is the installation prefix specified
109 +       with `--with-idn' option above.  You may need to use this
110 +       option to specify extra argments, for example,
111 +       `--with-idnlib="-L/usr/local/lib -R/usr/local/lib -lidnkit"'.
113 + Please consult `README' for other configuration options.
115 + Note that if you want to specify some extra header file directories,
116 + you should use the environment variable STD_CINCLUDES instead of
117 + CFLAGS, as described in README.
119 + 2. Compilation and installation
121 + After running "configure", just do
123 +       make
124 +       make install
126 + for compiling and installing.
129 + * Contact information
131 + Please see http//www.nic.ad.jp/en/idn/ for the latest news
132 + about idnkit and this patch.
134 + Bug reports and comments on this kit should be sent to
135 + mdnkit-bugs@nic.ad.jp and idn-cmt@nic.ad.jp, respectively.
138 + ; Id: bind-9.2.2-patch,v 1.1 2003/06/04 00:27:32 marka Exp 
139 Index: config.h.in
140 diff -c mdn/othersrc/bind9/config.h.in:1.1.1.6 mdn/othersrc/bind9/config.h.in:1.12
141 *** config.h.in Tue Nov 27 16:55:45 2001
142 --- config.h.in Tue Mar 19 16:45:35 2002
143 ***************
144 *** 141,146 ****
145 --- 141,149 ----
146   /* define if you have strerror in the C library. */
147   #undef HAVE_STRERROR
148   
149 + /* Define if you have the setlocale function.  */
150 + #undef HAVE_SETLOCALE
152   /* Define if you have the <dlfcn.h> header file.  */
153   #undef HAVE_DLFCN_H
154   
155 ***************
156 *** 150,155 ****
157 --- 153,161 ----
158   /* Define if you have the <linux/capability.h> header file.  */
159   #undef HAVE_LINUX_CAPABILITY_H
160   
161 + /* Define if you have the <locale.h> header file.  */
162 + #undef HAVE_LOCALE_H
164   /* Define if you have the <sys/prctl.h> header file.  */
165   #undef HAVE_SYS_PRCTL_H
166   
167 ***************
168 *** 176,178 ****
169 --- 182,188 ----
170   
171   /* Define if you have the socket library (-lsocket).  */
172   #undef HAVE_LIBSOCKET
174 + /* define if idnkit support is to be included. */
175 + #undef WITH_IDN
177 Index: configure
178 diff -c mdn/othersrc/bind9/configure:1.1.1.10 mdn/othersrc/bind9/configure:1.16
179 *** configure   Wed Mar  5 17:14:55 2003
180 --- configure   Thu Mar  6 20:10:05 2003
181 ***************
182 *** 1007,1012 ****
183 --- 1007,1016 ----
184       --with-gnu-ld           assume the C compiler uses GNU ld default=no
185       --with-pic              try to use only PIC/non-PIC objects default=use both
186     --with-kame=PATH    use Kame IPv6 default path /usr/local/v6
187 +   --with-idn=MPREFIX   enable IDN support using idnkit default PREFIX
188 +   --with-libiconv=IPREFIX   GNU libiconv are in IPREFIX default PREFIX
189 +   --with-iconv=LIBSPEC   specify iconv library default -liconv
190 +   --with-idnlib=ARG    specify libidnkit
191   
192   Some influential environment variables:
193     CC          C compiler command
194 ***************
195 *** 7371,7377 ****
196   case $host in
197   *-*-irix6*)
198     # Find out which ABI we are using.
199 !   echo '#line 7374 "configure"' > conftest.$ac_ext
200     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
201     (eval $ac_compile) 2>&5
202     ac_status=$?
203 --- 7375,7381 ----
204   case $host in
205   *-*-irix6*)
206     # Find out which ABI we are using.
207 !   echo '#line 7378 "configure"' > conftest.$ac_ext
208     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
209     (eval $ac_compile) 2>&5
210     ac_status=$?
211 ***************
212 *** 7914,7920 ****
213   save_CFLAGS="$CFLAGS"
214   CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
215   compiler_c_o=no
216 ! if { (eval echo configure:7917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
217     # The compiler can only warn and ignore the option if not recognized
218     # So say no if there are warnings
219     if test -s out/conftest.err; then
220 --- 7918,7924 ----
221   save_CFLAGS="$CFLAGS"
222   CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
223   compiler_c_o=no
224 ! if { (eval echo configure:7921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
225     # The compiler can only warn and ignore the option if not recognized
226     # So say no if there are warnings
227     if test -s out/conftest.err; then
228 ***************
229 *** 9599,9605 ****
230       lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
231     lt_status=$lt_dlunknown
232     cat > conftest.$ac_ext <<EOF
233 ! #line 9602 "configure"
234   #include "confdefs.h"
235   
236   #if HAVE_DLFCN_H
237 --- 9603,9609 ----
238       lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
239     lt_status=$lt_dlunknown
240     cat > conftest.$ac_ext <<EOF
241 ! #line 9606 "configure"
242   #include "confdefs.h"
243   
244   #if HAVE_DLFCN_H
245 ***************
246 *** 9697,9703 ****
247       lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
248     lt_status=$lt_dlunknown
249     cat > conftest.$ac_ext <<EOF
250 ! #line 9700 "configure"
251   #include "confdefs.h"
252   
253   #if HAVE_DLFCN_H
254 --- 9701,9707 ----
255       lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
256     lt_status=$lt_dlunknown
257     cat > conftest.$ac_ext <<EOF
258 ! #line 9704 "configure"
259   #include "confdefs.h"
260   
261   #if HAVE_DLFCN_H
262 ***************
263 *** 13265,13270 ****
264 --- 13269,13580 ----
265   
266   
267   #
268 + # IDN support
269 + #
271 + # Check whether --with-idn or --without-idn was given.
272 + if test "${with_idn+set}" = set; then
273 +   withval="$with_idn"
274 +   use_idn="$withval"
275 + else
276 +   use_idn="no"
277 + fi;
278 + case "$use_idn" in
279 + yes)
280 +       if test X$prefix = XNONE ; then
281 +               idn_path=/usr/local
282 +       else
283 +               idn_path=$prefix
284 +       fi
285 +       ;;
286 + no)
287 +       ;;
288 + *)
289 +       idn_path="$use_idn"
290 +       ;;
291 + esac
293 + iconvinc=
294 + iconvlib=
296 + # Check whether --with-libiconv or --without-libiconv was given.
297 + if test "${with_libiconv+set}" = set; then
298 +   withval="$with_libiconv"
299 +   use_libiconv="$withval"
300 + else
301 +   use_libiconv="no"
302 + fi;
303 + case "$use_libiconv" in
304 + yes)
305 +       if test X$prefix = XNONE ; then
306 +               iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
307 +       else
308 +               iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
309 +       fi
310 +       ;;
311 + no)
312 +       iconvlib=
313 +       ;;
314 + *)
315 +       iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
316 +       ;;
317 + esac
320 + # Check whether --with-iconv or --without-iconv was given.
321 + if test "${with_iconv+set}" = set; then
322 +   withval="$with_iconv"
323 +   iconvlib="$withval"
324 + fi;
325 + case "$iconvlib" in
326 + no)
327 +       iconvlib=
328 +       ;;
329 + yes)
330 +       iconvlib=-liconv
331 +       ;;
332 + esac
335 + # Check whether --with-idnlib or --without-idnlib was given.
336 + if test "${with_idnlib+set}" = set; then
337 +   withval="$with_idnlib"
338 +   idnlib="$withval"
339 + else
340 +   idnlib="no"
341 + fi;
342 + if test "$idnlib" = yes; then
343 +       { { echo "$as_me:$LINENO: error: You must specify ARG for --with-idnlib." >&5
344 + echo "$as_me: error: You must specify ARG for --with-idnlib." >&2;}
345 +    { (exit 1); exit 1; }; }
346 + fi
348 + IDNLIBS=
349 + if test "$use_idn" != no; then
351 + cat >>confdefs.h <<\_ACEOF
352 + #define WITH_IDN 1
353 + _ACEOF
355 +       STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
356 +       if test "$idnlib" != no; then
357 +               IDNLIBS="$idnlib $iconvlib"
358 +       else
359 +               IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
360 +       fi
361 + fi
365 + for ac_header in locale.h
366 + do
367 + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
368 + if eval "test \"\${$as_ac_Header+set}\" = set"; then
369 +   echo "$as_me:$LINENO: checking for $ac_header" >&5
370 + echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
371 + if eval "test \"\${$as_ac_Header+set}\" = set"; then
372 +   echo $ECHO_N "(cached) $ECHO_C" >&6
373 + fi
374 + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
375 + echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
376 + else
377 +   # Is the header compilable?
378 + echo "$as_me:$LINENO: checking $ac_header usability" >&5
379 + echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
380 + cat >conftest.$ac_ext <<_ACEOF
381 + #line $LINENO "configure"
382 + #include "confdefs.h"
383 + $ac_includes_default
384 + #include <$ac_header>
385 + _ACEOF
386 + rm -f conftest.$ac_objext
387 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
388 +   (eval $ac_compile) 2>&5
389 +   ac_status=$?
390 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
391 +   (exit $ac_status); } &&
392 +          { ac_try='test -s conftest.$ac_objext'
393 +   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
394 +   (eval $ac_try) 2>&5
395 +   ac_status=$?
396 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
397 +   (exit $ac_status); }; }; then
398 +   ac_header_compiler=yes
399 + else
400 +   echo "$as_me: failed program was:" >&5
401 + cat conftest.$ac_ext >&5
402 + ac_header_compiler=no
403 + fi
404 + rm -f conftest.$ac_objext conftest.$ac_ext
405 + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
406 + echo "${ECHO_T}$ac_header_compiler" >&6
408 + # Is the header present?
409 + echo "$as_me:$LINENO: checking $ac_header presence" >&5
410 + echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
411 + cat >conftest.$ac_ext <<_ACEOF
412 + #line $LINENO "configure"
413 + #include "confdefs.h"
414 + #include <$ac_header>
415 + _ACEOF
416 + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
417 +   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
418 +   ac_status=$?
419 +   egrep -v '^ *\+' conftest.er1 >conftest.err
420 +   rm -f conftest.er1
421 +   cat conftest.err >&5
422 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
423 +   (exit $ac_status); } >/dev/null; then
424 +   if test -s conftest.err; then
425 +     ac_cpp_err=$ac_c_preproc_warn_flag
426 +   else
427 +     ac_cpp_err=
428 +   fi
429 + else
430 +   ac_cpp_err=yes
431 + fi
432 + if test -z "$ac_cpp_err"; then
433 +   ac_header_preproc=yes
434 + else
435 +   echo "$as_me: failed program was:" >&5
436 +   cat conftest.$ac_ext >&5
437 +   ac_header_preproc=no
438 + fi
439 + rm -f conftest.err conftest.$ac_ext
440 + echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
441 + echo "${ECHO_T}$ac_header_preproc" >&6
443 + # So?  What about this header?
444 + case $ac_header_compiler:$ac_header_preproc in
445 +   yes:no )
446 +     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
447 + echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
448 +     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
449 + echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
450 +   no:yes )
451 +     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
452 + echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
453 +     { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
454 + echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
455 +     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
456 + echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
457 + esac
458 + echo "$as_me:$LINENO: checking for $ac_header" >&5
459 + echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
460 + if eval "test \"\${$as_ac_Header+set}\" = set"; then
461 +   echo $ECHO_N "(cached) $ECHO_C" >&6
462 + else
463 +   eval "$as_ac_Header=$ac_header_preproc"
464 + fi
465 + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
466 + echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
468 + fi
469 + if test `eval echo '${'$as_ac_Header'}'` = yes; then
470 +   cat >>confdefs.h <<_ACEOF
471 + #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
472 + _ACEOF
474 + fi
476 + done
479 + for ac_func in setlocale
480 + do
481 + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
482 + echo "$as_me:$LINENO: checking for $ac_func" >&5
483 + echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
484 + if eval "test \"\${$as_ac_var+set}\" = set"; then
485 +   echo $ECHO_N "(cached) $ECHO_C" >&6
486 + else
487 +   cat >conftest.$ac_ext <<_ACEOF
488 + #line $LINENO "configure"
489 + #include "confdefs.h"
490 + /* From autoconf 2.57 */
491 + /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
492 +    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
493 + #define $ac_func innocuous_$ac_func
495 + /* System header to define __stub macros and hopefully few prototypes,
496 +     which can conflict with char $ac_func (); below.
497 +     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
498 +     <limits.h> exists even on freestanding compilers.  */
500 + #ifdef __STDC__
501 + # include <limits.h>
502 + #else
503 + # include <assert.h>
504 + #endif
506 + #undef $ac_func
508 + /* Override any gcc2 internal prototype to avoid an error.  */
509 + #ifdef __cplusplus
510 + extern "C"
511 + {
512 + #endif
513 + /* We use char because int might match the return type of a gcc2
514 +    builtin and then its argument prototype would still apply.  */
515 + char $ac_func ();
516 + /* The GNU C library defines this for functions which it implements
517 +     to always fail with ENOSYS.  Some functions are actually named
518 +     something starting with __ and the normal name is an alias.  */
519 + #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
520 + choke me
521 + #else
522 + char (*f) () = $ac_func;
523 + #endif
524 + #ifdef __cplusplus
525 + }
526 + #endif
528 + #ifdef F77_DUMMY_MAIN
529 + #  ifdef __cplusplus
530 +      extern "C"
531 + #  endif
532 +    int F77_DUMMY_MAIN() { return 1; }
533 + #endif
534 + int
535 + main ()
536 + {
537 + return f != $ac_func;
538 +   ;
539 +   return 0;
540 + }
541 + _ACEOF
542 + rm -f conftest.$ac_objext conftest$ac_exeext
543 + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
544 +   (eval $ac_link) 2>&5
545 +   ac_status=$?
546 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
547 +   (exit $ac_status); } &&
548 +          { ac_try='test -s conftest$ac_exeext'
549 +   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
550 +   (eval $ac_try) 2>&5
551 +   ac_status=$?
552 +   echo "$as_me:$LINENO: \$? = $ac_status" >&5
553 +   (exit $ac_status); }; }; then
554 +   eval "$as_ac_var=yes"
555 + else
556 +   echo "$as_me: failed program was:" >&5
557 + cat conftest.$ac_ext >&5
558 + eval "$as_ac_var=no"
559 + fi
560 + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
561 + fi
562 + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
563 + echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
564 + if test `eval echo '${'$as_ac_var'}'` = yes; then
565 +   cat >>confdefs.h <<_ACEOF
566 + #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
567 + _ACEOF
569 + fi
570 + done
573 + #
574   # Substitutions
575   #
576   
577 ***************
578 *** 14061,14066 ****
579 --- 14371,14377 ----
580   s,@PRINTSTYLE@,$PRINTSTYLE,;t t
581   s,@XMLDCL@,$XMLDCL,;t t
582   s,@DOCBOOK2MANSPEC@,$DOCBOOK2MANSPEC,;t t
583 + s,@IDNLIBS@,$IDNLIBS,;t t
584   s,@BIND9_TOP_BUILDDIR@,$BIND9_TOP_BUILDDIR,;t t
585   s,@BIND9_ISC_BUILDINCLUDE@,$BIND9_ISC_BUILDINCLUDE,;t t
586   s,@BIND9_ISCCC_BUILDINCLUDE@,$BIND9_ISCCC_BUILDINCLUDE,;t t
587 Index: configure.in
588 diff -c mdn/othersrc/bind9/configure.in:1.1.1.10 mdn/othersrc/bind9/configure.in:1.16
589 *** configure.in        Wed Mar  5 17:14:56 2003
590 --- configure.in        Wed Mar  5 17:37:08 2003
591 ***************
592 *** 1681,1686 ****
593 --- 1681,1762 ----
594   NOM_PATH_FILE(DOCBOOK2MANSPEC, docbook2X/docbook2man-spec.pl, $sgmltrees)
595   
596   #
597 + # IDN support
598 + #
599 + AC_ARG_WITH(idn,
600 +       [  --with-idn[=MPREFIX]   enable IDN support using idnkit [default PREFIX]],
601 +       use_idn="$withval", use_idn="no")
602 + case "$use_idn" in
603 + yes)
604 +       if test X$prefix = XNONE ; then
605 +               idn_path=/usr/local
606 +       else
607 +               idn_path=$prefix
608 +       fi
609 +       ;;
610 + no)
611 +       ;;
612 + *)
613 +       idn_path="$use_idn"
614 +       ;;
615 + esac
617 + iconvinc=
618 + iconvlib=
619 + AC_ARG_WITH(libiconv,
620 +       [  --with-libiconv[=IPREFIX]   GNU libiconv are in IPREFIX [default PREFIX]],
621 +       use_libiconv="$withval", use_libiconv="no")
622 + case "$use_libiconv" in
623 + yes)
624 +       if test X$prefix = XNONE ; then
625 +               iconvlib="-L/usr/local/lib -R/usr/local/lib -liconv"
626 +       else
627 +               iconvlib="-L$prefix/lib -R$prefix/lib -liconv"
628 +       fi
629 +       ;;
630 + no)
631 +       iconvlib=
632 +       ;;
633 + *)
634 +       iconvlib="-L$use_libiconv/lib -R$use_libiconv/lib -liconv"
635 +       ;;
636 + esac
638 + AC_ARG_WITH(iconv,
639 +       [  --with-iconv[=LIBSPEC]   specify iconv library [default -liconv]],
640 +       iconvlib="$withval")
641 + case "$iconvlib" in
642 + no)
643 +       iconvlib=
644 +       ;;
645 + yes)
646 +       iconvlib=-liconv
647 +       ;;
648 + esac
650 + AC_ARG_WITH(idnlib,
651 +       [  --with-idnlib=ARG    specify libidnkit],
652 +       idnlib="$withval", idnlib="no")
653 + if test "$idnlib" = yes; then
654 +       AC_MSG_ERROR([You must specify ARG for --with-idnlib.])
655 + fi
657 + IDNLIBS=
658 + if test "$use_idn" != no; then
659 +       AC_DEFINE(WITH_IDN, 1, [define if idnkit support is to be included.])
660 +       STD_CINCLUDES="$STD_CINCLUDES -I$idn_path/include"
661 +       if test "$idnlib" != no; then
662 +               IDNLIBS="$idnlib $iconvlib"
663 +       else
664 +               IDNLIBS="-L$idn_path/lib -lidnkit $iconvlib"
665 +       fi
666 + fi
667 + AC_SUBST(IDNLIBS)
669 + AC_CHECK_HEADERS(locale.h)
670 + AC_CHECK_FUNCS(setlocale)
672 + #
673   # Substitutions
674   #
675   AC_SUBST(BIND9_TOP_BUILDDIR)
676 Index: bin/dig/Makefile.in
677 diff -c mdn/othersrc/bind9/bin/dig/Makefile.in:1.1.1.6 mdn/othersrc/bind9/bin/dig/Makefile.in:1.3
678 *** bin/dig/Makefile.in Tue Nov 27 16:55:50 2001
679 --- bin/dig/Makefile.in Tue Mar 19 16:45:35 2002
680 ***************
681 *** 36,42 ****
682   
683   DEPLIBS =     ${DNSDEPLIBS} ${ISCDEPLIBS}
684   
685 ! LIBS =                ${DNSLIBS} ${ISCLIBS} @LIBS@
686   
687   SUBDIRS =
688   
689 --- 36,42 ----
690   
691   DEPLIBS =     ${DNSDEPLIBS} ${ISCDEPLIBS}
692   
693 ! LIBS =                ${DNSLIBS} ${ISCLIBS} @IDNLIBS@ @LIBS@
694   
695   SUBDIRS =
696   
697 Index: bin/dig/dig.1
698 diff -c mdn/othersrc/bind9/bin/dig/dig.1:1.1.1.3 mdn/othersrc/bind9/bin/dig/dig.1:1.5
699 *** bin/dig/dig.1       Wed Mar  5 17:14:57 2003
700 --- bin/dig/dig.1       Wed Mar  5 17:42:53 2003
701 ***************
702 *** 349,354 ****
703 --- 349,365 ----
704   \fI+noqr\fR which means that \fBdig\fR
705   will not print the initial query when it looks up the NS records for
706   isc.org.
707 + .SH "IDN SUPPORT"
708 + .PP
709 + If \fBdig\fR has been built with IDN (internationalized
710 + domain name) support, it can accept and display non-ASCII domain names.
711 + \fBdig\fR appropriately converts character encoding of
712 + domain name before sending a request to DNS server or displaying a
713 + reply from the server.
714 + If you'd like to turn off the IDN support for some reason, defines
715 + the \fBIDN_DISABLE\fR environment variable.
716 + The IDN support is disabled if the the variable is set when 
717 + \fBdig\fR runs.
718   .SH "FILES"
719   .PP
720   \fI/etc/resolv.conf\fR
721 Index: bin/dig/dig.docbook
722 diff -c mdn/othersrc/bind9/bin/dig/dig.docbook:1.1.1.3 mdn/othersrc/bind9/bin/dig/dig.docbook:1.5
723 *** bin/dig/dig.docbook Wed Mar  5 17:14:57 2003
724 --- bin/dig/dig.docbook Wed Mar  5 17:42:53 2003
725 ***************
726 *** 523,528 ****
727 --- 523,543 ----
728   </refsect1>
729   
730   <refsect1>
731 + <title>IDN SUPPORT</title>
732 + <para>
733 + If <command>dig</command> has been built with IDN (internationalized
734 + domain name) support, it can accept and display non-ASCII domain names.
735 + <command>dig</command> appropriately converts character encoding of
736 + domain name before sending a request to DNS server or displaying a
737 + reply from the server.
738 + If you'd like to turn off the IDN support for some reason, defines
739 + the <envar>IDN_DISABLE</envar> environment variable.
740 + The IDN support is disabled if the the variable is set when 
741 + <command>dig</command> runs.
742 + </para>
743 + </refsect1>
745 + <refsect1>
746   <title>FILES</title>
747   <para>
748   <filename>/etc/resolv.conf</filename>
749 Index: bin/dig/dighost.c
750 diff -c mdn/othersrc/bind9/bin/dig/dighost.c:1.1.1.13 mdn/othersrc/bind9/bin/dig/dighost.c:1.33
751 *** bin/dig/dighost.c   Wed Mar  5 17:14:57 2003
752 --- bin/dig/dighost.c   Wed Mar  5 17:42:53 2003
753 ***************
754 *** 32,37 ****
755 --- 32,48 ----
756   #include <string.h>
757   #include <limits.h>
758   
759 + #ifdef HAVE_LOCALE_H
760 + #include <locale.h>
761 + #endif
763 + #ifdef WITH_IDN
764 + #include <idn/result.h>
765 + #include <idn/log.h>
766 + #include <idn/resconf.h>
767 + #include <idn/api.h>
768 + #endif
770   #include <dns/byaddr.h>
771   #include <dns/fixedname.h>
772   #include <dns/message.h>
773 ***************
774 *** 130,135 ****
775 --- 141,158 ----
776   isc_mutex_t lookup_lock;
777   dig_lookup_t *current_lookup = NULL;
778   
779 + #ifdef WITH_IDN
780 + static void         initialize_idn(void);
781 + static isc_result_t   output_filter(isc_buffer_t *buffer,
782 +                                   unsigned int used_org,
783 +                                   isc_boolean_t absolute);
784 + static idn_result_t   append_textname(char *name, const char *origin,
785 +                                     size_t namesize);
786 + static void         idn_check_result(idn_result_t r, const char *msg);
788 + #define MAXDLEN               256
789 + #endif
791   /*
792    * Apply and clear locks at the event level in global task.
793    * Can I get rid of these using shutdown events?  XXX
794 ***************
795 *** 648,653 ****
796 --- 671,680 ----
797                 ISC_LIST_APPEND(server_list, srv, link);
798         }
799   
800 + #ifdef WITH_IDN
801 +       initialize_idn();
802 + #endif
804         if (keyfile[0] != 0)
805                 setup_file_key();
806         else if (keysecret[0] != 0)
807 ***************
808 *** 1168,1173 ****
809 --- 1195,1208 ----
810         isc_buffer_t b;
811         dns_compress_t cctx;
812         char store[MXNAME];
813 + #ifdef WITH_IDN
814 +       idn_result_t mr;
815 +       char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
816 + #endif
818 + #ifdef WITH_IDN
819 +       dns_name_settotextfilter(output_filter);
820 + #endif
821   
822         REQUIRE(lookup != NULL);
823         INSIST(!free_now);
824 ***************
825 *** 1196,1201 ****
826 --- 1231,1247 ----
827         isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
828                         sizeof(lookup->onamespace));
829   
830 + #ifdef WITH_IDN
831 +       /*
832 +        * We cannot convert `textname' and `origin' separately.
833 +        * `textname' doesn't contain TLD, but local mapping needs
834 +        * TLD.
835 +        */
836 +       mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP, lookup->textname,
837 +                           utf8_textname, sizeof(utf8_textname));
838 +       idn_check_result(mr, "convert textname to UTF-8");
839 + #endif
841         /*
842          * If the name has too many dots, force the origin to be NULL
843          * (which produces an absolute lookup).  Otherwise, take the origin
844 ***************
845 *** 1204,1215 ****
846 --- 1250,1290 ----
847          * is TRUE or we got a domain line in the resolv.conf file.
848          */
849         /* XXX New search here? */
850 + #ifdef WITH_IDN
851 +       if ((count_dots(utf8_textname) >= ndots) || !usesearch)
852 +               lookup->origin = NULL; /* Force abs lookup */
853 +       else if (lookup->origin == NULL && lookup->new_search && usesearch) {
854 +               lookup->origin = ISC_LIST_HEAD(search_list);
855 +       }
856 + #else
857         if ((count_dots(lookup->textname) >= ndots) || !usesearch)
858                 lookup->origin = NULL; /* Force abs lookup */
859         else if (lookup->origin == NULL && lookup->new_search && usesearch) {
860                 lookup->origin = ISC_LIST_HEAD(search_list);
861         }
862 + #endif
864 + #ifdef WITH_IDN
865         if (lookup->origin != NULL) {
866 +               mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP,
867 +                                   lookup->origin->origin, utf8_origin,
868 +                                   sizeof(utf8_origin));
869 +               idn_check_result(mr, "convert origin to UTF-8");
870 +               mr = append_textname(utf8_textname, utf8_origin,
871 +                                    sizeof(utf8_textname));
872 +               idn_check_result(mr, "append origin to textname");
873 +       }
874 +       mr = idn_encodename(IDN_LOCALMAP | IDN_NAMEPREP | IDN_ASCCHECK |
875 +                           IDN_IDNCONV | IDN_LENCHECK, utf8_textname,
876 +                           idn_textname, sizeof(idn_textname));
877 +       idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
878 + #endif
880 + #ifdef WITH_IDN
881 +       if (0) {
882 + #else
883 +       if (lookup->origin != NULL) {
884 + #endif
885                 debug("trying origin %s", lookup->origin->origin);
886                 result = dns_message_gettempname(lookup->sendmsg,
887                                                  &lookup->oname);
888 ***************
889 *** 1254,1259 ****
890 --- 1329,1343 ----
891                 if (lookup->trace && lookup->trace_root)
892                         dns_name_clone(dns_rootname, lookup->name);
893                 else {
894 + #ifdef WITH_IDN
895 +                       len = strlen(idn_textname);
896 +                       isc_buffer_init(&b, idn_textname, len);
897 +                       isc_buffer_add(&b, len);
898 +                       result = dns_name_fromtext(lookup->name, &b,
899 +                                                  dns_rootname,
900 +                                                  ISC_FALSE,
901 +                                                  &lookup->namebuf);
902 + #else
903                         len = strlen(lookup->textname);
904                         isc_buffer_init(&b, lookup->textname, len);
905                         isc_buffer_add(&b, len);
906 ***************
907 *** 1261,1266 ****
908 --- 1345,1351 ----
909                                                    dns_rootname,
910                                                    ISC_FALSE,
911                                                    &lookup->namebuf);
912 + #endif
913                 }
914                 if (result != ISC_R_SUCCESS) {
915                         dns_message_puttempname(lookup->sendmsg,
916 ***************
917 *** 2663,2665 ****
918 --- 2748,2848 ----
919         if (mctx != NULL)
920                 isc_mem_destroy(&mctx);
921   }
923 + #ifdef WITH_IDN
924 + static void
925 + initialize_idn(void) {
926 +       idn_result_t r;
928 + #ifdef HAVE_SETLOCALE
929 +       /* Set locale */
930 +       (void)setlocale(LC_ALL, "");
931 + #endif
932 +       /* Create configuration context. */
933 +       r = idn_nameinit(1);
934 +       if (r != idn_success)
935 +               fatal("idn api initialization failed: %s",
936 +                     idn_result_tostring(r));
938 +       /* Set domain name -> text post-conversion filter. */
939 +       dns_name_settotextfilter(output_filter);
940 + }
942 + static isc_result_t
943 + output_filter(isc_buffer_t *buffer, unsigned int used_org,
944 +             isc_boolean_t absolute)
945 + {
946 +       char tmp1[MAXDLEN], tmp2[MAXDLEN];
947 +       size_t fromlen, tolen;
948 +       isc_boolean_t end_with_dot;
950 +       /*
951 +        * Copy contents of 'buffer' to 'tmp1', supply trailing dot
952 +        * if 'absolute' is true, and terminate with NUL.
953 +        */
954 +       fromlen = isc_buffer_usedlength(buffer) - used_org;
955 +       if (fromlen >= MAXDLEN)
956 +               return (ISC_R_SUCCESS);
957 +       memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
958 +       end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
959 +       if (absolute && !end_with_dot) {
960 +               fromlen++;
961 +               if (fromlen >= MAXDLEN)
962 +                       return (ISC_R_SUCCESS);
963 +               tmp1[fromlen - 1] = '.';
964 +       }
965 +       tmp1[fromlen] = '\0';
967 +       /*
968 +        * Convert contents of 'tmp1' to local encoding.
969 +        */
970 +       if (idn_decodename(IDN_DECODE_APP, tmp1, tmp2, MAXDLEN) != idn_success)
971 +               return (ISC_R_SUCCESS);
972 +       strcpy(tmp1, tmp2);
974 +       /*
975 +        * Copy the converted contents in 'tmp1' back to 'buffer'.
976 +        * If we have appended trailing dot, remove it.
977 +        */
978 +       tolen = strlen(tmp1);
979 +       if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
980 +               tolen--;
982 +       if (isc_buffer_length(buffer) < used_org + tolen)
983 +               return (ISC_R_NOSPACE);
985 +       isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
986 +       memcpy(isc_buffer_used(buffer), tmp1, tolen);
987 +       isc_buffer_add(buffer, tolen);
989 +       return (ISC_R_SUCCESS);
990 + }
992 + static idn_result_t
993 + append_textname(char *name, const char *origin, size_t namesize) {
994 +       size_t namelen = strlen(name);
995 +       size_t originlen = strlen(origin);
997 +       /* Already absolute? */
998 +       if (namelen > 0 && name[namelen - 1] == '.')
999 +               return idn_success;
1001 +       /* Append dot and origin */
1003 +       if (namelen + 1 + originlen >= namesize)
1004 +               return idn_buffer_overflow;
1006 +       name[namelen++] = '.';
1007 +       (void)strcpy(name + namelen, origin);
1008 +       return idn_success;
1009 + }
1011 + static void
1012 + idn_check_result(idn_result_t r, const char *msg) {
1013 +       if (r != idn_success) {
1014 +               exitcode = 1;
1015 +               fatal("%s: %s", msg, idn_result_tostring(r));
1016 +       }
1017 + }
1019 + #endif /* WITH_IDN */
1020 Index: bin/dig/host.1
1021 diff -c mdn/othersrc/bind9/bin/dig/host.1:1.1.1.2 mdn/othersrc/bind9/bin/dig/host.1:1.4
1022 *** bin/dig/host.1      Wed Mar  5 17:14:57 2003
1023 --- bin/dig/host.1      Wed Mar  5 17:42:53 2003
1024 ***************
1025 *** 120,125 ****
1026 --- 120,136 ----
1027   effectively wait forever for a reply. The time to wait for a response
1028   will be set to the number of seconds given by the hardware's maximum
1029   value for an integer quantity.
1030 + .SH "IDN SUPPORT"
1031 + .PP
1032 + If \fBhost\fR has been built with IDN (internationalized
1033 + domain name) support, it can accept and display non-ASCII domain names.
1034 + \fBhost\fR appropriately converts character encoding of
1035 + domain name before sending a request to DNS server or displaying a
1036 + reply from the server.
1037 + If you'd like to turn off the IDN support for some reason, defines
1038 + the \fBIDN_DISABLE\fR environment variable.
1039 + The IDN support is disabled if the the variable is set when
1040 + \fBhost\fR runs.
1041   .SH "FILES"
1042   .PP
1043   \fI/etc/resolv.conf\fR
1044 Index: bin/dig/host.docbook
1045 diff -c mdn/othersrc/bind9/bin/dig/host.docbook:1.1.1.2 mdn/othersrc/bind9/bin/dig/host.docbook:1.4
1046 *** bin/dig/host.docbook        Wed Mar  5 17:14:57 2003
1047 --- bin/dig/host.docbook        Wed Mar  5 17:42:53 2003
1048 ***************
1049 *** 181,186 ****
1050 --- 181,201 ----
1051   </refsect1>
1052   
1053   <refsect1>
1054 + <title>IDN SUPPORT</title>
1055 + <para>
1056 + If <command>host</command> has been built with IDN (internationalized
1057 + domain name) support, it can accept and display non-ASCII domain names.
1058 + <command>host</command> appropriately converts character encoding of
1059 + domain name before sending a request to DNS server or displaying a
1060 + reply from the server.
1061 + If you'd like to turn off the IDN support for some reason, defines
1062 + the <envar>IDN_DISABLE</envar> environment variable.
1063 + The IDN support is disabled if the the variable is set when
1064 + <command>host</command> runs.
1065 + </para>
1066 + </refsect1>
1068 + <refsect1>
1069   <title>FILES</title>
1070   <para>
1071   <filename>/etc/resolv.conf</filename>
1072 Index: lib/dns/name.c
1073 diff -c mdn/othersrc/bind9/lib/dns/name.c:1.1.1.11 mdn/othersrc/bind9/lib/dns/name.c:1.15
1074 *** lib/dns/name.c      Wed Mar  5 17:16:22 2003
1075 --- lib/dns/name.c      Wed Mar  5 17:49:58 2003
1076 ***************
1077 *** 194,199 ****
1078 --- 194,206 ----
1079   /* XXXDCL make const? */
1080   dns_name_t *dns_wildcardname = &wild;
1081   
1082 + #ifdef WITH_IDN
1083 + /*
1084 +  * dns_name_t to text post-conversion procedure.
1085 +  */
1086 + static dns_name_totextfilter_t totext_filter_proc = NULL;
1087 + #endif
1089   static void
1090   set_offsets(const dns_name_t *name, unsigned char *offsets,
1091             dns_name_t *set_name);
1092 ***************
1093 *** 1684,1689 ****
1094 --- 1691,1699 ----
1095         unsigned int labels;
1096         isc_boolean_t saw_root = ISC_FALSE;
1097         char num[4];
1098 + #ifdef WITH_IDN
1099 +       unsigned int oused = target->used;
1100 + #endif
1101   
1102         /*
1103          * This function assumes the name is in proper uncompressed
1104 ***************
1105 *** 1861,1866 ****
1106 --- 1871,1880 ----
1107   
1108         isc_buffer_add(target, tlen - trem);
1109   
1110 + #ifdef WITH_IDN
1111 +       if (totext_filter_proc != NULL)
1112 +               return ((*totext_filter_proc)(target, oused, saw_root));
1113 + #endif
1114         return (ISC_R_SUCCESS);
1115   }
1116   
1117 ***************
1118 *** 3325,3327 ****
1119 --- 3339,3347 ----
1120         return (ISC_R_SUCCESS);
1121   }
1122   
1123 + #ifdef WITH_IDN
1124 + void
1125 + dns_name_settotextfilter(dns_name_totextfilter_t proc) {
1126 +       totext_filter_proc = proc;
1127 + }
1128 + #endif
1129 Index: lib/dns/include/dns/name.h
1130 diff -c mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.1.1.7 mdn/othersrc/bind9/lib/dns/include/dns/name.h:1.10
1131 *** lib/dns/include/dns/name.h  Wed May 22 17:15:29 2002
1132 --- lib/dns/include/dns/name.h  Mon May 27 12:10:15 2002
1133 ***************
1134 *** 219,224 ****
1135 --- 219,235 ----
1136    */
1137   #define DNS_NAME_MAXWIRE 255
1138   
1139 + #ifdef WITH_IDN
1140 + /*
1141 +  * Text output filter procedure.
1142 +  * 'target' is the buffer to be converted.  The region to be converted
1143 +  * is from 'buffer'->base + 'used_org' to the end of the used region.
1144 +  */
1145 + typedef isc_result_t (*dns_name_totextfilter_t)(isc_buffer_t *target,
1146 +                                               unsigned int used_org,
1147 +                                               isc_boolean_t absolute);
1148 + #endif
1150   /***
1151    *** Initialization
1152    ***/
1153 ***************
1154 *** 1244,1249 ****
1155 --- 1255,1268 ----
1156    *    'size' > 0.
1157    *
1158    */
1160 + #ifdef WITH_IDN
1161 + void
1162 + dns_name_settotextfilter(dns_name_totextfilter_t proc);
1163 + /*
1164 +  * Call 'proc' at the end of dns_name_totext.
1165 +  */
1166 + #endif /* WITH_IDN */
1167   
1168   #define DNS_NAME_FORMATSIZE (DNS_NAME_MAXTEXT + 1)
1169   /*