summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_conftests.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-28 17:24:05 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:13 +1000
commitab1b0965380e927faa39ce4bf7f7de14e2d29afc (patch)
treeaa3143f5349dd1fe0140193eb26689f155535c90 /buildtools/wafsamba/samba_conftests.py
parent28a734829485f74ecff7fa922059c716893bbdc8 (diff)
downloadsamba-ab1b0965380e927faa39ce4bf7f7de14e2d29afc.tar.gz
samba-ab1b0965380e927faa39ce4bf7f7de14e2d29afc.tar.bz2
samba-ab1b0965380e927faa39ce4bf7f7de14e2d29afc.zip
build: auto-detect platforms which don't support shared libs
Diffstat (limited to 'buildtools/wafsamba/samba_conftests.py')
-rw-r--r--buildtools/wafsamba/samba_conftests.py33
1 files changed, 27 insertions, 6 deletions
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 8a9e3f5cd2..47bef40a3d 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -1,7 +1,9 @@
# a set of config tests that use the samba_autoconf functions
# to test for commonly needed configuration options
+
import os, Build, shutil, Utils
from Configure import conf
+from samba_utils import *
@conf
def CHECK_ICONV(conf, define='HAVE_NATIVE_ICONV'):
@@ -67,8 +69,15 @@ def CHECK_CHARSET_EXISTS(conf, charset, outcharset='UCS-2LE', headers=None, defi
# into several parts. I'd quite like to create a set of CHECK_COMPOUND()
# functions that make writing complex compound tests like this much easier
@conf
-def CHECK_RPATH_SUPPORT(conf):
- '''see if the platform supports rpath for libraries'''
+def CHECK_LIBRARY_SUPPORT(conf, rpath=False, msg=None):
+ '''see if the platform supports building libraries'''
+
+ if msg is None:
+ if rpath:
+ msg = "rpath library support"
+ else:
+ msg = "building library support"
+
k = 0
while k < 10000:
dir = os.path.join(conf.blddir, '.conf_check_%d' % k)
@@ -127,19 +136,28 @@ def CHECK_RPATH_SUPPORT(conf):
o = bld(features='cc cprogram',
source='main.c',
target='prog1',
- uselib_local='lib1',
- rpath=os.path.join(bdir, 'default/libdir'))
+ uselib_local='lib1')
+
+ if rpath:
+ o.rpath=os.path.join(bdir, 'default/libdir')
# compile the program
try:
bld.compile()
except:
- conf.check_message('rpath support', '', False)
+ conf.check_message(msg, '', False)
return False
# path for execution
lastprog = o.link_task.outputs[0].abspath(env)
+ if not rpath:
+ if 'LD_LIBRARY_PATH' in os.environ:
+ old_ld_library_path = os.environ['LD_LIBRARY_PATH']
+ else:
+ old_ld_library_path = None
+ ADD_LD_LIBRARY_PATH(os.path.join(bdir, 'default/libdir'))
+
# we need to run the program, try to get its result
args = []
proc = Utils.pproc.Popen([lastprog] + args, stdout=Utils.pproc.PIPE, stderr=Utils.pproc.PIPE)
@@ -151,5 +169,8 @@ def CHECK_RPATH_SUPPORT(conf):
w('\nreturncode %r\n' % proc.returncode)
ret = (proc.returncode == 0)
- conf.check_message('rpath support', '', ret)
+ if not rpath:
+ os.environ['LD_LIBRARY_PATH'] = old_ld_library_path or ''
+
+ conf.check_message(msg, '', ret)
return ret