1#!/usr/bin/env python
2# encoding: utf-8
3# Thomas Nagy, 2006-2018 (ita)
4# Ralf Habacker, 2006 (rh)
5# Yinon Ehrlich, 2009
6# Michael Kuhn, 2009
7
8from waflib.Tools import ccroot, ar
9from waflib.Configure import conf
10
11@conf
12def find_xlc(conf):
13	"""
14	Detects the Aix C compiler
15	"""
16	cc = conf.find_program(['xlc_r', 'xlc'], var='CC')
17	conf.get_xlc_version(cc)
18	conf.env.CC_NAME = 'xlc'
19
20@conf
21def xlc_common_flags(conf):
22	"""
23	Flags required for executing the Aix C compiler
24	"""
25	v = conf.env
26
27	v.CC_SRC_F            = []
28	v.CC_TGT_F            = ['-c', '-o']
29
30	if not v.LINK_CC:
31		v.LINK_CC = v.CC
32
33	v.CCLNK_SRC_F         = []
34	v.CCLNK_TGT_F         = ['-o']
35	v.CPPPATH_ST          = '-I%s'
36	v.DEFINES_ST          = '-D%s'
37
38	v.LIB_ST              = '-l%s' # template for adding libs
39	v.LIBPATH_ST          = '-L%s' # template for adding libpaths
40	v.STLIB_ST            = '-l%s'
41	v.STLIBPATH_ST        = '-L%s'
42	v.RPATH_ST            = '-Wl,-rpath,%s'
43
44	v.SONAME_ST           = []
45	v.SHLIB_MARKER        = []
46	v.STLIB_MARKER        = []
47
48	v.LINKFLAGS_cprogram  = ['-Wl,-brtl']
49	v.cprogram_PATTERN    = '%s'
50
51	v.CFLAGS_cshlib       = ['-fPIC']
52	v.LINKFLAGS_cshlib    = ['-G', '-Wl,-brtl,-bexpfull']
53	v.cshlib_PATTERN      = 'lib%s.so'
54
55	v.LINKFLAGS_cstlib    = []
56	v.cstlib_PATTERN      = 'lib%s.a'
57
58def configure(conf):
59	conf.find_xlc()
60	conf.find_ar()
61	conf.xlc_common_flags()
62	conf.cc_load_tools()
63	conf.cc_add_flags()
64	conf.link_add_flags()
65
66