dmraid-1.0.0_rc16-static-build-fixes.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. --- tools/Makefile.in.old 2010-05-31 07:18:31.000000000 -0400
  2. +++ tools/Makefile.in 2010-12-13 13:15:22.000000000 -0500
  3. @@ -60,17 +60,23 @@
  4. ifeq ("@KLIBC@", "no")
  5. ifeq ("@STATIC_LINK@", "no")
  6. LDFLAGS += -rdynamic
  7. + MYLIBOBJ=$(top_builddir)/lib/libdmraid.so
  8. else
  9. LDFLAGS += -static
  10. + MYLIBOBJ=$(top_builddir)/lib/libdmraid.a
  11. + DMRAIDLIBS += \
  12. + $(DEVMAPPEREVENT_LIBS) \
  13. + $(DEVMAPPER_LIBS) \
  14. + $(DL_LIBS)
  15. endif
  16. endif
  17. .PHONY: install_dmraid_tools
  18. -dmraid: $(OBJECTS) $(top_builddir)/lib/libdmraid.a
  19. +dmraid: $(OBJECTS) $(MYLIBOBJ)
  20. $(CC) -o $@ $(OBJECTS) $(LDFLAGS) -L$(top_builddir)/lib $(DMRAIDLIBS) $(LIBS)
  21. -dmevent_tool: $(OBJECTS2) $(top_builddir)/lib/libdmraid.a
  22. +dmevent_tool: $(OBJECTS2) $(MYLIBOBJ)
  23. $(CC) -o $@ $(OBJECTS2) $(INCLUDES) $(LDFLAGS) -L$(top_builddir)/lib \
  24. $(DMEVENTTOOLLIBS) $(DMRAIDLIBS) $(LIBS)
  25. --- lib/Makefile.in.old 2010-10-27 07:31:46.000000000 -0400
  26. +++ lib/Makefile.in 2010-12-13 13:04:16.000000000 -0500
  27. @@ -60,11 +60,11 @@
  28. USRLIB_RELPATH = $(shell echo $(abspath $(usrlibdir) $(libdir)) | \
  29. $(AWK) -f $(top_srcdir)/tools/relpath.awk)
  30. -TARGETS = $(LIB_STATIC)
  31. +TARGETS = $(LIB_STATIC) $(LIB_SHARED) $(LIB_EVENTS_SHARED)
  32. ifeq ("@KLIBC@", "no")
  33. ifeq ("@STATIC_LINK@", "no")
  34. - TARGETS += $(LIB_SHARED) $(LIB_EVENTS_SHARED)
  35. + TARGETS = $(LIB_SHARED) $(LIB_EVENTS_SHARED)
  36. endif
  37. endif
  38. --- configure.in 2010-05-31 07:18:30.000000000 -0400
  39. +++ configure.in.new 2010-12-07 13:30:40.000000000 -0500
  40. @@ -155,6 +155,15 @@
  41. Default is dynamic linking]),
  42. [STATIC_LINK=$enableval], [STATIC_LINK=no])
  43. +if test "x$STATIC_LINK" != "xno"; then
  44. + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  45. + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
  46. + fi
  47. + PKG_CONFIG="${PKG_CONFIG} --static"
  48. + ac_cv_env_PKG_CONFIG_set=set
  49. +fi
  50. +PKG_PROG_PKG_CONFIG([0.2])
  51. +
  52. dnl Enables shared libdmraid
  53. AC_ARG_ENABLE(shared_lib,
  54. AC_HELP_STRING([--enable-shared_lib], [Use this to generate shared
  55. @@ -248,23 +257,31 @@
  56. AC_HELP_STRING([--with-devmapper-prefix=PFX],
  57. [Where is devmapper library installed]),
  58. [DEVMAPPER_LIBS="-L$withval/lib"
  59. - DEVMAPPER_CFLAGS="-I$withval/include"],
  60. + DEVMAPPER_CFLAGS="-I$withval/include"
  61. + dmprefix=$withval],
  62. [DEVMAPPER_LIBS=
  63. - DEVMAPPER_CFLAGS=])
  64. -save_LDFLAGS=$LDFLAGS
  65. -save_CPPFLAGS=$CPPFLAGS
  66. -LDFLAGS="$LDFLAGS $DEVMAPPER_LIBS"
  67. -CPPFLAGS="$CPPFLAGS $DEVMAPPER_CFLAGS"
  68. -AC_CHECK_LIB(devmapper-event, dm_event_handler_create,
  69. - [DEVMAPPEREVENT_LIBS="$DEVMAPPER_LIBS -ldevmapper-event"],
  70. - [AC_MSG_ERROR([device-mapper-event library is either missing or is too old and badly linked])])
  71. -AC_CHECK_LIB(devmapper, dm_task_set_name,
  72. - [DEVMAPPER_LIBS="$DEVMAPPER_LIBS -ldevmapper"],
  73. - [AC_MSG_ERROR([device-mapper library is missing])])
  74. -AC_CHECK_HEADERS(libdevmapper.h libdevmapper-event.h,,
  75. - [AC_MSG_ERROR([Missing headers device-mapper headers])])
  76. -CPPFLAGS=$save_CPPFLAGS
  77. -LDFLAGS=$save_LDFLAGS
  78. + DEVMAPPER_CFLAGS=
  79. + dmprefix=no])
  80. +if test "x$dmprefix" = xno ; then
  81. + PKG_CHECK_MODULES([DEVMAPPER],[devmapper],
  82. + [PKG_CHECK_MODULES([DEVMAPPEREVENT],[devmapper-event])
  83. + ])
  84. +else
  85. + save_LDFLAGS=$LDFLAGS
  86. + save_CPPFLAGS=$CPPFLAGS
  87. + LDFLAGS="$LDFLAGS $DEVMAPPER_LIBS"
  88. + CPPFLAGS="$CPPFLAGS $DEVMAPPER_CFLAGS"
  89. + AC_CHECK_LIB(devmapper-event, dm_event_handler_create,
  90. + [DEVMAPPEREVENT_LIBS="$DEVMAPPER_LIBS -ldevmapper-event"],
  91. + [AC_MSG_ERROR([device-mapper-event library is either missing or is too old and badly linked])])
  92. + AC_CHECK_LIB(devmapper, dm_task_set_name,
  93. + [DEVMAPPER_LIBS="$DEVMAPPER_LIBS -ldevmapper"],
  94. + [AC_MSG_ERROR([device-mapper library is missing])])
  95. + AC_CHECK_HEADERS(libdevmapper.h libdevmapper-event.h,,
  96. + [AC_MSG_ERROR([Missing headers device-mapper headers])])
  97. + CPPFLAGS=$save_CPPFLAGS
  98. + LDFLAGS=$save_LDFLAGS
  99. +fi
  100. VERSION=$srcdir/tools/VERSION
  101. DMRAID_LIB_MAJOR=$(cut -d. -f1 $VERSION)