add check for shadow support, turn -Os back on
authorFelix Fietkau <nbd@openwrt.org>
Sun, 13 Jan 2013 09:17:31 +0000 (10:17 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 13 Jan 2013 09:18:26 +0000 (10:18 +0100)
CMakeLists.txt
auth.c

index d7712e427b2b4c16460dce617cff4b7491a3fe0c..c495bec0f8b67ad700779a204ed6709acbdb8567 100644 (file)
@@ -1,8 +1,11 @@
 cmake_minimum_required(VERSION 2.6)
 
 PROJECT(uhttpd C)
+
+INCLUDE (CheckFunctionExists)
+
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-ADD_DEFINITIONS(-O0 -Wall -Werror -Wmissing-declarations --std=gnu99 -g3)
+ADD_DEFINITIONS(-Os -Wall -Werror -Wmissing-declarations --std=gnu99 -g3)
 
 OPTION(TLS_SUPPORT "TLS support" ON)
 OPTION(LUA_SUPPORT "Lua support" ON)
@@ -24,6 +27,11 @@ IF(TLS_SUPPORT)
        ADD_DEFINITIONS(-DHAVE_TLS)
 ENDIF()
 
+CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
+IF(HAVE_SHADOW)
+    ADD_DEFINITIONS(-DHAVE_SHADOW)
+ENDIF()
+
 ADD_EXECUTABLE(uhttpd ${SOURCES})
 TARGET_LINK_LIBRARIES(uhttpd ubox dl ${LIBS})
 
diff --git a/auth.c b/auth.c
index 301e9383f9c05aa27fa439d53d57dcfff8b593e3..d6964f43738a0dd02c91552ad559eafa05782c5a 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -20,6 +20,9 @@
 #define _GNU_SOURCE
 #define _XOPEN_SOURCE  700
 #include <strings.h>
+#ifdef HAVE_SHADOW
+#include <shadow.h>
+#endif
 #include "uhttpd.h"
 
 static LIST_HEAD(auth_realms);