summaryrefslogtreecommitdiff
path: root/gcc/prefix.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-14 22:04:44 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-14 22:04:44 +0000
commit778a283350345f51e4271da760e8e4629470b72b (patch)
tree516d875124e45da7df656ea365b654044f3d7ecc /gcc/prefix.c
parent4ee3bd0d172dc9e34b03f65153eb6e3d7bfa0d20 (diff)
downloadgcc-778a283350345f51e4271da760e8e4629470b72b.tar.gz
Mumit Khan <khan@xraylith.wisc.edu>
* configure.in: Handle --disable/enable-win32-registry. * install.texi: Document --disable/enable-win32-registry. * acconfig.h (ENABLE_WIN32_REGISTRY): New macro. (WIN32_REGISTRY_KEY): New macro. * prefix.c: Use to enable/disable win32-specific code. (lookup_key): Use versioned key. * configure: Regenerate. * config.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28712 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/prefix.c')
-rw-r--r--gcc/prefix.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/prefix.c b/gcc/prefix.c
index 8bf5696f07f..8b53d3a1dc7 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -44,9 +44,10 @@ Boston, MA 02111-1307, USA. */
-- If this is a Win32 OS, then the Registry will be examined for
an entry of "key" in
- HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\
+ HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>
- if found, that value will be used.
+ if found, that value will be used. <KEY> defaults to GCC version
+ string, but can be overridden at configuration time.
-- If not found (or not a Win32 OS), the environment variable
key_ROOT (the value of "key" concatenated with the constant "_ROOT")
@@ -65,7 +66,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
-#ifdef _WIN32
+#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
#include <windows.h>
#endif
#include "prefix.h"
@@ -76,7 +77,7 @@ static const char *get_key_value PROTO((char *));
static const char *translate_name PROTO((const char *));
static char *save_string PROTO((const char *, int));
-#ifdef _WIN32
+#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
static char *lookup_key PROTO((char *));
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
#endif
@@ -101,7 +102,7 @@ get_key_value (key)
const char *prefix = 0;
char *temp = 0;
-#ifdef _WIN32
+#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
prefix = lookup_key (key);
#endif
@@ -187,7 +188,7 @@ save_string (s, len)
return result;
}
-#ifdef _WIN32
+#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
/* Look up "key" in the registry, as above. */
@@ -209,6 +210,10 @@ lookup_key (key)
res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
KEY_READ, &reg_key);
+ if (res == ERROR_SUCCESS)
+ res = RegOpenKeyExA (reg_key, WIN32_REGISTRY_KEY, 0,
+ KEY_READ, &reg_key);
+
if (res != ERROR_SUCCESS)
{
reg_key = (HKEY) INVALID_HANDLE_VALUE;