xref: /aoo42x/main/RepositoryExternal.mk (revision 52d905a6)
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_icudata
291$(call gb_LinkTarget_add_libs,$(1),-licudata)
292endef
293define gb_LinkTarget__use_icui18n
294$(call gb_LinkTarget_add_libs,$(1),-licui18n)
295endef
296define gb_LinkTarget__use_icule
297$(call gb_LinkTarget_add_libs,$(1),-licule)
298endef
299define gb_LinkTarget__use_icuuc
300$(call gb_LinkTarget_add_libs,$(1),-licuuc)
301endef
302
303else # !SYSTEM_ICU
304
305define gb_LinkTarget__use_icudata
306ifeq ($(OS)$(COM),WNTMSC)
307$(call gb_LinkTarget_add_libs,$(1),icudata.lib)
308else ifeq ($(OS)$(COM),WNTGCC)
309$(call gb_LinkTarget_add_libs,$(1),-licudt40)
310else ifeq ($(OS),OS2)
311$(call gb_LinkTarget_add_libs,$(1),-licudt)
312else
313$(call gb_LinkTarget_add_libs,$(1),-licudata)
314endif
315endef
316
317define gb_LinkTarget__use_icui18n
318ifeq ($(OS)$(COM),WNTMSC)
319$(call gb_LinkTarget_add_libs,$(1),icuin.lib)
320else ifeq ($(OS)$(COM),WNTGCC)
321$(call gb_LinkTarget_add_libs,$(1),-licuin40)
322else ifeq ($(OS),OS2)
323$(call gb_LinkTarget_add_libs,$(1),-licuin)
324else
325$(call gb_LinkTarget_add_libs,$(1),-licui18n)
326endif
327endef
328
329define gb_LinkTarget__use_icule
330ifeq ($(OS)$(COM),WNTMSC)
331$(call gb_LinkTarget_add_libs,$(1),icule.lib)
332else ifeq ($(OS)$(COM),WNTGCC)
333$(call gb_LinkTarget_add_libs,$(1),-licule40)
334else
335$(call gb_LinkTarget_add_libs,$(1),-licule)
336endif
337endef
338
339define gb_LinkTarget__use_icuuc
340ifeq ($(OS)$(COM),WNTMSC)
341$(call gb_LinkTarget_add_libs,$(1),icuuc.lib)
342else ifeq ($(OS)$(COM),WNTGCC)
343$(call gb_LinkTarget_add_libs,$(1),-licuuc40)
344else
345$(call gb_LinkTarget_add_libs,$(1),-licuuc)
346endif
347endef
348
349endif # SYSTEM_ICU
350
351
352ifeq ($(SYSTEM_OPENSSL),YES)
353
354define gb_LinkTarget__use_openssl
355$(call gb_LinkTarget_set_include,$(1),\
356	$$(INCLUDE) \
357	$(OPENSSL_CFLAGS) \
358)
359$(call gb_LinkTarget_add_libs,$(1),$(OPENSSL_LIBS))
360endef
361
362else # !SYSTEM_OPENSSL
363
364ifeq ($(OS),WNT)
365$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
366	crypto \
367	ssl \
368))
369else
370$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
371	crypto \
372	ssl \
373))
374endif
375
376define gb_LinkTarget__use_openssl
377ifeq ($(OS),WNT)
378$(call gb_LinkTarget_add_linked_libs,$(1),\
379	crypto \
380	ssl \
381)
382else
383$(call gb_LinkTarget_add_linked_static_libs,$(1),\
384	crypto \
385	ssl \
386)
387ifeq ($(OS),SOLARIS)
388$(call gb_LinkTarget_add_libs,$(1),\
389	-lnsl \
390	-lsocket \
391)
392endif
393endif
394endef
395
396endif # SYSTEM_OPENSSL
397
398
399ifeq ($(SYSTEM_APR),YES)
400
401define gb_LinkTarget__use_apr
402$(call gb_LinkTarget_add_defs,$(1),\
403		-DSYSTEM_APR \
404)
405$(call gb_LinkTarget_set_include,$(1),\
406	$$(INCLUDE) \
407	$(APR_CFLAGS) \
408)
409$(call gb_LinkTarget_add_libs,$(1),$(APR_LIBS))
410endef
411
412else # !SYSTEM_APR
413
414ifeq ($(OS),WNT)
415$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libapr-1))
416else
417$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,apr-1))
418endif
419
420define gb_LinkTarget__use_apr
421$(call gb_LinkTarget_set_include,$(1),\
422	$$(INCLUDE) \
423	-I$(OUTDIR)/inc/apr \
424)
425ifeq ($(OS),WNT)
426$(call gb_LinkTarget_add_linked_libs,$(1),libapr-1)
427else
428$(call gb_LinkTarget_add_linked_libs,$(1),apr-1)
429endif
430endef
431
432endif # SYSTEM_APR
433
434
435ifeq ($(SYSTEM_APR_UTIL),YES)
436
437define gb_LinkTarget__use_apr_util
438$(call gb_LinkTarget_add_defs,$(1),\
439	-DSYSTEM_APR_UTIL \
440)
441$(call gb_LinkTarget_set_include,$(1),\
442	$$(INCLUDE) \
443	$(APR_UTIL_CFLAGS) \
444)
445$(call gb_LinkTarget_add_libs,$(1),$(APR_UTIL_LIBS))
446endef
447
448else # !SYSTEM_APR_UTIL
449
450# on Windows apr-util is registered by ext_libraries/Repository.mk
451ifneq ($(OS),WNT)
452$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,aprutil-1))
453endif
454
455define gb_LinkTarget__use_apr_util
456$(call gb_LinkTarget_set_include,$(1),\
457	$$(INCLUDE) \
458	-I$(OUTDIR)/inc/apr-util \
459)
460ifeq ($(OS),WNT)
461$(call gb_LinkTarget_add_linked_libs,$(1),apr-util)
462else
463$(call gb_LinkTarget_add_linked_libs,$(1),aprutil-1)
464endif
465endef
466
467endif # SYSTEM_APR_UTIL
468
469
470ifeq ($(SYSTEM_SERF),YES)
471
472define gb_LinkTarget__use_serf
473$(call gb_LinkTarget_add_defs,$(1),\
474	-DSYSTEM_SERF \
475)
476$(call gb_LinkTarget_set_include,$(1),\
477	$$(INCLUDE) \
478	$(SERF_CFLAGS) \
479)
480$(call gb_LinkTarget_add_libs,$(1),$(SERF_LIBS))
481endef
482
483else # !SYSTEM_SERF
484
485# on Windows serf is registered by ext_libraries/Repository.mk
486ifneq ($(OS),WNT)
487$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,serf-1))
488endif
489
490define gb_LinkTarget__use_serf
491$(call gb_LinkTarget_set_include,$(1),\
492	$$(INCLUDE) \
493	-I$(OUTDIR)/inc/serf \
494)
495ifeq ($(OS),WNT)
496$(call gb_LinkTarget_add_linked_libs,$(1),serf)
497else
498$(call gb_LinkTarget_add_linked_libs,$(1),serf-1)
499endif
500endef
501
502endif # SYSTEM_SERF
503
504
505ifeq ($(SYSTEM_CURL),YES)
506
507define gb_LinkTarget__use_curl
508$(call gb_LinkTarget_add_defs,$(1),\
509	-DSYSTEM_CURL \
510)
511$(call gb_LinkTarget_set_include,$(1),\
512	$$(INCLUDE) \
513	$(CURL_CFLAGS) \
514)
515$(call gb_LinkTarget_add_libs,$(1),$(CURL_LIBS))
516endef
517
518else # !SYSTEM_CURL
519
520ifeq ($(OS),WNT)
521$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libcurl))
522else
523$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,curl))
524endif
525
526define gb_LinkTarget__use_curl
527ifeq ($(OS),WNT)
528$(call gb_LinkTarget_add_linked_libs,$(1),libcurl)
529else
530$(call gb_LinkTarget_add_linked_libs,$(1),curl)
531endif
532endef
533
534endif # SYSTEM_CURL
535
536
537ifeq ($(SYSTEM_COINMP),YES)
538
539define gb_LinkTarget__use_coinmp
540$(call gb_LinkTarget_add_defs,$(1),\
541	-DSYSTEM_COINMP \
542)
543$(call gb_LinkTarget_set_include,$(1),\
544	$$(INCLUDE) \
545	$(COINMP_CFLAGS) \
546)
547$(call gb_LinkTarget_add_libs,$(1),$(COINMP_LIBS))
548endef
549
550else # !SYSTEM_COINMP
551
552$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,CoinMP))
553ifneq ($(OS),WNT)
554$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
555	CoinUtils \
556	Clp \
557	Cbc \
558	Osi \
559	OsiClp \
560	Cgl \
561	CbcSolver \
562))
563endif
564
565define gb_LinkTarget__use_coinmp
566$(call gb_LinkTarget_set_include,$(1),\
567	$$(INCLUDE) \
568	-I$(OUTDIR)/inc/coinmp \
569)
570$(call gb_LinkTarget_add_linked_libs,$(1),CoinMP)
571ifneq ($(OS),WNT)
572ifneq ($(OS),OS2)
573$(call gb_LinkTarget_add_linked_libs,$(1),\
574	CoinUtils \
575	Clp \
576	Cbc \
577	Osi \
578	OsiClp \
579	Cgl \
580	CbcSolver \
581)
582endif
583endif
584endef
585
586endif # SYSTEM_COINMP
587
588
589ifeq ($(SYSTEM_HYPH),YES)
590
591define gb_LinkTarget__use_hyphen
592$(call gb_LinkTarget_add_defs,$(1),\
593		-DSYSTEM_HYPH \
594)
595$(call gb_LinkTarget_add_libs,$(1),$(HYPHEN_LIB))
596endef
597
598else # !SYSTEM_HYPH
599
600$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
601		hyphen \
602))
603
604define gb_LinkTarget__use_hyphen
605$(call gb_LinkTarget_add_linked_static_libs,$(1),\
606		hyphen \
607)
608endef
609
610endif # SYSTEM_HYPH
611
612
613ifeq ($(SYSTEM_LIBTEXTCAT),YES)
614
615define gb_LinkTarget__use_libtextcat
616$(call gb_LinkTarget_add_libs,$(1),-ltextcat)
617endef
618
619else # !SYSTEM_LIBTEXTCAT
620
621$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \
622	libtextcat \
623	textcat \
624))
625
626define gb_LinkTarget__use_libtextcat
627ifeq ($(OS),WNT)
628$(call gb_LinkTarget_add_linked_libs,$(1),libtextcat)
629else
630$(call gb_LinkTarget_add_linked_libs,$(1),textcat)
631endif
632endef
633
634endif # SYSTEM_LIBTEXTCAT
635
636
637ifeq ($(SYSTEM_MYTHES),YES)
638
639define gb_LinkTarget__use_mythes
640$(call gb_LinkTarget_set_include,$(1),\
641	$$(INCLUDE) \
642	$(MYTHES_CFLAGS) \
643)
644$(call gb_LinkTarget_add_libs,$(1),$(MYTHES_LIBS))
645endef
646
647else # !SYSTEM_MYTHES
648
649ifeq ($(OS),WNT)
650$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,libmythes))
651else
652$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,mythes-1.2))
653endif
654
655define gb_LinkTarget__use_mythes
656ifeq ($(OS),WNT)
657$(call gb_LinkTarget_add_linked_static_libs,$(1),libmythes)
658else
659$(call gb_LinkTarget_add_linked_static_libs,$(1),mythes-1.2)
660endif
661endef
662
663endif # SYSTEM_MYTHES
664
665
666ifeq ($(SYSTEM_HUNSPELL),YES)
667
668define gb_LinkTarget__use_hunspell
669$(call gb_LinkTarget_set_include,$(1),\
670		$$(INCLUDE) \
671		$(HUNSPELL_CFLAGS) \
672)
673$(call gb_LinkTarget_add_libs,$(1),$(HUNSPELL_LIBS))
674endef
675
676else # !SYSTEM_HUNSPELL
677
678ifeq ($(GUI),WNT)
679$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,libhunspell))
680else ifeq ($(GUI),OS2)
681$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,hunspell))
682else
683$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,hunspell-1.3))
684endif
685
686define gb_LinkTarget__use_hunspell
687$(call gb_LinkTarget_set_include,$(1),\
688	$$(INCLUDE) \
689	-I$(OUTDIR)/inc/hunspell \
690)
691$(call gb_LinkTarget_add_defs,$(1),\
692	-DHUNSPELL_STATIC
693)
694ifeq ($(GUI),WNT)
695$(call gb_LinkTarget_add_linked_static_libs,$(1),libhunspell)
696else ifeq ($(GUI),OS2)
697$(call gb_LinkTarget_add_linked_static_libs,$(1),hunspell)
698else
699$(call gb_LinkTarget_add_linked_static_libs,$(1),hunspell-1.3)
700endif
701endef
702
703endif # SYSTEM_HUNSPELL
704
705# vim: set noet sw=4 ts=4:
706