fe50d2eafd
fine on both 4-STABLE and 5-CURRENT.
80 lines
2.3 KiB
Text
80 lines
2.3 KiB
Text
--- extconf.rb.orig Mon Sep 11 01:14:42 2000
|
|
+++ extconf.rb Thu Mar 29 17:01:54 2001
|
|
@@ -1,35 +1,29 @@
|
|
require 'mkmf'
|
|
|
|
-py_dir = with_config("python-dir")
|
|
-if py_dir
|
|
- dirs = [py_dir]
|
|
-else
|
|
- dirs = ['/usr/local', '/usr']
|
|
- if File.executable? `which python`.chomp
|
|
- d = `python -c 'import sys; print sys.exec_prefix' < /dev/null`
|
|
- d = d.split(/\n/).shift
|
|
- dirs.unshift d if d and File.directory? d
|
|
- end
|
|
-end
|
|
+python = with_config("python", "python1.5")
|
|
+python = `which #{python}`.chomp
|
|
|
|
-for py_dir in dirs
|
|
- py_includedir = py_dir + "/include/python1.5"
|
|
- py_libdir = py_dir + "/lib/python1.5"
|
|
- py_configdir = py_libdir + "/config"
|
|
- py_makefile = py_configdir + "/Makefile"
|
|
+exit(1) unless File.executable? python
|
|
|
|
- print "checking for #{py_makefile}... "
|
|
- if File.exists? py_makefile
|
|
- print "yes\n"
|
|
- break
|
|
- else
|
|
- print "no\n"
|
|
- end
|
|
-end
|
|
-exit(1) unless File.exists? py_makefile
|
|
+py_name = File.basename(python)
|
|
+py_dir = `#{python} -c 'import sys; print sys.exec_prefix' < /dev/null`.split(/\n/)[0]
|
|
+
|
|
+exit(1) unless File.directory? py_dir
|
|
|
|
-$CFLAGS = "-I#{py_includedir}"
|
|
-$LDFLAGS = "-L#{py_configdir}"
|
|
+dir_config("python",
|
|
+ py_dir + "/include/" + py_name,
|
|
+ py_dir + "/lib/" + py_name + "/config")
|
|
+
|
|
+py_makefile = with_config("python-makefile",
|
|
+ py_dir + "/lib/" + py_name + "/config/Makefile")
|
|
+
|
|
+print "checking for #{py_makefile}... "
|
|
+if File.exists? py_makefile
|
|
+ print "yes\n"
|
|
+else
|
|
+ print "no\n"
|
|
+ exit(1)
|
|
+end
|
|
|
|
# If python is linked with extra libraries (e.g. -lpthread on Linux,
|
|
# -lsocket on Solaris, etc.), have_library test will fail and built
|
|
@@ -59,11 +53,13 @@
|
|
end
|
|
$LOCAL_LIBS << py_extralibs
|
|
|
|
-if have_library("python1.5", "Py_Initialize") && have_header("Python.h")
|
|
- # If DEBUG defined, you need python compiled with Py_DEBUG defined,
|
|
- # like as building python with "make OPT='-g -O2 -DPy_DEBUG'"
|
|
- if have_func('_Py_NewReference')
|
|
- $CFLAGS += " -DDEBUG"
|
|
- end
|
|
- create_makefile("python")
|
|
+if !have_library(py_name, "Py_Initialize") || !have_header("Python.h")
|
|
+ exit(1)
|
|
+end
|
|
+
|
|
+# If DEBUG defined, you need python compiled with Py_DEBUG defined,
|
|
+# like as building python with "make OPT='-g -O2 -DPy_DEBUG'"
|
|
+if have_func('_Py_NewReference')
|
|
+ $CFLAGS += " -DDEBUG"
|
|
end
|
|
+create_makefile("python")
|