LD65_OBJ = $(datadir)/lib
 LD65_CFG = $(datadir)/cfg
 
-CFLAGS += -MMD -MP -O -std=c89 -D_SVID_SOURCE -I common \
+CFLAGS += -MMD -MP -O -std=c89 -I common \
           -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
           -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
           -DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
 
 
 /* Name of the library file */
 const char*             LibName = 0;
-static const char*      NewLibName = 0;
+static char*            NewLibName = 0;
 
 /* File descriptor for the library file */
 static FILE*            Lib = 0;
     if (NeedTemp) {
 
         /* Create the temporary library name */
-        NewLibName = tempnam (NULL, NULL);
-        if (NewLibName == 0) {
-            Error ("Cannot create temporary library file name: %s", strerror (errno));
-        }
+        NewLibName = xmalloc (strlen (Name) + strlen (".temp") + 1);
+        strcpy (NewLibName, Name);
+        strcat (NewLibName, ".temp");
 
         /* Create the temporary library */
         NewLib = fopen (NewLibName, "w+b");
                    LibName, strerror (errno));
         }
 
-        /* Copy the new library to the new one */
+        /* Copy the temporary library to the new one */
         fseek (NewLib, 0, SEEK_SET);
         while ((Count = fread (Buf, 1, sizeof (Buf), NewLib)) != 0) {
             if (fwrite (Buf, 1, Count, Lib) != Count) {