busybox: Fix pam_start link errors when PAM support is enabled
[openwrt/svn-archive/archive.git] / package / utils / busybox / Makefile
index 3380885a1dc1d9907b04e99415e52398adf0f6c9..668679e4d2193f62ef730a303616e8680f227c69 100644 (file)
@@ -17,7 +17,7 @@ PKG_SOURCE_URL:=http://www.busybox.net/downloads \
                http://distfiles.gentoo.org/distfiles/
 PKG_MD5SUM:=337d1a15ab1cb1d4ed423168b1eb7d7e
 
-PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc
+PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam
 PKG_BUILD_PARALLEL:=1
 PKG_CHECK_FORMAT_SECURITY:=0
 
@@ -42,7 +42,7 @@ define Package/busybox
   MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
   TITLE:=Core utilities for embedded Linux
   URL:=http://busybox.net/
-  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc
+  DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
   MENU:=1
 endef
 
@@ -80,6 +80,12 @@ ifdef CONFIG_BUSYBOX_USE_LIBRPC
   LDLIBS += rpc
 endif
 
+ifdef CONFIG_BUSYBOX_CONFIG_PAM
+  TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+  export LDFLAGS=$(TARGET_LDFLAGS)
+  LDLIBS += pam pam_misc pthread
+endif
+
 define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" \