Check for crypt.h existence, and use it if available over using unistd.h for which a certain feature level has to be set to export a definition for crypt. On Solaris this set causes a standards conflict in the headers, because at the time of this check C99 mode is already enabled, which implies certain standards non-compatible with _XOPEN_SOURCE. 92 #define _XOPEN_SOURCE 93 #include <unistd.h> configure:16259: gcc -std=gnu99 -c -g -O2 conftest.c >&5 In file included from /usr/include/unistd.h:18, from conftest.c:93: /prefix/gentoo/usr/lib/gcc/i386-pc-solaris2.10/4.4.5/include-fixed/sys/feature_tests.h:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications" configure.ac: improve crypt check login-utils/my_crypt.h: replace old GNU_LIBRARY check with autoconf define for crypt.h Signed-off-by: Fabian Groffen <grobian@xxxxxxxxxx> diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -522,17 +522,28 @@ 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 <crypt.h> +#else #define _XOPEN_SOURCE #include <unistd.h> +#endif ]], [[ char *c = crypt("abc","pw"); ]])],[],[ LIBS="$LIBS -lcrypt" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifdef HAVE_CRYPT_H + #include <crypt.h> + #else #define _XOPEN_SOURCE #include <unistd.h> + #endif ]], [[ char *c = crypt("abc","pw"); ]])],[ diff --git a/login-utils/my_crypt.h b/login-utils/my_crypt.h --- a/login-utils/my_crypt.h +++ b/login-utils/my_crypt.h @@ -1,3 +1,3 @@ -#if defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 +#ifdef HAVE_CRYPT_H #include <crypt.h> #endif -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html