xref: /aoo42x/main/RepositoryExternal.mk (revision 45e5bdea)
1###############################################################
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20###############################################################
21
22
23
24# this file describes all the external libraries
25# depending on the configure options these may be taken from the system,
26# or the internal/bundled copy may be built.
27
28# for every external, a function gb_LinkTarget_use__FOO is defined,
29# once for the system case, once for the internal case.
30
31# in the system case, no libraries should be registered, but the target-local
32# variable LIBS should be set to FOO_LIBS, and INCLUDES to FOO_CFLAGS.
33
34
35ifeq ($(SYSTEM_ZLIB),YES)
36
37define gb_LinkTarget__use_zlib
38$(call gb_LinkTarget_add_defs,$(1),\
39	-DSYSTEM_ZLIB \
40)
41$(call gb_LinkTarget_add_libs,$(1),-lz)
42endef
43
44else # !SYSTEM_ZLIB
45
46$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
47	zlib \
48))
49
50define gb_LinkTarget__use_zlib
51$(call gb_LinkTarget_add_linked_static_libs,$(1),\
52	zlib \
53)
54endef
55
56endif # SYSTEM_ZLIB
57
58
59ifeq ($(SYSTEM_JPEG),YES)
60
61define gb_LinkTarget__use_jpeg
62$(call gb_LinkTarget_add_libs,$(1),-ljpeg)
63$(call gb_LinkTarget_set_ldflags,$(1),\
64	$$(filter-out -L/usr/lib/jvm%,$$(T_LDFLAGS)) \
65)
66ifeq ($(OS),FREEBSD)
67# JDK jpeg library on FreeBSD lives under ${JAVA_HOME}/jre/lib/${ARCH}/
68$(call gb_LinkTarget_set_ldflags,$(1),\
69	$$(filter-out -L$$(JAVA_HOME)/jre/lib/%,$$(T_LDFLAGS)) \
70)
71endif
72endef
73
74else # !SYSTEM_JPEG
75
76$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
77	jpeglib \
78))
79
80define gb_LinkTarget__use_jpeg
81$(call gb_LinkTarget_add_linked_static_libs,$(1),\
82	jpeglib \
83)
84endef
85
86endif # SYSTEM_JPEG
87
88
89ifeq ($(SYSTEM_EXPAT),YES)
90
91define gb_LinkTarget__use_expat
92$(if $(2),,$(error gb_LinkTarget__use_expat needs additional parameter))
93
94$(call gb_LinkTarget_add_defs,$(1),\
95	-DSYSTEM_EXPAT \
96)
97
98$(call gb_LinkTarget_add_libs,$(1),-lexpat)
99endef
100
101else # !SYSTEM_EXPAT
102
103$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
104	ascii_expat_xmlparse \
105	expat_xmlparse \
106	expat_xmltok \
107))
108
109define gb_LinkTarget__use_expat
110$(if $(2),,$(error gb_LinkTarget__use_expat needs additional parameter))
111
112$(if $(filter-out ascii_expat_xmlparse,$(2)),\
113	$(call gb_LinkTarget_add_defs,$(1),\
114		-DXML_UNICODE \
115))
116
117$(call gb_LinkTarget_add_linked_static_libs,$(1),\
118	$(2) \
119	expat_xmltok \
120)
121endef
122
123endif # SYSTEM_EXPAT
124
125# now define 2 wrappers that select which internal static library to use...
126define gb_LinkTarget__use_expat_utf8
127$(call gb_LinkTarget__use_expat,$(1),ascii_expat_xmlparse)
128endef
129
130define gb_LinkTarget__use_expat_utf16
131$(call gb_LinkTarget__use_expat,$(1),expat_xmlparse)
132endef
133
134
135ifeq ($(SYSTEM_LIBXML),YES)
136
137define gb_LinkTarget__use_libxml2
138$(call gb_LinkTarget_add_defs,$(1),\
139	-DSYSTEM_LIBXML \
140)
141$(call gb_LinkTarget_set_include,$(1),\
142	$$(INCLUDE) \
143	$(LIBXML_CFLAGS) \
144)
145$(call gb_LinkTarget_add_libs,$(1),$(LIBXML_LIBS))
146endef
147
148else # !SYSTEM_LIBXML
149
150$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
151	xml2 \
152))
153
154define gb_LinkTarget__use_libxml2
155$(call gb_LinkTarget_add_linked_libs,$(1),\
156	xml2 \
157)
158endef
159
160endif # SYSTEM_LIBXML
161
162
163ifeq ($(SYSTEM_LIBXSLT),YES)
164
165define gb_LinkTarget__use_libxslt
166$(call gb_LinkTarget_set_include,$(1),\
167	$$(INCLUDE) \
168	$(LIBXSLT_CFLAGS) \
169)
170$(call gb_LinkTarget_add_libs,$(1),$(LIBXSLT_LIBS))
171endef
172
173else # !SYSTEM_LIBXSLT
174
175$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
176	xslt \
177))
178
179define gb_LinkTarget__use_libxslt
180$(call gb_LinkTarget_add_linked_libs,$(1),\
181	xslt \
182)
183endef
184
185endif # SYSTEM_LIBXSLT
186
187
188ifeq ($(SYSTEM_REDLAND),YES)
189
190define gb_LinkTarget__use_librdf
191$(call gb_LinkTarget_add_defs,$(1),\
192	-DSYSTEM_REDLAND \
193)
194$(call gb_LinkTarget_set_include,$(1),\
195	$$(INCLUDE) \
196	$(REDLAND_CFLAGS) \
197)
198$(call gb_LinkTarget_add_libs,$(1),$(REDLAND_LIBS))
199endef
200
201else # !SYSTEM_REDLAND
202
203$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
204	rdf \
205))
206
207define gb_LinkTarget__use_librdf
208$(call gb_LinkTarget_add_linked_libs,$(1),\
209	rdf \
210)
211endef
212
213endif # SYSTEM_REDLAND
214
215
216ifeq ($(SYSTEM_CAIRO),YES)
217
218# FREETYPE_CLAGS from environment if ENABLE_CAIRO is used
219define gb_LinkTarget__use_cairo
220$(call gb_LinkTarget_set_include,$(1),\
221	$$(INCLUDE) \
222	$(FREETYPE_CFLAGS) \
223	$(CAIRO_CFLAGS) \
224)
225$(call gb_LinkTarget_add_libs,$(1),$(CAIRO_LIBS))
226endef
227
228else # !SYSTEM_CAIRO
229
230$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
231	cairo \
232))
233ifneq ($(OS),WNT)
234$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
235	pixman-1 \
236))
237endif # WNT
238
239define gb_LinkTarget__use_cairo
240$(call gb_LinkTarget_set_include,$(1),\
241	$$(INCLUDE) \
242	-I$(OUTDIR)/inc/cairo \
243	$(FREETYPE_CFLAGS) \
244)
245$(call gb_LinkTarget_add_linked_libs,$(1),\
246	cairo \
247)
248ifneq ($(OS),WNT)
249$(call gb_LinkTarget_add_linked_libs,$(1),\
250	pixman-1 \
251)
252endif
253endef
254
255endif # SYSTEM_CAIRO
256
257
258ifeq ($(SYSTEM_GRAPHITE),YES)
259
260#check for building with stlport, but graphite was not built with stlport
261define gb_LinkTarget__use_graphite
262ifneq ($(USE_SYSTEM_STL),YES)
263$(call gb_LinkTarget_add_defs,$(1),\
264	-DADAPT_EXT_STL \
265)
266endif
267$(call gb_LinkTarget_set_include,$(1),\
268	$$(INCLUDE) \
269	$(GRAPHITE_CFLAGS) \
270)
271$(call gb_LinkTarget_add_libs,$(1),$(GRAPHITE_LIBS))
272endef
273
274else # !SYSTEM_GRAPHITE
275
276$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
277    graphite \
278))
279define gb_LinkTarget__use_graphite
280$(call gb_LinkTarget_add_linked_static_libs,$(1),\
281    graphite \
282)
283endef
284
285endif # SYSTEM_GRAPHITE
286
287
288ifeq ($(SYSTEM_ICU),YES)
289
290define gb_LinkTarget__use_icule
291$(call gb_LinkTarget_add_libs,$(1),-licule)
292endef
293define gb_LinkTarget__use_icuuc
294$(call gb_LinkTarget_add_libs,$(1),-licuuc)
295endef
296
297else # !SYSTEM_ICU
298
299$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
300	icule \
301	icuuc \
302))
303
304define gb_LinkTarget__use_icule
305$(call gb_LinkTarget_add_linked_libs,$(1),\
306	icule \
307)
308endef
309define gb_LinkTarget__use_icuuc
310$(call gb_LinkTarget_add_linked_libs,$(1),\
311	icuuc \
312)
313endef
314
315endif # SYSTEM_ICU
316
317
318ifeq ($(SYSTEM_OPENSSL),YES)
319
320define gb_LinkTarget__use_openssl
321$(call gb_LinkTarget_set_include,$(1),\
322	$$(INCLUDE) \
323	$(OPENSSL_CFLAGS) \
324)
325$(call gb_LinkTarget_add_libs,$(1),$(OPENSSL_LIBS))
326endef
327
328else # !SYSTEM_OPENSSL
329
330ifeq ($(OS),WNT)
331$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
332    crypto \
333    ssl \
334))
335else
336$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
337    crypto \
338    ssl \
339))
340endif
341
342define gb_LinkTarget__use_openssl
343ifeq ($(OS),WNT)
344$(call gb_LinkTarget_add_linked_libs,$(1),\
345	crypto \
346	ssl \
347)
348else
349$(call gb_LinkTarget_add_linked_static_libs,$(1),\
350	crypto \
351	ssl \
352)
353ifeq ($(OS),SOLARIS)
354$(call gb_LinkTarget_add_libs,$(1),\
355	-lnsl \
356	-lsocket \
357)
358endif
359endif
360endef
361
362endif # SYSTEM_OPENSSL
363
364
365ifeq ($(SYSTEM_APR),YES)
366
367define gb_LinkTarget__use_apr
368$(call gb_LinkTarget_add_defs,$(1),\
369        -DSYSTEM_APR \
370)
371$(call gb_LinkTarget_set_include,$(1),\
372	$$(INCLUDE) \
373	$(APR_CFLAGS) \
374)
375$(call gb_LinkTarget_add_libs,$(1),$(APR_LIBS))
376endef
377
378else # !SYSTEM_APR
379
380$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
381	apr-1 \
382))
383
384define gb_LinkTarget__use_apr
385$(call gb_LinkTarget_add_linked_libs,$(1),\
386	apr-1 \
387)
388endef
389
390endif # SYSTEM_APR
391
392
393ifeq ($(SYSTEM_APR_UTIL),YES)
394
395define gb_LinkTarget__use_apr_util
396$(call gb_LinkTarget_add_defs,$(1),\
397	-DSYSTEM_APR_UTIL \
398)
399$(call gb_LinkTarget_set_include,$(1),\
400	$$(INCLUDE) \
401	$(APR_UTIL_CFLAGS) \
402)
403$(call gb_LinkTarget_add_libs,$(1),$(APR_UTIL_LIBS))
404endef
405
406else # !SYSTEM_APR_UTIL
407
408$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
409	aprutil-1 \
410))
411
412define gb_LinkTarget__use_apr_util
413$(call gb_LinkTarget_add_linked_libs,$(1),\
414	aprutil-1 \
415)
416endef
417
418endif # SYSTEM_APR_UTIL
419
420
421ifeq ($(SYSTEM_SERF),YES)
422
423define gb_LinkTarget__use_serf
424$(call gb_LinkTarget_add_defs,$(1),\
425	-DSYSTEM_SERF \
426)
427$(call gb_LinkTarget_set_include,$(1),\
428	$$(INCLUDE) \
429	$(SERF_CFLAGS) \
430)
431$(call gb_LinkTarget_add_libs,$(1),$(SERF_LIBS))
432endef
433
434else # !SYSTEM_SERF
435
436$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
437	serf-1 \
438))
439
440define gb_LinkTarget__use_serf
441$(call gb_LinkTarget_set_include,$(1),\
442	$$(INCLUDE) \
443	-I$(OUTDIR)/inc/serf \
444)
445$(call gb_LinkTarget_add_linked_libs,$(1),\
446	serf-1 \
447)
448endef
449
450endif # SYSTEM_SERF
451
452
453# vim: set noet sw=4 ts=4:
454