Remove the SQLITE_MUTEX_APPDEF compile-time option.  The SQLITE_THREADSAFE=0
option always removes all mutex code.  For application-defined mutexes only,
use SQLITE_THREADSAFE=1 with SQLITE_MUTEX_NOOP=1.  Ticket #3421. (CVS 5779)

FossilOrigin-Name: 02a12eb1cfe9307c66556105a1a99d657cc01ab5
diff --git a/src/main.c b/src/main.c
index eece6f1..12b98c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.502 2008/09/23 17:39:26 danielk1977 Exp $
+** $Id: main.c,v 1.503 2008/10/07 15:25:48 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -245,6 +245,11 @@
 
   va_start(ap, op);
   switch( op ){
+
+    /* Mutex configuration options are only available in a threadsafe
+    ** compile. 
+    */
+#if SQLITE_THREADSAFE
     case SQLITE_CONFIG_SINGLETHREAD: {
       /* Disable all mutexing */
       sqlite3GlobalConfig.bCoreMutex = 0;
@@ -264,6 +269,19 @@
       sqlite3GlobalConfig.bFullMutex = 1;
       break;
     }
+    case SQLITE_CONFIG_MUTEX: {
+      /* Specify an alternative mutex implementation */
+      sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
+      break;
+    }
+    case SQLITE_CONFIG_GETMUTEX: {
+      /* Retrieve the current mutex implementation */
+      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
+      break;
+    }
+#endif
+
+
     case SQLITE_CONFIG_MALLOC: {
       /* Specify an alternative malloc implementation */
       sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
@@ -275,16 +293,6 @@
       *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
       break;
     }
-    case SQLITE_CONFIG_MUTEX: {
-      /* Specify an alternative mutex implementation */
-      sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
-      break;
-    }
-    case SQLITE_CONFIG_GETMUTEX: {
-      /* Retrieve the current mutex implementation */
-      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
-      break;
-    }
     case SQLITE_CONFIG_MEMSTATUS: {
       /* Enable or disable the malloc status collection */
       sqlite3GlobalConfig.bMemstat = va_arg(ap, int);