diff --git a/xz.changes b/xz.changes
index 06f4f11..f1ce171 100644
--- a/xz.changes
+++ b/xz.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Wed Jan 21 11:21:32 UTC 2015 - rguenther@suse.com
+
+- Avoid running configure twice and using -fprofile-generate or
+  -fprofile-use for compiling configure tests when profiling.
+
 -------------------------------------------------------------------
 Thu Dec 25 20:23:28 UTC 2014 - andreas.stieger@gmx.de
 
diff --git a/xz.spec b/xz.spec
index 468c76d..c24ce07 100644
--- a/xz.spec
+++ b/xz.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package xz
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -108,28 +108,20 @@ Static library for the LZMA library
 %build
 %global optflags    %{optflags} -D_REENTRANT -pipe -fPIE
 export LDFLAGS="-Wl,-z,relro,-z,now -pie"
-%if %{do_profiling}
-profiledir=$(mktemp -d)
-trap "rm -rf $profiledir" EXIT
-export CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir"
-%endif
 %configure \
 %if ! %{with static_libs}
 	--disable-static \
 %endif
 	--with-pic \
 	--docdir=%{_docdir}/%{name}
-make %{?_smp_mflags}
 %if %{do_profiling}
+profiledir=$(mktemp -d)
+trap "rm -rf $profiledir" EXIT
+make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir"
 time make check
 make clean %{?_smp_mflags}
-export CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir"
-%configure \
-%if %{without static_libs}
-	--disable-static \
-%endif
-	--with-pic \
-	--docdir=%{_docdir}/%{name}
+make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir"
+%else
 make %{?_smp_mflags}
 %endif