xref: /aoo42x/main/RepositoryExternal.mk (revision 1f56509e)
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_set_include,$(1),\
386	$$(INCLUDE) \
387	-I$(OUTDIR)/inc/apr \
388)
389$(call gb_LinkTarget_add_linked_libs,$(1),\
390	apr-1 \
391)
392endef
393
394endif # SYSTEM_APR
395
396
397ifeq ($(SYSTEM_APR_UTIL),YES)
398
399define gb_LinkTarget__use_apr_util
400$(call gb_LinkTarget_add_defs,$(1),\
401	-DSYSTEM_APR_UTIL \
402)
403$(call gb_LinkTarget_set_include,$(1),\
404	$$(INCLUDE) \
405	$(APR_UTIL_CFLAGS) \
406)
407$(call gb_LinkTarget_add_libs,$(1),$(APR_UTIL_LIBS))
408endef
409
410else # !SYSTEM_APR_UTIL
411
412$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
413	aprutil-1 \
414))
415
416define gb_LinkTarget__use_apr_util
417$(call gb_LinkTarget_set_include,$(1),\
418	$$(INCLUDE) \
419	-I$(OUTDIR)/inc/apr-util \
420)
421$(call gb_LinkTarget_add_linked_libs,$(1),\
422	aprutil-1 \
423)
424endef
425
426endif # SYSTEM_APR_UTIL
427
428
429ifeq ($(SYSTEM_SERF),YES)
430
431define gb_LinkTarget__use_serf
432$(call gb_LinkTarget_add_defs,$(1),\
433	-DSYSTEM_SERF \
434)
435$(call gb_LinkTarget_set_include,$(1),\
436	$$(INCLUDE) \
437	$(SERF_CFLAGS) \
438)
439$(call gb_LinkTarget_add_libs,$(1),$(SERF_LIBS))
440endef
441
442else # !SYSTEM_SERF
443
444$(eval $(call gb_Helper_register_libraries,PLAINLIBS_URE, \
445	serf-1 \
446))
447
448define gb_LinkTarget__use_serf
449$(call gb_LinkTarget_set_include,$(1),\
450	$$(INCLUDE) \
451	-I$(OUTDIR)/inc/serf \
452)
453$(call gb_LinkTarget_add_linked_libs,$(1),\
454	serf-1 \
455)
456endef
457
458endif # SYSTEM_SERF
459
460
461ifeq ($(SYSTEM_CURL),YES)
462
463define gb_LinkTarget__use_curl
464$(call gb_LinkTarget_add_defs,$(1),\
465	-DSYSTEM_CURL \
466)
467$(call gb_LinkTarget_set_include,$(1),\
468	$$(INCLUDE) \
469	$(CURL_CFLAGS) \
470)
471$(call gb_LinkTarget_add_libs,$(1),$(CURL_LIBS))
472endef
473
474else # !SYSTEM_CURL
475
476$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
477	curl \
478))
479
480define gb_LinkTarget__use_curl
481$(call gb_LinkTarget_add_linked_libs,$(1),\
482	curl \
483)
484endef
485
486endif # SYSTEM_CURL
487
488
489ifeq ($(SYSTEM_COINMP),YES)
490
491define gb_LinkTarget__use_coinmp
492$(call gb_LinkTarget_add_defs,$(1),\
493	-DSYSTEM_COINMP \
494)
495$(call gb_LinkTarget_set_include,$(1),\
496	$$(INCLUDE) \
497	$(COINMP_CFLAGS) \
498)
499$(call gb_LinkTarget_add_libs,$(1),$(COINMP_LIBS))
500endef
501
502else # !SYSTEM_COINMP
503
504$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
505	CoinMP \
506	CoinUtils \
507	Clp \
508	Cbc \
509	Osi \
510	OsiClp \
511	Cgl \
512	CbcSolver \
513))
514
515define gb_LinkTarget__use_coinmp
516$(call gb_LinkTarget_set_include,$(1),\
517	$$(INCLUDE) \
518	-I$(OUTDIR)/inc/coinmp \
519)
520$(call gb_LinkTarget_add_linked_libs,$(1),\
521	CoinMP \
522	CoinUtils \
523	Clp \
524	Cbc \
525	Osi \
526	OsiClp \
527	Cgl \
528	CbcSolver \
529)
530endef
531
532endif # SYSTEM_COINMP
533
534# vim: set noet sw=4 ts=4:
535