From: Karel Zak Date: Thu, 27 Oct 2011 13:13:40 +0000 (+0200) Subject: build-sys: cleanup HAVE_LIBCRYPT X-Git-Tag: v2.21-rc1~246 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d35bdc917b6dd0f2411cd1ea6ee33dac77265f6;p=thirdparty%2Futil-linux.git build-sys: cleanup HAVE_LIBCRYPT Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 48b53dbcb1..facc9e41f8 100644 --- a/configure.ac +++ b/configure.ac @@ -429,6 +429,39 @@ AC_CHECK_DECLS([CPU_ALLOC], [], [], [[ #include ]]) +# on Solaris, you can't mix and match standards, since we use c99 +# aparently at this stage, XOPEN_SOURCE will conflict. As workaround, +# check for crypt.h and use that without XOPEN_SOURCE. +AC_CHECK_HEADERS([crypt.h]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_CRYPT_H +#include +#else +#define _XOPEN_SOURCE +#include +#endif +]], [[ +char *c = crypt("abc","pw"); +]])],[],[ + LIBS="$LIBS -lcrypt" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifdef HAVE_CRYPT_H + #include + #else + #define _XOPEN_SOURCE + #include + #endif + ]], [[ + char *c = crypt("abc","pw"); + ]])],[ + AC_DEFINE(HAVE_LIBCRYPT, 1, [Do we need -lcrypt?]) + have_libcrypt=yes + ],[ + AC_MSG_ERROR([crypt() is not available]) + ]) +]) +AM_CONDITIONAL(HAVE_LIBCRYPT, test "x$have_libcrypt" = xyes) + AC_ARG_ENABLE([most-builds], AS_HELP_STRING([--enable-most-builds], [build everthing other than experimental code]), @@ -637,41 +670,6 @@ else AM_CONDITIONAL(HAVE_UTEMPTER, false) fi -# on Solaris, you can't mix and match standards, since we use c99 -# aparently at this stage, XOPEN_SOURCE will conflict. As workaround, -# check for crypt.h and use that without XOPEN_SOURCE. -AC_CHECK_HEADERS([crypt.h]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#ifdef HAVE_CRYPT_H -#include -#else -#define _XOPEN_SOURCE -#include -#endif -]], [[ -char *c = crypt("abc","pw"); -]])],[],[ - LIBS="$LIBS -lcrypt" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #ifdef HAVE_CRYPT_H - #include - #else - #define _XOPEN_SOURCE - #include - #endif - ]], [[ - char *c = crypt("abc","pw"); - ]])],[ - AC_DEFINE(NEED_LIBCRYPT, 1, [Do we need -lcrypt?]) - need_libcrypt=yes - ],[ - AC_MSG_ERROR([crypt() is not available]) - ]) -]) - -AM_CONDITIONAL(NEED_LIBCRYPT, test "x$need_libcrypt" = xyes) - - UL_CHECK_SYSCALL([pivot_root]) UL_CHECK_SYSCALL([sched_getaffinity]) UL_CHECK_SYSCALL([ioprio_set], diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am index ada45553dd..6d1e85fd5f 100644 --- a/login-utils/Makefile.am +++ b/login-utils/Makefile.am @@ -45,7 +45,7 @@ newgrp_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) login_ldadd_common += -lpam -lpam_misc -if NEED_LIBCRYPT +if HAVE_LIBCRYPT newgrp_LDADD += -lcrypt endif