--- configure.ac.orig	2017-01-09 16:58:58 UTC
+++ configure.ac
@@ -31,8 +31,8 @@ dnl AC_FUNC_MALLOC
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([getcwd strcasecmp strchr strdup strerror strncasecmp strrchr])
 
-LIBS="$LIBS $RAPTOR_LIBS"
-AM_CFLAGS="$CFLAGS $RAPTOR_CFLAGS"
+LIBS="$RAPTOR_LIBS $LIBS" 
+AM_CFLAGS="$RAPTOR_CFLAGS $CFLAGS"
 
 AC_SUBST(AM_CFLAGS)
 AC_SUBST(LIBS)
