Brian Candler <B.Candler / pobox.com> writes:

> On Fri, May 02, 2003 at 10:53:46PM +0900, KUBO Takehiro wrote:
>> Does gcc make 32 bit object in any case? If so, I'll change oraconf.rb
>> as following.
>
> Unfortunately I know little about Solaris, and I don't have a Sun 'cc' to
> compare with 'gcc'
>
> I'm not convinced it's specific to Oracle 9.2 problem. The box where I had
> this problem was running gcc 3.1. I've just gone back to the older box
> (running 9.0.1 / gcc 2.95.3) and compiled ruby-oci8-0.1.3 and it does
> compile without patching. However the demo.mk has both 'build' and 'build32'
> targets, just the same as Oracle 9.2
>
> It's not impossible that I had frigged something manually in those Makefiles
> a long time ago to make it compile, I can't be sure; or it might be a gcc
> 2.95.3/3.1 difference.
>
> Perhaps it would be better as an option to extconf.rb, like
>    --force-32bit
> or something.

Hmm, how about the follow patch.
If error on 'build', add '32' as postfix and retry.
It is available both Sun cc and gcc, I assume.

--- ruby-oci8-0.1.3.old/src/oraconf.rb	2003-03-08 22:29:01.000000000 +0900
+++ ruby-oci8-0.1.3/src/oraconf.rb	2003-05-03 14:40:17.000000000 +0900
@@ -103,9 +103,18 @@
 	  @libs = get_libs()
 
 	  $CFLAGS += ' ' + @cflags
-	  $libs += " -L#{CONFIG["libdir"]} " + @libs
+	  $libs += " -L#{CONFIG['libdir']} " + @libs
 	  unless have_func("OCIInitialize", "oci.h")
-		raise 'cannot compile OCI' 
+		ok = false
+		case RUBY_PLATFORM
+		when /solaris/
+		  if /9../ =~ @version
+			@libs = get_libs('32')
+			$libs += " -L#{CONFIG['libdir']} " + @libs
+			ok = true if have_func("OCIInitialize", "oci.h")
+		  end
+		end
+		raise 'cannot compile OCI' unless ok
 	  end
 	ensure
 	  $CFLAGS = original_CFLAGS
@@ -206,18 +215,18 @@
 	  end
 	end # get_cflags
 
-	def get_libs
-	  print("Running make for $ORACLE_HOME/rdbms/demo/demo_rdbms.mk ...")
+	def get_libs(postfix = '')
+	  print("Running make for $ORACLE_HOME/rdbms/demo/demo_rdbms.mk (build#{postfix}) ...")
 	  STDOUT.flush
 
 	  make_opt = "CC='echo MARKER' EXE=/dev/null ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh'"
 	  if @cc_is_gcc && /solaris/ =~ RUBY_PLATFORM
 		# suggested by Brian Candler.
-		make_opt += " KPIC_OPTION= NOKPIC_CCFLAGS="
+		make_opt += " KPIC_OPTION= NOKPIC_CCFLAGS#{postfix}="
 	  end
 
-	  command = "|make -f #{@oracle_home}/rdbms/demo/demo_rdbms.mk build #{make_opt}"
-	  marker = /^\s*MARKER/					 
+	  command = "|make -f #{@oracle_home}/rdbms/demo/demo_rdbms.mk build#{postfix} #{make_opt}"
+	  marker = /^\s*MARKER/
 	  echo = /^\s*echo/
 	  libs = nil
 	  Logging::open do

-- 
KUBO Takehiro