~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to debian/patches/902_extra_search_path.patch

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -ruN ruby-1.8.5.orig/configure.in ruby-1.8.5/configure.in
2
 
--- ruby-1.8.5.orig/configure.in        2006-08-08 11:37:43.000000000 +0900
3
 
+++ ruby-1.8.5/configure.in     2006-09-19 15:39:46.000000000 +0900
4
 
@@ -1569,6 +1569,19 @@
5
 
     AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")
6
 
 fi
7
 
 
8
 
+AC_ARG_WITH(extra-site-search-path,
9
 
+               [  --with-extra-site-search-path=DIR specify the extra site search path],
10
 
+               [extra_site_search_path=$withval])
11
 
+if test "$extra_site_search_path" != ""; then
12
 
+    AC_DEFINE_UNQUOTED(RUBY_EXTRA_SITE_SEARCH_PATH,"$extra_site_search_path")
13
 
+fi
14
 
+AC_ARG_WITH(extra-search-path,
15
 
+               [  --with--site-search-path=DIR specify the extra search path],
16
 
+               [extra_search_path=$withval])
17
 
+if test "$extra_search_path" != ""; then
18
 
+    AC_DEFINE_UNQUOTED(RUBY_EXTRA_SEARCH_PATH,"$extra_search_path")
19
 
+fi
20
 
+
21
 
 AC_ARG_WITH(mantype,
22
 
                [  --with-mantype=TYPE specify man page type; TYPE is one of man and doc],
23
 
                [
24
 
diff -ruN ruby-1.8.5.orig/configure.in.orig ruby-1.8.5/configure.in.orig
25
 
--- ruby-1.8.5.orig/configure.in.orig   1970-01-01 09:00:00.000000000 +0900
26
 
+++ ruby-1.8.5/configure.in.orig        2006-08-08 11:37:43.000000000 +0900
27
 
@@ -0,0 +1,1608 @@
28
 
+dnl Process this file with autoconf to produce a configure script.
29
 
+AC_INIT()
30
 
+
31
 
+AC_PREREQ(2.58)
32
 
+
33
 
+AC_DEFUN([RUBY_MINGW32],
34
 
+[case "$host_os" in
35
 
+cygwin*)
36
 
+AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
37
 
+[AC_TRY_CPP([
38
 
+#ifndef __MINGW32__
39
 
+# error
40
 
+#endif
41
 
+], rb_cv_mingw32=yes,rb_cv_mingw32=no)
42
 
+rm -f conftest*])
43
 
+test "$rb_cv_mingw32" = yes && target_os="mingw32"
44
 
+  ;;
45
 
+esac])
46
 
+
47
 
+AC_DEFUN([RUBY_CPPOUTFILE],
48
 
+[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
49
 
+[cppflags=$CPPFLAGS
50
 
+CPPFLAGS='-o conftest.i'
51
 
+AC_TRY_CPP([], rb_cv_cppoutfile=yes, rb_cv_cppoutfile=no)
52
 
+CPPFLAGS=$cppflags
53
 
+rm -f conftest*])
54
 
+if test "$rb_cv_cppoutfile" = yes; then
55
 
+  CPPOUTFILE='-o conftest.i'
56
 
+elif test "$rb_cv_cppoutfile" = no; then
57
 
+  CPPOUTFILE='> conftest.i'
58
 
+elif test -n "$rb_cv_cppoutfile"; then
59
 
+  CPPOUTFILE="$rb_cv_cppoutfile"
60
 
+fi
61
 
+AC_SUBST(CPPOUTFILE)])
62
 
+
63
 
+AC_DEFUN([RUBY_PROG_GNU_LD],
64
 
+[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
65
 
+[if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
66
 
+  rb_cv_prog_gnu_ld=yes
67
 
+else
68
 
+  rb_cv_prog_gnu_ld=no
69
 
+fi
70
 
+])
71
 
+GNU_LD=$rb_cv_prog_gnu_ld
72
 
+AC_SUBST(GNU_LD)])
73
 
+
74
 
+rb_version=`grep RUBY_VERSION $srcdir/version.h`
75
 
+MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'`
76
 
+MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'`
77
 
+TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'`
78
 
+AC_SUBST(MAJOR)
79
 
+AC_SUBST(MINOR)
80
 
+AC_SUBST(TEENY)
81
 
+dnl checks for alternative programs
82
 
+AC_ARG_WITH(gcc, [  --without-gcc           never use gcc], [
83
 
+       case $withval in
84
 
+       no)     : ${CC=cc}
85
 
+               ;;
86
 
+       yes)    : ${CC=gcc}
87
 
+               ;;
88
 
+       *)      CC=$withval
89
 
+               ;;
90
 
+       esac])
91
 
+dnl If the user switches compilers, we can't believe the cache
92
 
+if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
93
 
+then
94
 
+  AC_MSG_ERROR(cached CC is different -- throw away $cache_file
95
 
+(it is also a good idea to do 'make clean' before compiling))
96
 
+fi
97
 
+
98
 
+if test "$program_prefix" = NONE; then
99
 
+  program_prefix=
100
 
+fi
101
 
+AC_CANONICAL_TARGET
102
 
+target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
103
 
+ac_install_sh='' # unusable for extension libraries.
104
 
+
105
 
+dnl checks for fat-binary
106
 
+AC_ARG_ENABLE(fat-binary,
107
 
+       [  --enable-fat-binary=ARCHS
108
 
+                          build an Apple/NeXT Multi Architecture Binary (MAB);
109
 
+                          ARCHS is a comma-delimited list of architectures for
110
 
+                          which to build; if ARCHS is omitted, then the package
111
 
+                          will be built for all architectures supported by the
112
 
+                          platform ("ppc" for MacOS/X and Darwin; "ppc,i386"
113
 
+                          for Rhapsody; "m68k,i386,sparc" for OpenStep;
114
 
+                          "m68k,i386,sparc,hppa" for NextStep); if this option
115
 
+                          is disabled or omitted entirely, then the package
116
 
+                          will be built only for the target platform],
117
 
+       [fat_binary=$enableval], [fat_binary=no])
118
 
+if test "$fat_binary" != no; then
119
 
+
120
 
+    AC_MSG_CHECKING([target architectures])
121
 
+
122
 
+    # Respect TARGET_ARCHS setting from environment if available.
123
 
+    if test -z "$TARGET_ARCHS"; then
124
 
+       # Respect ARCH given to --enable-fat-binary if present.
125
 
+       if test "$fat_binary" != yes; then
126
 
+           TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
127
 
+       else
128
 
+           # Choose a default set of architectures based upon platform.
129
 
+           case "$target_os" in
130
 
+           darwin*)
131
 
+               TARGET_ARCHS="ppc"
132
 
+               ;;
133
 
+           rhapsody*)
134
 
+               TARGET_ARCHS="ppc i386"
135
 
+               ;;
136
 
+           openstep*)
137
 
+               TARGET_ARCHS="m68k i386 sparc"
138
 
+               ;;
139
 
+           nextstep*)
140
 
+               TARGET_ARCHS="m68k i386 sparc hppa"
141
 
+               ;;
142
 
+           *)
143
 
+               TARGET_ARCHS=`arch`
144
 
+           esac
145
 
+       fi
146
 
+    fi
147
 
+
148
 
+    AC_MSG_RESULT([$TARGET_ARCHS])
149
 
+
150
 
+    # /usr/lib/arch_tool -archify_list $TARGET_ARCHS
151
 
+    ARCH_FLAG=
152
 
+    for archs in $TARGET_ARCHS 
153
 
+    do
154
 
+        ARCH_FLAG="$ARCH_FLAG -arch $archs"
155
 
+    done
156
 
+    AC_DEFINE(NEXT_FAT_BINARY)
157
 
+fi
158
 
+
159
 
+case $target_cpu in
160
 
+  i?86) frame_address=yes;;
161
 
+  *)    frame_address=no;;
162
 
+esac
163
 
+AC_ARG_ENABLE(frame-address,
164
 
+       [  --enable-frame-address  use GCC __builtin_frame_address(). ],
165
 
+       [frame_address=$enableval])
166
 
+if test $frame_address = yes; then
167
 
+    AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS)
168
 
+fi
169
 
+
170
 
+AC_ARG_PROGRAM
171
 
+
172
 
+dnl Checks for programs.
173
 
+
174
 
+if test x"${build}" != x"${host}"; then
175
 
+  AC_CHECK_TOOL(CC, gcc)
176
 
+fi
177
 
+AC_PROG_CC
178
 
+AC_PROG_GCC_TRADITIONAL
179
 
+
180
 
+RUBY_PROG_GNU_LD
181
 
+RUBY_CPPOUTFILE
182
 
+
183
 
+: ${OUTFLAG='-o '}
184
 
+AC_SUBST(OUTFLAG)
185
 
+
186
 
+RUBY_MINGW32
187
 
+
188
 
+AC_PROG_YACC
189
 
+if test "$YACC" = "yacc"; then
190
 
+  AC_DEFINE([OLD_YACC])
191
 
+fi
192
 
+
193
 
+AC_CHECK_TOOL(RANLIB, ranlib, :)
194
 
+AC_CHECK_TOOL(AR, ar)
195
 
+if test -z "$AR"; then
196
 
+  AC_CHECK_PROGS(AR, aal, ar)
197
 
+fi
198
 
+
199
 
+AC_CHECK_TOOL(AS, as)
200
 
+ASFLAGS=$ASFLAGS
201
 
+AC_SUBST(ASFLAGS)
202
 
+
203
 
+case "$target_os" in
204
 
+cygwin*|mingw*)
205
 
+    AC_CHECK_TOOL(NM, nm)
206
 
+    AC_CHECK_TOOL(WINDRES, windres)
207
 
+    AC_CHECK_TOOL(DLLWRAP, dllwrap)
208
 
+    target_cpu=`echo $target_cpu | sed s/i.86/i386/`
209
 
+    case "$target_os" in
210
 
+    mingw*)
211
 
+       test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt
212
 
+       AC_CHECK_TOOL(OBJDUMP, objdump)
213
 
+       AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [
214
 
+       AC_TRY_LINK([#include <stdio.h>],
215
 
+                   [FILE* volatile f = stdin; return 0;],
216
 
+                   [rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext |
217
 
+                                  tr A-Z a-z |
218
 
+                                  sed -n '/^[[         ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`],
219
 
+                   [rb_cv_msvcrt=msvcrt])
220
 
+       test "$rb_cv_msvcrt" = "" && rb_cv_msvcrt=msvcrt])
221
 
+       AC_ARG_WITH(winsock2,
222
 
+               [  --with-winsock2         link winsock2 (MinGW only)], [
223
 
+               case $withval in
224
 
+               yes) with_winsock2=yes;;
225
 
+               *)   with_winsock2=no;;
226
 
+               esac], [with_winsock2=no])
227
 
+       if test "$with_winsock2" = yes; then
228
 
+         AC_DEFINE(USE_WINSOCK2)
229
 
+       fi
230
 
+    esac
231
 
+    : ${enable_shared=yes}
232
 
+    ;;
233
 
+aix*)
234
 
+    AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)
235
 
+    ;;
236
 
+hiuxmpp*)
237
 
+    # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
238
 
+    AC_DEFINE(__HIUX_MPP__)
239
 
+    ;;
240
 
+esac
241
 
+
242
 
+AC_PROG_LN_S
243
 
+AC_PROG_MAKE_SET
244
 
+AC_PROG_INSTALL
245
 
+
246
 
+# checks for UNIX variants that set C preprocessor variables
247
 
+AC_AIX
248
 
+AC_MINIX
249
 
+
250
 
+AC_SUBST(RM, ['rm -f'])
251
 
+AC_SUBST(CP, ['cp'])
252
 
+if $as_mkdir_p; then
253
 
+  AC_SUBST(MAKEDIRS, ['mkdir -p'])
254
 
+else
255
 
+  AC_SUBST(MAKEDIRS, ['install -d'])
256
 
+fi
257
 
+
258
 
+dnl check for large file stuff
259
 
+AC_SYS_LARGEFILE
260
 
+
261
 
+AC_CHECK_TYPES([long long, off_t])
262
 
+
263
 
+AC_CHECK_SIZEOF(int, 4)
264
 
+AC_CHECK_SIZEOF(short, 2)
265
 
+AC_CHECK_SIZEOF(long, 4)
266
 
+AC_CHECK_SIZEOF(long long, 0)
267
 
+AC_CHECK_SIZEOF(__int64, 0)
268
 
+AC_CHECK_SIZEOF(off_t, 0)
269
 
+AC_CHECK_SIZEOF(void*, 4)
270
 
+AC_CHECK_SIZEOF(float, 4)
271
 
+AC_CHECK_SIZEOF(double, 8)
272
 
+AC_CHECK_SIZEOF(time_t, 0)
273
 
+
274
 
+for id in pid_t gid_t uid_t; do
275
 
+    AC_CHECK_TYPE($id, [typ=$id], [typ=int])
276
 
+    AC_DEFINE_UNQUOTED(rb_$id, $typ)
277
 
+done
278
 
+
279
 
+AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
280
 
+  [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
281
 
+       rb_cv_have_prototypes=yes,
282
 
+       rb_cv_have_prototypes=no)])
283
 
+if test "$rb_cv_have_prototypes" = yes; then
284
 
+  AC_DEFINE(HAVE_PROTOTYPES)
285
 
+fi
286
 
+
287
 
+AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
288
 
+  [AC_TRY_COMPILE([#define paste(a,b) a##b],
289
 
+                 [int xy = 1; return paste(x,y);],
290
 
+                 rb_cv_tokenpaste=ansi,
291
 
+                 rb_cv_tokenpaste=knr)])
292
 
+if test "$rb_cv_tokenpaste" = ansi; then
293
 
+  AC_DEFINE(TOKEN_PASTE(x,y),[x##y])
294
 
+else
295
 
+  AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
296
 
+fi
297
 
+
298
 
+AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
299
 
+  [AC_TRY_COMPILE([
300
 
+#include <stdarg.h>
301
 
+int foo(int x, ...) {
302
 
+       va_list va;
303
 
+       va_start(va, x);
304
 
+       va_arg(va, int);
305
 
+       va_arg(va, char *);
306
 
+       va_arg(va, double);
307
 
+       return 0;
308
 
+}
309
 
+], [return foo(10, "", 3.14);],
310
 
+       rb_cv_stdarg=yes,
311
 
+       rb_cv_stdarg=no)])
312
 
+if test "$rb_cv_stdarg" = yes; then
313
 
+  AC_DEFINE(HAVE_STDARG_PROTOTYPES)
314
 
+fi
315
 
+
316
 
+AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
317
 
+[rb_cv_noreturn=x
318
 
+for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
319
 
+  AC_TRY_COMPILE(
320
 
+    [#define NORETURN(x) $mac
321
 
+NORETURN(void exit(int x));],
322
 
+    [],
323
 
+    [rb_cv_noreturn="$mac"; break])
324
 
+done])
325
 
+AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
326
 
+
327
 
+AC_CACHE_CHECK([for RUBY_EXTERN], rb_cv_ruby_extern,
328
 
+[rb_cv_ruby_extern=no
329
 
+for mac in "__attribute__((dllimport))" "__declspec(dllimport)"; do
330
 
+  AC_TRY_COMPILE(
331
 
+    [extern $mac void conftest(void);],
332
 
+    [rb_cv_ruby_extern="extern $mac"; break])
333
 
+done])
334
 
+test "x$rb_cv_ruby_extern" = xno || AC_DEFINE_UNQUOTED(RUBY_EXTERN, $rb_cv_ruby_extern)
335
 
+
336
 
+XCFLAGS="$XCFLAGS -DRUBY_EXPORT"
337
 
+
338
 
+dnl Check whether we need to define sys_nerr locally
339
 
+AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
340
 
+#include <errno.h>])
341
 
+
342
 
+dnl whether link libc_r or not
343
 
+AC_ARG_WITH(libc_r, 
344
 
+       [  --with-libc_r           link libc_r if possible (FreeBSD only)], [
345
 
+       case $withval in
346
 
+       yes) with_libc_r=yes;;
347
 
+       *)   with_libc_r=no;;
348
 
+       esac], [with_libc_r=no])
349
 
+
350
 
+AC_ARG_ENABLE(pthread,
351
 
+       [  --enable-pthread        use pthread library.],
352
 
+       [enable_pthread=$enableval], [enable_pthread=no])
353
 
+
354
 
+dnl Checks for libraries.
355
 
+case "$target_os" in
356
 
+nextstep*)     ;;
357
 
+openstep*)     ;;
358
 
+rhapsody*)     ;;
359
 
+darwin*)       LIBS="-lobjc $LIBS";;
360
 
+hpux*)         LIBS="-lm $LIBS"
361
 
+               ac_cv_c_inline=no;;
362
 
+human*)                ac_cv_func_getpgrp_void=yes
363
 
+               ac_cv_func_setitimer=no
364
 
+               ;;
365
 
+beos*)         ac_cv_func_link=no;;
366
 
+cygwin*)       rb_cv_have_daylight=no
367
 
+               ac_cv_var_tzname=no
368
 
+               ac_cv_func__setjmp=no
369
 
+               ac_cv_func_setitimer=no
370
 
+               ;;
371
 
+mingw*)                if test "$with_winsock2" = yes; then
372
 
+                 LIBS="-lws2_32 $LIBS"
373
 
+               else
374
 
+                 LIBS="-lwsock32 $LIBS"
375
 
+               fi
376
 
+               ac_cv_header_a_out_h=no
377
 
+               ac_cv_header_pwd_h=no
378
 
+               ac_cv_header_utime_h=no
379
 
+               ac_cv_header_sys_ioctl_h=no
380
 
+               ac_cv_header_sys_param_h=no
381
 
+               ac_cv_header_sys_resource_h=no
382
 
+               ac_cv_header_sys_select_h=no
383
 
+               ac_cv_header_sys_time_h=no
384
 
+               ac_cv_header_sys_times_h=no
385
 
+               ac_cv_func_times=yes
386
 
+               ac_cv_func_waitpid=yes
387
 
+               ac_cv_func_fsync=yes
388
 
+               ac_cv_func_vsnprintf=yes
389
 
+               ac_cv_func_seekdir=yes
390
 
+               ac_cv_func_telldir=yes
391
 
+               ac_cv_func_isinf=yes
392
 
+               ac_cv_func_isnan=yes
393
 
+               ac_cv_func_finite=yes
394
 
+               ac_cv_func_link=yes
395
 
+               ac_cv_lib_crypt_crypt=no
396
 
+               ac_cv_func_getpgrp_void=no
397
 
+               ac_cv_func_setpgrp_void=yes
398
 
+               ac_cv_func_memcmp_working=yes
399
 
+               ac_cv_lib_dl_dlopen=no
400
 
+               rb_cv_binary_elf=no
401
 
+               rb_cv_negative_time_t=no
402
 
+               enable_pthread=no
403
 
+               ;;
404
 
+os2-emx*)      LIBS="-lm $LIBS"
405
 
+               ac_cv_lib_dir_opendir=no;;
406
 
+msdosdjgpp*)   LIBS="-lm $LIBS"
407
 
+               ac_cv_func_getpgrp_void=yes
408
 
+               ac_cv_func_setitimer=no
409
 
+                ac_cv_sizeof_rlim_t=4
410
 
+               ;;
411
 
+bsdi*)          LIBS="-lm $LIBS"
412
 
+                ac_cv_sizeof_rlim_t=8;;
413
 
+freebsd*)      LIBS="-lm $LIBS"
414
 
+               AC_CACHE_CHECK([whether -lxpg4 has to be linked],
415
 
+                 rb_cv_lib_xpg4_needed,
416
 
+                 [AC_TRY_CPP([
417
 
+#include <osreldate.h>
418
 
+#if __FreeBSD_version < 400020 || \
419
 
+   (__FreeBSD_version >= 500000 && __FreeBSD_version < 500005)
420
 
+#error needs libxpg4
421
 
+#endif
422
 
+                  ],
423
 
+                  rb_cv_lib_xpg4_needed=no,
424
 
+                  rb_cv_lib_xpg4_needed=yes,
425
 
+                  rb_cv_lib_xpg4_needed=yes)])
426
 
+               if test "$rb_cv_lib_xpg4_needed" = yes; then
427
 
+                       AC_CHECK_LIB(xpg4, setlocale)
428
 
+               fi
429
 
+               if test "$with_libc_r" = yes; then
430
 
+                       AC_CACHE_CHECK([whether libc_r is supplementary to libc],
431
 
+                         rb_cv_supplementary_lib_c_r,
432
 
+                         [AC_TRY_CPP([
433
 
+#include <osreldate.h>
434
 
+#if 500016 <= __FreeBSD_version
435
 
+#error libc_r is supplementary to libc
436
 
+#endif
437
 
+                          ],
438
 
+                          rb_cv_supplementary_lib_c_r=no,
439
 
+                          rb_cv_supplementary_lib_c_r=yes,
440
 
+                          rb_cv_supplementary_lib_c_r=yes)])
441
 
+                       if test "$rb_cv_supplementary_lib_c_r" = yes; then
442
 
+                          MAINLIBS="-lc_r $MAINLIBS"
443
 
+                       fi
444
 
+               fi
445
 
+               ;;
446
 
+dragonfly*)    LIBS="-lm $LIBS"
447
 
+               ;;
448
 
+bow)           ac_cv_func_setitimer=no
449
 
+               ;;
450
 
+superux*)     ac_cv_func_setitimer=no
451
 
+              ;;
452
 
+solaris*2.10)  if test -z "$GCC"; then
453
 
+                      ac_cv_func_isinf=yes
454
 
+              fi
455
 
+               LIBS="-lm $LIBS"
456
 
+              ;;
457
 
+*) LIBS="-lm $LIBS";;
458
 
+esac
459
 
+AC_CHECK_LIB(crypt, crypt)
460
 
+AC_CHECK_LIB(dl, dlopen)       # Dynamic linking for SunOS/Solaris and SYSV
461
 
+AC_CHECK_LIB(dld, shl_load)    # Dynamic linking for HP-UX
462
 
+
463
 
+case "$target_cpu" in
464
 
+alpha*)                case "$target_os"::"$GCC" in
465
 
+               *::yes) CFLAGS="-mieee $CFLAGS" ;;   # gcc
466
 
+               osf*)   CFLAGS="-ieee $CFLAGS" ;;    # ccc
467
 
+               esac ;;
468
 
+esac
469
 
+
470
 
+dnl Checks for header files.
471
 
+AC_HEADER_DIRENT
472
 
+AC_HEADER_STDC
473
 
+AC_HEADER_SYS_WAIT
474
 
+AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h sys/syscall.h\
475
 
+                fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
476
 
+                syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
477
 
+                sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
478
 
+                ucontext.h intrinsics.h)
479
 
+
480
 
+dnl Check additional types.
481
 
+AC_CHECK_SIZEOF(rlim_t, 0, [
482
 
+  #ifdef HAVE_SYS_TYPES_H
483
 
+  # include <sys/types.h>
484
 
+  #endif
485
 
+  #ifdef HAVE_SYS_TIME_H
486
 
+  # include <sys/time.h>
487
 
+  #endif
488
 
+  #ifdef HAVE_SYS_RESOURCE_H
489
 
+  # include <sys/resource.h>
490
 
+  #endif
491
 
+  #ifdef HAVE_UNISTD_H
492
 
+  # include <unistd.h>
493
 
+  #endif
494
 
+  #include <stdio.h>
495
 
+])
496
 
+
497
 
+dnl Checks for typedefs, structures, and compiler characteristics.
498
 
+AC_TYPE_SIZE_T
499
 
+AC_STRUCT_ST_BLKSIZE
500
 
+AC_STRUCT_ST_BLOCKS
501
 
+AC_STRUCT_ST_RDEV
502
 
+
503
 
+dnl Checks for library functions.
504
 
+AC_TYPE_GETGROUPS
505
 
+AC_TYPE_SIGNAL
506
 
+AC_FUNC_ALLOCA
507
 
+AC_FUNC_MEMCMP
508
 
+AC_FUNC_FSEEKO
509
 
+AC_CHECK_FUNCS(ftello)
510
 
+AC_REPLACE_FUNCS(dup2 memmove strcasecmp strncasecmp strerror strftime\
511
 
+                strchr strstr strtoul crypt flock vsnprintf\
512
 
+                isnan finite isinf hypot acosh erf)
513
 
+AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd eaccess\
514
 
+             truncate chsize times utimes fcntl lockf lstat symlink link\
515
 
+             readlink setitimer setruid seteuid setreuid setresuid\
516
 
+             setproctitle setrgid setegid setregid setresgid issetugid pause\
517
 
+             lchown lchmod getpgrp setpgrp getpgid setpgid initgroups\
518
 
+             getgroups setgroups getpriority getrlimit setrlimit sysconf\
519
 
+              dlopen sigprocmask\
520
 
+             sigaction _setjmp setsid telldir seekdir fchmod mktime timegm\
521
 
+             cosh sinh tanh setuid setgid setenv unsetenv)
522
 
+AC_ARG_ENABLE(setreuid,
523
 
+       [  --enable-setreuid       use setreuid()/setregid() according to need even if obsolete.],
524
 
+       [use_setreuid=$enableval])
525
 
+if test "$use_setreuid" = yes; then
526
 
+    AC_DEFINE(USE_SETREUID)
527
 
+    AC_DEFINE(USE_SETREGID)
528
 
+fi
529
 
+AC_STRUCT_TIMEZONE
530
 
+AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
531
 
+  [AC_TRY_COMPILE([#include <time.h>],
532
 
+    [struct tm t; t.tm_gmtoff = 3600;],
533
 
+  [rb_cv_member_struct_tm_tm_gmtoff=yes],
534
 
+  [rb_cv_member_struct_tm_tm_gmtoff=no])])
535
 
+if test "$rb_cv_member_struct_tm_tm_gmtoff" = yes; then
536
 
+  AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
537
 
+fi
538
 
+AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
539
 
+  [AC_TRY_LINK([#include <time.h>
540
 
+  int i;],
541
 
+       [i = daylight;],
542
 
+       rb_cv_have_daylight=yes,
543
 
+       rb_cv_have_daylight=no)])
544
 
+if test "$rb_cv_have_daylight" = yes; then
545
 
+  AC_DEFINE(HAVE_DAYLIGHT)
546
 
+fi
547
 
+AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
548
 
+  [AC_TRY_RUN([
549
 
+#include <time.h>
550
 
+
551
 
+void
552
 
+check(tm, y, m, d, h, s)
553
 
+    struct tm *tm;
554
 
+    int y, m, d, h, s;
555
 
+{
556
 
+    if (!tm ||
557
 
+       tm->tm_year != y ||
558
 
+       tm->tm_mon  != m-1 ||
559
 
+       tm->tm_mday != d ||
560
 
+       tm->tm_hour != h ||
561
 
+       tm->tm_sec  != s) {
562
 
+       exit(1);
563
 
+    }
564
 
+}
565
 
+
566
 
+int
567
 
+main()
568
 
+{
569
 
+   time_t t = -1;
570
 
+   struct tm *tm;
571
 
+
572
 
+   check(gmtime(&t), 69, 12, 31, 23, 59);
573
 
+   t = ~(time_t)0 << 31;
574
 
+   check(gmtime(&t), 1, 12, 13, 20, 52);
575
 
+   return 0;
576
 
+}
577
 
+],
578
 
+       rb_cv_negative_time_t=yes,
579
 
+       rb_cv_negative_time_t=no,
580
 
+       rb_cv_negative_time_t=yes)])
581
 
+if test "$rb_cv_negative_time_t" = yes; then
582
 
+  AC_DEFINE(NEGATIVE_TIME_T)
583
 
+fi
584
 
+
585
 
+if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
586
 
+   AC_DEFINE(POSIX_SIGNAL)
587
 
+else
588
 
+  AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
589
 
+    [AC_TRY_RUN([
590
 
+#include <stdio.h>
591
 
+#include <signal.h>
592
 
+
593
 
+void
594
 
+sig_handler(dummy)
595
 
+     int dummy;
596
 
+{
597
 
+}
598
 
+
599
 
+int
600
 
+main()
601
 
+{
602
 
+  signal(SIGINT, sig_handler);
603
 
+  kill(getpid(), SIGINT);
604
 
+  kill(getpid(), SIGINT);
605
 
+  return 0;
606
 
+}
607
 
+],
608
 
+       rb_cv_bsd_signal=yes,
609
 
+       rb_cv_bsd_signal=no,
610
 
+       rb_cv_bsd_signal=no)])
611
 
+  if test "$rb_cv_bsd_signal" = yes; then
612
 
+    AC_DEFINE(BSD_SIGNAL)
613
 
+  fi
614
 
+fi
615
 
+
616
 
+AC_FUNC_GETPGRP
617
 
+AC_FUNC_SETPGRP  
618
 
+
619
 
+AC_C_BIGENDIAN
620
 
+AC_C_CONST
621
 
+AC_C_CHAR_UNSIGNED
622
 
+AC_C_INLINE
623
 
+AC_C_VOLATILE
624
 
+
625
 
+AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
626
 
+    [AC_TRY_RUN([
627
 
+int
628
 
+main()
629
 
+{
630
 
+  if (-1==(-1>>1))
631
 
+    return 0;
632
 
+  return 1;
633
 
+}
634
 
+],
635
 
+       rb_cv_rshift_sign=yes,
636
 
+       rb_cv_rshift_sign=no,
637
 
+       rb_cv_rshift_sign=yes)])
638
 
+if test "$rb_cv_rshift_sign" = yes; then
639
 
+  AC_DEFINE(RSHIFT(x,y), ((x)>>(int)y))
640
 
+else
641
 
+  AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y))
642
 
+fi
643
 
+
644
 
+AC_MSG_CHECKING(read count field in FILE structures)
645
 
+AC_CACHE_VAL(rb_cv_fcnt,
646
 
+[for fcnt in   dnl
647
 
+     _cnt      dnl
648
 
+     __cnt     dnl
649
 
+     _r                dnl
650
 
+     readCount dnl
651
 
+     _rcount   dnl for emx0.9c
652
 
+; do
653
 
+    AC_TRY_COMPILE([#include <stdio.h>
654
 
+],
655
 
+       [FILE *f = stdin; f->$fcnt = 0;],
656
 
+       rb_cv_fcnt="$fcnt"; break,
657
 
+       rb_cv_fcnt="not found")
658
 
+done])
659
 
+if test "$rb_cv_fcnt" = "not found"; then
660
 
+  AC_MSG_RESULT([not found(OK if using GNU libc)])
661
 
+else
662
 
+  AC_MSG_RESULT($rb_cv_fcnt)
663
 
+  AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)
664
 
+fi
665
 
+
666
 
+AC_MSG_CHECKING(read buffer ptr field in FILE structures)
667
 
+AC_CACHE_VAL(rb_cv_frptr,
668
 
+[for frptr in  dnl
669
 
+     _IO_read_ptr dnl
670
 
+     _ptr      dnl
671
 
+     __ptr     dnl
672
 
+     bufpos    dnl
673
 
+     _p        dnl
674
 
+; do
675
 
+    AC_TRY_COMPILE([#include <stdio.h>
676
 
+],
677
 
+       [FILE *f = stdin; char buf[256]; f->$frptr = buf;],
678
 
+       rb_cv_frptr="$frptr"; break,
679
 
+       rb_cv_frptr="not found")
680
 
+done])
681
 
+if test "$rb_cv_frptr" = "not found"; then
682
 
+  AC_MSG_RESULT([not found])
683
 
+else
684
 
+  AC_MSG_RESULT($rb_cv_frptr)
685
 
+  AC_DEFINE_UNQUOTED(FILE_READPTR, $rb_cv_frptr)
686
 
+
687
 
+  if test "$rb_cv_fcnt" = "not found"; then
688
 
+    AC_MSG_CHECKING(read buffer end field in FILE structures)
689
 
+    AC_CACHE_VAL(rb_cv_frend,
690
 
+    [for frend in      dnl
691
 
+         _IO_read_end  dnl
692
 
+         bufread       dnl
693
 
+    ; do
694
 
+        AC_TRY_COMPILE([#include <stdio.h>
695
 
+    ],
696
 
+       [FILE *f = stdin; char buf[256]; f->$frend = buf;],
697
 
+       rb_cv_frend="$frend"; break,
698
 
+       rb_cv_frend="not found")
699
 
+    done])
700
 
+    if test "$rb_cv_frend" = "not found"; then
701
 
+      AC_MSG_RESULT([not found])
702
 
+    else
703
 
+      AC_MSG_RESULT($rb_cv_frend)
704
 
+      AC_DEFINE_UNQUOTED(FILE_READEND, $rb_cv_frend)
705
 
+    fi
706
 
+  fi
707
 
+fi
708
 
+
709
 
+AC_DEFUN([RUBY_CHECK_IO_NEED],
710
 
+[AC_CACHE_CHECK(whether need to [$1], [$2],
711
 
+    [AC_TRY_RUN([
712
 
+#include <stdio.h>
713
 
+#ifndef SEEK_SET
714
 
+#define SEEK_SET 0
715
 
+#endif
716
 
+#ifndef SEEK_CUR
717
 
+#define SEEK_CUR 1
718
 
+#endif
719
 
+#define before_seek(f) ]ifelse(index($2,flush_before_seek),-1,[fflush(f)],[(f,0)])[
720
 
+#define reset_rw(f) ]ifelse(index($2,seek_between_rw),-1,[do_seek(f,SEEK_CUR)],[(f,0)])[
721
 
+#define do_seek(f, w) (before_seek(f), fseek(f,0,w))
722
 
+
723
 
+char *fn = "conftest.dat";
724
 
+char *wombat = "wombat\n";
725
 
+char *koara = "koara\n";
726
 
+char *kangaroo = "kangaroo\n";
727
 
+
728
 
+int main()
729
 
+{
730
 
+    char buf[BUFSIZ];
731
 
+    FILE *f;
732
 
+    int r = 1;
733
 
+
734
 
+    if (!(f = fopen(fn, "w+"))) return 1;
735
 
+    fputs(wombat, f);
736
 
+    do_seek(f, SEEK_SET);
737
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
738
 
+    reset_rw(f);
739
 
+    fputs(koara, f);
740
 
+    fputs(kangaroo, f);
741
 
+    do_seek(f, SEEK_SET);
742
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
743
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara)) goto fail;
744
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
745
 
+    do_seek(f, SEEK_SET);
746
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
747
 
+    reset_rw(f);
748
 
+    fputc('X', f);
749
 
+    reset_rw(f);
750
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara+1)) goto fail;
751
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
752
 
+    do_seek(f, SEEK_SET);
753
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
754
 
+    if (!fgets(buf, BUFSIZ, f) || buf[0] != 'X' || strcmp(buf+1, koara+1)) goto fail;
755
 
+    if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
756
 
+    r = 0;
757
 
+  fail:
758
 
+    fclose(f);
759
 
+    unlink(fn);
760
 
+    return r;
761
 
+}
762
 
+], [$2]=no, [$2]=yes, [$2]=[$3])])])
763
 
+RUBY_CHECK_IO_NEED(seek between R/W, rb_cv_need_io_seek_between_rw, yes)
764
 
+if test "$rb_cv_need_io_seek_between_rw" = yes; then
765
 
+  AC_DEFINE(NEED_IO_SEEK_BETWEEN_RW, 1)
766
 
+fi
767
 
+dnl RUBY_CHECK_IO_NEED(flush before seek, rb_cv_need_io_flush_before_seek, no)
768
 
+dnl if test "$rb_cv_need_io_flush_before_seek" = yes; then
769
 
+dnl   AC_DEFINE(NEED_IO_FLUSH_BEFORE_SEEK, 1)
770
 
+dnl fi
771
 
+
772
 
+AC_CACHE_CHECK([whether st_ino is huge], rb_cv_huge_st_ino,
773
 
+[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([
774
 
+#include <sys/stat.h>
775
 
+struct stat test_stat;
776
 
+], [sizeof(test_stat.st_ino)>sizeof(long)])],
777
 
+rb_cv_huge_st_ino=yes,
778
 
+rb_cv_huge_st_ino=no)
779
 
+])
780
 
+if test $rb_cv_huge_st_ino = yes; then
781
 
+  AC_DEFINE(HUGE_ST_INO)
782
 
+fi
783
 
+
784
 
+if test "$ac_cv_func_sysconf" = yes; then
785
 
+  AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl
786
 
+  AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1),
787
 
+    [AC_TRY_COMPILE([#include <unistd.h>
788
 
+      ],
789
 
+      [_SC_$1 >= 0],
790
 
+      rb_cv_have_sc_[]m4_tolower($1)=yes,
791
 
+      rb_cv_have_sc_[]m4_tolower($1)=no)
792
 
+    ])
793
 
+  if test "$rb_cv_have_sc_[]m4_tolower($1)" = yes; then
794
 
+    AC_DEFINE(HAVE__SC_$1)
795
 
+  fi
796
 
+  ])
797
 
+  RUBY_CHECK_SYSCONF(CLK_TCK)
798
 
+fi
799
 
+
800
 
+case "$target_cpu" in
801
 
+m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;;
802
 
+hppa*) rb_cv_stack_grow_dir=+1;;
803
 
+esac
804
 
+AC_CACHE_CHECK(stack growing direction, rb_cv_stack_grow_dir,
805
 
+  [AC_TRY_RUN([
806
 
+/* recurse to get rid of inlining */
807
 
+static int
808
 
+stack_growup_p(addr, n)
809
 
+    volatile int *addr, n;
810
 
+{
811
 
+    volatile int end;
812
 
+    if (n > 0)
813
 
+       return *addr = stack_growup_p(addr, n - 1);
814
 
+    else
815
 
+       return (&end > addr);
816
 
+}
817
 
+int main()
818
 
+{
819
 
+    int x;
820
 
+    return stack_growup_p(&x, 10);
821
 
+}
822
 
+], rb_cv_stack_grow_dir=-1, rb_cv_stack_grow_dir=+1, rb_cv_stack_grow_dir=0)])
823
 
+AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $rb_cv_stack_grow_dir)
824
 
+
825
 
+if test x"$enable_pthread" = xyes; then
826
 
+    for pthread_lib in pthread pthreads c c_r; do
827
 
+       AC_CHECK_LIB($pthread_lib, pthread_kill,
828
 
+                    rb_with_pthread=yes, rb_with_pthread=no)
829
 
+       if test "$rb_with_pthread" = "yes"; then break; fi
830
 
+    done
831
 
+    if test x"$rb_with_pthread" = xyes; then
832
 
+       AC_DEFINE(_REENTRANT)
833
 
+       AC_DEFINE(_THREAD_SAFE)
834
 
+       AC_DEFINE(HAVE_LIBPTHREAD)
835
 
+       case $pthread_lib in
836
 
+       c)
837
 
+           ;;
838
 
+       c_r)
839
 
+           MAINLIBS="-pthread $MAINLIBS"
840
 
+           ;;
841
 
+       *)
842
 
+           LIBS="-l$pthread_lib $LIBS"
843
 
+           ;;
844
 
+       esac
845
 
+    else
846
 
+       AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
847
 
+    fi
848
 
+    AC_CHECK_FUNCS(nanosleep)
849
 
+    if test x"$ac_cv_func_nanosleep" = xno; then
850
 
+       AC_CHECK_LIB(rt, nanosleep)
851
 
+       if test x"$ac_cv_lib_rt_nanosleep" = xyes; then
852
 
+           AC_DEFINE(HAVE_NANOSLEEP)
853
 
+       fi
854
 
+    fi
855
 
+fi
856
 
+if test x"$ac_cv_header_ucontext_h" = xyes; then
857
 
+    if test x"$target_cpu" = xia64 -o x"$rb_with_pthread" = xyes; then
858
 
+       AC_CHECK_FUNCS(getcontext setcontext)
859
 
+    fi
860
 
+fi
861
 
+
862
 
+dnl default value for $KANJI
863
 
+DEFAULT_KCODE="KCODE_NONE"
864
 
+
865
 
+AC_ARG_WITH(default-kcode, 
866
 
+       [  --with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)], 
867
 
+       [case $withval in
868
 
+       utf8) DEFAULT_KCODE="KCODE_UTF8";;
869
 
+       euc)  DEFAULT_KCODE="KCODE_EUC";;
870
 
+       sjis) DEFAULT_KCODE="KCODE_SJIS";;
871
 
+       none) DEFAULT_KCODE="KCODE_NONE";;
872
 
+        *)    AC_MSG_WARN($withval is not valid kcode; ignored);;
873
 
+       esac])
874
 
+AC_DEFINE_UNQUOTED(DEFAULT_KCODE, $DEFAULT_KCODE)
875
 
+
876
 
+dnl wheather use dln_a_out or not
877
 
+AC_ARG_WITH(dln-a-out, 
878
 
+       [  --with-dln-a-out        use dln_a_out if possible], [
879
 
+       case $withval in
880
 
+       yes) with_dln_a_out=yes;;
881
 
+       *)   with_dln_a_out=no;;
882
 
+       esac], [with_dln_a_out=no])
883
 
+
884
 
+AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
885
 
+[AC_TRY_RUN([
886
 
+/* Test for whether ELF binaries are produced */
887
 
+#include <fcntl.h>
888
 
+#include <stdlib.h>
889
 
+main() {
890
 
+       char buffer[4];
891
 
+       int i=open("conftest",O_RDONLY);
892
 
+       if(i==-1)
893
 
+               exit(1); /* fail */
894
 
+       if(read(i,&buffer[0],4)<4)
895
 
+               exit(1); /* fail */
896
 
+       if(buffer[0] != 127 || buffer[1] != 'E' ||
897
 
+           buffer[2] != 'L' || buffer[3] != 'F')
898
 
+               exit(1); /* fail */
899
 
+       exit(0); /* succeed (yes, it's ELF) */
900
 
+}
901
 
+],
902
 
+rb_cv_binary_elf=yes,
903
 
+rb_cv_binary_elf=no,
904
 
+rb_cv_binary_elf=yes)])
905
 
+
906
 
+if test "$rb_cv_binary_elf" = yes; then
907
 
+  AC_DEFINE(USE_ELF)
908
 
+fi
909
 
+
910
 
+case "$target_os" in
911
 
+linux* | gnu* | k*bsd*-gnu | bsdi*)
912
 
+    if test "$rb_cv_binary_elf" = no; then
913
 
+       with_dln_a_out=yes
914
 
+    else
915
 
+       LDFLAGS="$LDFLAGS -rdynamic"
916
 
+    fi;;
917
 
+esac
918
 
+LIBEXT=a
919
 
+
920
 
+AC_SUBST(DLDFLAGS)dnl
921
 
+AC_SUBST(ARCH_FLAG)dnl
922
 
+
923
 
+AC_SUBST(STATIC)dnl
924
 
+AC_SUBST(CCDLFLAGS)dnl
925
 
+AC_SUBST(LDSHARED)dnl
926
 
+AC_SUBST(DLEXT)dnl
927
 
+AC_SUBST(DLEXT2)dnl
928
 
+AC_SUBST(LIBEXT)dnl
929
 
+
930
 
+STATIC=
931
 
+: ${LIBPATHFLAG=' -L"%s"'}
932
 
+: ${PATHFLAG=''}
933
 
+
934
 
+if test "$with_dln_a_out" != yes; then
935
 
+  rb_cv_dlopen=unknown
936
 
+  AC_MSG_CHECKING(whether OS depend dynamic link works)
937
 
+  if test "$GCC" = yes; then
938
 
+    case "$target_os" in
939
 
+    nextstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
940
 
+    openstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
941
 
+    rhapsody*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
942
 
+    darwin*)   CCDLFLAGS="$CCDLFLAGS -fno-common";;
943
 
+    human*|bsdi*|beos*|cygwin*|mingw*|aix*|interix*) ;;
944
 
+    *) CCDLFLAGS="$CCDLFLAGS -fPIC";;
945
 
+    esac
946
 
+  else
947
 
+    case "$target_os" in
948
 
+       hpux*)          CCDLFLAGS="$CCDLFLAGS +Z";;
949
 
+       solaris*|irix*) CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
950
 
+       sunos*)         CCDLFLAGS="$CCDLFLAGS -PIC" ;;
951
 
+       esix*|uxpds*)   CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
952
 
+       *)              : ${CCDLFLAGS=""} ;;
953
 
+    esac
954
 
+  fi
955
 
+
956
 
+  case "$target_os" in
957
 
+       hpux*)          DLDFLAGS="$DLDFLAGS -E"
958
 
+                       : ${LDSHARED='ld -b'}
959
 
+                       XLDFLAGS="$XLDFLAGS -Wl,-E"
960
 
+                       : ${LIBPATHENV=SHLIB_PATH}
961
 
+                       rb_cv_dlopen=yes;;
962
 
+       solaris*)       if test "$GCC" = yes; then
963
 
+                          : ${LDSHARED='$(CC) -shared'}
964
 
+                          if test "$rb_cv_prog_gnu_ld" = yes; then
965
 
+                              LDFLAGS="$LDFLAGS -Wl,-E"
966
 
+                          fi
967
 
+                       else
968
 
+                          : ${LDSHARED='ld -G'}
969
 
+                       fi
970
 
+                       rb_cv_dlopen=yes;;
971
 
+       sunos*)         : ${LDSHARED='ld -assert nodefinitions'}
972
 
+                       rb_cv_dlopen=yes;;
973
 
+       irix*)          : ${LDSHARED='ld -shared'}
974
 
+                       rb_cv_dlopen=yes;;
975
 
+       sysv4*)         : ${LDSHARED='ld -G'}
976
 
+                       rb_cv_dlopen=yes;;
977
 
+        nto-qnx*)       : ${LDSHARED="qcc -shared"}
978
 
+                        rb_cv_dlopen=yes ;;
979
 
+       esix*|uxpds*)   : ${LDSHARED="ld -G"}
980
 
+                       rb_cv_dlopen=yes ;;
981
 
+       osf*)           : ${LDSHARED="ld -shared -expect_unresolved \"*\""}
982
 
+                       rb_cv_dlopen=yes ;;
983
 
+       bsdi3*)         case "$CC" in
984
 
+                       *shlicc*)       : ${LDSHARED="$CC -r"}
985
 
+                                       rb_cv_dlopen=yes ;;
986
 
+                       esac ;;
987
 
+       linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi*)
988
 
+                       : ${LDSHARED='${CC} -shared'}
989
 
+                       if test "$rb_cv_binary_elf" = yes; then
990
 
+                           LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
991
 
+                       fi
992
 
+                       rb_cv_dlopen=yes ;;
993
 
+       interix*)       : ${LDSHARED="$CC -shared"}
994
 
+                       XLDFLAGS="$XLDFLAGS -Wl,-E"
995
 
+                       LIBPATHFLAG=" -L'%1\$-s'"
996
 
+                       rb_cv_dlopen=yes ;;
997
 
+       freebsd*|dragonfly*)       : ${LDSHARED="$CC -shared"}
998
 
+                       if test "$rb_cv_binary_elf" = yes; then
999
 
+                           LDFLAGS="$LDFLAGS -rdynamic"
1000
 
+                           DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
1001
 
+                       else
1002
 
+                         test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED="ld -Bshareable"
1003
 
+                       fi
1004
 
+                       rb_cv_dlopen=yes ;;
1005
 
+       openbsd*)       : ${LDSHARED="\$(CC) -shared ${CCDLFLAGS}"}
1006
 
+                       if test "$rb_cv_binary_elf" = yes; then
1007
 
+                           LDFLAGS="$LDFLAGS -Wl,-E"
1008
 
+                       fi
1009
 
+                       rb_cv_dlopen=yes ;;
1010
 
+       nextstep*)      : ${LDSHARED='cc -r -nostdlib'}
1011
 
+                       LDFLAGS="$LDFLAGS -u libsys_s"
1012
 
+                       rb_cv_dlopen=yes ;;
1013
 
+       openstep*)      : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
1014
 
+                       : ${LDFLAGS=""}
1015
 
+                       rb_cv_dlopen=yes ;;
1016
 
+       rhapsody*)      : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
1017
 
+                       : ${LDFLAGS=""}
1018
 
+                       rb_cv_dlopen=yes ;;
1019
 
+       darwin*)        : ${LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace'}
1020
 
+                       : ${LDFLAGS=""}
1021
 
+                       : ${LIBPATHENV=DYLD_LIBRARY_PATH}
1022
 
+                       rb_cv_dlopen=yes ;;
1023
 
+        aix*)           if test "$GCC" = yes; then
1024
 
+                           : ${LDSHARED='gcc -shared'}
1025
 
+                           DLDFLAGS='-Wl,-G -eInit_$(TARGET)'
1026
 
+                           LDFLAGS='-Wl,-brtl -Wl,-bE:ruby.imp'
1027
 
+                        else
1028
 
+                          : ${LDSHARED='/usr/ccs/bin/ld'}
1029
 
+                          DLDFLAGS='-G -eInit_$(TARGET)'
1030
 
+                          LDFLAGS="-brtl -bE:ruby.imp"
1031
 
+                        fi
1032
 
+                        : ${ARCHFILE="ruby.imp"}
1033
 
+                        TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
1034
 
+                        TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
1035
 
+                        : ${LIBPATHENV=SHLIB_PATH}
1036
 
+                        rb_cv_dlopen=yes ;;
1037
 
+       human*)         : ${DLDFLAGS=''}
1038
 
+                       : ${LDSHARED=''}
1039
 
+                       : ${LDFLAGS=''}
1040
 
+                       : ${LINK_SO='ar cru $@ $(OBJS)'}
1041
 
+                       rb_cv_dlopen=yes ;;
1042
 
+       beos*)          case "$target_cpu" in
1043
 
+                         powerpc*)
1044
 
+                           : ${LDSHARED="ld -xms"}
1045
 
+                           DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
1046
 
+                            ;;
1047
 
+                         i586*)
1048
 
+                           : ${LDSHARED="ld -shared"}
1049
 
+                           DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
1050
 
+                           ;;
1051
 
+                       esac
1052
 
+                       : ${LIBPATHENV=LIBRARY_PATH}
1053
 
+                       rb_cv_dlopen=yes ;;
1054
 
+       nto-qnx*)       DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
1055
 
+                       : ${LDSHARED='ld -Bshareable -x'}
1056
 
+                       LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
1057
 
+                       rb_cv_dlopen=yes;;
1058
 
+       cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"}
1059
 
+                       XLDFLAGS="$XLDFLAGS -Wl,--stack,0x02000000"
1060
 
+                       DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-import,--export-all"
1061
 
+                       : ${LIBPATHENV=""}
1062
 
+                       rb_cv_dlopen=yes ;;
1063
 
+       hiuxmpp)        : ${LDSHARED='ld -r'} ;;
1064
 
+       atheos*)        : ${LDSHARED="$CC -shared"}
1065
 
+                       rb_cv_dlopen=yes ;;
1066
 
+       os2-emx*)       LDFLAGS="$LDFLAGS -Zbsd-signals"
1067
 
+                       ;;
1068
 
+       *)              : ${LDSHARED='ld'} ;;
1069
 
+  esac
1070
 
+  AC_MSG_RESULT($rb_cv_dlopen)
1071
 
+
1072
 
+  AC_ARG_ENABLE(rpath,
1073
 
+       [  --disable-rpath         embed run path into extension libraries.],
1074
 
+       [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
1075
 
+  if test "$enable_rpath" = yes; then
1076
 
+    LIBPATHFLAG=" -L'%1\$-s'"
1077
 
+    if test "$GCC" = yes; then
1078
 
+       RPATHFLAG=" -Wl,-R'%1\$-s'"
1079
 
+    else
1080
 
+       RPATHFLAG=" -R'%1\$-s'"
1081
 
+    fi
1082
 
+  fi
1083
 
+fi
1084
 
+AC_SUBST(LINK_SO)
1085
 
+AC_SUBST(LIBPATHFLAG)
1086
 
+AC_SUBST(RPATHFLAG)
1087
 
+AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
1088
 
+AC_SUBST(TRY_LINK)
1089
 
+
1090
 
+dln_a_out_works=no
1091
 
+if test "$ac_cv_header_a_out_h" = yes; then
1092
 
+  if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
1093
 
+    cat confdefs.h > config.h
1094
 
+    AC_CACHE_CHECK(whether matz's dln works, rb_cv_dln_a_out,
1095
 
+    [AC_TRY_COMPILE([
1096
 
+#define USE_DLN_A_OUT
1097
 
+#include "dln.c"
1098
 
+],
1099
 
+       [], 
1100
 
+       rb_cv_dln_a_out=yes,
1101
 
+       rb_cv_dln_a_out=no)])
1102
 
+    if test "$rb_cv_dln_a_out" = yes; then
1103
 
+      dln_a_out_works=yes
1104
 
+      AC_DEFINE(USE_DLN_A_OUT)
1105
 
+    fi
1106
 
+  fi
1107
 
+fi
1108
 
+
1109
 
+if test "$dln_a_out_works" = yes; then
1110
 
+  if test "$GCC" = yes; then
1111
 
+    STATIC=-static
1112
 
+  else
1113
 
+    STATIC=-Bstatic
1114
 
+  fi
1115
 
+  DLEXT=so
1116
 
+  AC_DEFINE(DLEXT, ".so")
1117
 
+  CCDLFLAGS=
1118
 
+else
1119
 
+  case "$target_os" in
1120
 
+    hpux*)     DLEXT=sl
1121
 
+               AC_DEFINE(DLEXT, ".sl");;
1122
 
+    nextstep*) DLEXT=bundle
1123
 
+               AC_DEFINE(DLEXT, ".bundle");;
1124
 
+    openstep*) DLEXT=bundle
1125
 
+               AC_DEFINE(DLEXT, ".bundle");;
1126
 
+    rhapsody*) DLEXT=bundle
1127
 
+               AC_DEFINE(DLEXT, ".bundle");;
1128
 
+    darwin*)   DLEXT=bundle
1129
 
+               AC_DEFINE(DLEXT, ".bundle");;
1130
 
+    os2-emx*)  DLEXT=dll
1131
 
+               AC_DEFINE(DLEXT, ".dll");;
1132
 
+    cygwin*|mingw*)    DLEXT=so
1133
 
+               AC_DEFINE(DLEXT, ".so")
1134
 
+               DLEXT2=dll
1135
 
+               AC_DEFINE(DLEXT2, ".dll");;
1136
 
+    *)         DLEXT=so
1137
 
+               AC_DEFINE(DLEXT, ".so");;
1138
 
+  esac
1139
 
+fi
1140
 
+
1141
 
+AC_SUBST(STRIP)dnl
1142
 
+if test "$with_dln_a_out" = yes; then
1143
 
+  STRIP=true
1144
 
+else
1145
 
+  STRIP=strip
1146
 
+fi
1147
 
+
1148
 
+case "$target_os" in
1149
 
+  linux* | gnu* | k*bsd*-gnu)
1150
 
+       STRIP='strip -S -x';;
1151
 
+  nextstep*)
1152
 
+       STRIP='strip -A -n';;
1153
 
+  openstep*)
1154
 
+       STRIP='strip -A -n';;
1155
 
+  rhapsody*)
1156
 
+       STRIP='strip -A -n';;
1157
 
+  darwin*)
1158
 
+       STRIP='strip -A -n';;
1159
 
+esac
1160
 
+
1161
 
+EXTSTATIC=
1162
 
+AC_SUBST(EXTSTATIC)dnl
1163
 
+AC_ARG_WITH(static-linked-ext,
1164
 
+           [  --with-static-linked-ext link external modules statically],
1165
 
+            [case $withval in
1166
 
+            yes) STATIC=
1167
 
+                 EXTSTATIC=static;;
1168
 
+            *) ;;
1169
 
+            esac])
1170
 
+
1171
 
+case "$target_os" in
1172
 
+  human*)
1173
 
+    AC_CHECK_LIB(signal, _harderr)
1174
 
+    AC_CHECK_LIB(hmem, hmemset)
1175
 
+    AC_CHECK_FUNCS(select gettimeofday)
1176
 
+    AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
1177
 
+                  rb_cv_missing__dtos18,
1178
 
+    [AC_TRY_RUN(
1179
 
+changequote(<<, >>)dnl
1180
 
+<<
1181
 
+#include <stdio.h>
1182
 
+main ()
1183
 
+{
1184
 
+   char buf[256];
1185
 
+   sprintf (buf, "%g", 1e+300);
1186
 
+   exit (strcmp (buf, "1e+300") ? 0 : 1);
1187
 
+}
1188
 
+>>,
1189
 
+changequote([, ])dnl
1190
 
+rb_cv_missing__dtos18=yes, rb_cv_missing__dtos18=no, rb_cv_missing__dtos18=no)])
1191
 
+    if test "$rb_cv_missing__dtos18" = yes; then
1192
 
+      AC_DEFINE(MISSING__DTOS18)
1193
 
+    fi
1194
 
+    AC_CACHE_CHECK(whether PD libc fconvert fail to round,
1195
 
+                  rb_cv_missing_fconvert,
1196
 
+    [AC_TRY_RUN(
1197
 
+changequote(<<, >>)dnl
1198
 
+<<
1199
 
+#include <stdio.h>
1200
 
+#include <math.h>
1201
 
+main ()
1202
 
+{
1203
 
+  char buf[256];
1204
 
+  sprintf (buf, "%f", log(exp(1.0)));
1205
 
+  exit (strcmp (buf, "1.000000") ? 0 : 1);
1206
 
+}
1207
 
+>>,
1208
 
+changequote([, ])dnl
1209
 
+rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no)])
1210
 
+    if test "$rb_cv_missing_fconvert" = yes; then
1211
 
+      AC_DEFINE(MISSING_FCONVERT)
1212
 
+    fi
1213
 
+    AC_LIBOBJ([x68.o])
1214
 
+    CFLAGS="$CFLAGS -fansi-only"
1215
 
+    XCFLAGS="$XCFLAGS -cc1-stack=262144 -cpp-stack=2694144"
1216
 
+    EXEEXT=.x
1217
 
+    OBJEXT=o
1218
 
+    setup=Setup.x68
1219
 
+    ;;
1220
 
+  dnl OS/2 environment w/ Autoconf 2.1x for EMX
1221
 
+  os2-emx)
1222
 
+    AC_LIBOBJ([os2])
1223
 
+    setup=Setup.emx
1224
 
+    ;;
1225
 
+  *djgpp*)
1226
 
+    setup=Setup.dj
1227
 
+    ;;
1228
 
+  *)
1229
 
+    setup=Setup
1230
 
+    ;;
1231
 
+esac
1232
 
+
1233
 
+AC_SUBST(setup)
1234
 
+
1235
 
+if test "$prefix" = NONE; then
1236
 
+  prefix=$ac_default_prefix
1237
 
+fi
1238
 
+
1239
 
+#if test "$fat_binary" != no ; then
1240
 
+#  CFLAGS="$CFLAGS $ARCH_FLAG"
1241
 
+#fi
1242
 
+
1243
 
+if test x"$cross_compiling" = xyes; then
1244
 
+  test x"$MINIRUBY" = x && MINIRUBY="${RUBY-ruby} -I`pwd` -rfake"
1245
 
+  PREP=fake.rb
1246
 
+  RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
1247
 
+else
1248
 
+  MINIRUBY='./miniruby$(EXEEXT)'
1249
 
+  PREP='miniruby$(EXEEXT)'
1250
 
+  RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT) --'
1251
 
+fi
1252
 
+AC_SUBST(MINIRUBY)
1253
 
+AC_SUBST(PREP)
1254
 
+AC_SUBST(RUNRUBY)
1255
 
+AC_SUBST(EXTOUT, [${EXTOUT-.ext}])
1256
 
+
1257
 
+FIRSTMAKEFILE=""
1258
 
+LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
1259
 
+LIBRUBY='$(LIBRUBY_A)'
1260
 
+LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static'
1261
 
+LIBRUBYARG='$(LIBRUBYARG_STATIC)'
1262
 
+SOLIBS=
1263
 
+
1264
 
+case "$target_os" in
1265
 
+  cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|darwin*|os2-emx*)
1266
 
+    : ${DLDLIBS=""}
1267
 
+    ;;
1268
 
+  *)
1269
 
+    DLDLIBS="$DLDLIBS -lc"
1270
 
+    ;;
1271
 
+esac
1272
 
+
1273
 
+RUBY_SO_NAME='$(RUBY_INSTALL_NAME)'
1274
 
+LIBRUBY_LDSHARED=$LDSHARED
1275
 
+LIBRUBY_DLDFLAGS=$DLDFLAGS
1276
 
+LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
1277
 
+LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so'
1278
 
+ENABLE_SHARED=no
1279
 
+
1280
 
+AC_ARG_ENABLE(shared,
1281
 
+       [  --enable-shared         build a shared library for Ruby. ],
1282
 
+       [enable_shared=$enableval])
1283
 
+if test "$enable_shared" = 'yes'; then
1284
 
+  LIBRUBY='$(LIBRUBY_SO)'
1285
 
+  LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)'
1286
 
+  LIBRUBYARG='$(LIBRUBYARG_SHARED)'
1287
 
+  CFLAGS="$CFLAGS $CCDLFLAGS"
1288
 
+  ENABLE_SHARED=yes
1289
 
+  if test "$rb_cv_binary_elf" = yes; then
1290
 
+    SOLIBS='$(LIBS)'
1291
 
+  fi
1292
 
+  case "$target_os" in
1293
 
+    sunos4*)
1294
 
+       LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
1295
 
+       ;;
1296
 
+    linux* | gnu* | k*bsd*-gnu | atheos*)
1297
 
+       LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
1298
 
+       LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
1299
 
+       ;;
1300
 
+    freebsd*|dragonfly*)
1301
 
+       SOLIBS='$(LIBS)'
1302
 
+       LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
1303
 
+       if test "$rb_cv_binary_elf" != "yes" ; then
1304
 
+           LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
1305
 
+           LIBRUBY_ALIASES=''
1306
 
+       fi
1307
 
+       ;;
1308
 
+    netbsd*)
1309
 
+       SOLIBS='$(LIBS)'
1310
 
+       LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
1311
 
+       LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
1312
 
+       if test "$rb_cv_binary_elf" = yes; then # ELF platforms
1313
 
+          LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
1314
 
+       else    # a.out platforms
1315
 
+          LIBRUBY_ALIASES=""
1316
 
+       fi
1317
 
+       ;;
1318
 
+    openbsd*)
1319
 
+       SOLIBS='$(LIBS)'
1320
 
+       LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
1321
 
+       ;;
1322
 
+    solaris*)
1323
 
+       SOLIBS='$(LIBS)'
1324
 
+       LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)'
1325
 
+       LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY) lib$(RUBY_SO_NAME).so'
1326
 
+       if test "$GCC" = yes; then
1327
 
+           LIBRUBY_DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(@F)'
1328
 
+       fi
1329
 
+       XLDFLAGS="$XLDFLAGS "'-R${libdir}'
1330
 
+       ;;
1331
 
+    hpux*)
1332
 
+       XLDFLAGS="$XLDFLAGS "'-Wl,+s,+b,$(libdir)'
1333
 
+       LIBRUBY_SO='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)'
1334
 
+       LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
1335
 
+       ;;
1336
 
+    aix*)
1337
 
+       if test "$GCC" = yes; then
1338
 
+           LIBRUBY_LDSHARED='$(CC) -shared'
1339
 
+           LIBRUBY_DLDFLAGS='-Wl,-G -Wl,-bE:ruby.imp -Wl,-bnoentry'
1340
 
+       else
1341
 
+           LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
1342
 
+           LIBRUBY_DLDFLAGS='-G -bE:ruby.imp -bnoentry'
1343
 
+       fi
1344
 
+       LIBRUBYARG_SHARED='-L${libdir} -lruby'
1345
 
+       SOLIBS='-lm -lc'
1346
 
+       ;;
1347
 
+    beos*)
1348
 
+       case "$target_cpu" in
1349
 
+       powerpc*)
1350
 
+           LIBRUBY_DLDFLAGS='-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
1351
 
+           ;;
1352
 
+       esac
1353
 
+       ;;
1354
 
+    darwin*)
1355
 
+       LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib'
1356
 
+       LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
1357
 
+       LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)'
1358
 
+       LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
1359
 
+       ;;
1360
 
+    interix*)
1361
 
+       LIBRUBYARG_SHARED='-L${libdir} -L. -l$(RUBY_SO_NAME)'
1362
 
+       ;;
1363
 
+    *)
1364
 
+       ;;
1365
 
+  esac
1366
 
+fi
1367
 
+if test "$enable_rpath" = yes; then
1368
 
+    if test "$GCC" = yes; then
1369
 
+       LIBRUBYARG_SHARED='-Wl,-R -Wl,$(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
1370
 
+    else
1371
 
+       LIBRUBYARG_SHARED='-R $(libdir) -L$(libdir) -L. '"$LIBRUBYARG_SHARED"
1372
 
+    fi
1373
 
+fi
1374
 
+
1375
 
+XLDFLAGS="$XLDFLAGS -L."
1376
 
+AC_SUBST(ARCHFILE)
1377
 
+
1378
 
+dnl build rdoc index if requested
1379
 
+RDOCTARGET=""
1380
 
+AC_ARG_ENABLE(install-doc,
1381
 
+       [  --enable-install-doc    build and install rdoc indexes during install ],
1382
 
+       [install_doc=$enableval], [install_doc=no])
1383
 
+if test "$install_doc" != no; then
1384
 
+   RDOCTARGET="install-doc"
1385
 
+fi
1386
 
+AC_SUBST(RDOCTARGET)
1387
 
+
1388
 
+case "$target_os" in
1389
 
+    netbsd*)
1390
 
+       CFLAGS="$CFLAGS -pipe"
1391
 
+       ;;
1392
 
+    nextstep*|openstep*)
1393
 
+       # The -fno-common is needed if we wish to embed the Ruby interpreter
1394
 
+       # into a plugin module of some project (as opposed to embedding it
1395
 
+       # within the project's application).  The -I/usr/local/include is
1396
 
+       # needed because CPP as discovered by configure (cc -E -traditional)
1397
 
+       # fails to consult /usr/local/include by default.  This causes
1398
 
+       # mkmf.rb's have_header() to fail if the desired resource happens to be
1399
 
+       # installed in the /usr/local tree.
1400
 
+       CFLAGS="$CFLAGS -pipe -fno-common"
1401
 
+       CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1402
 
+       ;;
1403
 
+    rhapsody*)
1404
 
+       CFLAGS="$CFLAGS -pipe -no-precomp -fno-common"
1405
 
+       ;;
1406
 
+    darwin*)
1407
 
+       CFLAGS="$CFLAGS -pipe -fno-common"
1408
 
+       ;;
1409
 
+    os2-emx)
1410
 
+       CFLAGS="$CFLAGS -DOS2 -Zmts"
1411
 
+       LIBRUBY_A=`echo $LIBRUBY_A | sed 's/^lib//'`
1412
 
+       LIBRUBY_SO=`echo $LIBRUBY_SO | sed 's/^lib//'`
1413
 
+       LIBRUBY_ALIASES=`for i in $LIBRUBY_ALIASES; do echo "$i"; done | sed 's/^lib//'`
1414
 
+       ;;
1415
 
+    osf*)
1416
 
+       if test "$GCC" != "yes" ; then
1417
 
+         # compile something small: taint.c is fine for this.
1418
 
+         # the main point is the '-v' flag of 'cc'.
1419
 
+         case "`cc -v -I. -c main.c -o /tmp/main.o 2>&1`" in
1420
 
+         */gemc_cc*)   # we have the new DEC GEM CC
1421
 
+                        CFLAGS="$CFLAGS -oldc"
1422
 
+                        ;;
1423
 
+          *)            # we have the old MIPS CC
1424
 
+                        ;;
1425
 
+          esac
1426
 
+         # cleanup
1427
 
+         rm -f /tmp/main.o
1428
 
+         CFLAGS="$CFLAGS -std"
1429
 
+       fi
1430
 
+               ;;
1431
 
+    beos*)
1432
 
+       case "$target_cpu" in
1433
 
+       powerpc*)
1434
 
+           CFLAGS="$CFLAGS -relax_pointers"
1435
 
+           ;;
1436
 
+       esac
1437
 
+       ;;
1438
 
+    cygwin*|mingw*)
1439
 
+       case "$target_os" in
1440
 
+       cygwin*)
1441
 
+           if test x"$enable_shared" = xyes; then
1442
 
+               LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}.dll
1443
 
+               LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
1444
 
+           fi
1445
 
+           AC_LIBOBJ([strftime])
1446
 
+           ;;
1447
 
+       mingw*)
1448
 
+           RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
1449
 
+           if test x"$enable_shared" = xyes; then
1450
 
+               LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
1451
 
+               LIBRUBY='lib$(LIBRUBY_SO).a'
1452
 
+           fi
1453
 
+           AC_LIBOBJ([win32])
1454
 
+           COMMON_LIBS=m
1455
 
+#          COMMON_MACROS="WIN32_LEAN_AND_MEAN="
1456
 
+           COMMON_HEADERS="windows.h winsock.h"
1457
 
+           ;;
1458
 
+       esac
1459
 
+       LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
1460
 
+       LIBRUBY_ALIASES=''
1461
 
+       FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
1462
 
+       SOLIBS='$(LIBS)'
1463
 
+       if test x"$enable_shared" = xno; then
1464
 
+           LIBRUBY_SO=dummy
1465
 
+           LIBRUBY='lib$(RUBY_SO_NAME).a'
1466
 
+           LIBRUBYARG='-l$(RUBY_SO_NAME)'
1467
 
+       fi
1468
 
+       MINIOBJS=dmydln.o
1469
 
+       ;;
1470
 
+    hpux*)
1471
 
+       case "$YACC" in
1472
 
+         *yacc*)
1473
 
+           XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300"
1474
 
+           YACC="$YACC -Nl40000 -Nm40000"
1475
 
+           ;;
1476
 
+       esac
1477
 
+       MINIOBJS=dmydln.o
1478
 
+       ;;
1479
 
+    aix*)
1480
 
+       PREINSTALL='@$(RM) -r $(prefix)/lib/$(LIBRUBY_A) $(prefix)/lib/$(LIBRUBY_SO) $(prefix)/lib/ruby/$(MAJOR).$(MINOR)/$(arch)'
1481
 
+       ;;
1482
 
+    *)
1483
 
+       ;;
1484
 
+esac
1485
 
+
1486
 
+case "$build_os" in
1487
 
+  *msdosdjgpp*) FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in;;
1488
 
+esac
1489
 
+
1490
 
+AC_SUBST(XCFLAGS)dnl
1491
 
+AC_SUBST(XLDFLAGS)dnl
1492
 
+AC_SUBST(LIBRUBY_LDSHARED)
1493
 
+AC_SUBST(LIBRUBY_DLDFLAGS)
1494
 
+AC_SUBST(RUBY_INSTALL_NAME)
1495
 
+AC_SUBST(rubyw_install_name)
1496
 
+AC_SUBST(RUBYW_INSTALL_NAME)
1497
 
+AC_SUBST(RUBY_SO_NAME)
1498
 
+AC_SUBST(LIBRUBY_A)
1499
 
+AC_SUBST(LIBRUBY_SO)
1500
 
+AC_SUBST(LIBRUBY_ALIASES)
1501
 
+AC_SUBST(LIBRUBY)
1502
 
+AC_SUBST(LIBRUBYARG)
1503
 
+AC_SUBST(LIBRUBYARG_STATIC)
1504
 
+AC_SUBST(LIBRUBYARG_SHARED)
1505
 
+AC_SUBST(SOLIBS)
1506
 
+AC_SUBST(DLDLIBS)
1507
 
+AC_SUBST(ENABLE_SHARED)
1508
 
+AC_SUBST(MAINLIBS)
1509
 
+AC_SUBST(COMMON_LIBS)
1510
 
+AC_SUBST(COMMON_MACROS)
1511
 
+AC_SUBST(COMMON_HEADERS)
1512
 
+AC_SUBST(EXPORT_PREFIX)
1513
 
+AC_SUBST(MINIOBJS)
1514
 
+AC_SUBST(PREINSTALL)
1515
 
+
1516
 
+MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
1517
 
+MAKEFILES="`echo $MAKEFILES`"
1518
 
+AC_SUBST(MAKEFILES)
1519
 
+
1520
 
+ri_prefix=
1521
 
+test "$program_prefix" != NONE &&
1522
 
+  ri_prefix=$program_prefix
1523
 
+
1524
 
+ri_suffix=
1525
 
+test "$program_suffix" != NONE &&
1526
 
+  ri_suffix=$program_suffix
1527
 
+
1528
 
+RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
1529
 
+case "$target_os" in
1530
 
+  cygwin*|mingw*)
1531
 
+    RUBYW_INSTALL_NAME="${ri_prefix}rubyw${ri_suffix}"
1532
 
+    rubyw_install_name="$RUBYW_INSTALL_NAME"
1533
 
+    ;;
1534
 
+esac
1535
 
+case "$target_os" in
1536
 
+  cygwin*|mingw*|*djgpp*|os2-emx*)
1537
 
+    RUBY_LIB_PREFIX="/lib/ruby"
1538
 
+    ;;
1539
 
+  *)
1540
 
+    RUBY_LIB_PREFIX="${prefix}/lib/ruby"
1541
 
+    ;;
1542
 
+esac
1543
 
+RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
1544
 
+
1545
 
+AC_ARG_WITH(sitedir,
1546
 
+           [  --with-sitedir=DIR      site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
1547
 
+            [sitedir=$withval],
1548
 
+            [sitedir='${prefix}/lib/ruby/site_ruby'])
1549
 
+SITE_DIR="`eval \"echo ${sitedir}\"`"
1550
 
+case "$target_os" in
1551
 
+  cygwin*|mingw*|*djgpp*|os2-emx*)
1552
 
+    RUBY_SITE_LIB_PATH="`expr "$SITE_DIR" : "$prefix\(/.*\)"`" ||
1553
 
+    RUBY_SITE_LIB_PATH="$SITE_DIR";;
1554
 
+  *)
1555
 
+    RUBY_SITE_LIB_PATH="$SITE_DIR";;
1556
 
+esac
1557
 
+RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
1558
 
+
1559
 
+AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
1560
 
+AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
1561
 
+AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
1562
 
+
1563
 
+AC_SUBST(arch)dnl
1564
 
+AC_SUBST(sitearch)dnl
1565
 
+AC_SUBST(sitedir)dnl
1566
 
+
1567
 
+configure_args=$ac_configure_args
1568
 
+AC_SUBST(configure_args)dnl
1569
 
+
1570
 
+if test "$fat_binary" != no ; then
1571
 
+    arch="fat-${target_os}"
1572
 
+
1573
 
+    AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
1574
 
+                 "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
1575
 
+
1576
 
+    AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
1577
 
+                 "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
1578
 
+    AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
1579
 
+else
1580
 
+    arch="${target_cpu}-${target_os}"
1581
 
+    AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
1582
 
+fi
1583
 
+
1584
 
+case "$target_os" in
1585
 
+  mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
1586
 
+  *) sitearch="${arch}" ;;
1587
 
+esac
1588
 
+
1589
 
+AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
1590
 
+AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
1591
 
+
1592
 
+AC_ARG_WITH(search-path,
1593
 
+               [  --with-search-path=DIR specify the additional search path],
1594
 
+               [search_path=$withval])
1595
 
+if test "$search_path" != ""; then
1596
 
+    AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")
1597
 
+fi
1598
 
+
1599
 
+AC_ARG_WITH(mantype,
1600
 
+               [  --with-mantype=TYPE specify man page type; TYPE is one of man and doc],
1601
 
+               [
1602
 
+                       case "$withval" in
1603
 
+                       man|doc)
1604
 
+                               MANTYPE=$withval
1605
 
+                               ;;
1606
 
+                       *)
1607
 
+                               AC_MSG_ERROR(invalid man type: $withval)
1608
 
+                               ;;
1609
 
+                       esac
1610
 
+               ])
1611
 
+if test -z "$MANTYPE"; then
1612
 
+       AC_PATH_PROGS(NROFF, nroff awf, /bin/false, "/usr/bin:/usr/ucb")
1613
 
+       if ${NROFF} -mdoc ${srcdir}/ruby.1 >/dev/null 2>&1; then
1614
 
+               MANTYPE=doc
1615
 
+       else
1616
 
+               MANTYPE=man
1617
 
+       fi
1618
 
+fi
1619
 
+AC_SUBST(MANTYPE)
1620
 
+
1621
 
+if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then
1622
 
+  echo "config.h unchanged"
1623
 
+else
1624
 
+  echo "creating config.h"
1625
 
+  tr -d '\015' < confdefs.h > config.h
1626
 
+fi
1627
 
+: > confdefs.h
1628
 
+
1629
 
+AC_CONFIG_FILES($FIRSTMAKEFILE)
1630
 
+AC_CONFIG_FILES(Makefile, [{
1631
 
+       echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
1632
 
+       test "$RUBY_INSTALL_NAME$EXEEXT" = ruby || echo 'ruby: $(PROGRAM);'
1633
 
+       sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
1634
 
+} >> Makefile], [RUBY_INSTALL_NAME=$RUBY_INSTALL_NAME EXEEXT=$EXEEXT])
1635
 
+AC_OUTPUT
1636
 
diff -ruN ruby-1.8.5.orig/ruby.c ruby-1.8.5/ruby.c
1637
 
--- ruby-1.8.5.orig/ruby.c      2006-08-16 11:11:21.000000000 +0900
1638
 
+++ ruby-1.8.5/ruby.c   2006-09-19 15:39:46.000000000 +0900
1639
 
@@ -296,6 +296,9 @@
1640
 
     ruby_incpush(RUBY_RELATIVE(RUBY_SITE_THIN_ARCHLIB));
1641
 
 #endif
1642
 
     ruby_incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
1643
 
+#ifdef RUBY_EXTRA_SITE_SEARCH_PATH
1644
 
+    ruby_incpush(RUBY_RELATIVE(RUBY_EXTRA_SITE_SEARCH_PATH));
1645
 
+#endif
1646
 
     ruby_incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
1647
 
 
1648
 
     ruby_incpush(RUBY_RELATIVE(RUBY_LIB));
1649
 
@@ -303,6 +306,9 @@
1650
 
     ruby_incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
1651
 
 #endif
1652
 
     ruby_incpush(RUBY_RELATIVE(RUBY_ARCHLIB));
1653
 
+#ifdef RUBY_EXTRA_SEARCH_PATH
1654
 
+    ruby_incpush(RUBY_RELATIVE(RUBY_EXTRA_SEARCH_PATH));
1655
 
+#endif
1656
 
 
1657
 
     if (rb_safe_level() == 0) {
1658
 
        ruby_incpush(".");