diff --git a/configure b/configure index 3d89870d99..f6a51e0765 100755 --- a/configure +++ b/configure @@ -4612,9 +4612,17 @@ elif compile_prog "" "$pthread_lib -lrt" ; then libs_qga="$libs_qga -lrt" fi -if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ - "$haiku" != "yes" ; then +# Check whether we need to link libutil for openpty() +cat > $TMPC << EOF +extern int openpty(int *am, int *as, char *name, void *termp, void *winp); +int main(void) { return openpty(0, 0, 0, 0, 0); } +EOF + +if ! compile_prog "" "" ; then + if compile_prog "" "-lutil" ; then libs_softmmu="-lutil $libs_softmmu" + libs_tools="-lutil $libs_tools" + fi fi ########################################## diff --git a/tests/Makefile.include b/tests/Makefile.include index 75ad9c0dd3..b39e989f72 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -798,10 +798,6 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF) rm $(INITRD_WORK_DIR)/init rmdir $(INITRD_WORK_DIR) -ifeq ($(CONFIG_POSIX),y) -LIBS += -lutil -endif - # QTest rules TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))