Skip to content

Commit

Permalink
Makes ./configure output more helpful and adds a Makevars.win.
Browse files Browse the repository at this point in the history
  • Loading branch information
atheriel committed Aug 28, 2019
1 parent dc53e41 commit 2aa03cd
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 22 deletions.
45 changes: 32 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3505,6 +3505,9 @@ fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`

# Look for librabbitmq/rabbitmq-c.
have_librabbitmq=no

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing amqp_new_connection" >&5
$as_echo_n "checking for library containing amqp_new_connection... " >&6; }
if ${ac_cv_search_amqp_new_connection+:} false; then :
Expand Down Expand Up @@ -3558,9 +3561,7 @@ $as_echo "$ac_cv_search_amqp_new_connection" >&6; }
ac_res=$ac_cv_search_amqp_new_connection
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"

else
as_fn_error $? "librabbitmq is required. Try 'apt install librabbitmq-dev'." "$LINENO" 5
have_librabbitmq=yes
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
Expand Down Expand Up @@ -3829,14 +3830,32 @@ if test "x$ac_cv_header_amqp_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_AMQP_H 1
_ACEOF

else
as_fn_error $? "The librabbitmq headers are required. Try 'apt install librabbitmq-dev'." "$LINENO" 5
have_librabbitmq=yes
fi

done


if test "x${have_librabbitmq}" = xno; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "
---
The librabbitmq/rabbitmq-c headers could not be found. Please install
- librabbitmq-dev on Debian-based systems (including Ubuntu)
- librabbitmq-devel on Fedora-based systems (including CentOS, RHEL)
- librabbitmq-c on Arch-based systems
- rabbitmq-c (via Homebrew) on macOS
and try again. If you do have this library and this installation still fails,
you can provide the location of the library directly with
R CMD INSTALL longears --configure-vars='LIBS=-L/path/to/libs CPPFLAGS=-I/path/to/headers'
---
See \`config.log' for more details" "$LINENO" 5; }
fi

PKG_LIBS="${PKG_LIBS} ${ac_cv_search_amqp_new_connection}"

PKG_CPPFLAGS="${PKG_CPPFLAGS}"
Expand Down Expand Up @@ -4999,11 +5018,11 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
echo "
Configuration:
==============
echo "---
Configuration:
cc: ${CC}
cflags: ${CFLAGS}
libs: ${PKG_LIBS}
"
CC: ${CC}
CFLAGS: ${CFLAGS}
CPPFLAGS: ${PKG_CPPFLAGS}
LIBS: ${PKG_LIBS}
---"
38 changes: 29 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,39 @@ fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`

AC_SEARCH_LIBS(amqp_new_connection, rabbitmq, [], [AC_ERROR([librabbitmq is required. Try 'apt install librabbitmq-dev'.])])
AC_CHECK_HEADERS(amqp.h, [], [AC_ERROR([The librabbitmq headers are required. Try 'apt install librabbitmq-dev'.])])
# Look for librabbitmq/rabbitmq-c.
have_librabbitmq=no

AC_SEARCH_LIBS(amqp_new_connection, rabbitmq, [have_librabbitmq=yes])
AC_CHECK_HEADERS(amqp.h, [have_librabbitmq=yes])

if test "x${have_librabbitmq}" = xno; then
AC_MSG_FAILURE([
---
The librabbitmq/rabbitmq-c headers could not be found. Please install
- librabbitmq-dev on Debian-based systems (including Ubuntu)
- librabbitmq-devel on Fedora-based systems (including CentOS, RHEL)
- librabbitmq-c on Arch-based systems
- rabbitmq-c (via Homebrew) on macOS
and try again. If you do have this library and this installation still fails,
you can provide the location of the library directly with
R CMD INSTALL longears --configure-vars='LIBS=-L/path/to/libs CPPFLAGS=-I/path/to/headers'
---])
fi

AC_SUBST([PKG_LIBS],["${PKG_LIBS} ${ac_cv_search_amqp_new_connection}"])
AC_SUBST([PKG_CPPFLAGS],["${PKG_CPPFLAGS}"])
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT

echo "
Configuration:
==============
echo "---
Configuration:

cc: ${CC}
cflags: ${CFLAGS}
libs: ${PKG_LIBS}
"
CC: ${CC}
CFLAGS: ${CFLAGS}
CPPFLAGS: ${PKG_CPPFLAGS}
LIBS: ${PKG_LIBS}
---"
2 changes: 2 additions & 0 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PKG_CPPFLAGS = -I.
PKG_LIBS = -lrabbitmq

0 comments on commit 2aa03cd

Please sign in to comment.