0001-build-ability-to-disable-libbsd-with-without-libbsd.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. From ff3dcc4ad71c1105bd8ea11afe7e07efd48c038d Mon Sep 17 00:00:00 2001
  2. From: Vincent Bernat <vincent@bernat.ch>
  3. Date: Tue, 25 Sep 2018 10:57:49 +0200
  4. Subject: [PATCH] build: ability to disable libbsd with --without-libbsd
  5. This is useful when user wants to ensure reproducibility of the build
  6. whatever libbsd is present or not.
  7. Signed-off-by: Trent Piepho <tpiepho@impinj.com>
  8. ---
  9. configure.ac | 59 +++++++++++++++++++++++++++++++++++++++--------------------
  10. src/marshal.h | 1 +
  11. 2 files changed, 40 insertions(+), 20 deletions(-)
  12. diff --git a/configure.ac b/configure.ac
  13. index 9b40473..589cd96 100644
  14. --- a/configure.ac
  15. +++ b/configure.ac
  16. @@ -173,26 +173,44 @@ AC_FUNC_REALLOC
  17. AC_FUNC_FORK
  18. # Some functions can be in libbsd
  19. -PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
  20. - _save_CFLAGS="$CFLAGS"
  21. - _save_LIBS="$LIBS"
  22. - CFLAGS="$CFLAGS $libbsd_CFLAGS"
  23. - LIBS="$LIBS $libbsd_LIBS"
  24. - AC_MSG_CHECKING([if libbsd can be linked correctly])
  25. - AC_TRY_LINK([
  26. -@%:@include <sys/time.h>
  27. -@%:@include <sys/types.h>
  28. -],[],
  29. - [
  30. - AC_MSG_RESULT(yes)
  31. - LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
  32. - LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
  33. - ],[
  34. - AC_MSG_RESULT(no)
  35. - CFLAGS="$_save_CFLAGS"
  36. - LIBS="$_save_LIBS"
  37. - ])
  38. -], [:])
  39. +AC_ARG_WITH([libbsd],
  40. + AS_HELP_STRING(
  41. + [--with-libbsd],
  42. + [Use libbsd @<:@default=auto@:>@]),
  43. + [],
  44. + [with_libbsd=auto])
  45. +if test x"$with_libbsd" != x"no"; then
  46. + PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
  47. + _save_CFLAGS="$CFLAGS"
  48. + _save_LIBS="$LIBS"
  49. + CFLAGS="$CFLAGS $libbsd_CFLAGS"
  50. + LIBS="$LIBS $libbsd_LIBS"
  51. + AC_MSG_CHECKING([if libbsd can be linked correctly])
  52. + AC_TRY_LINK([
  53. + @%:@include <sys/time.h>
  54. + @%:@include <sys/types.h>
  55. + ],[],
  56. + [
  57. + AC_MSG_RESULT(yes)
  58. + LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
  59. + LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
  60. + with_libbsd=yes
  61. + ],[
  62. + AC_MSG_RESULT(no)
  63. + CFLAGS="$_save_CFLAGS"
  64. + LIBS="$_save_LIBS"
  65. + if test x"$with_libbsd" = x"yes"; then
  66. + AC_MSG_FAILURE([*** no libbsd support found])
  67. + fi
  68. + with_libbsd=no
  69. + ])
  70. + ], [
  71. + if test x"$with_libbsd" = x"yes"; then
  72. + AC_MSG_FAILURE([*** no libbsd support found])
  73. + fi
  74. + with_libbsd=no
  75. + ])
  76. +fi
  77. # setproctitle may have an _init function
  78. AC_REPLACE_FUNCS([setproctitle])
  79. @@ -412,6 +430,7 @@ cat <<EOF
  80. XML output.....: ${with_xml-no}
  81. Oldies support.: $enable_oldies
  82. seccomp........: ${with_seccomp-no}
  83. + libbsd.........: ${with_libbsd-no}
  84. Privilege separation:
  85. Enabled........: $enable_privsep
  86. diff --git a/src/marshal.h b/src/marshal.h
  87. index b0e8032..0a782d5 100644
  88. --- a/src/marshal.h
  89. +++ b/src/marshal.h
  90. @@ -19,6 +19,7 @@
  91. #define _MARSHAL_H
  92. #include <stddef.h>
  93. +#include <stdint.h>
  94. #include <sys/types.h>
  95. struct marshal_info;
  96. --
  97. 2.14.4