configure: Use pkg-config to determine Ruby CFLAGS/LIBS

This commit is contained in:
Tobias Brunner
2017-06-07 16:48:02 +02:00
parent aa66e2b704
commit d29531c226
4 changed files with 10 additions and 35 deletions
+2 -30
View File
@@ -1011,37 +1011,9 @@ if test x$dumm = xtrue; then
AC_SUBST(gtk_CFLAGS)
AC_SUBST(gtk_LIBS)
AC_CHECK_PROGS(RUBY, ruby)
AC_MSG_CHECKING([for Ruby header files])
if test -n "$RUBY"; then
RUBYINCLUDE=
RUBYDIR=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["rubyhdrdir"]] || ""') 2>/dev/null`
if test -n "$RUBYDIR" -a -r "$RUBYDIR/ruby.h"; then
RUBYARCH=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["arch"]] || ""') 2>/dev/null`
if test -n "$RUBYARCH"; then
AC_MSG_RESULT([$RUBYDIR])
RUBYINCLUDE="-I$RUBYDIR -I$RUBYDIR/$RUBYARCH"
fi
else
RUBYDIR=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["archdir"]] || ""') 2>/dev/null`
if test -n "$RUBYDIR" -a -r "$RUBYDIR/ruby.h"; then
AC_MSG_RESULT([$RUBYDIR])
RUBYINCLUDE="-I$RUBYDIR"
fi
fi
if test -z "$RUBYINCLUDE"; then
AC_MSG_ERROR([ruby.h not found])
fi
AC_SUBST(RUBYINCLUDE)
else
AC_MSG_ERROR([don't know how to run ruby])
fi
AC_MSG_CHECKING([for libruby])
PKG_CHECK_MODULES(ruby, [ruby])
saved_LIBS=$LIBS
LIBS=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["LIBRUBYARG_SHARED"]] || ""') 2>/dev/null`
AC_TRY_LINK_FUNC(ruby_init,
[AC_MSG_RESULT([$LIBS]); RUBYLIB=$LIBS],
[AC_MSG_ERROR([not found])])
AC_SUBST(RUBYLIB)
LIBS=$ruby_LIBS
AC_CHECK_FUNCS(rb_errinfo)
LIBS=$saved_LIBS
fi
+4 -5
View File
@@ -11,15 +11,14 @@ irdumm_SOURCES = irdumm.c
libdumm_la_LIBADD = -lbridge -lfuse -lutil $(top_builddir)/src/libstrongswan/libstrongswan.la
dumm_LDADD = libdumm.la ${gtk_LIBS} $(top_builddir)/src/libstrongswan/libstrongswan.la
irdumm_LDADD = libdumm.la ${RUBYLIB} $(top_builddir)/src/libstrongswan/libstrongswan.la
irdumm_LDADD = libdumm.la ${ruby_LIBS} $(top_builddir)/src/libstrongswan/libstrongswan.la
AM_CPPFLAGS = \
-D_FILE_OFFSET_BITS=64 \
-I$(top_srcdir)/src/libstrongswan \
${RUBYINCLUDE}
-I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = \
${gtk_CFLAGS}
dumm_CFLAGS = ${gtk_CFLAGS}
irdumm_CFLAGS = ${ruby_CFLAGS}
all-local: ext
+2
View File
@@ -30,6 +30,8 @@
#undef PACKAGE_STRING
#undef PACKAGE_BUGREPORT
#undef PACKAGE_URL
#undef HAVE_DLADDR
#undef HAVE_QSORT_R
/* avoid redefintiion of snprintf etc. */
#define RUBY_DONT_SUBST
/* undef our _GNU_SOURCE, as it gets redefined by <ruby.h> */
+2
View File
@@ -19,6 +19,8 @@
#undef PACKAGE_STRING
#undef PACKAGE_BUGREPORT
#undef PACKAGE_URL
#undef HAVE_DLADDR
#undef HAVE_QSORT_R
#include <ruby.h>
#ifdef HAVE_RB_ERRINFO