Rename the macros in defaults.h - they are not meant to be
authorLuigi Rizzo <rizzo@icir.org>
Tue, 18 Dec 2007 09:26:03 +0000 (09:26 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Tue, 18 Dec 2007 09:26:03 +0000 (09:26 +0000)
globally visible.

Document the fact that DEFAULT_TMP_DIR cannot be overridden
from the default configuration (this needs to be fixed, as you
could have a totally different spooldir configured at runtime,
and yet DEFAULT_TMP_DIR keeps the compile-time default).

Remove two unused entries for sounds and images.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93581 65c4cc65-6c06-0410-ace0-fbb531ad65f3

build_tools/make_defaults_h
main/asterisk.c

index dfd3bc2..0aae608 100755 (executable)
@@ -2,25 +2,27 @@
 cat << END
 /*
  * defaults.h 
- * Automatically generated
+ * Automatically generated from build options,
+ * only used in main/asterisk.c
  */
-#define AST_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
-#define AST_RUN_DIR    "${INSTALL_PATH}${ASTVARRUNDIR}"
-#define AST_SOCKET     "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
-#define AST_PID        "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
-#define AST_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
-#define AST_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
-#define AST_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
-#define AST_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
-#define AST_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
-#define AST_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
-#define AST_KEY_DIR    "${INSTALL_PATH}${ASTDATADIR}/keys"
-#define AST_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
-#define AST_TMP_DIR    "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
+#define DEFAULT_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
 
-#define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
+#define DEFAULT_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
+#define DEFAULT_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
+#define DEFAULT_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
+#define DEFAULT_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
 
-#define AST_SOUNDS     "${INSTALL_PATH}${ASTDATADIR}/sounds"
-#define AST_IMAGES     "${INSTALL_PATH}${ASTDATADIR}/images"
+#define DEFAULT_RUN_DIR    "${INSTALL_PATH}${ASTVARRUNDIR}"
+#define DEFAULT_SOCKET     "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
+#define DEFAULT_PID        "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
+
+#define DEFAULT_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
+#define DEFAULT_DB         "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
+
+#define DEFAULT_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
+#define DEFAULT_KEY_DIR    "${INSTALL_PATH}${ASTDATADIR}/keys"
+
+#define DEFAULT_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
+#define DEFAULT_TMP_DIR    "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
 
 END
index dbc4438..05813e1 100644 (file)
@@ -164,7 +164,8 @@ long option_minmemfree;                             /*!< Minimum amount of free system memory - stop acce
 
 /*! @} */
 
-char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
+/* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
+char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
 
 static int ast_socket = -1;            /*!< UNIX Socket for allowing remote control */
 static int ast_consock = -1;           /*!< UNIX Socket for controlling another asterisk */
@@ -2402,7 +2403,7 @@ static void ast_readconfig(void)
 {
        struct ast_config *cfg;
        struct ast_variable *v;
-       char *config = AST_CONFIG_FILE;
+       char *config = DEFAULT_CONFIG_FILE;
        char hostname[MAXHOSTNAMELEN] = "";
        struct ast_flags config_flags = { 0 };
        struct {
@@ -2418,19 +2419,19 @@ static void ast_readconfig(void)
                cfg = ast_config_load(config, config_flags);
 
        /* init with buildtime config */
-       ast_copy_string(ast_config_AST_CONFIG_DIR, AST_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
-       ast_copy_string(ast_config_AST_SPOOL_DIR, AST_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
-       ast_copy_string(ast_config_AST_MODULE_DIR, AST_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
+       ast_copy_string(ast_config_AST_CONFIG_DIR, DEFAULT_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
+       ast_copy_string(ast_config_AST_SPOOL_DIR, DEFAULT_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
+       ast_copy_string(ast_config_AST_MODULE_DIR, DEFAULT_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
        snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", ast_config_AST_SPOOL_DIR);
-       ast_copy_string(ast_config_AST_VAR_DIR, AST_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
-       ast_copy_string(ast_config_AST_DATA_DIR, AST_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
-       ast_copy_string(ast_config_AST_LOG_DIR, AST_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
-       ast_copy_string(ast_config_AST_AGI_DIR, AST_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
-       ast_copy_string(ast_config_AST_DB, AST_DB, sizeof(ast_config_AST_DB));
-       ast_copy_string(ast_config_AST_KEY_DIR, AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
-       ast_copy_string(ast_config_AST_PID, AST_PID, sizeof(ast_config_AST_PID));
-       ast_copy_string(ast_config_AST_SOCKET, AST_SOCKET, sizeof(ast_config_AST_SOCKET));
-       ast_copy_string(ast_config_AST_RUN_DIR, AST_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
+       ast_copy_string(ast_config_AST_VAR_DIR, DEFAULT_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
+       ast_copy_string(ast_config_AST_DATA_DIR, DEFAULT_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
+       ast_copy_string(ast_config_AST_LOG_DIR, DEFAULT_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
+       ast_copy_string(ast_config_AST_AGI_DIR, DEFAULT_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
+       ast_copy_string(ast_config_AST_DB, DEFAULT_DB, sizeof(ast_config_AST_DB));
+       ast_copy_string(ast_config_AST_KEY_DIR, DEFAULT_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
+       ast_copy_string(ast_config_AST_PID, DEFAULT_PID, sizeof(ast_config_AST_PID));
+       ast_copy_string(ast_config_AST_SOCKET, DEFAULT_SOCKET, sizeof(ast_config_AST_SOCKET));
+       ast_copy_string(ast_config_AST_RUN_DIR, DEFAULT_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
 
        /* no asterisk.conf? no problem, use buildtime config! */
        if (!cfg) {