diff --git a/ChangeLog b/ChangeLog
index ec92ab019128c9dd1f6929e36bec28d8385c1851..3150310d9bbcfb532381c4ee1176c06b83cb0e39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-01-16  Niels Möller  <nisse@lysator.liu.se>
+
+	* configure.ac (OPT_NETTLE_SOURCES): New substituted variable.
+	(asm_path): Fixed x86_64 fat setup. Include only x86_64 and
+	x86_64/fat in the asm_path. Put fat-x86_64.c in
+	OPT_NETTLE_SOURCES, with no symlinking.
+
+	* fat-x86_64.c: Renamed,...
+	* x86_64/fat/fat.c: ... from old name.
+
 2015-01-13  Niels Möller  <nisse@lysator.liu.se>
 
 	* x86_64/fat/fat.c: For constructor hack, check
diff --git a/Makefile.in b/Makefile.in
index 6db6c34989344157e9fdb376c3a31f7c5fe941ae..474b5b894e0ebdeec6b7a54b3b00a3127dabbbfb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,6 +15,7 @@ MKDIR_P = @MKDIR_P@
 OPT_NETTLE_OBJS = @OPT_NETTLE_OBJS@
 OPT_HOGWEED_OBJS = @OPT_HOGWEED_OBJS@
 
+OPT_NETTLE_SOURCES = @OPT_NETTLE_SOURCES@
 OPT_HOGWEED_SOURCES = @IF_MINI_GMP@ mini-gmp.c
 
 SUBDIRS = tools testsuite examples
@@ -134,7 +135,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
 		 umac-poly64.c umac-poly128.c umac-set-key.c \
 		 umac32.c umac64.c umac96.c umac128.c \
 		 write-be32.c write-le32.c write-le64.c \
-		 yarrow256.c yarrow_key_event.c
+		 yarrow256.c yarrow_key_event.c \
+		 $(OPT_NETTLE_SOURCES)
 
 hogweed_SOURCES = sexp.c sexp-format.c \
 		  sexp-transport.c sexp-transport-format.c \
diff --git a/configure.ac b/configure.ac
index 93f4f90187d1953e6bc43f894b90319a00eb8809..7b8dc775f46960af6cb34c9f14958b6e12041e56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,6 +238,8 @@ if test "x$ABI" != xstandard ; then
   fi
 fi
 
+OPT_NETTLE_SOURCES=""
+
 # Select assembler code
 asm_path=
 if test "x$enable_assembler" = xyes ; then
@@ -248,11 +250,11 @@ if test "x$enable_assembler" = xyes ; then
     [x86_64 | amd64])
       if test "$ABI" = 64 ; then
 	asm_path=x86_64
-	if test "x$enable_x86_aesni" = xyes ; then
-	  asm_path="x86_64/aesni $asm_path"
-	fi
 	if test "x$enable_fat" = xyes ; then
 	  asm_path="x86_64/fat $asm_path"
+	  OPT_NETTLE_SOURCES="fat-x86_64.c $OPT_NETTLE_SOURCES"
+	elif test "x$enable_x86_aesni" = xyes ; then
+	  asm_path="x86_64/aesni $asm_path"
 	fi
       else
 	asm_path=x86
@@ -296,7 +298,7 @@ asm_replace_list="aes-encrypt-internal.asm aes-decrypt-internal.asm \
 		sha3-permute.asm umac-nh.asm umac-nh-n.asm machine.m4"
 
 # Assembler files which generate additional object files if they are used.
-asm_nettle_optional_list="gcm-hash8.asm cpuid.asm fat.c \
+asm_nettle_optional_list="gcm-hash8.asm cpuid.asm \
   aes-encrypt-internal-2.asm aes-decrypt-internal-2.asm"
 asm_hogweed_optional_list=""
 if test "x$enable_public_key" = "xyes" ; then
@@ -376,6 +378,7 @@ fi
 
 AC_SUBST([OPT_NETTLE_OBJS])
 AC_SUBST([OPT_HOGWEED_OBJS])
+AC_SUBST([OPT_NETTLE_SOURCES])
 AC_SUBST([ASM_RODATA])
 if test "x$enable_assembler" = xyes ; then
   IF_ASM=''
diff --git a/x86_64/fat/fat.c b/fat-x86_64.c
similarity index 99%
rename from x86_64/fat/fat.c
rename to fat-x86_64.c
index fc022b9ef30ef6dad5f21d11b6e1a71f6c363c8d..30d1c249bc56a2d77b638334eabfc53c5606648e 100644
--- a/x86_64/fat/fat.c
+++ b/fat-x86_64.c
@@ -1,4 +1,4 @@
-/* fat.c
+/* fat-x86_64.c
 
    Copyright (C) 2015 Niels Möller