فهرست منبع

Merge pull request #58 from talex5/pkg-config

Add pkg-config support
Keno Fischer 11 سال پیش
والد
کامیت
17775c52dc
3فایلهای تغییر یافته به همراه31 افزوده شده و 7 حذف شده
  1. 8 3
      Makefile
  2. 10 0
      openlibm.pc.in
  3. 13 4
      src/openlibm.h

+ 8 - 3
Makefile

@@ -44,14 +44,19 @@ distclean:
 	-rm -f $(OBJS) *.a *.$(SHLIB_EXT) libopenlibm.*
 	-$(MAKE) -C test clean
 
-install: all
+openlibm.pc: openlibm.pc.in Make.inc Makefile
+	echo "prefix=${prefix}" > openlibm.pc
+	echo "version=${VERSION}" >> openlibm.pc
+	cat openlibm.pc.in >> openlibm.pc
+
+install: all openlibm.pc
 	mkdir -p $(DESTDIR)$(shlibdir)
-	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(libdir)/pkgconfig
 	mkdir -p $(DESTDIR)$(includedir)/openlibm
 	cp -a libopenlibm.$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
 	cp -a libopenlibm.a $(DESTDIR)$(libdir)/
 	cp -a src/openlibm.h $(DESTDIR)$(includedir)/
-	cp -a include/*.h $(DESTDIR)$(includedir)/openlibm/
+	cp -a openlibm.pc $(DESTDIR)$(libdir)/pkgconfig/
 ifneq ($(wildcard $(ARCH)/bsd_asm.h),)
 	cp -a $(ARCH)/bsd_asm.h $(DESTDIR)$(includedir)/openlibm/
 endif

+ 10 - 0
openlibm.pc.in

@@ -0,0 +1,10 @@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${exec_prefix}/lib
+
+Name: openlibm
+Version: ${version}
+URL: https://github.com/JuliaLang/openlibm
+Description: High quality system independent, open source libm.
+Cflags: -I${includedir}
+Libs: -L${libdir} -lopenlibm

+ 13 - 4
src/openlibm.h

@@ -18,8 +18,12 @@
 #define	_MATH_H_
 
 #include <complex.h>
-#include "cdefs-compat.h"
-#include "types-compat.h"
+
+#if (defined(_WIN32) || defined (_MSC_VER)) && !defined(__WIN32__)
+    #define __WIN32__
+#endif
+
+#define __pure2
 
 /*
  * ANSI/POSIX
@@ -253,7 +257,10 @@ cpackl(long double x, long double y)
  * effect of raising floating-point exceptions, so they are not declared
  * as __pure2.  In C99, FENV_ACCESS affects the purity of these functions.
  */
-__BEGIN_DECLS
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
 /*
  * ANSI/POSIX
  */
@@ -571,5 +578,7 @@ long double	tgammal(long double);
 long double	truncl(long double);
 
 #endif /* __ISO_C_VISIBLE >= 1999 */
-__END_DECLS
+#if defined(__cplusplus)
+}
+#endif
 #endif /* !_MATH_H_ */