Skip to content

Commit 17775c5

Browse files
committed
Merge pull request #58 from talex5/pkg-config
Add pkg-config support
2 parents 1f3925b + 5b16546 commit 17775c5

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ distclean:
4444
-rm -f $(OBJS) *.a *.$(SHLIB_EXT) libopenlibm.*
4545
-$(MAKE) -C test clean
4646

47-
install: all
47+
openlibm.pc: openlibm.pc.in Make.inc Makefile
48+
echo "prefix=${prefix}" > openlibm.pc
49+
echo "version=${VERSION}" >> openlibm.pc
50+
cat openlibm.pc.in >> openlibm.pc
51+
52+
install: all openlibm.pc
4853
mkdir -p $(DESTDIR)$(shlibdir)
49-
mkdir -p $(DESTDIR)$(libdir)
54+
mkdir -p $(DESTDIR)$(libdir)/pkgconfig
5055
mkdir -p $(DESTDIR)$(includedir)/openlibm
5156
cp -a libopenlibm.$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
5257
cp -a libopenlibm.a $(DESTDIR)$(libdir)/
5358
cp -a src/openlibm.h $(DESTDIR)$(includedir)/
54-
cp -a include/*.h $(DESTDIR)$(includedir)/openlibm/
59+
cp -a openlibm.pc $(DESTDIR)$(libdir)/pkgconfig/
5560
ifneq ($(wildcard $(ARCH)/bsd_asm.h),)
5661
cp -a $(ARCH)/bsd_asm.h $(DESTDIR)$(includedir)/openlibm/
5762
endif

openlibm.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
exec_prefix=${prefix}
2+
includedir=${prefix}/include
3+
libdir=${exec_prefix}/lib
4+
5+
Name: openlibm
6+
Version: ${version}
7+
URL: https://github.com/JuliaLang/openlibm
8+
Description: High quality system independent, open source libm.
9+
Cflags: -I${includedir}
10+
Libs: -L${libdir} -lopenlibm

src/openlibm.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
#define _MATH_H_
1919

2020
#include <complex.h>
21-
#include "cdefs-compat.h"
22-
#include "types-compat.h"
21+
22+
#if (defined(_WIN32) || defined (_MSC_VER)) && !defined(__WIN32__)
23+
#define __WIN32__
24+
#endif
25+
26+
#define __pure2
2327

2428
/*
2529
* ANSI/POSIX
@@ -253,7 +257,10 @@ cpackl(long double x, long double y)
253257
* effect of raising floating-point exceptions, so they are not declared
254258
* as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
255259
*/
256-
__BEGIN_DECLS
260+
261+
#if defined(__cplusplus)
262+
extern "C" {
263+
#endif
257264
/*
258265
* ANSI/POSIX
259266
*/
@@ -571,5 +578,7 @@ long double tgammal(long double);
571578
long double truncl(long double);
572579

573580
#endif /* __ISO_C_VISIBLE >= 1999 */
574-
__END_DECLS
581+
#if defined(__cplusplus)
582+
}
583+
#endif
575584
#endif /* !_MATH_H_ */

0 commit comments

Comments
 (0)