ce62dc
diff -up cups-2.2rc1/scheduler/conf.c.serverbin-compat cups-2.2rc1/scheduler/conf.c
ce62dc
--- cups-2.2rc1/scheduler/conf.c.serverbin-compat	2016-08-08 20:06:00.000000000 +0200
ce62dc
+++ cups-2.2rc1/scheduler/conf.c	2016-08-09 09:58:21.324033645 +0200
ce62dc
@@ -609,6 +609,9 @@ cupsdReadConfiguration(void)
ce62dc
   cupsdClearString(&ServerName);
ce62dc
   cupsdClearString(&ServerAdmin);
ce62dc
   cupsdSetString(&ServerBin, CUPS_SERVERBIN);
ce62dc
+#ifdef __x86_64__
ce62dc
+  cupsdSetString(&ServerBin_compat, "/usr/lib64/cups");
ce62dc
+#endif /* __x86_64__ */
ce62dc
   cupsdSetString(&RequestRoot, CUPS_REQUESTS);
ce62dc
   cupsdSetString(&CacheDir, CUPS_CACHEDIR);
ce62dc
   cupsdSetString(&DataDir, CUPS_DATADIR);
ce62dc
@@ -1604,7 +1607,12 @@ cupsdReadConfiguration(void)
ce62dc
     * Read the MIME type and conversion database...
ce62dc
     */
ce62dc
 
ce62dc
+#ifdef __x86_64__
ce62dc
+    snprintf(temp, sizeof(temp), "%s/filter:%s/filter", ServerBin,
ce62dc
+	     ServerBin_compat);
ce62dc
+#else
ce62dc
     snprintf(temp, sizeof(temp), "%s/filter", ServerBin);
ce62dc
+#endif
ce62dc
     snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir);
ce62dc
 
ce62dc
     MimeDatabase = mimeNew();
ce62dc
diff -up cups-2.2rc1/scheduler/conf.h.serverbin-compat cups-2.2rc1/scheduler/conf.h
ce62dc
--- cups-2.2rc1/scheduler/conf.h.serverbin-compat	2016-08-08 20:06:00.000000000 +0200
ce62dc
+++ cups-2.2rc1/scheduler/conf.h	2016-08-09 09:58:21.325033636 +0200
ce62dc
@@ -106,6 +106,10 @@ VAR char		*ConfigurationFile	VALUE(NULL)
ce62dc
 					/* Root directory for scheduler */
ce62dc
 			*ServerBin		VALUE(NULL),
ce62dc
 					/* Root directory for binaries */
ce62dc
+#ifdef __x86_64__
ce62dc
+			*ServerBin_compat	VALUE(NULL),
ce62dc
+					/* Compat directory for binaries */
ce62dc
+#endif /* __x86_64__ */
ce62dc
 			*StateDir		VALUE(NULL),
ce62dc
 					/* Root directory for state data */
ce62dc
 			*RequestRoot		VALUE(NULL),
ce62dc
diff -up cups-2.2rc1/scheduler/env.c.serverbin-compat cups-2.2rc1/scheduler/env.c
ce62dc
--- cups-2.2rc1/scheduler/env.c.serverbin-compat	2016-08-08 20:06:00.000000000 +0200
ce62dc
+++ cups-2.2rc1/scheduler/env.c	2016-08-09 09:58:21.325033636 +0200
ce62dc
@@ -212,8 +212,13 @@ cupsdUpdateEnv(void)
ce62dc
   set_if_undefined("LD_PRELOAD", NULL);
ce62dc
   set_if_undefined("NLSPATH", NULL);
ce62dc
   if (find_env("PATH") < 0)
ce62dc
+#ifdef __x86_64__
ce62dc
+    cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
ce62dc
+                         ":/bin:/usr/bin", ServerBin, ServerBin_compat);
ce62dc
+#else /* ! defined(__x86_64__) */
ce62dc
     cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
ce62dc
 			 ":/bin:/usr/bin", ServerBin);
ce62dc
+#endif
ce62dc
   set_if_undefined("SERVER_ADMIN", ServerAdmin);
ce62dc
   set_if_undefined("SHLIB_PATH", NULL);
ce62dc
   set_if_undefined("SOFTWARE", CUPS_MINIMAL);
ce62dc
diff -up cups-2.2rc1/scheduler/ipp.c.serverbin-compat cups-2.2rc1/scheduler/ipp.c
ce62dc
--- cups-2.2rc1/scheduler/ipp.c.serverbin-compat	2016-08-09 09:58:21.326033626 +0200
ce62dc
+++ cups-2.2rc1/scheduler/ipp.c	2016-08-09 10:10:16.266127629 +0200
ce62dc
@@ -2419,12 +2419,21 @@ add_printer(cupsd_client_t  *con,	/* I -
ce62dc
         * Could not find device in list!
ce62dc
 	*/
ce62dc
 
ce62dc
+#ifdef __x86_64__
ce62dc
+	snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin_compat,
ce62dc
+		 scheme);
ce62dc
+	if (access(srcfile, X_OK))
ce62dc
+	{
ce62dc
+#endif /* __x86_64__ */
ce62dc
 	send_ipp_status(con, IPP_NOT_POSSIBLE,
ce62dc
                         _("Bad device-uri scheme \"%s\"."), scheme);
ce62dc
 	if (!modify)
ce62dc
 	  cupsdDeletePrinter(printer, 0);
ce62dc
 
ce62dc
 	return;
ce62dc
+#ifdef __x86_64__
ce62dc
+	}
ce62dc
+#endif /* __x86_64__ */
ce62dc
       }
ce62dc
     }
ce62dc
 
ce62dc
diff -up cups-2.2rc1/scheduler/job.c.serverbin-compat cups-2.2rc1/scheduler/job.c
ce62dc
--- cups-2.2rc1/scheduler/job.c.serverbin-compat	2016-08-08 20:06:00.000000000 +0200
ce62dc
+++ cups-2.2rc1/scheduler/job.c	2016-08-09 09:58:21.327033616 +0200
ce62dc
@@ -1126,8 +1126,32 @@ cupsdContinueJob(cupsd_job_t *job)	/* I
ce62dc
        i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
ce62dc
   {
ce62dc
     if (filter->filter[0] != '/')
ce62dc
-      snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ce62dc
-               filter->filter);
ce62dc
+      {
ce62dc
+	snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ce62dc
+		 filter->filter);
ce62dc
+#ifdef __x86_64__
ce62dc
+	if (access(command, F_OK))
ce62dc
+	  {
ce62dc
+	    snprintf(command, sizeof(command), "%s/filter/%s",
ce62dc
+		     ServerBin_compat, filter->filter);
ce62dc
+	    if (!access(command, F_OK))
ce62dc
+	      {
ce62dc
+		/* Not in the correct directory, but found it in the compat
ce62dc
+		 * directory.  Issue a warning. */
ce62dc
+		cupsdLogMessage(CUPSD_LOG_INFO,
ce62dc
+				"Filter '%s' not in %s/filter!",
ce62dc
+				filter->filter, ServerBin);
ce62dc
+	      }
ce62dc
+	    else
ce62dc
+	      {
ce62dc
+		/* Not in the compat directory either; make any error
ce62dc
+		 * messages use the correct directory name then. */
ce62dc
+		snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ce62dc
+			 filter->filter);
ce62dc
+	      }
ce62dc
+	  }
ce62dc
+#endif /* __x86_64__ */
ce62dc
+      }
ce62dc
     else
ce62dc
       strlcpy(command, filter->filter, sizeof(command));
ce62dc
 
ce62dc
@@ -1283,6 +1307,28 @@ cupsdContinueJob(cupsd_job_t *job)	/* I
ce62dc
     {
ce62dc
       cupsdClosePipe(job->back_pipes);
ce62dc
       cupsdClosePipe(job->side_pipes);
ce62dc
+#ifdef __x86_64__
ce62dc
+      if (access(command, F_OK))
ce62dc
+	{
ce62dc
+	  snprintf(command, sizeof(command), "%s/backend/%s", ServerBin_compat,
ce62dc
+		   scheme);
ce62dc
+	  if (!access(command, F_OK))
ce62dc
+	    {
ce62dc
+	      /* Not in the correct directory, but we found it in the compat
ce62dc
+	       * directory.  Issue a warning. */
ce62dc
+	      cupsdLogMessage(CUPSD_LOG_INFO,
ce62dc
+			      "Backend '%s' not in %s/backend!", scheme,
ce62dc
+			      ServerBin);
ce62dc
+	    }
ce62dc
+	  else
ce62dc
+	    {
ce62dc
+	      /* Not in the compat directory either; make any error
ce62dc
+		 messages use the correct directory name then. */
ce62dc
+	      snprintf(command, sizeof(command), "%s/backend/%s", ServerBin,
ce62dc
+		       scheme);
ce62dc
+	    }
ce62dc
+	}
ce62dc
+#endif /* __x86_64__ */
ce62dc
 
ce62dc
       close(job->status_pipes[1]);
ce62dc
       job->status_pipes[1] = -1;
ce62dc
diff -up cups-2.2rc1/scheduler/printers.c.serverbin-compat cups-2.2rc1/scheduler/printers.c
ce62dc
--- cups-2.2rc1/scheduler/printers.c.serverbin-compat	2016-08-08 20:06:00.000000000 +0200
ce62dc
+++ cups-2.2rc1/scheduler/printers.c	2016-08-09 09:58:21.327033616 +0200
ce62dc
@@ -967,9 +967,19 @@ cupsdLoadAllPrinters(void)
ce62dc
 	    * Backend does not exist, stop printer...
ce62dc
 	    */
ce62dc
 
ce62dc
+#ifdef __x86_64__
ce62dc
+	    snprintf(line, sizeof(line), "%s/backend/%s", ServerBin_compat,
ce62dc
+		     p->device_uri);
ce62dc
+	    if (access(line, 0))
ce62dc
+	      {
ce62dc
+#endif /* __x86_64__ */
ce62dc
+
ce62dc
 	    p->state = IPP_PRINTER_STOPPED;
ce62dc
 	    snprintf(p->state_message, sizeof(p->state_message),
ce62dc
 	             "Backend %s does not exist!", line);
ce62dc
+#ifdef __x86_64__
ce62dc
+	      }
ce62dc
+#endif /* __x86_64__ */
ce62dc
 	  }
ce62dc
         }
ce62dc
 
ce62dc
@@ -3481,8 +3491,20 @@ add_printer_filter(
ce62dc
     else
ce62dc
       snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program);
ce62dc
 
ce62dc
+#ifdef __x86_64__
ce62dc
+    if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ce62dc
+                       cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING) {
ce62dc
+      snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin_compat,
ce62dc
+               program);
ce62dc
+      if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ce62dc
+                         cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING)
ce62dc
+        snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin,
ce62dc
+                 program);
ce62dc
+    }
ce62dc
+#else /* ! defined(__x86_64__) */
ce62dc
     _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ce62dc
                    cupsdLogFCMessage, p);
ce62dc
+#endif 
ce62dc
   }
ce62dc
 
ce62dc
  /*