# HG changeset patch # User james # Date 1031671659 0 # Node ID 25e260cb7994704f2bcb998614529ef21fd784ad # Parent 4575a219af58440d9e13f674fd6dadc094bceaed [xemacs-hg @ 2002-09-10 15:27:02 by james] Enable unloading of dynamic modules. Create the first two internal XEmacs modules: LDAP and postgreSQL. Update the sample directory to contain a sample internal XEmacs module and a sample external XEmacs module. Improve support for autoloading modules. Make internal module code compile into the XEmacs binary if XEmacs is configured without module support. Make the internal module directories self-contained so that they can be distributed separately from XEmacs. diff -r 4575a219af58 -r 25e260cb7994 lib-src/ChangeLog --- a/lib-src/ChangeLog Mon Sep 09 21:53:43 2002 +0000 +++ b/lib-src/ChangeLog Tue Sep 10 15:27:39 2002 +0000 @@ -1,3 +1,23 @@ +2002-08-08 Jerry James + + * config.values.in: Regenerate. + * ellcc.c: A thorough cleanup to eliminate potential buffer + overruns and null pointer dereferences, make some global variables + local, add braces for clarity, etc., using hints supplied by + splint. + * ellcc.c (EXEC_GROW_SIZE): New constant for dynamic allocation. + * ellcc.c (xrealloc): New function. + * ellcc.c (xstrdup): New function. + * ellcc.c (fatal): Use varargs for flexibility. + * ellcc.c (add_string): New function for abstracting the addition + of a string to the exec_argv array. + * ellcc.c (add_to_argv): Use add_string. Improve whitespace + handling. Recode finite state machine as a clearer while loop. + * ellcc.c (do_compile_mode): Use new functions. + * ellcc.c (do_link_mode): Ditto. + * ellcc.c (do_init_mode): Ditto. Default to in-source + make-docfile. + 2002-08-30 Steve Youngs * XEmacs 21.5.9 "brussels sprouts" is released. diff -r 4575a219af58 -r 25e260cb7994 lib-src/config.values.in --- a/lib-src/config.values.in Mon Sep 09 21:53:43 2002 +0000 +++ b/lib-src/config.values.in Tue Sep 10 15:27:39 2002 +0000 @@ -37,6 +37,7 @@ INFOPATH "@INFOPATH@" INFOPATH_USER_DEFINED "@INFOPATH_USER_DEFINED@" INSTALL "@INSTALL@" +INSTALLPATH "@INSTALLPATH@" INSTALL_ARCH_DEP_SUBDIR "@INSTALL_ARCH_DEP_SUBDIR@" INSTALL_DATA "@INSTALL_DATA@" INSTALL_PROGRAM "@INSTALL_PROGRAM@" @@ -46,9 +47,15 @@ LISPDIR "@LISPDIR@" LISPDIR_USER_DEFINED "@LISPDIR_USER_DEFINED@" LN_S "@LN_S@" +MAKE_DOCFILE "@MAKE_DOCFILE@" MAKE_SUBDIR "@MAKE_SUBDIR@" +MODARCHDIR "@MODARCHDIR@" +MODCFLAGS "@MODCFLAGS@" MODULEDIR "@MODULEDIR@" MODULEDIR_USER_DEFINED "@MODULEDIR_USER_DEFINED@" +MOD_CC "@MOD_CC@" +MOD_INSTALL_PROGRAM "@MOD_INSTALL_PROGRAM@" +OBJECT_TO_BUILD "@OBJECT_TO_BUILD@" PACKAGE_PATH "@PACKAGE_PATH@" PACKAGE_PATH_USER_DEFINED "@PACKAGE_PATH_USER_DEFINED@" PREFIX "@PREFIX@" @@ -110,6 +117,7 @@ ld_switch_general "@ld_switch_general@" ld_switch_shared "@ld_switch_shared@" ld_switch_window_system "@ld_switch_window_system@" +ldap_libs "@ldap_libs@" lib_gcc "@lib_gcc@" libdir "@libdir@" libexecdir "@libexecdir@" @@ -125,6 +133,7 @@ opsysfile "@opsysfile@" package_path "@package_path@" pkgdir "@pkgdir@" +postgresql_libs "@postgresql_libs@" prefix "@prefix@" program_transform_name "@program_transform_name@" sbindir "@sbindir@" @@ -139,6 +148,7 @@ sysconfdir "@sysconfdir@" top_srcdir "@top_srcdir@" version "@version@" +with_modules "@with_modules@" ;;; Variables defined in configure by AC_DEFINE and AC_DEFINE_UNQUOTED follow: ;;; (These are used in C code) diff -r 4575a219af58 -r 25e260cb7994 lib-src/ellcc.c --- a/lib-src/ellcc.c Mon Sep 09 21:53:43 2002 +0000 +++ b/lib-src/ellcc.c Tue Sep 10 15:27:39 2002 +0000 @@ -1,5 +1,6 @@ /* ellcc.c - front-end for compiling Emacs modules Copyright (C) 1998, 1999 J. Kean Johnston. +Copyright (C) 2002 Jerry James. This file is part of XEmacs. @@ -62,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -72,12 +74,11 @@ #endif /* HAVE_UNISTD_H */ #define EMODULES_GATHER_VERSION +#define EXEC_GROW_SIZE 4 #include #include /* Generated files must be included using <...> */ -#define DEBUG - #ifndef HAVE_SHLIB int main (int argc, char *argv[]) @@ -92,6 +93,31 @@ * and how to compile for PIC mode. */ +static char *progname; +static char *mod_name = NULL; +static char *mod_version = NULL; +static char *mod_title = NULL; +static char *mod_output = NULL; +static int exec_argc = 1; +static int exec_length = 0; +static int *exec_args; +static int real_argc = 0; +static char **prog_argv; + +/* + * We allow the user to override things in the environment + */ +static char *ellcc, *ellld, *ellcflags, *ellldflags, *ellpicflags, + *elldllflags; + +#define OVERENV(STR,EVAR,DFLT) \ +do { \ + STR = getenv (EVAR); \ + if ((STR) == NULL) { \ + STR = DFLT; \ + } \ +} while(0) + /* * xnew, xrnew -- allocate, reallocate storage * @@ -108,94 +134,141 @@ # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type))) #endif -static void *xmalloc (size_t); -static void fatal (char *, char *); -static void add_to_argv (const char *); -static void do_compile_mode (void); -static void do_link_mode (void); -static void do_init_mode (void); + +/* + * Ellcc modes of operation + */ + +enum mode { ELLCC_COMPILE_MODE, ELLCC_LINK_MODE, ELLCC_INIT_MODE }; -#define SSTR(S) ((S)?(S):"") - -#define ELLCC_COMPILE_MODE 0 -#define ELLCC_LINK_MODE 1 -#define ELLCC_INIT_MODE 2 +#ifdef DEBUG +static const char *ellcc_mode_name (enum mode ellcc_mode) +#if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 + __attribute__ ((const)) +#endif + ; -static int ellcc_mode = ELLCC_COMPILE_MODE; -static char *progname; -static char *mod_name = NULL; -static char *mod_version = NULL; -static char *mod_title = NULL; -static char *mod_output = NULL; -static int verbose = 0; -static char **exec_argv; -static int exec_argc = 1; -static int *exec_args; -static int real_argc = 0; -static int prog_argc; -static char **prog_argv; +static const char * +ellcc_mode_name (enum mode ellcc_mode) +{ + switch (ellcc_mode) + { + case ELLCC_COMPILE_MODE: + return "compile"; + case ELLCC_LINK_MODE: + return "link"; + case ELLCC_INIT_MODE: + return "init"; + } + return ""; +} +#endif /* - * We allow the user to over-ride things in the environment + * Function Prototypes */ -char *ellcc, *ellld, *ellcflags, *ellldflags, *ellpicflags, *elldllflags; -#define OVERENV(STR,EVAR,DFLT) \ - STR = getenv(EVAR); \ - if ((STR) == (char *)0) \ - STR = DFLT + +static void *xmalloc (size_t size) +#ifdef __GNUC__ + __attribute__ ((malloc)) +#endif + ; + +static void *xrealloc (void *ptr, size_t size) +#ifdef __GNUC__ + __attribute__ ((malloc)) +#endif + ; + +static char *xstrdup (char *) +#ifdef __GNUC__ + __attribute__ ((malloc)) +#endif + ; + +static void fatal (char *, ...) +#ifdef __GNUC__ + __attribute__ ((noreturn, format (printf, 1, 2))) +#endif + ; + +static char ** add_string (char **, char *); +static char ** add_to_argv (char **, const char *); +static char ** do_compile_mode (void); +static char ** do_link_mode (void); +static char ** do_init_mode (void); + +#define SSTR(S) ((S) != NULL ? (S) : "") int main (int argc, char *argv[]) { char *tmp; - int i, done_mode = 0; + char ** exec_argv; + int i, done_mode = 0, verbose = 0; + enum mode ellcc_mode; - prog_argc = argc; + if (argc < 2) + { + /* FIXME: Print usage output instead */ + fatal ("too few arguments"); + } + prog_argv = argv; #if defined(WIN32_NATIVE) tmp = strrchr (argv[0], '\\'); - if (tmp != (char *)0) - tmp++; + if (tmp != NULL) + { + tmp++; + } #elif !defined (VMS) tmp = strrchr (argv[0], '/'); - if (tmp != (char *)0) - tmp++; + if (tmp != NULL) + { + tmp++; + } #else tmp = argv[0]; #endif - if (tmp != (char *)0) - progname = tmp; - else - progname = argv[0]; + progname = (tmp == NULL) ? argv[0] : tmp; tmp = &progname[strlen(progname)-2]; if (strcmp (tmp, "cc") == 0) - ellcc_mode = ELLCC_COMPILE_MODE; + { + ellcc_mode = ELLCC_COMPILE_MODE; + } else if (strcmp (tmp, "ld") == 0) - ellcc_mode = ELLCC_LINK_MODE; + { + ellcc_mode = ELLCC_LINK_MODE; + } else if (strcmp (tmp, "it") == 0) - ellcc_mode = ELLCC_INIT_MODE; + { + ellcc_mode = ELLCC_INIT_MODE; + } + else + { + ellcc_mode = ELLCC_COMPILE_MODE; + } - exec_argv = xnew(argc + 20, char *); exec_args = xnew(argc, int); - for (i = 0; i < argc; i++) - exec_args[i] = -1; - - if (argc < 2) - fatal ("too few arguments", (char *)0); - exec_args[0] = 0; + for (i = 1; i < argc; i++) + { + exec_args[i] = -1; + } for (i = 1; i < argc; i++) { - if (strncmp (argv[i], "--mode=", 7) == 0) + if (strncmp (argv[i], "--mode=", (size_t)7) == 0) { - char *modeopt = argv[i] + 7; + char *modeopt = &argv[i][7]; - if (done_mode && strcmp (modeopt, "verbose")) - fatal ("more than one mode specified", (char *) 0); + if (done_mode && strcmp (modeopt, "verbose") != 0) + { + fatal ("more than one mode specified"); + } if (strcmp (modeopt, "link") == 0) { done_mode++; @@ -212,36 +285,50 @@ ellcc_mode = ELLCC_INIT_MODE; } else if (strcmp (modeopt, "verbose") == 0) - verbose += 1; + { + verbose++; + } + else + { + fatal ("Mode must be link, compile, init, or verbose"); + } } else if (strcmp (argv[i], "--mod-location") == 0) { printf ("%s\n", ELLCC_MODDIR); - return 0; + exit (EXIT_SUCCESS); } else if (strcmp (argv[i], "--mod-site-location") == 0) { printf ("%s\n", ELLCC_SITEMODS); - return 0; + exit (EXIT_SUCCESS); } else if (strcmp (argv[i], "--mod-archdir") == 0) { printf ("%s\n", ELLCC_ARCHDIR); - return 0; + exit (EXIT_SUCCESS); } else if (strcmp (argv[i], "--mod-config") == 0) { printf ("%s\n", ELLCC_CONFIG); - return 0; + exit (EXIT_SUCCESS); } - else if (strncmp (argv[i], "--mod-name=", 11) == 0) - mod_name = argv[i] + 11; - else if (strncmp (argv[i], "--mod-title=", 12) == 0) - mod_title = argv[i] + 12; - else if (strncmp (argv[i], "--mod-version=", 14) == 0) - mod_version = argv[i] + 14; - else if (strncmp (argv[i], "--mod-output=", 13) == 0) - mod_output = argv[i] + 13; + else if (strncmp (argv[i], "--mod-name=", (size_t)11) == 0) + { + mod_name = &argv[i][11]; + } + else if (strncmp (argv[i], "--mod-title=", (size_t)12) == 0) + { + mod_title = &argv[i][12]; + } + else if (strncmp (argv[i], "--mod-version=", (size_t)14) == 0) + { + mod_version = &argv[i][14]; + } + else if (strncmp (argv[i], "--mod-output=", (size_t)13) == 0) + { + mod_output = &argv[i][13]; + } else { exec_args[exec_argc] = i; @@ -249,27 +336,34 @@ } } - if (ellcc_mode == ELLCC_LINK_MODE && mod_output == (char *)0) - fatal ("must specify --mod-output when linking", (char *)0); - if (ellcc_mode == ELLCC_INIT_MODE && mod_output == (char *)0) - fatal ("must specify --mod-output when creating init file", (char *)0); - if (ellcc_mode == ELLCC_INIT_MODE && mod_name == (char *)0) - fatal ("must specify --mod-name when creating init file", (char *)0); + if (ellcc_mode == ELLCC_LINK_MODE && mod_output == NULL) + { + fatal ("must specify --mod-output when linking"); + } + if (ellcc_mode == ELLCC_INIT_MODE && mod_output == NULL) + { + fatal ("must specify --mod-output when creating init file"); + } + if (ellcc_mode == ELLCC_INIT_MODE && mod_name == NULL) + { + fatal ("must specify --mod-name when creating init file"); + } /* * We now have the list of arguments to pass to the compiler or - * linker (or to process for doc files). We can do the real work - * now. + * linker (or to process for doc files). We can do the real work now. */ if (verbose) - printf ("ellcc driver version %s for EMODULES version %s (%ld)\n", - ELLCC_EMACS_VER, EMODULES_VERSION, EMODULES_REVISION); + { + printf ("ellcc driver version %s for EMODULES version %s (%ld)\n", + ELLCC_EMACS_VER, EMODULES_VERSION, EMODULES_REVISION); + } + #ifdef DEBUG if (verbose >= 2) { - printf (" mode = %d (%s)\n", ellcc_mode, - ellcc_mode == ELLCC_COMPILE_MODE ? "compile" : - ellcc_mode == ELLCC_LINK_MODE ? "link" : "init"); + printf (" mode = %d (%s)\n", (int)ellcc_mode, + ellcc_mode_name (ellcc_mode)); printf (" module_name = \"%s\"\n", SSTR(mod_name)); printf (" module_title = \"%s\"\n", SSTR(mod_title)); printf (" module_version = \"%s\"\n", SSTR(mod_version)); @@ -286,10 +380,13 @@ #endif if (exec_argc < 2) - fatal ("too few arguments", (char *) 0); + { + /* FIXME: Print usage output instead */ + fatal ("too few arguments"); + } /* - * Get the over-rides from the environment + * Get the overrides from the environment */ OVERENV(ellcc, "ELLCC", ELLCC_CC); OVERENV(ellld, "ELLLD", ELLCC_DLL_LD); @@ -298,12 +395,18 @@ OVERENV(elldllflags, "ELLDLLFLAGS", ELLCC_DLL_LDFLAGS); OVERENV(ellpicflags, "ELLPICFLAGS", ELLCC_DLL_CFLAGS); - if (ellcc_mode == ELLCC_COMPILE_MODE) - do_compile_mode(); - else if (ellcc_mode == ELLCC_LINK_MODE) - do_link_mode(); - else - do_init_mode(); + switch (ellcc_mode) + { + case ELLCC_COMPILE_MODE: + exec_argv = do_compile_mode (); + break; + case ELLCC_LINK_MODE: + exec_argv = do_link_mode (); + break; + default: + exec_argv = do_init_mode (); + break; + } /* * The arguments to pass on to the desired program have now been set @@ -312,16 +415,22 @@ if (verbose) { for (i = 0; i < real_argc; i++) - printf ("%s ", exec_argv[i]); + { + printf ("%s ", exec_argv[i]); + } printf ("\n"); - fflush (stdout); + (void)fflush (stdout); } - exec_argv[real_argc] = (char *)0; /* Terminate argument list */ + + /* Terminate argument list. */ + exec_argv = add_string (exec_argv, NULL); i = execvp (exec_argv[0], exec_argv); if (verbose) - printf ("%s exited with status %d\n", exec_argv[0], i); - return i; + { + printf ("%s exited with status %d\n", exec_argv[0], i); + } + exit (i); } /* Like malloc but get fatal error if memory is exhausted. */ @@ -330,112 +439,166 @@ { void *result = malloc (size); if (result == NULL) - fatal ("virtual memory exhausted", (char *)0); + { + fatal ("virtual memory exhausted"); + } + return result; +} + +/* Like realloc but get fatal error if memory is exhausted. */ +static void * +xrealloc (void *ptr, size_t size) +{ + void *result = realloc (ptr, size); + if (result == NULL) + { + fatal ("virtual memory exhausted"); + } + return result; +} + +/* Like strdup but get fatal error if memory is exhausted. */ +static char * +xstrdup (char *s) +{ + char *result = strdup (s); + if (result == NULL) + { + fatal ("virtual memory exhausted"); + } return result; } /* Print error message and exit. */ static void -fatal (char *s1, char *s2) +fatal (char *format, ...) { - fprintf (stderr, "%s: ", progname); - fprintf (stderr, s1, s2); - fprintf (stderr, "\n"); + va_list ap; + + va_start (ap, format); + (void)fprintf (stderr, "%s: ", progname); + (void)vfprintf (stderr, format, ap); + (void)fprintf (stderr, "\n"); + va_end (ap); exit (EXIT_FAILURE); } +static char ** +add_string (char **exec_argv, char *str) +{ + if (real_argc >= exec_length) + { + exec_length = real_argc + EXEC_GROW_SIZE; + exec_argv = xrnew (exec_argv, exec_length, char *); + } + exec_argv[real_argc++] = str; + return exec_argv; +} + /* * Add a string to the argument vector list that will be passed on down * to the compiler or linker. We need to split individual words into - * arguments, taking quoting into account. This can get ugly. + * arguments, taking quoting into account. */ -static void -add_to_argv (const char *str) +static char ** +add_to_argv (char **exec_argv, const char *str) { - int sm = 0; - const char *s = (const char *)0; - - if ((str == (const char *)0) || (str[0] == '\0')) - return; - - while (*str) + /* Don't add nonexistent strings */ + if (str == NULL) { - switch (sm) - { - case 0: /* Start of case - string leading whitespace */ - if (isspace ((unsigned char) *str)) - str++; - else - { - sm = 1; /* Change state to non-whitespace */ - s = str; /* Mark the start of THIS argument */ - } - break; + return exec_argv; + } - case 1: /* Non-whitespace character. Mark the start */ - if (isspace ((unsigned char) *str)) - { - /* Reached the end of the argument. Add it. */ - int l = str-s; - exec_argv[real_argc] = xnew (l+2, char); - strncpy (exec_argv[real_argc], s, l); - exec_argv[real_argc][l] = '\0'; - real_argc++; - sm = 0; /* Back to start state */ - s = (const char *)0; - break; - } - else if (*str == '\\') - { - sm = 2; /* Escaped character */ - str++; - break; - } - else if (*str == '\'') - { - /* Start of quoted string (single quotes) */ - sm = 3; - } - else if (*str == '"') - { - /* Start of quoted string (double quotes) */ - sm = 4; - } - else - { - /* This was just a normal character. Advance the pointer. */ - str++; - } - break; + /* Skip leading whitespace */ + while (isspace (*str)) + { + str++; + } - case 2: /* Escaped character */ - str++; /* Preserve the quoted character */ - sm = 1; /* Go back to gathering state */ - break; - - case 3: /* Inside single quoted string */ - if (*str == '\'') - sm = 1; - str++; - break; - - case 4: /* inside double quoted string */ - if (*str == '"') - sm = 1; - str++; - break; - } + /* Don't add nonexistent strings */ + if (*str == '\0') + { + return exec_argv; } - if (s != (const char *)0) + while (*str != '\0') { - int l = str-s; - exec_argv[real_argc] = xnew (l+2, char); - strncpy (exec_argv[real_argc], s, l); - exec_argv[real_argc][l] = '\0'; - real_argc++; - s = (const char *)0; + const char *s; + char *arg; + int l; + + s = str; /* Mark the start of THIS argument */ + + /* Find contiguous nonwhitespace characters */ + while (*str != '\0' && !isspace(*str)) + { + if (*str == '\\') /* Escaped character */ + { + str++; + if (*str != '\0') + { + str++; + } + } + else if (*str == '\'') + { + str++; + while (*str != '\0' && *str != '\'') + { + if (str[0] == '\\' && str[1] != '\0') + { + str += 2; + } + else + { + str++; + } + } + if (*str == '\'') + { + str++; + } + } + else if (*str == '\"') + { + str++; + while (*str != '\0' && *str != '\"') + { + if (str[0] == '\\' && str[1] != '\0') + { + str += 2; + } + else + { + str++; + } + } + if (*str == '\"') + { + str++; + } + } + else + { + str++; /* Normal character. Advance the pointer. */ + } + } + + /* Reached the end of the argument. Add it. */ + l = str-s; + arg = xnew(l+1, char); + strncpy(arg, s, (size_t)l); + arg[l] = '\0'; + exec_argv = add_string (exec_argv, arg); + + /* Skip trailing whitespace */ + while (isspace (*str)) + { + str++; + } } + + return exec_argv; } /* @@ -443,27 +606,29 @@ * is build up the argument vector and exec() it. We must just make sure * that we get all of the required arguments in place. */ -static void +static char ** do_compile_mode (void) { int i; - char ts[4096]; /* Plenty big enough */ + char **exec_argv = xnew (exec_argc + 20, char *); - add_to_argv (ellcc); - add_to_argv (ellcflags); - add_to_argv (ellpicflags); - add_to_argv ("-DPIC"); - add_to_argv ("-DEMACS_MODULE"); + exec_argv = add_to_argv (exec_argv, ellcc); + exec_argv = add_to_argv (exec_argv, ellcflags); + exec_argv = add_to_argv (exec_argv, ellpicflags); + exec_argv = add_to_argv (exec_argv, "-DPIC"); + exec_argv = add_to_argv (exec_argv, "-DEMACS_MODULE"); #ifdef XEMACS - add_to_argv ("-DXEMACS_MODULE"); /* Cover both cases */ - add_to_argv ("-Dxemacs"); + /* Cover both cases */ + exec_argv = add_to_argv (exec_argv, "-DXEMACS_MODULE"); + exec_argv = add_to_argv (exec_argv, "-Dxemacs"); #endif - add_to_argv ("-Demacs"); - sprintf (ts, "-I%s/include", ELLCC_ARCHDIR); - add_to_argv (ts); - add_to_argv (ELLCC_CF_ALL); + exec_argv = add_to_argv (exec_argv, "-Demacs"); + exec_argv = add_to_argv (exec_argv, ELLCC_CF_ALL); for (i = 1; i < exec_argc; i++) - exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]); + { + exec_argv = add_string (exec_argv, xstrdup (prog_argv[exec_args[i]])); + } + return exec_argv; } /* @@ -473,20 +638,23 @@ * all of the provided arguments, then the final post arguments. Once * all of this has been done, the argument vector is ready to run. */ -static void +static char ** do_link_mode (void) { int i,x; - char *t, ts[4096]; /* Plenty big enough */ + char *t, *ts; + char **exec_argv = xnew(exec_argc + 10, char *); - add_to_argv (ellld); - add_to_argv (ellldflags); - add_to_argv (elldllflags); - add_to_argv (ELLCC_DLL_LDO); - add_to_argv (mod_output); + exec_argv = add_to_argv (exec_argv, ellld); + exec_argv = add_to_argv (exec_argv, ellldflags); + exec_argv = add_to_argv (exec_argv, elldllflags); + exec_argv = add_to_argv (exec_argv, ELLCC_DLL_LDO); + exec_argv = add_to_argv (exec_argv, mod_output); for (i = 1; i < exec_argc; i++) - exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]); - add_to_argv (ELLCC_DLL_POST); + { + exec_argv = add_string (exec_argv, xstrdup (prog_argv[exec_args[i]])); + } + exec_argv = add_to_argv (exec_argv, ELLCC_DLL_POST); /* * Now go through each argument and replace ELLSONAME with mod_output. @@ -494,18 +662,19 @@ for (i = 0; i < real_argc; i++) { x = 0; + ts = xnew (2 * strlen (exec_argv[i]), char); ts[0] = '\0'; t = exec_argv[i]; - while (*t) + while (*t != '\0') { if (*t == 'E') { - if (strncmp (t, "ELLSONAME", 9) == 0) + if (strncmp (t, "ELLSONAME", (size_t)9) == 0) { strcat (ts, mod_output); + x += strlen (mod_output); t += 8; - x += strlen (mod_output); } else { @@ -523,8 +692,9 @@ t++; } free (exec_argv[i]); - exec_argv[i] = strdup (ts); + exec_argv[i] = ts; } + return exec_argv; } /* @@ -534,16 +704,18 @@ * the header information first, as make-doc will append to the file by * special dispensation. */ -static void +static char ** do_init_mode (void) { int i; - char ts[4096]; /* Plenty big enough */ - char *mdocprog; + char *ts, *mdocprog; + char **exec_argv = xnew(exec_argc + 8, char *); FILE *mout = fopen (mod_output, "w"); - if (mout == (FILE *)0) - fatal ("failed to open output file", mod_output); + if (mout == NULL) + { + fatal ("Failed to open output file %s", mod_output); + } fprintf (mout, "/* DO NOT EDIT - AUTOMATICALLY GENERATED */\n\n"); fprintf (mout, "#include \n\n"); fprintf (mout, "const long emodule_compiler = %ld;\n", EMODULES_REVISION); @@ -552,16 +724,27 @@ fprintf (mout, "const char *emodule_title = \"%s\";\n", SSTR(mod_title)); fprintf (mout, "\n\n"); fprintf (mout, "void docs_of_%s()\n", SSTR(mod_name)); - fclose (mout); + if (fclose (mout) != 0) + { + fatal ("Failed to close output file %s", mod_output); + } - sprintf (ts, "%s/make-docfile", ELLCC_ARCHDIR); - OVERENV(mdocprog, "ELLMAKEDOC", ts); - add_to_argv (mdocprog); + mdocprog = getenv ("ELLMAKEDOC"); + if (mdocprog == NULL) + { + mdocprog = xnew (14 + strlen (ELLCC_ARCHDIR), char); + sprintf (mdocprog, "%s/make-docfile", ELLCC_ARCHDIR); + } + exec_argv = add_to_argv (exec_argv, mdocprog); + ts = xnew (4 + strlen (mod_output), char); sprintf (ts, "-E %s", mod_output); - add_to_argv (ts); + exec_argv = add_to_argv (exec_argv, ts); + free (ts); for (i = 1; i < exec_argc; i++) - exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]); + { + exec_argv = add_string (exec_argv, xstrdup (prog_argv[exec_args[i]])); + } + return exec_argv; } #endif /* HAVE_SHLIB */ - diff -r 4575a219af58 -r 25e260cb7994 lisp/ChangeLog --- a/lisp/ChangeLog Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/ChangeLog Tue Sep 10 15:27:39 2002 +0000 @@ -1,3 +1,24 @@ +2002-08-08 Jerry James + + * autoload.el (make-c-autoload): New function for reading autoload + markers in C files. + * autoload.el (generate-c-autoload-cookie): New variable. + * autoload.el (generate-c-autoload-module): New variable. + * autoload.el (generate-file-autoloads): Do C autoloads, too. + * autoload.el (generate-file-autoloads-1): Use print-autoload. + * autoload.el (generate-c-file-autoloads-1): New function. + * autoload.el (print-autoload): New function to abstract the + printing of autoload forms. + * autoload.el (update-file-autoloads): Do C autoloads, too. + * autoload.el (update-autoloads-from-directory): Ditto. + * code-files.el (load): Pass the pathless filename to load-module. + * loadhist.el (unload-feature): Set unloading-module when a + module marker is seen in load-history. Call unload-module if + unloading-module is non-nil. + * startup.el (startup-load-autoloads): Look for module autoloads. + * update-elc-2.el (batch-update-elc-2): Generate module + autoloads. + 2002-09-02 Ville Skyttä * bytecomp-runtime.el (make-obsolete): Docstring argument nit. diff -r 4575a219af58 -r 25e260cb7994 lisp/autoload.el --- a/lisp/autoload.el Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/autoload.el Tue Sep 10 15:27:39 2002 +0000 @@ -35,6 +35,8 @@ ;; ChangeLog: +;; Jun-25-2002: Jerry James added code for processing C files, to +;; support modularization ;; Sep-26-1997: slb removed code dealing with customization. ;;; Code: @@ -68,6 +70,40 @@ (if macrop (list 'quote 'macro) nil))) nil))) +(defun make-c-autoload (module) + "Make an autoload list for the DEFUN at point in MODULE. +Returns nil if the DEFUN is malformed." + (and + ;; Match the DEFUN + (search-forward "DEFUN" nil t) + ;; Match the opening parenthesis + (progn + (skip-syntax-forward " ") + (eq (char-after) ?\()) + ;; Match the opening quote of the Lisp function name + (progn + (forward-char) + (skip-syntax-forward " ") + (eq (char-after) ?\")) + ;; Extract the Lisp function name, interactive indicator, and docstring + (let* ((func-name (let ((begin (progn (forward-char) (point)))) + (search-forward "\"" nil t) + (backward-char) + (intern (buffer-substring begin (point))))) + (interact (progn + (search-forward "," nil t 4) + (skip-syntax-forward " ") + (not (eq (char-after) ?0)))) + (begin (progn + (search-forward "/*" nil t) + (forward-line 1) + (point)))) + (search-forward "*/" nil t) + (goto-char (match-beginning 0)) + (skip-chars-backward " \t\n\f") + (list 'autoload (list 'quote func-name) module + (buffer-substring begin (point)) interact nil)))) + (defvar generate-autoload-cookie ";;;###autoload" "Magic comment indicating the following form should be autoloaded. Used by `update-file-autoloads'. This string should be @@ -84,6 +120,26 @@ verbatim. If there is further text on the line, that text will be copied verbatim to `generated-autoload-file'.") +(defvar generate-c-autoload-cookie "/* ###autoload" + "Magic C comment indicating the following form should be autoloaded. +Used by `update-file-autoloads'. This string should be +meaningless to C (e.g., a comment). + +This string is used: + +/* ###autoload */ +DEFUN (\"function-to-be-autoloaded\", ... ) + +If this string appears alone on a line, the following form will be +read and an autoload made for it. If there is further text on the line, +that text will be copied verbatim to `generated-autoload-file'.") + +(defvar generate-c-autoload-module "/* ###module" + "Magic C comment indicating the module containing autoloaded functions. +Since a module can consist of multiple C files, the module name may not be +the same as the C source file base name. In that case, use this comment to +indicate the actual name of the module from which to autoload functions.") + (defvar generate-autoload-section-header "\f\n;;;### " "String inserted before the form identifying the section of autoloads for a file.") @@ -138,7 +194,9 @@ If FILE is being visited in a buffer, the contents of the buffer are used." (interactive "fGenerate autoloads for file: ") - (generate-file-autoloads-1 file funlist)) + (if (string-match "\\.el$" file) + (generate-file-autoloads-1 file funlist) + (generate-c-file-autoloads-1 file funlist))) (defun* generate-file-autoloads-1 (file funlist) "Insert at point a loaddefs autoload section for FILE. @@ -214,79 +272,7 @@ (setq autoloads-done (cons (nth 1 form) autoloads-done)) (setq autoload form)) - (if (and doc-string-elt - (stringp (nth doc-string-elt autoload))) - ;; We need to hack the printing because the - ;; doc-string must be printed specially for - ;; make-docfile (sigh). - (let* ((p (nthcdr (1- doc-string-elt) - autoload)) - (elt (cdr p))) - (setcdr p nil) - (princ "\n(" outbuf) - ;; XEmacs change: don't let ^^L's get into - ;; the file or sorting is hard. - (let ((print-escape-newlines t) - (p (save-excursion - (set-buffer outbuf) - (point))) - p2) - (mapcar (function (lambda (elt) - (prin1 elt outbuf) - (princ " " outbuf))) - autoload) - (save-excursion - (set-buffer outbuf) - (setq p2 (point-marker)) - (goto-char p) - (save-match-data - (while (search-forward "\^L" p2 t) - (delete-char -1) - (insert "\\^L"))) - (goto-char p2) - )) - (princ "\"\\\n" outbuf) - (let ((begin (save-excursion - (set-buffer outbuf) - (point)))) - (princ (substring - (prin1-to-string (car elt)) 1) - outbuf) - ;; Insert a backslash before each ( that - ;; appears at the beginning of a line in - ;; the doc string. - (save-excursion - (set-buffer outbuf) - (save-excursion - (while (search-backward "\n(" begin t) - (forward-char 1) - (insert "\\")))) - (if (null (cdr elt)) - (princ ")" outbuf) - (princ " " outbuf) - (princ (substring - (prin1-to-string (cdr elt)) - 1) - outbuf)) - (terpri outbuf))) - ;; XEmacs change: another fucking ^L hack - (let ((p (save-excursion - (set-buffer outbuf) - (point))) - (print-escape-newlines t) - p2) - (print autoload outbuf) - (save-excursion - (set-buffer outbuf) - (setq p2 (point-marker)) - (goto-char p) - (save-match-data - (while (search-forward "\^L" p2 t) - (delete-char -1) - (insert "\\^L"))) - (goto-char p2) - )) - )) + (print-autoload autoload doc-string-elt outbuf)) ;; Copy the rest of the line to the output. (let ((begin (point))) ;; (terpri outbuf) @@ -346,6 +332,165 @@ (or noninteractive ; XEmacs: only need one line in -batch mode. (message "Generating autoloads for %s...done" file)))) +(defun* generate-c-file-autoloads-1 (file funlist) + "Insert at point a loaddefs autoload section for the C file FILE. +autoloads are generated for Defuns and defmacros in FILE +marked by `generate-c-autoload-cookie' (which see). +If FILE is being visited in a buffer, the contents of the buffer +are used." + (let ((outbuf (current-buffer)) + (autoloads-done '()) + (load-name (replace-in-string (file-name-nondirectory file) + "\\.c?$" + "")) + (trim-name (autoload-trim-file-name file)) + (print-length nil) + (print-readably t) + (float-output-format nil) + ;; (done-any nil) + (visited (get-file-buffer file)) + output-end) + + ;; If the autoload section we create here uses an absolute + ;; pathname for FILE in its header, and then Emacs is installed + ;; under a different path on another system, + ;; `update-autoloads-here' won't be able to find the files to be + ;; autoloaded. So, if FILE is in the same directory or a + ;; subdirectory of the current buffer's directory, we'll make it + ;; relative to the current buffer's directory. + (setq file (expand-file-name file)) + + (save-excursion + (unwind-protect + (progn + (let ((find-file-hooks nil) + (enable-local-variables nil)) + (set-buffer (or visited (find-file-noselect file t t))) + ;; This doesn't look right, but it is. The only place we need + ;; the syntax table is when snarfing the Lisp function name. + (set-syntax-table emacs-lisp-mode-syntax-table)) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + ;; Is there a module name comment? + (when (search-forward generate-c-autoload-module nil t) + (skip-chars-forward " \t") + (let ((begin (point))) + (skip-chars-forward "^ \t\n\f") + (setq load-name (buffer-substring begin (point))))) + (if funlist + (progn + (message "Generating autoloads for %s..." trim-name) + (dolist (arg funlist) + (goto-char (point-min)) + (re-search-forward + (concat "DEFUN (\"" + (regexp-quote (symbol-name arg)) + "\"")) + (goto-char (match-beginning 0)) + (let ((autoload (make-c-autoload load-name))) + (when autoload + (push (nth 1 (nth 1 autoload)) autoloads-done) + (print-autoload autoload 3 outbuf))))) + (goto-char (point-min)) + (let ((match + (search-forward generate-c-autoload-cookie nil t))) + (unless match + (message "No autoloads found in %s" trim-name) + (return-from generate-c-file-autoloads-1)) + + (message "Generating autoloads for %s..." trim-name) + (while match + (forward-line 1) + (let ((autoload (make-c-autoload load-name))) + (when autoload + (push (nth 1 (nth 1 autoload)) autoloads-done) + (print-autoload autoload 3 outbuf))) + (setq match + (search-forward generate-c-autoload-cookie nil t)) + )))))) + (unless visited + ;; We created this buffer, so we should kill it. + (kill-buffer (current-buffer))) + (set-buffer outbuf) + (setq output-end (point-marker)))) + (insert generate-autoload-section-header) + (prin1 (list 'autoloads autoloads-done load-name trim-name) outbuf) + (terpri outbuf) + (when (< output-end (point)) + (setq output-end (point-marker))) + (goto-char output-end) + (insert generate-autoload-section-trailer) + (or noninteractive ; XEmacs: only need one line in -batch mode. + (message "Generating autoloads for %s...done" trim-name)))) + +(defun print-autoload (autoload doc-string-elt outbuf) + "Print an autoload form, handling special characters. +In particular, print docstrings with escapes inserted before left parentheses +at the beginning of lines and ^L characters." + (if (and doc-string-elt (stringp (nth doc-string-elt autoload))) + ;; We need to hack the printing because the doc-string must be + ;; printed specially for make-docfile (sigh). + (let* ((p (nthcdr (1- doc-string-elt) autoload)) + (elt (cdr p))) + (setcdr p nil) + (princ "\n(" outbuf) + ;; XEmacs change: don't let ^^L's get into + ;; the file or sorting is hard. + (let ((print-escape-newlines t) + (p (save-excursion + (set-buffer outbuf) + (point))) + p2) + (mapcar #'(lambda (elt) + (prin1 elt outbuf) + (princ " " outbuf)) + autoload) + (save-excursion + (set-buffer outbuf) + (setq p2 (point-marker)) + (goto-char p) + (save-match-data + (while (search-forward "\^L" p2 t) + (delete-char -1) + (insert "\\^L"))) + (goto-char p2))) + (princ "\"\\\n" outbuf) + (let ((begin (save-excursion + (set-buffer outbuf) + (point)))) + (princ (substring (prin1-to-string (car elt)) 1) outbuf) + ;; Insert a backslash before each ( that appears at the beginning + ;; of a line in the doc string. + (save-excursion + (set-buffer outbuf) + (save-excursion + (while (search-backward "\n(" begin t) + (forward-char 1) + (insert "\\")))) + (if (null (cdr elt)) + (princ ")" outbuf) + (princ " " outbuf) + (princ (substring (prin1-to-string (cdr elt)) 1) outbuf)) + (terpri outbuf))) + ;; XEmacs change: another ^L hack + (let ((p (save-excursion + (set-buffer outbuf) + (point))) + (print-escape-newlines t) + p2) + (print autoload outbuf) + (save-excursion + (set-buffer outbuf) + (setq p2 (point-marker)) + (goto-char p) + (save-match-data + (while (search-forward "\^L" p2 t) + (delete-char -1) + (insert "\\^L"))) + (goto-char p2))))) + (defconst autoload-file-name "auto-autoloads.el" "Generic filename to put autoloads into. @@ -383,7 +528,7 @@ (list autoload-file-name)))) (let ((load-name (replace-in-string (file-name-nondirectory file) - "\\.elc?$" + "\\.\\(elc?\\|c\\)$" "")) (trim-name (autoload-trim-file-name file)) section-begin form) @@ -473,7 +618,7 @@ ;;;###autoload (defun update-autoloads-from-directory (dir) "Update `generated-autoload-file' with all the current autoloads from DIR. -This runs `update-file-autoloads' on each .el file in DIR. +This runs `update-file-autoloads' on each .el and .c file in DIR. Obsolete autoload entries for files that no longer exist are deleted. Note that, if this function is called from `batch-update-directory', `generated-autoload-file' was rebound in that function. @@ -505,7 +650,8 @@ (search-forward generate-autoload-section-trailer) (delete-region begin (point))))) ;; Update or create autoload sections for existing files. - (mapcar 'update-file-autoloads (directory-files dir t "^[^=].*\\.el$")) + (mapcar 'update-file-autoloads + (directory-files dir t "^[^=].*\\.\\(el\\|c\\)$")) (unless noninteractive (save-buffer))))) diff -r 4575a219af58 -r 25e260cb7994 lisp/code-files.el --- a/lisp/code-files.el Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/code-files.el Tue Sep 10 15:27:39 2002 +0000 @@ -273,12 +273,12 @@ )))) ;; The file name is invalid, or we want to load a binary module (if (and (> (length filename) 0) - (setq path (locate-file filename module-load-path - (and (not nosuffix) - '(".ell" ".dll" ".so" ""))))) + (locate-file filename module-load-path + (and (not nosuffix) + '(".ell" ".dll" ".so" "")))) (if (featurep 'modules) (let ((load-modules-quietly nomessage)) - (load-module path)) + (load-module filename)) (signal 'file-error '("This XEmacs does not support modules"))) (and (null noerror) (signal 'file-error (list "Cannot open load file" filename)))) diff -r 4575a219af58 -r 25e260cb7994 lisp/loadhist.el --- a/lisp/loadhist.el Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/loadhist.el Tue Sep 10 15:27:39 2002 +0000 @@ -124,7 +124,8 @@ (error "Loaded libraries %s depend on %s" (prin1-to-string dependents) file)))) (let* ((flist (feature-symbols feature)) - (file (car flist))) + (file (car flist)) + (unloading-module nil)) (flet ((reset-aload (x) (let ((aload (get x 'autoload))) (if aload (fset x (cons 'autoload aload)))))) @@ -134,7 +135,9 @@ ((consp x) ;; Remove any feature names that this file provided. (if (eq (car x) 'provide) - (setq features (delq (cdr x) features)))) + (setq features (delq (cdr x) features)) + (if (eq (car x) 'module) + (setq unloading-module t)))) ((and (boundp x) (fboundp x)) (makunbound x) @@ -148,7 +151,10 @@ (cdr flist))) ;; Delete the load-history element for this file. (let ((elt (assoc file load-history))) - (setq load-history (delq elt load-history))))) + (setq load-history (delq elt load-history))) + ;; If it is a module, really unload it. + (if unloading-module + (unload-module (symbol-name feature))))) (provide 'loadhist) diff -r 4575a219af58 -r 25e260cb7994 lisp/startup.el --- a/lisp/startup.el Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/startup.el Tue Sep 10 15:27:39 2002 +0000 @@ -1415,6 +1415,10 @@ (load (expand-file-name (file-name-sans-extension autoload-file-name) lisp-directory) nil t)) + ;; Hey! Let's use a packages-* function for a non-package purpose! + (if (and (not inhibit-autoloads) (featurep 'modules)) + (packages-load-package-auto-autoloads module-load-path)) + (if (and (not inhibit-autoloads) (not inhibit-all-packages)) (progn (if (not inhibit-early-packages) diff -r 4575a219af58 -r 25e260cb7994 lisp/update-elc-2.el --- a/lisp/update-elc-2.el Mon Sep 09 21:53:43 2002 +0000 +++ b/lisp/update-elc-2.el Tue Sep 10 15:27:39 2002 +0000 @@ -146,6 +146,12 @@ (load "autoload") (update-autoload-files (list dir)) (byte-recompile-file (expand-file-name "auto-autoloads.el" dir) 0) + (if (featurep 'modules) + (let* ((moddir (expand-file-name "../modules" (file-truename dir))) + (generated-autoload-file + (expand-file-name "auto-autoloads.el" moddir))) + (update-autoload-files (directory-files moddir t nil nil 0) t) + (byte-recompile-file generated-autoload-file 0))) (when (featurep 'mule) (update-autoload-files (list (expand-file-name "mule" dir))) (byte-recompile-file (expand-file-name "mule/auto-autoloads.el" dir) 0)) diff -r 4575a219af58 -r 25e260cb7994 modules/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/.cvsignore Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,1 @@ +auto-autoloads.el diff -r 4575a219af58 -r 25e260cb7994 modules/ChangeLog --- a/modules/ChangeLog Mon Sep 09 21:53:43 2002 +0000 +++ b/modules/ChangeLog Tue Sep 10 15:27:39 2002 +0000 @@ -1,3 +1,43 @@ +2002-08-08 Jerry James + + * auto-autoloads.el: New file containing module autoloads. + * auto-autoloads.elc: Ditto. + * README: Update to reflect the new architecture. + * ldap/configure.ac: New file. + * ldap/configure: Ditto. + * ldap/eldap.h: Copy the version from src. + * ldap/eldap.c: Ditto. Add autoloads. + * ldap/eldap.c (unload_eldap): New function to unstaticpro symbols + defined in this file. + * ldap/install-sh: New script for independent module building. + * ldap/Makefile: Remove in favor of autoconf solution. + * ldap/Makefile.in.in: New file containing the autoconf solution. + * postgresql: New directory. + * postgresql/.cvsignore: New file. + * postgresql/configure.ac: Ditto. + * postgresql/configure: Ditto. + * postgresql/install-sh: New script for independent module + building. + * postgresql/Makefile.in.in: New file. + * postgresql/postgresql.h: Copy the version from src. + * postgresql/postgresql.c: Ditto. Add autoloads. + * sample/Makefile: Move to internal and external subdirectories. + * sample/sample.c: Ditto. + * sample/external: New directory containing sample external + modules. + * sample/external/.cvsignore: New file. + * sample/external/configure.ac: Ditto. + * sample/external/install-sh: Ditto. + * sample/external/Makefile.in.in: New. + * sample/external/sample.c: Move from next higher directory. + * sample/internal: New directory containing sample internal + modules. + * sample/internal/.cvsignore: New file. + * sample/internal/configure.ac: Ditto. + * sample/internal/install-sh: Ditto. + * sample/internal/Makefile.in.in: New. + * sample/internal/sample.c: Move from next higher directory. + 2002-08-30 Steve Youngs * XEmacs 21.5.9 "brussels sprouts" is released. diff -r 4575a219af58 -r 25e260cb7994 modules/README --- a/modules/README Mon Sep 09 21:53:43 2002 +0000 +++ b/modules/README Tue Sep 10 15:27:39 2002 +0000 @@ -1,17 +1,27 @@ -This directory contains a number of sample Emacs dynamic modules. -These modules can be loaded with the command 'M-x load-module'. +This directory contains a number of XEmacs dynamic modules. These +modules can be loaded directly with the command 'M-x load-module'. +However, the preferred method of loading a module is to issue a +"(require 'module-name)" command to the Lisp interpreter. This will +store information so that a later "(unload-feature 'module-name)" can +succeed. -To compile one of these modules, simply enter the desired directory -and type 'make'. Then, from within Emacs, load the module by -specifying the path to the directory which contains the compiled -module. +To compile one of these modules, simply enter the desired directory, +type 'configure', and then 'make'. If you are building the module for +an installed XEmacs, then 'make install' will place the module in the +appropriate directory for XEmacs to find it later (assuming you have +permission to write to that directory). A subsequent 'load-module' or +'require' will then load the module, as described above. -Each of these samples describes different features and limitations -of the Emacs module loading technology. Please refer to the README -files in each directory for a brief discussion on what the sample -in that directory is demonstrating. For a complete discussion on -Emacs dynamic modules, please consult the Emacs Module Writers Guide, -which can be found in the ../info directory. +Each of these demonstrates different features and limitations of the +XEmacs module loading technology. For a complete discussion on XEmacs +dynamic modules, please consult the XEmacs Module Writers Guide, which +can be found in the ../info directory. -NOTE: As this technology matures, this directory will eventually contain -large parts of XEmacs itself, which will be loaded in as required. +For those wanting to get started with module writing, please see the +'sample' directory. It contains two subdirectories: internal and +external. The 'internal' subdirectory contains the framework needed to +migrate some core piece of XEmacs functionality into code that can +either be compiled into the core or built as a separate module. The +'external' subdirectory contains the somewhat simpler framework needed +to build a module separately from XEmacs. These should be considered +starting places for module writing. diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/Makefile --- a/modules/ldap/Makefile Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -# -# This is slightly more complicated than would normally be the case, -# as this makefile has been tailored to work in the Emacs source tree. -# For samples of how to compile modules outside of the source tree -# (as would be the case if a user had downloaded a module and wanted -# to compile it for use within Emacs), see the samples in the sub-directory -# 'installed'. -# - -SHELL=/bin/sh -RM=rm -f -CC=../../lib-src/ellcc -CFLAGS=-I. -I../../src -LD=$(CC) --mode=link -MKINIT=$(CC) --mode=init - -SRCS=eldap.c -OBJS=$(SRCS:.c=.o) - -.c.o: - $(CC) $(CFLAGS) -c $< - -MODNAME=ldap -MODVER=1.0.0 -MODTITLE="LDAP Client Interface for XEmacs" - -all: $(MODNAME).ell - -distclean: clean - -clean: - $(RM) $(MODNAME).ell $(OBJS) eldap_i.o eldap_i.c - -$(MODNAME).ell: $(OBJS) eldap_i.o - $(LD) --mod-output=$@ $(OBJS) eldap_i.o - -eldap_i.o: eldap_i.c -eldap_i.c: $(SRCS) - ELLMAKEDOC=../../lib-src/make-docfile $(MKINIT) --mod-output=$@ \ - --mod-name=$(MODNAME) --mod-version=$(MODVER) \ - --mod-title=$(MODTITLE) $(SRCS) - diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/Makefile.in.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/ldap/Makefile.in.in Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,85 @@ +## Makefile for the LDAP module in XEmacs. +## Copyright (C) 2002 Jerry James. + +## This file is part of XEmacs. + +## XEmacs is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. + +## XEmacs is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. + +## You should have received a copy of the GNU General Public License +## along with XEmacs; see the file COPYING. If not, write to +## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +## Boston, MA 02111-1307, USA. + +## Synched up with: Not synched with FSF. + +## This is more complicated than would normally be the case, as this makefile +## has been tailored to work both inside and independently of the XEmacs +## source tree, and to support both module and non-module building inside the +## source tree. + +### Specialize this part for your module +MODNAME=eldap +MODVER=1.0.0 +MODTITLE="LDAP Client Interface for XEmacs" +LDFLAGS=@LDFLAGS@ @ldap_libs@ +SRCS=eldap.c + +### You should not need to modify anything below this line +SRC_SRCS=$(SRCS:%=$(srcdir)/%) +OBJS=$(SRCS:.c=.o) + +SHELL=/bin/sh +RM=rm -f +PROGNAME=@PROGNAME@ +CFLAGS=@CFLAGS@ +INSTALL=@INSTALL@ +version=@version@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +instvardir=@instvardir@ +configuration=@configuration@ +moduledir=@moduledir@ +with_modules=@with_modules@ + +srcdir=@srcdir@ +VPATH=@srcdir@ + +CC=@MOD_CC@ +MODARCHDIR=@MODARCHDIR@ +MAKE_DOCFILE=@MAKE_DOCFILE@ +MODCFLAGS=@MODCFLAGS@ +INSTALLPATH=@INSTALLPATH@ +INSTALL_PROGRAM=@MOD_INSTALL_PROGRAM@ +OBJECT_TO_BUILD=@OBJECT_TO_BUILD@ + +.PHONY: clean distclean install +all: $(OBJECT_TO_BUILD) + +.c.o: + $(CC) $(MODCFLAGS) -c $< + +$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o + $(CC) --mode=link --mod-output=$@ $^ $(LDFLAGS) + +$(MODNAME)_i.c: $(SRCS) + ELLMAKEDOC=$(MAKE_DOCFILE) $(CC) --mode=init --mod-output=$@ \ + --mod-name=$(MODNAME) --mod-version=$(MODVER) \ + --mod-title=$(MODTITLE) $(SRC_SRCS) + +clean: + $(RM) $(MODNAME).ell $(OBJS) $(MODNAME)_i.* *~ + +distclean: clean + $(RM) Makefile config.* configure + +install: $(OBJECT_TO_BUILD) + $(INSTALL_PROGRAM) $< $(INSTALLPATH) diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/ldap/configure Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,3955 @@ +#! /bin/sh +# From configure.ac Revision: 1.0 . +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53b for LDAP module 1.0. +# +# Report bugs to . +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +# +# Configuration script for the LDAP module. +# Copyright (C) 2002 Jerry James. +# +# This file is part of XEmacs. +# +# XEmacs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your +# option) any later version. +# +# XEmacs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XEmacs; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='LDAP module' +PACKAGE_TARNAME='ldap-module' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='LDAP module 1.0' +PACKAGE_BUGREPORT='xemacs-beta@xemacs.org' + +ac_unique_file="eldap.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA ELLCC CPP EGREP ldap_libs PROGNAME MOD_CC MODARCHDIR MAKE_DOCFILE MODCFLAGS INSTALLPATH MOD_INSTALL_PROGRAM OBJECT_TO_BUILD LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_ELLCC_set=${ELLCC+set} +ac_env_ELLCC_value=$ELLCC +ac_cv_env_ELLCC_set=${ELLCC+set} +ac_cv_env_ELLCC_value=$ELLCC +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures LDAP module 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of LDAP module 1.0:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + ELLCC The path to the ellcc module compiler + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +LDAP module configure 1.0 +generated by GNU Autoconf 2.53b + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. + +Configuration script for the LDAP module. +Copyright (C) 2002 Jerry James. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your +option) any later version. + +XEmacs is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by LDAP module $as_me 1.0, which was +generated by GNU Autoconf 2.53b. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + + +# Find ELLCC + +# Extract the first word of "ellcc", so it can be a program name with args. +set dummy ellcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ELLCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ELLCC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ELLCC="$ELLCC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ELLCC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_ELLCC" && ac_cv_path_ELLCC=""FAIL"" + ;; +esac +fi +ELLCC=$ac_cv_path_ELLCC + +if test -n "$ELLCC"; then + echo "$as_me:$LINENO: result: $ELLCC" >&5 +echo "${ECHO_T}$ELLCC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$ELLCC" = "FAIL"; then + { { echo "$as_me:$LINENO: error: Cannot find ellcc" >&5 +echo "$as_me: error: Cannot find ellcc" >&2;} + { (exit 1); exit 1; }; } +fi + + +# Find the LDAP headers and libraries +have_ldap="yes" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_header in ldap.h lber.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + have_ldap="no" +fi + +done + +if test "$have_ldap" = "yes"; then + +echo "$as_me:$LINENO: checking for ldap_search in -lldap" >&5 +echo $ECHO_N "checking for ldap_search in -lldap... $ECHO_C" >&6 +if test "${ac_cv_lib_ldap_ldap_search+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldap -llber $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldap_search (); +int +main () +{ +ldap_search (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ldap_ldap_search=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ldap_ldap_search=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_search" >&5 +echo "${ECHO_T}$ac_cv_lib_ldap_ldap_search" >&6 +if test $ac_cv_lib_ldap_ldap_search = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDAP 1 +_ACEOF + + LIBS="-lldap $LIBS" + +else + have_ldap="no"; LIBS="$LIBS -llber" +fi + + test "$have_ldap" = "no" && { + echo "$as_me:$LINENO: checking for ldap_open in -lldap" >&5 +echo $ECHO_N "checking for ldap_open in -lldap... $ECHO_C" >&6 +if test "${ac_cv_lib_ldap_ldap_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldap -lkrb $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldap_open (); +int +main () +{ +ldap_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ldap_ldap_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ldap_ldap_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_open" >&5 +echo "${ECHO_T}$ac_cv_lib_ldap_ldap_open" >&6 +if test $ac_cv_lib_ldap_ldap_open = yes; then + have_ldap="yes" +else + LIBS="$LIBS -lkrb" +fi + } + test "$have_ldap" = "no" && { + echo "$as_me:$LINENO: checking for ldap_open in -lldap" >&5 +echo $ECHO_N "checking for ldap_open in -lldap... $ECHO_C" >&6 +if test "${ac_cv_lib_ldap_ldap_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldap -ldes $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ldap_open (); +int +main () +{ +ldap_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ldap_ldap_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ldap_ldap_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_open" >&5 +echo "${ECHO_T}$ac_cv_lib_ldap_ldap_open" >&6 +if test $ac_cv_lib_ldap_ldap_open = yes; then + have_ldap="yes" +else + LIBS="$LIBS -ldes" +fi + } +else + { { echo "$as_me:$LINENO: error: Cannot find the LDAP header file" >&5 +echo "$as_me: error: Cannot find the LDAP header file" >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$have_ldap" = "yes"; then + + + + +for ac_func in ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +else + { { echo "$as_me:$LINENO: error: Cannot link with the LDAP library" >&5 +echo "$as_me: error: Cannot link with the LDAP library" >&2;} + { (exit 1); exit 1; }; } +fi + +ldap_libs="$LIBS" + + +# This part should appear unchanged in every module configure.ac +PROGNAME="module" + +MOD_CC="@ELLCC@" + +MODARCHDIR="\$(shell @ELLCC@ --mod-archdir)" + +MAKE_DOCFILE="\$(MODARCHDIR)/make-docfile" + +MODCFLAGS="\$(CFLAGS) --mode=compile --mod-output=\$@ -I\$(MODARCHDIR)/include" + +INSTALLPATH="\$(shell @ELLCC@ --mod-site-location)" + +MOD_INSTALL_PROGRAM="@INSTALL_PROGRAM@" + +OBJECT_TO_BUILD="\$(MODNAME).ell" + + + ac_config_files="$ac_config_files Makefile.in Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by LDAP module $as_me 1.0, which was +generated by GNU Autoconf 2.53b. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +LDAP module config.status 1.0 +configured by $0, generated by GNU Autoconf 2.53b, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile.in" ) CONFIG_FILES="$CONFIG_FILES Makefile.in" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@ELLCC@,$ELLCC,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@ldap_libs@,$ldap_libs,;t t +s,@PROGNAME@,$PROGNAME,;t t +s,@MOD_CC@,$MOD_CC,;t t +s,@MODARCHDIR@,$MODARCHDIR,;t t +s,@MAKE_DOCFILE@,$MAKE_DOCFILE,;t t +s,@MODCFLAGS@,$MODCFLAGS,;t t +s,@INSTALLPATH@,$INSTALLPATH,;t t +s,@MOD_INSTALL_PROGRAM@,$MOD_INSTALL_PROGRAM,;t t +s,@OBJECT_TO_BUILD@,$OBJECT_TO_BUILD,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/ldap/configure.ac Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,66 @@ +# Process this file with autoconf to produce a configure script. +# This is only used for independent module building. +AC_INIT([LDAP module], [1.0], [xemacs-beta@xemacs.org]) +AC_PREREQ(2.53) +AC_REVISION($Revision: 1.1 $) +AC_COPYRIGHT([Configuration script for the LDAP module. +Copyright (C) 2002 Jerry James. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your +option) any later version. + +XEmacs is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA.]) + +AC_CONFIG_SRCDIR([eldap.c]) +AC_PROG_CC +AC_PROG_INSTALL +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) + +# Find ELLCC +AC_ARG_VAR([ELLCC], [The path to the ellcc module compiler]) +AC_PATH_PROG([ELLCC], [ellcc], ["FAIL"]) +AS_IF([test "$ELLCC" = "FAIL"], [AS_ERROR([Cannot find ellcc])]) + +# Find the LDAP headers and libraries +have_ldap="yes" +AC_CHECK_HEADERS([ldap.h lber.h], , [have_ldap="no"]) +AS_IF([test "$have_ldap" = "yes"], + [AC_CHECK_LIB([ldap], [ldap_search], , [have_ldap="no"; LIBS="$LIBS -llber"], + [-llber]) + test "$have_ldap" = "no" && { + AC_CHECK_LIB([ldap], [ldap_open], [have_ldap="yes"], [LIBS="$LIBS -lkrb"], + [-lkrb]) } + test "$have_ldap" = "no" && { + AC_CHECK_LIB([ldap], [ldap_open], [have_ldap="yes"], [LIBS="$LIBS -ldes"], + [-ldes]) }], + [AS_ERROR([Cannot find the LDAP header file])]) +AS_IF([test "$have_ldap" = "yes"], + [AC_CHECK_FUNCS([ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result])], + [AS_ERROR([Cannot link with the LDAP library])]) +AC_SUBST(ldap_libs, "$LIBS") + +# This part should appear unchanged in every module configure.ac +AC_SUBST(PROGNAME, "module") +AC_SUBST(MOD_CC, "@ELLCC@") +AC_SUBST(MODARCHDIR, "\$(shell @ELLCC@ --mod-archdir)") +AC_SUBST(MAKE_DOCFILE, "\$(MODARCHDIR)/make-docfile") +AC_SUBST(MODCFLAGS, "\$(CFLAGS) --mode=compile --mod-output=\$@ -I\$(MODARCHDIR)/include") +AC_SUBST(INSTALLPATH, "\$(shell @ELLCC@ --mod-site-location)") +AC_SUBST(MOD_INSTALL_PROGRAM, "@INSTALL_PROGRAM@") +AC_SUBST(OBJECT_TO_BUILD, "\$(MODNAME).ell") + +AC_CONFIG_FILES([Makefile.in Makefile]) +AC_OUTPUT diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/eldap.c --- a/modules/ldap/eldap.c Mon Sep 09 21:53:43 2002 +0000 +++ b/modules/ldap/eldap.c Tue Sep 10 15:27:39 2002 +0000 @@ -20,62 +20,193 @@ /* Synched up with: Not in FSF. */ -/* Author: Oscar Figueiredo */ +/* Author: Oscar Figueiredo with lots of support from Hrvoje Niksic */ /* This file provides lisp primitives for access to an LDAP library conforming to the API defined in RFC 1823. It has been tested with: - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) - - Netscape's LDAP SDK 1.0 (http://developer.netscape.com) */ + - OpenLDAP 1.2 (http://www.openldap.org/) + - Netscape's LDAP SDK (http://developer.netscape.com/) */ + -#include +#include +#include "lisp.h" +#include "opaque.h" +#include "sysdep.h" +#include "buffer.h" +#include "process.h" /* for report_process_error */ -#if defined (HAVE_LDAP) -/* The entire file is within this conditional */ +#include #include "eldap.h" -#include -#include + +static Fixnum ldap_default_port; +static Lisp_Object Vldap_default_base; + +static Lisp_Object Qeldap; -#ifdef HAVE_NS_LDAP -#define HAVE_LDAP_SET_OPTION 1 -#define HAVE_LDAP_GET_ERRNO 1 -#else -#undef HAVE_LDAP_SET_OPTION -#undef HAVE_LDAP_GET_ERRNO -#endif +/* Needed by the lrecord definition */ +Lisp_Object Qldapp; -static Lisp_Object Vldap_default_base; -static Lisp_Object Vldap_default_host; - -/* ldap-search-internal plist keywords */ -static Lisp_Object Qhost, Qfilter, Qattributes, Qattrsonly, Qbase, Qscope, - Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit, Qsizelimit; +/* ldap-open plist keywords */ +static Lisp_Object Qport, Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit, Qsizelimit; /* Search scope limits */ static Lisp_Object Qbase, Qonelevel, Qsubtree; /* Authentication methods */ -#ifdef LDAP_AUTH_KRBV41 -static Lisp_Object Qkrbv41; -#endif -#ifdef LDAP_AUTH_KRBV42 -static Lisp_Object Qkrbv42; -#endif +static Lisp_Object Qkrbv41, Qkrbv42; /* Deref policy */ static Lisp_Object Qnever, Qalways, Qfind; +/* Modification types (Qdelete is defined in general.c) */ +static Lisp_Object Qadd, Qreplace; -DEFUN ("ldap-search-internal", Fldap_search_internal, 1, 1, 0, /* -Perform a search on a LDAP server. -SEARCH-PLIST is a property list describing the search request. + +/************************************************************************/ +/* Utility Functions */ +/************************************************************************/ + +static void +signal_ldap_error (LDAP *ld, LDAPMessage *res, int ldap_err) +{ + if (ldap_err <= 0) + { +#if defined HAVE_LDAP_PARSE_RESULT + int err; + ldap_err = ldap_parse_result (ld, res, + &err, + NULL, NULL, NULL, NULL, 0); + if (ldap_err == LDAP_SUCCESS) + ldap_err = err; +#elif defined HAVE_LDAP_GET_LDERRNO + ldap_err = ldap_get_lderrno (ld, NULL, NULL); +#elif defined HAVE_LDAP_RESULT2ERROR + ldap_err = ldap_result2error (ld, res, 0); +#else + ldap_err = ld->ld_errno; +#endif + } + invalid_operation ("LDAP error", + build_string (ldap_err2string (ldap_err))); +} + + +/************************************************************************/ +/* ldap lrecord basic functions */ +/************************************************************************/ + +static Lisp_Object +make_ldap (Lisp_LDAP *ldap) +{ + return wrap_ldap (ldap); +} + +#ifdef USE_KKCC +static const struct lrecord_description ldap_description [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_LDAP, host) }, + { XD_END } +}; +#endif /* USE_KKCC */ + +static Lisp_Object +mark_ldap (Lisp_Object obj) +{ + return XLDAP (obj)->host; +} + +static void +print_ldap (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) +{ + Lisp_LDAP *ldap = XLDAP (obj); + + if (print_readably) + printing_unreadable_object ("#", XSTRING_DATA (ldap->host)); + + write_fmt_string_lisp (printcharfun, "#host); + if (!ldap->ld) + write_c_string (printcharfun,"(dead) "); + write_fmt_string (printcharfun, " 0x%lx>", (long)ldap); +} + +static Lisp_LDAP * +allocate_ldap (void) +{ + Lisp_LDAP *ldap = alloc_lcrecord_type (Lisp_LDAP, &lrecord_ldap); + + ldap->ld = NULL; + ldap->host = Qnil; + return ldap; +} + +static void +finalize_ldap (void *header, int for_disksave) +{ + Lisp_LDAP *ldap = (Lisp_LDAP *) header; + + if (for_disksave) + invalid_operation ("Can't dump an emacs containing LDAP objects", + make_ldap (ldap)); + + if (ldap->ld) + ldap_unbind (ldap->ld); + ldap->ld = NULL; +} + +#ifdef USE_KKCC +DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap, + 0, /*dumpable-flag*/ + mark_ldap, print_ldap, finalize_ldap, + NULL, NULL, ldap_description, Lisp_LDAP); +#else /* not USE_KKCC */ +DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap, + mark_ldap, print_ldap, finalize_ldap, + NULL, NULL, 0, Lisp_LDAP); +#endif /* not USE_KKCC */ + + + +/************************************************************************/ +/* Basic ldap accessors */ +/************************************************************************/ + +/* ###autoload */ +DEFUN ("ldapp", Fldapp, 1, 1, 0, /* +Return t if OBJECT is a LDAP connection. +*/ + (object)) +{ + return LDAPP (object) ? Qt : Qnil; +} + +DEFUN ("ldap-host", Fldap_host, 1, 1, 0, /* +Return the server host of the connection LDAP, as a string. +*/ + (ldap)) +{ + CHECK_LDAP (ldap); + return (XLDAP (ldap))->host; +} + +DEFUN ("ldap-live-p", Fldap_live_p, 1, 1, 0, /* +Return t if LDAP is an active LDAP connection. +*/ + (ldap)) +{ + CHECK_LDAP (ldap); + return (XLDAP (ldap))->ld ? Qt : Qnil; +} + +/************************************************************************/ +/* Opening/Closing a LDAP connection */ +/************************************************************************/ + + +/* ###autoload */ +DEFUN ("ldap-open", Fldap_open, 1, 2, 0, /* +Open a LDAP connection to HOST. +PLIST is a plist containing additional parameters for the connection. Valid keys in that list are: - `host' is a string naming one or more (blank separated) LDAP servers to -to try to connect to. Each host name may optionally be of the form host:port. - `filter' is a filter string for the search as described in RFC 1558 - `attributes' is a list of strings indicating which attributes to retrieve -for each matching entry. If nil return all available attributes. - `attrsonly' if non-nil indicates that only the attributes are retrieved, not -the associated values. - `base' is the base for the search as described in RFC 1779. - `scope' is one of the three symbols `subtree', `base' or `onelevel'. + `port' the TCP port to use for the connection if different from +`ldap-default-port'. `auth' is the authentication method to use, possible values depend on the LDAP library XEmacs was compiled with: `simple', `krbv41' and `krbv42'. `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax). @@ -83,364 +214,643 @@ `deref' is one of the symbols `never', `always', `search' or `find'. `timelimit' is the timeout limit for the connection in seconds. `sizelimit' is the maximum number of matches to return. -The function returns a list of matching entries. Each entry is itself -an alist of attribute/values. */ - (search_plist)) + (host, plist)) { - /* This function calls lisp */ - - /* Vars for query */ + /* This function can GC */ + Lisp_LDAP *ldap; LDAP *ld; - LDAPMessage *res, *e; - BerElement *ptr; - char *a; - int i, rc, err; - - char *ldap_host = NULL; - char *ldap_filter = NULL; - char **ldap_attributes = NULL; - int ldap_attrsonly = 0; - char *ldap_base = NULL; - int ldap_scope = LDAP_SCOPE_SUBTREE; + int ldap_port = 0; int ldap_auth = LDAP_AUTH_SIMPLE; char *ldap_binddn = NULL; char *ldap_passwd = NULL; int ldap_deref = LDAP_DEREF_NEVER; int ldap_timelimit = 0; int ldap_sizelimit = 0; - - char **vals = NULL; - int matches; - - Lisp_Object list, entry, result, keyword, value; - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; - - list = entry = result = keyword = value = Qnil; - GCPRO5 (list, entry, result, keyword, value); - + int err; - EXTERNAL_PROPERTY_LIST_LOOP(list, keyword, value, search_plist) - { - /* Host */ - if (EQ (keyword, Qhost)) - { - CHECK_STRING (value); - ldap_host = alloca (XSTRING_LENGTH (value) + 1); - strcpy (ldap_host, (char *)XSTRING_DATA (value)); - } - /* Filter */ - else if (EQ (keyword, Qfilter)) - { - CHECK_STRING (value); - ldap_filter = alloca (XSTRING_LENGTH (value) + 1); - strcpy (ldap_filter, (char *)XSTRING_DATA (value)); - } - /* Attributes */ - else if (EQ (keyword, Qattributes)) - { - if (! NILP (value)) - { - Lisp_Object attr_left = value; - struct gcpro ngcpro1; - - NGCPRO1 (attr_left); - CHECK_CONS (value); - - ldap_attributes = alloca ((XINT (Flength (value)) + 1)*sizeof (char *)); + CHECK_STRING (host); - for (i=0; !NILP (attr_left); i++) { - CHECK_STRING (XCAR (attr_left)); - ldap_attributes[i] = alloca (XSTRING_LENGTH (XCAR (attr_left)) + 1); - strcpy(ldap_attributes[i], - (char *)(XSTRING_DATA( XCAR (attr_left)))); - attr_left = XCDR (attr_left); - } - ldap_attributes[i] = NULL; - NUNGCPRO; - } - } - /* Attributes Only */ - else if (EQ (keyword, Qattrsonly)) - { - CHECK_SYMBOL (value); - ldap_attrsonly = NILP (value) ? 0 : 1; - } - /* Base */ - else if (EQ (keyword, Qbase)) - { - if (!NILP (value)) - { - CHECK_STRING (value); - ldap_base = alloca (XSTRING_LENGTH (value) + 1); - strcpy (ldap_base, (char *)XSTRING_DATA (value)); - } - } - /* Scope */ - else if (EQ (keyword, Qscope)) - { - CHECK_SYMBOL (value); - - if (EQ (value, Qbase)) - ldap_scope = LDAP_SCOPE_BASE; - else if (EQ (value, Qonelevel)) - ldap_scope = LDAP_SCOPE_ONELEVEL; - else if (EQ (value, Qsubtree)) - ldap_scope = LDAP_SCOPE_SUBTREE; - else - signal_simple_error ("Invalid scope", value); - } - /* Authentication method */ - else if (EQ (keyword, Qauth)) - { - CHECK_SYMBOL (value); - - if (EQ (value, Qsimple)) - ldap_auth = LDAP_AUTH_SIMPLE; + { + EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) + { + /* TCP Port */ + if (EQ (keyword, Qport)) + { + CHECK_INT (value); + ldap_port = XINT (value); + } + /* Authentication method */ + if (EQ (keyword, Qauth)) + { + if (EQ (value, Qsimple)) + ldap_auth = LDAP_AUTH_SIMPLE; #ifdef LDAP_AUTH_KRBV41 - else if (EQ (value, Qkrbv41)) - ldap_auth = LDAP_AUTH_KRBV41; + else if (EQ (value, Qkrbv41)) + ldap_auth = LDAP_AUTH_KRBV41; #endif #ifdef LDAP_AUTH_KRBV42 - else if (EQ (value, Qkrbv42)) - ldap_auth = LDAP_AUTH_KRBV42; + else if (EQ (value, Qkrbv42)) + ldap_auth = LDAP_AUTH_KRBV42; #endif - else - signal_simple_error ("Invalid authentication method", value); - } - /* Bind DN */ - else if (EQ (keyword, Qbinddn)) - { - if (!NILP (value)) - { - CHECK_STRING (value); - ldap_binddn = alloca (XSTRING_LENGTH (value) + 1); - strcpy (ldap_binddn, (char *)XSTRING_DATA (value)); - } - } - /* Password */ - else if (EQ (keyword, Qpasswd)) - { - if (!NILP (value)) - { - CHECK_STRING (value); - ldap_passwd = alloca (XSTRING_LENGTH (value) + 1); - strcpy (ldap_passwd, (char *)XSTRING_DATA (value)); - } - } - /* Deref */ - else if (EQ (keyword, Qderef)) - { - CHECK_SYMBOL (value); - if (EQ (value, Qnever)) - ldap_deref = LDAP_DEREF_NEVER; - else if (EQ (value, Qsearch)) - ldap_deref = LDAP_DEREF_SEARCHING; - else if (EQ (value, Qfind)) - ldap_deref = LDAP_DEREF_FINDING; - else if (EQ (value, Qalways)) - ldap_deref = LDAP_DEREF_ALWAYS; - else - signal_simple_error ("Invalid deref value", value); - } - /* Timelimit */ - else if (EQ (keyword, Qtimelimit)) - { - if (!NILP (value)) - { - CHECK_INT (value); - ldap_timelimit = XINT (value); - } - } - /* Sizelimit */ - else if (EQ (keyword, Qsizelimit)) - { - if (!NILP (value)) - { - CHECK_INT (value); - ldap_sizelimit = XINT (value); - } - } + else + invalid_constant ("Invalid authentication method", value); + } + /* Bind DN */ + else if (EQ (keyword, Qbinddn)) + { + CHECK_STRING (value); + LISP_STRING_TO_EXTERNAL (value, ldap_binddn, Qnative); + } + /* Password */ + else if (EQ (keyword, Qpasswd)) + { + CHECK_STRING (value); + LISP_STRING_TO_EXTERNAL (value, ldap_passwd, Qnative); + } + /* Deref */ + else if (EQ (keyword, Qderef)) + { + if (EQ (value, Qnever)) + ldap_deref = LDAP_DEREF_NEVER; + else if (EQ (value, Qsearch)) + ldap_deref = LDAP_DEREF_SEARCHING; + else if (EQ (value, Qfind)) + ldap_deref = LDAP_DEREF_FINDING; + else if (EQ (value, Qalways)) + ldap_deref = LDAP_DEREF_ALWAYS; + else + invalid_constant ("Invalid deref value", value); + } + /* Timelimit */ + else if (EQ (keyword, Qtimelimit)) + { + CHECK_INT (value); + ldap_timelimit = XINT (value); + } + /* Sizelimit */ + else if (EQ (keyword, Qsizelimit)) + { + CHECK_INT (value); + ldap_sizelimit = XINT (value); + } + } + } + + if (ldap_port == 0) + { + ldap_port = ldap_default_port; } - /* Use ldap-default-base if no default base was given */ - if (ldap_base == NULL && !NILP (Vldap_default_base)) - { - CHECK_STRING (Vldap_default_base); - ldap_base = alloca (XSTRING_LENGTH (Vldap_default_base) + 1); - strcpy (ldap_base, (char *)XSTRING_DATA (Vldap_default_base)); - } + /* Connect to the server and bind */ + slow_down_interrupts (); + ld = ldap_open ((char *) XSTRING_DATA (host), ldap_port); + speed_up_interrupts (); - /* Use ldap-default-host if no host was given */ - if (ldap_host == NULL && !NILP (Vldap_default_host)) - { - CHECK_STRING (Vldap_default_host); - ldap_host = alloca (XSTRING_LENGTH (Vldap_default_host) + 1); - strcpy (ldap_host, (char *)XSTRING_DATA (Vldap_default_host)); - } - - if (ldap_filter == NULL) - error ("Empty search filter"); + if (ld == NULL ) + report_process_error ("Failed connecting to host", host); - /* Garbage collect before connecting (if using UMich lib). - This is ugly, I know, but without this, the UMich LDAP library 3.3 - frequently reports "Can't contact LDAP server". I really need to - check what happens inside that lib. Anyway this should be harmless to - XEmacs and makes things work. */ -#if defined (HAVE_UMICH_LDAP) - garbage_collect_1 (); -#endif - - /* Connect to the server and bind */ - message ("Connecting to %s...", ldap_host); - if ( (ld = ldap_open (ldap_host, LDAP_PORT)) == NULL ) - signal_simple_error ("Failed connecting to host", - build_string (ldap_host)); - -#if HAVE_LDAP_SET_OPTION - if (ldap_set_option (ld, LDAP_OPT_DEREF, (void *)&ldap_deref) != LDAP_SUCCESS) - error ("Failed to set deref option"); - if (ldap_set_option (ld, LDAP_OPT_TIMELIMIT, (void *)&ldap_timelimit) != LDAP_SUCCESS) - error ("Failed to set timelimit option"); - if (ldap_set_option (ld, LDAP_OPT_SIZELIMIT, (void *)&ldap_sizelimit) != LDAP_SUCCESS) - error ("Failed to set sizelimit option"); - if (ldap_set_option (ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON) != LDAP_SUCCESS) - error ("Failed to set referral option"); -#else /* HAVE_LDAP_SET_OPTION */ +#ifdef HAVE_LDAP_SET_OPTION + if ((err = ldap_set_option (ld, LDAP_OPT_DEREF, + (void *)&ldap_deref)) != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, err); + if ((err = ldap_set_option (ld, LDAP_OPT_TIMELIMIT, + (void *)&ldap_timelimit)) != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, err); + if ((err = ldap_set_option (ld, LDAP_OPT_SIZELIMIT, + (void *)&ldap_sizelimit)) != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, err); + if ((err = ldap_set_option (ld, LDAP_OPT_REFERRALS, + LDAP_OPT_ON)) != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, err); + if ((err = ldap_set_option (ld, LDAP_OPT_RESTART, + LDAP_OPT_ON)) != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, err); +#else /* not HAVE_LDAP_SET_OPTION */ ld->ld_deref = ldap_deref; ld->ld_timelimit = ldap_timelimit; ld->ld_sizelimit = ldap_sizelimit; #ifdef LDAP_REFERRALS ld->ld_options = LDAP_OPT_REFERRALS; -#else /* LDAP_REFERRALS */ +#else /* not LDAP_REFERRALS */ ld->ld_options = 0; -#endif /* LDAP_REFERRALS */ -#endif /* HAVE_LDAP_SET_OPTION */ +#endif /* not LDAP_REFERRALS */ + /* XEmacs uses interrupts (SIGIO,SIGALRM), LDAP calls need to ignore them */ + ld->ld_options |= LDAP_OPT_RESTART; +#endif /* not HAVE_LDAP_SET_OPTION */ + + err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth); + if (err != LDAP_SUCCESS) + { + Ibyte *interrmess; + EXTERNAL_TO_C_STRING (ldap_err2string (err), interrmess, Qnative); + signal_error (Qprocess_error, "Failed binding to the server", + build_intstring (interrmess)); + } + + ldap = allocate_ldap (); + ldap->ld = ld; + ldap->host = host; + + return make_ldap (ldap); +} + + + +DEFUN ("ldap-close", Fldap_close, 1, 1, 0, /* +Close an LDAP connection. +*/ + (ldap)) +{ + Lisp_LDAP *lldap; + CHECK_LIVE_LDAP (ldap); + lldap = XLDAP (ldap); + ldap_unbind (lldap->ld); + lldap->ld = NULL; + return Qnil; +} + + + +/************************************************************************/ +/* Working on a LDAP connection */ +/************************************************************************/ +struct ldap_unwind_struct +{ + LDAPMessage *res; + struct berval **vals; +}; + +static Lisp_Object +ldap_search_unwind (Lisp_Object unwind_obj) +{ + struct ldap_unwind_struct *unwind = + (struct ldap_unwind_struct *) get_opaque_ptr (unwind_obj); + if (unwind->res) + ldap_msgfree (unwind->res); + if (unwind->vals) + ldap_value_free_len (unwind->vals); + return Qnil; +} + +/* The following function is called `ldap-search-basic' instead of */ +/* plain `ldap-search' to maintain compatibility with the XEmacs 21.1 */ +/* API where `ldap-search' was the name of the high-level search */ +/* function */ - message ("Binding to %s...", ldap_host); - if ( (err = (ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth ))) != LDAP_SUCCESS ) - signal_simple_error ("Failed binding to the server", - build_string (ldap_err2string (err))); +DEFUN ("ldap-search-basic", Fldap_search_basic, 2, 8, 0, /* +Perform a search on an open LDAP connection. +LDAP is an LDAP connection object created with `ldap-open'. +FILTER is a filter string for the search as described in RFC 1558. +BASE is the distinguished name at which to start the search. +SCOPE is one of the symbols `base', `onelevel' or `subtree' indicating +the scope of the search. +ATTRS is a list of strings indicating which attributes to retrieve + for each matching entry. If nil return all available attributes. +If ATTRSONLY is non-nil then only the attributes are retrieved, not +the associated values. +If WITHDN is non-nil each entry in the result will be prepended with +its distinguished name DN. +If VERBOSE is non-nil progress messages will be echoed. +The function returns a list of matching entries. Each entry is itself +an alist of attribute/value pairs optionally preceded by the DN of the +entry according to the value of WITHDN. +*/ + (ldap, filter, base, scope, attrs, attrsonly, withdn, verbose)) +{ + /* This function can GC */ + + /* Vars for query */ + LDAP *ld; + LDAPMessage *e; + BerElement *ptr; + char *a, *dn; + int i, rc; + int matches; + struct ldap_unwind_struct unwind; + + int ldap_scope = LDAP_SCOPE_SUBTREE; + char **ldap_attributes = NULL; + + int speccount = specpdl_depth (); + + Lisp_Object list = Qnil; + Lisp_Object entry = Qnil; + Lisp_Object result = Qnil; + struct gcpro gcpro1, gcpro2, gcpro3; + + GCPRO3 (list, entry, result); + + unwind.res = NULL; + unwind.vals = NULL; + + /* Do all the parameter checking */ + CHECK_LIVE_LDAP (ldap); + ld = XLDAP (ldap)->ld; + + /* Filter */ + CHECK_STRING (filter); + + /* Search base */ + if (NILP (base)) + { + base = Vldap_default_base; + } + if (!NILP (base)) + { + CHECK_STRING (base); + } + + /* Search scope */ + if (!NILP (scope)) + { + if (EQ (scope, Qbase)) + ldap_scope = LDAP_SCOPE_BASE; + else if (EQ (scope, Qonelevel)) + ldap_scope = LDAP_SCOPE_ONELEVEL; + else if (EQ (scope, Qsubtree)) + ldap_scope = LDAP_SCOPE_SUBTREE; + else + invalid_constant ("Invalid scope", scope); + } + + /* Attributes to search */ + if (!NILP (attrs)) + { + CHECK_CONS (attrs); + ldap_attributes = alloca_array (char *, 1 + XINT (Flength (attrs))); + + i = 0; + EXTERNAL_LIST_LOOP (attrs, attrs) + { + Lisp_Object current = XCAR (attrs); + CHECK_STRING (current); + LISP_STRING_TO_EXTERNAL (current, ldap_attributes[i], Qnative); + ++i; + } + ldap_attributes[i] = NULL; + } + + /* Attributes only ? */ + CHECK_SYMBOL (attrsonly); /* Perform the search */ - message ("Searching with LDAP on %s...", ldap_host); - if ( ldap_search (ld, ldap_base, ldap_scope, ldap_filter, - ldap_attributes, ldap_attrsonly) == -1) + if (ldap_search (ld, + NILP (base) ? (char *) "" : (char *) XSTRING_DATA (base), + ldap_scope, + NILP (filter) ? (char *) "" : (char *) XSTRING_DATA (filter), + ldap_attributes, + NILP (attrsonly) ? 0 : 1) + == -1) { - ldap_unbind (ld); -#if HAVE_LDAP_GET_ERRNO - signal_simple_error ("Error during LDAP search", - build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); -#else - signal_simple_error ("Error during LDAP search", - build_string (ldap_err2string (ld->ld_errno))); -#endif + signal_ldap_error (ld, NULL, 0); } + /* Ensure we don't exit without cleaning up */ + record_unwind_protect (ldap_search_unwind, + make_opaque_ptr (&unwind)); + /* Build the results list */ matches = 0; - while ( (rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &res)) - == LDAP_RES_SEARCH_ENTRY ) + rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &unwind.res); + + while (rc == LDAP_RES_SEARCH_ENTRY) { + QUIT; matches ++; - e = ldap_first_entry (ld, res); - message ("Parsing results... %d", matches); + e = ldap_first_entry (ld, unwind.res); + /* #### This call to message() is pretty fascist, because it + destroys the current echo area contents, even when invoked + from Lisp. It should use echo_area_message() instead, and + restore the old echo area contents later. */ + if (! NILP (verbose)) + message ("Parsing ldap results... %d", matches); entry = Qnil; + /* Get the DN if required */ + if (! NILP (withdn)) + { + dn = ldap_get_dn (ld, e); + if (dn == NULL) + signal_ldap_error (ld, e, 0); + entry = Fcons (build_ext_string (dn, Qnative), Qnil); + } for (a= ldap_first_attribute (ld, e, &ptr); a != NULL; - a= ldap_next_attribute (ld, e, ptr) ) + a = ldap_next_attribute (ld, e, ptr) ) { - list = Fcons (build_string (a), Qnil); - vals = ldap_get_values (ld, e, a); - if (vals != NULL) + list = Fcons (build_ext_string (a, Qnative), Qnil); + unwind.vals = ldap_get_values_len (ld, e, a); + if (unwind.vals != NULL) { - for (i=0; vals[i]!=NULL; i++) + for (i = 0; unwind.vals[i] != NULL; i++) { - list = Fcons (build_string (vals[i]), + list = Fcons (make_ext_string ((Extbyte *) unwind.vals[i]->bv_val, + unwind.vals[i]->bv_len, + Qnative), list); } } entry = Fcons (Fnreverse (list), entry); - ldap_value_free (vals); + ldap_value_free_len (unwind.vals); + unwind.vals = NULL; } result = Fcons (Fnreverse (entry), result); - ldap_msgfree (res); - } + ldap_msgfree (unwind.res); + unwind.res = NULL; - if (rc == -1) - { -#if HAVE_LDAP_GET_ERRNO - signal_simple_error ("Error retrieving result", - build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); -#else - signal_simple_error ("Error retrieving result", - build_string (ldap_err2string (ld->ld_errno))); -#endif + rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &(unwind.res)); } - if ((rc = ldap_result2error (ld, res, 0)) != LDAP_SUCCESS) - { -#if HAVE_LDAP_GET_ERRNO - signal_simple_error ("Error on result", - build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL)))); +#if defined HAVE_LDAP_PARSE_RESULT + { + int rc2 = ldap_parse_result (ld, unwind.res, + &rc, + NULL, NULL, NULL, NULL, 0); + if (rc2 != LDAP_SUCCESS) + rc = rc2; + } #else - signal_simple_error ("Error on result", - build_string (ldap_err2string (ld->ld_errno))); + if (rc == 0) + signal_ldap_error (ld, NULL, LDAP_TIMELIMIT_EXCEEDED); + + if (rc == -1) + signal_ldap_error (ld, unwind.res, (unwind.res==NULL) ? ld->ld_errno : 0); + +#if defined HAVE_LDAP_RESULT2ERROR + rc = ldap_result2error (ld, unwind.res, 0); +#endif #endif - } + + if (rc != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, rc); + + ldap_msgfree (unwind.res); + unwind.res = (LDAPMessage *)NULL; + + /* #### See above for calling message(). */ + if (! NILP (verbose)) + message ("Parsing ldap results... done"); + + unbind_to (speccount); + UNGCPRO; + return Fnreverse (result); +} + +DEFUN ("ldap-add", Fldap_add, 3, 3, 0, /* +Add an entry to an LDAP directory. +LDAP is an LDAP connection object created with `ldap-open'. +DN is the distinguished name of the entry to add. +ENTRY is an entry specification, i.e., a list of cons cells +containing attribute/value string pairs. +*/ + (ldap, dn, entry)) +{ + LDAP *ld; + LDAPMod *ldap_mods, **ldap_mods_ptrs; + struct berval *bervals; + int rc; + int i, j; + Elemcount len; + + Lisp_Object current = Qnil; + Lisp_Object values = Qnil; + struct gcpro gcpro1, gcpro2; + + GCPRO2 (current, values); + + /* Do all the parameter checking */ + CHECK_LIVE_LDAP (ldap); + ld = XLDAP (ldap)->ld; + + /* Check the DN */ + CHECK_STRING (dn); + + /* Check the entry */ + CHECK_CONS (entry); + if (NILP (entry)) + invalid_operation ("Cannot add void entry", entry); - ldap_msgfree (res); - ldap_unbind (ld); - message ("Done."); - - result = Fnreverse (result); - clear_message (); + /* Build the ldap_mods array */ + len = (Elemcount) XINT (Flength (entry)); + ldap_mods = alloca_array (LDAPMod, len); + ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); + i = 0; + EXTERNAL_LIST_LOOP (entry, entry) + { + current = XCAR (entry); + CHECK_CONS (current); + CHECK_STRING (XCAR (current)); + ldap_mods_ptrs[i] = &(ldap_mods[i]); + LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); + ldap_mods[i].mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; + values = XCDR (current); + if (CONSP (values)) + { + len = (Elemcount) XINT (Flength (values)); + bervals = alloca_array (struct berval, len); + ldap_mods[i].mod_vals.modv_bvals = + alloca_array (struct berval *, 1 + len); + j = 0; + EXTERNAL_LIST_LOOP (values, values) + { + current = XCAR (values); + CHECK_STRING (current); + ldap_mods[i].mod_vals.modv_bvals[j] = &(bervals[j]); + TO_EXTERNAL_FORMAT (LISP_STRING, current, + ALLOCA, (bervals[j].bv_val, + bervals[j].bv_len), + Qnative); + j++; + } + ldap_mods[i].mod_vals.modv_bvals[j] = NULL; + } + else + { + CHECK_STRING (values); + bervals = alloca_array (struct berval, 1); + ldap_mods[i].mod_vals.modv_bvals = alloca_array (struct berval *, 2); + ldap_mods[i].mod_vals.modv_bvals[0] = &(bervals[0]); + TO_EXTERNAL_FORMAT (LISP_STRING, values, + ALLOCA, (bervals[0].bv_val, + bervals[0].bv_len), + Qnative); + ldap_mods[i].mod_vals.modv_bvals[1] = NULL; + } + i++; + } + ldap_mods_ptrs[i] = NULL; + rc = ldap_add_s (ld, (char *) XSTRING_DATA (dn), ldap_mods_ptrs); + if (rc != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, rc); UNGCPRO; - return result; + return Qnil; +} + +DEFUN ("ldap-modify", Fldap_modify, 3, 3, 0, /* +Add an entry to an LDAP directory. +LDAP is an LDAP connection object created with `ldap-open'. +DN is the distinguished name of the entry to modify. +MODS is a list of modifications to apply. +A modification is a list of the form (MOD-OP ATTR VALUE1 VALUE2 ...) +MOD-OP and ATTR are mandatory, VALUEs are optional depending on MOD-OP. +MOD-OP is the type of modification, one of the symbols `add', `delete' +or `replace'. ATTR is the LDAP attribute type to modify. +*/ + (ldap, dn, mods)) +{ + LDAP *ld; + LDAPMod *ldap_mods, **ldap_mods_ptrs; + struct berval *bervals; + int i, j, rc; + Lisp_Object mod_op; + Elemcount len; + + Lisp_Object current = Qnil; + Lisp_Object values = Qnil; + struct gcpro gcpro1, gcpro2; + + /* Do all the parameter checking */ + CHECK_LIVE_LDAP (ldap); + ld = XLDAP (ldap)->ld; + + /* Check the DN */ + CHECK_STRING (dn); + + /* Check the entry */ + CHECK_CONS (mods); + if (NILP (mods)) + return Qnil; + + /* Build the ldap_mods array */ + len = (Elemcount) XINT (Flength (mods)); + ldap_mods = alloca_array (LDAPMod, len); + ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); + i = 0; + + GCPRO2 (current, values); + EXTERNAL_LIST_LOOP (mods, mods) + { + current = XCAR (mods); + CHECK_CONS (current); + CHECK_SYMBOL (XCAR (current)); + mod_op = XCAR (current); + ldap_mods_ptrs[i] = &(ldap_mods[i]); + ldap_mods[i].mod_op = LDAP_MOD_BVALUES; + if (EQ (mod_op, Qadd)) + ldap_mods[i].mod_op |= LDAP_MOD_ADD; + else if (EQ (mod_op, Qdelete)) + ldap_mods[i].mod_op |= LDAP_MOD_DELETE; + else if (EQ (mod_op, Qreplace)) + ldap_mods[i].mod_op |= LDAP_MOD_REPLACE; + else + invalid_constant ("Invalid LDAP modification type", mod_op); + current = XCDR (current); + CHECK_STRING (XCAR (current)); + LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); + values = XCDR (current); + len = (Elemcount) XINT (Flength (values)); + bervals = alloca_array (struct berval, len); + ldap_mods[i].mod_vals.modv_bvals = + alloca_array (struct berval *, 1 + len); + j = 0; + EXTERNAL_LIST_LOOP (values, values) + { + current = XCAR (values); + CHECK_STRING (current); + ldap_mods[i].mod_vals.modv_bvals[j] = &(bervals[j]); + TO_EXTERNAL_FORMAT (LISP_STRING, current, + ALLOCA, (bervals[j].bv_val, + bervals[j].bv_len), + Qnative); + j++; + } + ldap_mods[i].mod_vals.modv_bvals[j] = NULL; + i++; + } + ldap_mods_ptrs[i] = NULL; + rc = ldap_modify_s (ld, (char *) XSTRING_DATA (dn), ldap_mods_ptrs); + if (rc != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, rc); + + UNGCPRO; + return Qnil; +} + + +DEFUN ("ldap-delete", Fldap_delete, 2, 2, 0, /* +Delete an entry to an LDAP directory. +LDAP is an LDAP connection object created with `ldap-open'. +DN is the distinguished name of the entry to delete. +*/ + (ldap, dn)) +{ + LDAP *ld; + int rc; + + /* Check parameters */ + CHECK_LIVE_LDAP (ldap); + ld = XLDAP (ldap)->ld; + CHECK_STRING (dn); + + rc = ldap_delete_s (ld, (char *) XSTRING_DATA (dn)); + if (rc != LDAP_SUCCESS) + signal_ldap_error (ld, NULL, rc); + + return Qnil; } void -syms_of_ldap (void) +syms_of_eldap (void) { - DEFSUBR(Fldap_search_internal); + INIT_LRECORD_IMPLEMENTATION (ldap); - defsymbol (&Qhost, "host"); - defsymbol (&Qfilter, "filter"); - defsymbol (&Qattributes, "attributes"); - defsymbol (&Qattrsonly, "attrsonly"); - defsymbol (&Qbase, "base"); - defsymbol (&Qscope, "scope"); - defsymbol (&Qauth, "auth"); - defsymbol (&Qbinddn, "binddn"); - defsymbol (&Qpasswd, "passwd"); - defsymbol (&Qderef, "deref"); - defsymbol (&Qtimelimit, "timelimit"); - defsymbol (&Qsizelimit, "sizelimit"); - defsymbol (&Qbase, "base"); - defsymbol (&Qonelevel, "onelevel"); - defsymbol (&Qsubtree, "subtree"); -#ifdef LDAP_AUTH_KRBV41 - defsymbol (&Qkrbv41, "krbv41"); -#endif -#ifdef LDAP_AUTH_KRBV42 - defsymbol (&Qkrbv42, "krbv42"); -#endif - defsymbol (&Qnever, "never"); - defsymbol (&Qalways, "always"); - defsymbol (&Qfind, "find"); + DEFSYMBOL (Qeldap); + DEFSYMBOL (Qldapp); + DEFSYMBOL (Qport); + DEFSYMBOL (Qauth); + DEFSYMBOL (Qbinddn); + DEFSYMBOL (Qpasswd); + DEFSYMBOL (Qderef); + DEFSYMBOL (Qtimelimit); + DEFSYMBOL (Qsizelimit); + DEFSYMBOL (Qbase); + DEFSYMBOL (Qonelevel); + DEFSYMBOL (Qsubtree); + DEFSYMBOL (Qkrbv41); + DEFSYMBOL (Qkrbv42); + DEFSYMBOL (Qnever); + DEFSYMBOL (Qalways); + DEFSYMBOL (Qfind); + DEFSYMBOL (Qadd); + DEFSYMBOL (Qreplace); + + DEFSUBR (Fldapp); + DEFSUBR (Fldap_host); + DEFSUBR (Fldap_live_p); + DEFSUBR (Fldap_open); + DEFSUBR (Fldap_close); + DEFSUBR (Fldap_search_basic); + DEFSUBR (Fldap_add); + DEFSUBR (Fldap_modify); + DEFSUBR (Fldap_delete); } void -vars_of_ldap (void) +vars_of_eldap (void) { - Fprovide (intern ("ldap-internal")); + + Fprovide (Qeldap); - DEFVAR_LISP ("ldap-default-host", &Vldap_default_host /* -Default LDAP host. + ldap_default_port = LDAP_PORT; + Vldap_default_base = Qnil; + + DEFVAR_INT ("ldap-default-port", &ldap_default_port /* +Default TCP port for LDAP connections. +Initialized from the LDAP library. Default value is 389. */ ); DEFVAR_LISP ("ldap-default-base", &Vldap_default_base /* @@ -450,8 +860,34 @@ Acme organization in the United States. */ ); - Vldap_default_host = Qnil; - Vldap_default_base = Qnil; } -#endif /* HAVE_LDAP */ +#ifdef HAVE_SHLIB +void +unload_eldap (void) +{ + /* Remove defined types */ + UNDEF_LRECORD_IMPLEMENTATION (ldap); + + /* Remove staticpro'ing of symbols */ + unstaticpro_nodump (&Qeldap); + unstaticpro_nodump (&Qldapp); + unstaticpro_nodump (&Qport); + unstaticpro_nodump (&Qauth); + unstaticpro_nodump (&Qbinddn); + unstaticpro_nodump (&Qpasswd); + unstaticpro_nodump (&Qderef); + unstaticpro_nodump (&Qtimelimit); + unstaticpro_nodump (&Qsizelimit); + unstaticpro_nodump (&Qbase); + unstaticpro_nodump (&Qonelevel); + unstaticpro_nodump (&Qsubtree); + unstaticpro_nodump (&Qkrbv41); + unstaticpro_nodump (&Qkrbv42); + unstaticpro_nodump (&Qnever); + unstaticpro_nodump (&Qalways); + unstaticpro_nodump (&Qfind); + unstaticpro_nodump (&Qadd); + unstaticpro_nodump (&Qreplace); +} +#endif /* HAVE_SHLIB */ diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/eldap.h --- a/modules/ldap/eldap.h Mon Sep 09 21:53:43 2002 +0000 +++ b/modules/ldap/eldap.h Tue Sep 10 15:27:39 2002 +0000 @@ -18,22 +18,65 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Synched up with: Not in FSF. */ +#ifndef INCLUDED_eldap_h_ +#define INCLUDED_eldap_h_ + +#include +#include + +/* + * The following structure records pertinent information about a + * LDAP connection. + */ -/* Author: Oscar Figueiredo */ +struct Lisp_LDAP +{ + /* lcrecord header */ + struct lcrecord_header header; + /* The LDAP connection handle used by the LDAP API */ + LDAP *ld; + /* Name of the host we connected to */ + Lisp_Object host; +}; +typedef struct Lisp_LDAP Lisp_LDAP; -#ifndef _XEMACS_ELDAP_H_ -#define _XEMACS_ELDAP_H_ +DECLARE_LRECORD (ldap, Lisp_LDAP); +#define XLDAP(x) XRECORD (x, ldap, Lisp_LDAP) +#define wrap_ldap(p) wrap_record (p, ldap) +#define LDAPP(x) RECORDP (x, ldap) +#define CHECK_LDAP(x) CHECK_RECORD (x, ldap) +#define CONCHECK_LDAP(x) CONCHECK_RECORD (x, ldap) -#ifdef HAVE_LDAP +#define CHECK_LIVE_LDAP(ldap) do { \ + CHECK_LDAP (ldap); \ + if (!XLDAP (ldap)->ld) \ + invalid_operation ("Attempting to access closed LDAP connection", \ + ldap); \ +} while (0) -#ifdef emacs -Lisp_Object Fldap_search_internal (Lisp_Object search_plist); - -#endif /* emacs */ +Lisp_Object Fldapp (Lisp_Object object); +Lisp_Object Fldap_host (Lisp_Object ldap); +Lisp_Object Fldap_live_p (Lisp_Object ldap); +Lisp_Object Fldap_open (Lisp_Object host, + Lisp_Object ldap_plist); +Lisp_Object Fldap_close (Lisp_Object ldap); +Lisp_Object Fldap_search_basic (Lisp_Object ldap, + Lisp_Object filter, + Lisp_Object base, + Lisp_Object scope, + Lisp_Object attrs, + Lisp_Object attrsonly, + Lisp_Object withdn, + Lisp_Object verbose); +Lisp_Object Fldap_add (Lisp_Object ldap, + Lisp_Object dn, + Lisp_Object entry); +Lisp_Object Fldap_modify (Lisp_Object ldap, + Lisp_Object dn, + Lisp_Object entry); +Lisp_Object Fldap_delete (Lisp_Object ldap, + Lisp_Object dn); -#endif /* HAVE_LDAP */ - -#endif /* _XEMACS_ELDAP_H_ */ +#endif /* INCLUDED_eldap_h_ */ diff -r 4575a219af58 -r 25e260cb7994 modules/ldap/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/ldap/install-sh Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + : + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/.cvsignore Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,2 @@ +*.ell +*_i.c diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/Makefile.in.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/Makefile.in.in Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,85 @@ +## Makefile for the PostgreSQL module in XEmacs. +## Copyright (C) 2002 Jerry James. + +## This file is part of XEmacs. + +## XEmacs is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. + +## XEmacs is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. + +## You should have received a copy of the GNU General Public License +## along with XEmacs; see the file COPYING. If not, write to +## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +## Boston, MA 02111-1307, USA. + +## Synched up with: Not synched with FSF. + +## This is more complicated than would normally be the case, as this makefile +## has been tailored to work both inside and independently of the XEmacs +## source tree, and to support both module and non-module building inside the +## source tree. + +### Specialize this part for your module +MODNAME=postgresql +MODVER=1.0.0 +MODTITLE="PostgreSQL Client Interface for XEmacs" +LDFLAGS=@LDFLAGS@ @postgresql_libs@ +SRCS=postgresql.c + +### You should not need to modify anything below this line +SRC_SRCS=$(SRCS:%=$(srcdir)/%) +OBJS=$(SRCS:.c=.o) + +SHELL=/bin/sh +RM=rm -f +PROGNAME=@PROGNAME@ +CFLAGS=@CFLAGS@ +INSTALL=@INSTALL@ +version=@version@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +instvardir=@instvardir@ +configuration=@configuration@ +moduledir=@moduledir@ +with_modules=@with_modules@ + +srcdir=@srcdir@ +VPATH=@srcdir@ + +CC=@MOD_CC@ +MODARCHDIR=@MODARCHDIR@ +MAKE_DOCFILE=@MAKE_DOCFILE@ +MODCFLAGS=@MODCFLAGS@ +INSTALLPATH=@INSTALLPATH@ +INSTALL_PROGRAM=@MOD_INSTALL_PROGRAM@ +OBJECT_TO_BUILD=@OBJECT_TO_BUILD@ + +.PHONY: clean distclean install +all: $(OBJECT_TO_BUILD) + +.c.o: + $(CC) $(MODCFLAGS) -c $< + +$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o + $(CC) --mode=link --mod-output=$@ $^ $(LDFLAGS) + +$(MODNAME)_i.c: $(SRCS) + ELLMAKEDOC=$(MAKE_DOCFILE) $(CC) --mode=init --mod-output=$@ \ + --mod-name=$(MODNAME) --mod-version=$(MODVER) \ + --mod-title=$(MODTITLE) $(SRC_SRCS) + +clean: + $(RM) $(MODNAME).ell $(OBJS) $(MODNAME)_i.* *~ + +distclean: clean + $(RM) Makefile config.* configure + +install: $(OBJECT_TO_BUILD) + $(INSTALL_PROGRAM) $< $(INSTALLPATH) diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/configure Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,3816 @@ +#! /bin/sh +# From configure.ac Revision: 1.0 . +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53b for PostgreSQL module 1.0. +# +# Report bugs to . +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +# +# Configuration script for the PostgreSQL module. +# Copyright (C) 2002 Jerry James. +# +# This file is part of XEmacs. +# +# XEmacs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your +# option) any later version. +# +# XEmacs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XEmacs; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='PostgreSQL module' +PACKAGE_TARNAME='postgresql-module' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='PostgreSQL module 1.0' +PACKAGE_BUGREPORT='xemacs-beta@xemacs.org' + +ac_unique_file="postgresql.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA ELLCC CPP EGREP postgresql_libs PROGNAME MOD_CC MODARCHDIR MAKE_DOCFILE MODCFLAGS INSTALLPATH MOD_INSTALL_PROGRAM OBJECT_TO_BUILD LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_ELLCC_set=${ELLCC+set} +ac_env_ELLCC_value=$ELLCC +ac_cv_env_ELLCC_set=${ELLCC+set} +ac_cv_env_ELLCC_value=$ELLCC +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures PostgreSQL module 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of PostgreSQL module 1.0:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + ELLCC The path to the ellcc module compiler + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +PostgreSQL module configure 1.0 +generated by GNU Autoconf 2.53b + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. + +Configuration script for the PostgreSQL module. +Copyright (C) 2002 Jerry James. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your +option) any later version. + +XEmacs is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by PostgreSQL module $as_me 1.0, which was +generated by GNU Autoconf 2.53b. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + + +# Find ELLCC + +# Extract the first word of "ellcc", so it can be a program name with args. +set dummy ellcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ELLCC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ELLCC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ELLCC="$ELLCC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ELLCC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_ELLCC" && ac_cv_path_ELLCC=""FAIL"" + ;; +esac +fi +ELLCC=$ac_cv_path_ELLCC + +if test -n "$ELLCC"; then + echo "$as_me:$LINENO: result: $ELLCC" >&5 +echo "${ECHO_T}$ELLCC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$ELLCC" = "FAIL"; then + { { echo "$as_me:$LINENO: error: Cannot find ellcc" >&5 +echo "$as_me: error: Cannot find ellcc" >&2;} + { (exit 1); exit 1; }; } +fi + + +for header_dir in "" "pgsql/" "postgresql/"; do + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +as_ac_Header=`echo "ac_cv_header_${header_dir}libpq-fe.h" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for ${header_dir}libpq-fe.h" >&5 +echo $ECHO_N "checking for ${header_dir}libpq-fe.h... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking ${header_dir}libpq-fe.h usability" >&5 +echo $ECHO_N "checking ${header_dir}libpq-fe.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <${header_dir}libpq-fe.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking ${header_dir}libpq-fe.h presence" >&5 +echo $ECHO_N "checking ${header_dir}libpq-fe.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <${header_dir}libpq-fe.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: ${header_dir}libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ${header_dir}libpq-fe.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ${header_dir}libpq-fe.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${header_dir}libpq-fe.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: ${header_dir}libpq-fe.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ${header_dir}libpq-fe.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ${header_dir}libpq-fe.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ${header_dir}libpq-fe.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ${header_dir}libpq-fe.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ${header_dir}libpq-fe.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for ${header_dir}libpq-fe.h" >&5 +echo $ECHO_N "checking for ${header_dir}libpq-fe.h... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + libpq_fe_h_file=${header_dir}libpq-fe.h; break +fi + + +done + +test -z "$libpq_fe_h_file" && + { { echo "$as_me:$LINENO: error: Cannot find the PostgresQL header files; try specifying CPPFLAGS." >&5 +echo "$as_me: error: Cannot find the PostgresQL header files; try specifying CPPFLAGS." >&2;} + { (exit 1); exit 1; }; } +cat >>confdefs.h <<_ACEOF +#define LIBPQ_FE_H_FILE "$libpq_fe_h_file" +_ACEOF + + + +echo "$as_me:$LINENO: checking for PQconnectdb in -lpq" >&5 +echo $ECHO_N "checking for PQconnectdb in -lpq... $ECHO_C" >&6 +if test "${ac_cv_lib_pq_PQconnectdb+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpq $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char PQconnectdb (); +int +main () +{ +PQconnectdb (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pq_PQconnectdb=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pq_PQconnectdb=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectdb" >&5 +echo "${ECHO_T}$ac_cv_lib_pq_PQconnectdb" >&6 +if test $ac_cv_lib_pq_PQconnectdb = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPQ 1 +_ACEOF + + LIBS="-lpq $LIBS" + +else + { { echo "$as_me:$LINENO: error: Cannot find the PostgresQL library. Try specifying LDFLAGS." >&5 +echo "$as_me: error: Cannot find the PostgresQL library. Try specifying LDFLAGS." >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:$LINENO: checking for PQconnectStart in -lpq" >&5 +echo $ECHO_N "checking for PQconnectStart in -lpq... $ECHO_C" >&6 +if test "${ac_cv_lib_pq_PQconnectStart+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpq $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char PQconnectStart (); +int +main () +{ +PQconnectStart (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pq_PQconnectStart=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pq_PQconnectStart=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectStart" >&5 +echo "${ECHO_T}$ac_cv_lib_pq_PQconnectStart" >&6 +if test $ac_cv_lib_pq_PQconnectStart = yes; then + + with_postgresqlv7=yes; + cat >>confdefs.h <<\_ACEOF +#define HAVE_POSTGRESQLV7 1 +_ACEOF + +fi + +postgresql_libs="$LIBS" + + +# This part should appear unchanged in every module configure.ac +PROGNAME="module" + +MOD_CC="@ELLCC@" + +MODARCHDIR="\$(shell @ELLCC@ --mod-archdir)" + +MAKE_DOCFILE="\$(MODARCHDIR)/make-docfile" + +MODCFLAGS="\$(CFLAGS) --mode=compile --mod-output=\$@ -I\$(MODARCHDIR)/include" + +INSTALLPATH="\$(shell @ELLCC@ --mod-site-location)" + +MOD_INSTALL_PROGRAM="@INSTALL_PROGRAM@" + +OBJECT_TO_BUILD="\$(MODNAME).ell" + + + ac_config_files="$ac_config_files Makefile.in Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by PostgreSQL module $as_me 1.0, which was +generated by GNU Autoconf 2.53b. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +PostgreSQL module config.status 1.0 +configured by $0, generated by GNU Autoconf 2.53b, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile.in" ) CONFIG_FILES="$CONFIG_FILES Makefile.in" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@ELLCC@,$ELLCC,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@postgresql_libs@,$postgresql_libs,;t t +s,@PROGNAME@,$PROGNAME,;t t +s,@MOD_CC@,$MOD_CC,;t t +s,@MODARCHDIR@,$MODARCHDIR,;t t +s,@MAKE_DOCFILE@,$MAKE_DOCFILE,;t t +s,@MODCFLAGS@,$MODCFLAGS,;t t +s,@INSTALLPATH@,$INSTALLPATH,;t t +s,@MOD_INSTALL_PROGRAM@,$MOD_INSTALL_PROGRAM,;t t +s,@OBJECT_TO_BUILD@,$OBJECT_TO_BUILD,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/configure.ac Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,72 @@ +# Process this file with autoconf to produce a configure script. +# This is only used for independent module building. +AC_INIT([PostgreSQL module], [1.0], [xemacs-beta@xemacs.org]) +AC_PREREQ(2.53) +AC_REVISION($Revision: 1.1 $) +AC_COPYRIGHT([Configuration script for the PostgreSQL module. +Copyright (C) 2002 Jerry James. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your +option) any later version. + +XEmacs is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA.]) + +AC_CONFIG_SRCDIR([postgresql.c]) +AC_PROG_CC +AC_PROG_INSTALL +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) + +# Find ELLCC +AC_ARG_VAR([ELLCC], [The path to the ellcc module compiler]) +AC_PATH_PROG([ELLCC], [ellcc], ["FAIL"]) +AS_IF([test "$ELLCC" = "FAIL"], [AS_ERROR([Cannot find ellcc])]) + +dnl On many Linux systems, PostgreSQL is packaged to be installed in /usr; +dnl in this case, configure will easily detect it there. +dnl +dnl If PostgreSQL is installed into a different prefix, +dnl (such as the default /usr/local/pgsql when building from source), +dnl then specify CPPFLAGS and LDFLAGS when configuring. +dnl +dnl Look for these standard header file locations, known to be used on Linux +for header_dir in "" "pgsql/" "postgresql/"; do + AC_CHECK_HEADER([${header_dir}libpq-fe.h], + [libpq_fe_h_file=${header_dir}libpq-fe.h; break]) +done + +test -z "$libpq_fe_h_file" && + AS_ERROR([Cannot find the PostgresQL header files; try specifying CPPFLAGS.]) +AC_DEFINE_UNQUOTED(LIBPQ_FE_H_FILE, "$libpq_fe_h_file") + +AC_CHECK_LIB(pq,PQconnectdb,, + AS_ERROR([Cannot find the PostgresQL library. Try specifying LDFLAGS.])) +AC_CHECK_LIB(pq,PQconnectStart, [ + with_postgresqlv7=yes; + AC_DEFINE(HAVE_POSTGRESQLV7)]) +AC_SUBST(postgresql_libs, "$LIBS") + +# This part should appear unchanged in every module configure.ac +AC_SUBST(PROGNAME, "module") +AC_SUBST(MOD_CC, "@ELLCC@") +AC_SUBST(MODARCHDIR, "\$(shell @ELLCC@ --mod-archdir)") +AC_SUBST(MAKE_DOCFILE, "\$(MODARCHDIR)/make-docfile") +AC_SUBST(MODCFLAGS, "\$(CFLAGS) --mode=compile --mod-output=\$@ -I\$(MODARCHDIR)/include") +AC_SUBST(INSTALLPATH, "\$(shell @ELLCC@ --mod-site-location)") +AC_SUBST(MOD_INSTALL_PROGRAM, "@INSTALL_PROGRAM@") +AC_SUBST(OBJECT_TO_BUILD, "\$(MODNAME).ell") + +AC_CONFIG_FILES([Makefile.in Makefile]) +AC_OUTPUT diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/install-sh Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + : + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/postgresql.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/postgresql.c Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,1926 @@ +/* + postgresql.c -- Emacs Lisp binding to libpq.so + Copyright (C) 2000 Electrotechnical Laboratory, JAPAN. + Licensed to the Free Software Foundation. + + Author: SL Baur + Maintainer: SL Baur + +Please send patches to this file to me first before submitting them to +xemacs-patches. + + +KNOWN PROBLEMS (Last update 15-March-2000) ++ None. + +Implementation notes: +0. Supported PostgreSQL versions + This code was developed against libpq-6.5.3 and libpq-7.0-beta1. Earlier + versions may work. V7 support is more complete than V6.5 support. +1. Mule + Non-ASCII databases have been tested on both 6.5 and 7.0. +2. Asynchronous Operation + Starting with libpq-7.0, an asynchronous interface is offered. This + binding supports the asynchronous calls to a limited extent. Since the + XEmacs 21.2 core does not support a sensible interface to add managed but + unreadable (by XEmacs) file descriptors to the main select code, polling + is required to drive the asynchronous calls. XtAppAddInput would work + fine, but we want to be able to use the database when running strictly in + tty mode. +3. Completeness + Various calls have been deliberately not exported to Lisp. The + unexported calls are either left-over backwards compatibility code that + aren't needed, calls that cannot be implemented sensibly, or calls that + cannot be implemented safely. A list of all global functions in libpq + but not exported to Lisp is below. +4. Policy + This interface tries very hard to not set any policy towards how database + code in Emacs Lisp will be written. +5. Documentation + For full lisp programming documentation, see the XEmacs Lisp Reference + Manual. For PostgreSQL documentation, see the PostgreSQL distribution. + +TODO (in rough order of priority): +1. Asynchronous notifies need to be implemented to the extent they can be. +2. The large object interface needs work with Emacs buffers in addition + to files. Need two functions buffer->large_object, and large_object-> + buffer. +*/ + +/* + Unimplemented functions: [TODO] + PQsetNoticeProcessor + + Implemented, but undocumented functions: [TODO] + PQgetline (copy in/out) + PQputline (copy in/out) + PQgetlineAsync (copy in/out Asynch.) + PQputnbytes (copy in/out Asynch.) + PQendcopy (copy in/out) + + Unsupported functions: + PQsetdbLogin -- This function is deprecated, has a subset of the + functionality of PQconnectdb, and is better done in Lisp. + PQsetdb -- Same as for PQsetdbLogin + PQsocket -- Abstraction error, file descriptors should not be leaked + into Lisp code + PQprint -- print to a file descriptor, deprecated, better done in Lisp + PQdisplayTuples -- deprecated + PQprintTuples -- really, really deprecated + PQmblen -- Returns the length in bytes of multibyte character encoded + string. + PQtrace -- controls debug print tracing to a tty. + PQuntrace -- Ditto. I don't see any way to do this sensibly. + PQoidStatus -- deprecated and nearly identical to PQoidValue + PQfn -- "Fast path" interface + lo_open (large object) [*] + lo_close (large object) [*] + lo_read (large object) [*] + lo_write (large object) [*] + lo_lseek (large object) [*] + lo_creat (large object) [*] + lo_tell (large object) [*] + lo_unlink (large object) [*] +*/ + +#include + +/* This must be portable with XEmacs 21.1 so long as it is the official + released version of XEmacs and provides the basis of InfoDock. The + interface to lcrecord handling has changed with 21.2, so unfortunately + we will need a few snippets of backwards compatibility code. +*/ +#if (EMACS_MAJOR_VERSION == 21) && (EMACS_MINOR_VERSION < 2) +#define RUNNING_XEMACS_21_1 1 +#endif + +/* #define POSTGRES_LO_IMPORT_IS_VOID 1 */ + +#include "lisp.h" +#include "sysdep.h" + +#include "buffer.h" +#include "postgresql.h" +#include "process.h" + +#ifdef RUNNING_XEMACS_21_1 /* handle interface changes */ +#define PG_OS_CODING FORMAT_FILENAME +#define TO_EXTERNAL_FORMAT(a,from,b,to,c) GET_C_STRING_EXT_DATA_ALLOCA(from,FORMAT_FILENAME,to) +#else +#ifdef MULE +#define PG_OS_CODING get_coding_system_for_text_file (Vpg_coding_system, 1) +#else +#define PG_OS_CODING Qnative +#endif +Lisp_Object Vpg_coding_system; +#endif + +#define CHECK_LIVE_CONNECTION(P) do { \ + if (!P || (PQstatus (P) != CONNECTION_OK)) { \ + char *e = "bad value"; \ + if (P) e = PQerrorMessage (P); \ + signal_ferror (Qprocess_error, "dead connection [%s]", e); \ + } } while (0) +#define PUKE_IF_NULL(p) do { \ + if (!p) signal_error (Qinvalid_argument, "bad value", Qunbound); \ + } while (0) + +static Lisp_Object VXPGHOST; +static Lisp_Object VXPGUSER; +static Lisp_Object VXPGOPTIONS; +static Lisp_Object VXPGPORT; +static Lisp_Object VXPGTTY; /* This needs to be blanked! */ +static Lisp_Object VXPGDATABASE; +static Lisp_Object VXPGREALM; +#ifdef MULE +static Lisp_Object VXPGCLIENTENCODING; +#endif /* MULE */ + +/* Other variables: + PGAUTHTYPE -- not used after PostgreSQL 6.5 + PGGEQO + PGCOSTINDEX + PGCOSTHEAP + PGTZ + PGDATESTYLE +*/ +#ifndef HAVE_POSTGRESQLV7 +static Lisp_Object VXPGAUTHTYPE; +#endif +static Lisp_Object VXPGGEQO, VXPGCOSTINDEX, VXPGCOSTHEAP, VXPGTZ, VXPGDATESTYLE; + +static Lisp_Object Qpostgresql; +static Lisp_Object Qpg_connection_ok, Qpg_connection_bad; +static Lisp_Object Qpg_connection_started, Qpg_connection_made; +static Lisp_Object Qpg_connection_awaiting_response, Qpg_connection_auth_ok; +static Lisp_Object Qpg_connection_setenv; + +static Lisp_Object Qpqdb, Qpquser, Qpqpass, Qpqhost, Qpqport, Qpqtty; +static Lisp_Object Qpqoptions, Qpqstatus, Qpqerrormessage, Qpqbackendpid; + +static Lisp_Object Qpgres_empty_query, Qpgres_command_ok, Qpgres_tuples_ok; +static Lisp_Object Qpgres_copy_out, Qpgres_copy_in, Qpgres_bad_response; +static Lisp_Object Qpgres_nonfatal_error, Qpgres_fatal_error; + +static Lisp_Object Qpgres_polling_failed, Qpgres_polling_reading; +static Lisp_Object Qpgres_polling_writing, Qpgres_polling_ok; +static Lisp_Object Qpgres_polling_active; +/****/ + +/* PGconn is an opaque object and we need to be able to store them in + Lisp code because libpq supports multiple connections. +*/ +Lisp_Object Qpgconnp; + +static Lisp_Object +make_pgconn (Lisp_PGconn *pgconn) +{ + return wrap_pgconn (pgconn); +} + +#ifdef USE_KKCC +static const struct lrecord_description pgconn_description [] = { + { XD_END } +}; +#endif /* USE_KKCC */ + +static Lisp_Object +#ifdef RUNNING_XEMACS_21_1 +mark_pgconn (Lisp_Object obj, void (*markobj) (Lisp_Object)) +#else +mark_pgconn (Lisp_Object obj) +#endif +{ + return Qnil; +} + +static void +print_pgconn (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) +{ + char buf[256]; + PGconn *P; + ConnStatusType cst; + char *host="", *db="", *user="", *port=""; + + P = (XPGCONN (obj))->pgconn; + + if (!P) /* this may happen since we allow PQfinish() to be called */ + strcpy (buf, "#"); /* evil! */ + else if ((cst = PQstatus (P)) == CONNECTION_OK) + { + if (!(host = PQhost (P))) + host = ""; + port = PQport (P); + db = PQdb (P); + if (!(user = PQuser (P))) + user = ""; + sprintf (buf, "#", /* evil! */ + !strlen (host) ? "localhost" : host, + port, + user, + db); + } + else if (cst == CONNECTION_BAD) + strcpy (buf, "#"); /* evil! */ + else + strcpy (buf, "#"); /* evil! */ + + if (print_readably) + printing_unreadable_object ("%s", buf); + else + write_c_string (printcharfun, buf); +} + +static Lisp_PGconn * +allocate_pgconn (void) +{ +#ifdef RUNNING_XEMACS_21_1 + Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn, + lrecord_pgconn); +#else + Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn, + &lrecord_pgconn); +#endif + pgconn->pgconn = (PGconn *)NULL; + return pgconn; +} + +static void +finalize_pgconn (void *header, int for_disksave) +{ + Lisp_PGconn *pgconn = (Lisp_PGconn *)header; + + if (for_disksave) + invalid_operation ("Can't dump an emacs containing PGconn objects", + make_pgconn (pgconn)); + + if (pgconn->pgconn) + { + PQfinish (pgconn->pgconn); + pgconn->pgconn = (PGconn *)NULL; + } +} + +#ifdef RUNNING_XEMACS_21_1 +DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, + mark_pgconn, print_pgconn, finalize_pgconn, + NULL, NULL, + Lisp_PGconn); +#else +#ifdef USE_KKCC +DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, + 0, /*dumpable-flag*/ + mark_pgconn, print_pgconn, finalize_pgconn, + NULL, NULL, + pgconn_description, + Lisp_PGconn); +#else /* not USE_KKCC */ +DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, + mark_pgconn, print_pgconn, finalize_pgconn, + NULL, NULL, + 0, + Lisp_PGconn); +#endif /* not USE_KKCC */ +#endif +/****/ + +/* PGresult is an opaque object and we need to be able to store them in + Lisp code. +*/ +Lisp_Object Qpgresultp; + +static Lisp_Object +make_pgresult (Lisp_PGresult *pgresult) +{ + return wrap_pgresult (pgresult); +} + +#ifdef USE_KKCC +static const struct lrecord_description pgresult_description [] = { + { XD_END } +}; +#endif /* USE_KKCC */ + + +static Lisp_Object +#ifdef RUNNING_XEMACS_21_1 +mark_pgresult (Lisp_Object obj, void (*markobj) (Lisp_Object)) +#else +mark_pgresult (Lisp_Object obj) +#endif +{ + return Qnil; +} + +#define RESULT_TUPLES_FMT "#" +#define RESULT_CMD_TUPLES_FMT "#" +#define RESULT_DEFAULT_FMT "#" +static void +print_pgresult (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) +{ + char buf[1024]; + PGresult *res; + + res = (XPGRESULT (obj))->pgresult; + + if (res) + { + switch (PQresultStatus (res)) + { + case PGRES_TUPLES_OK: + /* Add number of tuples of result to output */ + sprintf (buf, RESULT_TUPLES_FMT, /* evil! */ + PQresStatus (PQresultStatus (res)), + PQntuples (res), + PQcmdStatus (res)); + break; + case PGRES_COMMAND_OK: + /* Add number of tuples affected by output-less command */ + if (!strlen (PQcmdTuples (res))) goto notuples; + sprintf (buf, RESULT_CMD_TUPLES_FMT, /* evil! */ + PQresStatus (PQresultStatus (res)), + PQcmdTuples (res), + PQcmdStatus (res)); + break; + default: +notuples: + /* No counts to print */ + sprintf (buf, RESULT_DEFAULT_FMT, /* evil! */ + PQresStatus (PQresultStatus (res)), + PQcmdStatus (res)); + break; + } + } + else + strcpy (buf, "#"); /* evil! */ + + if (print_readably) + printing_unreadable_object ("%s", buf); + else + write_c_string (printcharfun, buf); +} + +#undef RESULT_TUPLES_FMT +#undef RESULT_CMD_TUPLES_FMT +#undef RESULT_DEFAULT_FMT + +static Lisp_PGresult * +allocate_pgresult (void) +{ +#ifdef RUNNING_XEMACS_21_1 + Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult, + lrecord_pgresult); +#else + Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult, + &lrecord_pgresult); +#endif + pgresult->pgresult = (PGresult *)NULL; + return pgresult; +} + +static void +finalize_pgresult (void *header, int for_disksave) +{ + Lisp_PGresult *pgresult = (Lisp_PGresult *)header; + + if (for_disksave) + invalid_operation ("Can't dump an emacs containing PGresult objects", + make_pgresult (pgresult)); + + if (pgresult->pgresult) + { + PQclear (pgresult->pgresult); + pgresult->pgresult = (PGresult *)NULL; + } +} + +#ifdef RUNNING_XEMACS_21_1 +DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, + mark_pgresult, print_pgresult, finalize_pgresult, + NULL, NULL, + Lisp_PGresult); +#else +#ifdef USE_KKCC +DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, + 0, /*dumpable-flag*/ + mark_pgresult, print_pgresult, finalize_pgresult, + NULL, NULL, + pgresult_description, + Lisp_PGresult); +#else /* not USE_KKCC */ +DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, + mark_pgresult, print_pgresult, finalize_pgresult, + NULL, NULL, + 0, + Lisp_PGresult); +#endif /* not USE_KKCC */ +#endif + +/***********************/ + +/* notices */ +static void +xemacs_notice_processor (void *arg, const char *msg) +{ + warn_when_safe (Qpostgresql, Qnotice, "%s", msg); +} + +/* There are four ways (as of PostgreSQL v7) to connect to a database. + Two of them, PQsetdb and PQsetdbLogin, are deprecated. Both of those + routines take a number of positional parameters and are better done in Lisp. + Note that PQconnectStart does not exist prior to v7. +*/ + +/* ###autoload */ +DEFUN ("pq-conn-defaults", Fpq_conn_defaults, 0, 0, 0, /* +Return a connection default structure. +*/ + ()) +{ + /* This function can GC */ + PQconninfoOption *pcio; + Lisp_Object temp, temp1; + int i; + + pcio = PQconndefaults(); + if (!pcio) return Qnil; /* can never happen in libpq-7.0 */ + temp = list1 (Fcons (build_ext_string (pcio[0].keyword, PG_OS_CODING), + Fcons (build_ext_string (pcio[0].envvar, PG_OS_CODING), + Fcons (build_ext_string (pcio[0].compiled, PG_OS_CODING), + Fcons (build_ext_string (pcio[0].val, PG_OS_CODING), + Fcons (build_ext_string (pcio[0].label, PG_OS_CODING), + Fcons (build_ext_string (pcio[0].dispchar, PG_OS_CODING), + Fcons (make_int (pcio[0].dispsize), Qnil)))))))); + + for (i = 1; pcio[i].keyword; i++) + { + temp1 = list1 (Fcons (build_ext_string (pcio[i].keyword, PG_OS_CODING), + Fcons (build_ext_string (pcio[i].envvar, PG_OS_CODING), + Fcons (build_ext_string (pcio[i].compiled, PG_OS_CODING), + Fcons (build_ext_string (pcio[i].val, PG_OS_CODING), + Fcons (build_ext_string (pcio[i].label, PG_OS_CODING), + Fcons (build_ext_string (pcio[i].dispchar, PG_OS_CODING), + Fcons (make_int (pcio[i].dispsize), Qnil)))))))); + { + Lisp_Object args[2]; + args[0] = temp; + args[1] = temp1; + /* Fappend GCPROs its arguments */ + temp = Fappend (2, args); + } + } + + return temp; +} + +/* PQconnectdb Makes a new connection to a backend. +PGconn *PQconnectdb(const char *conninfo) +*/ + +/* ###autoload */ +DEFUN ("pq-connectdb", Fpq_connectdb, 1, 1, 0, /* +Make a new connection to a PostgreSQL backend. +*/ + (conninfo)) +{ + PGconn *P; + Lisp_PGconn *lisp_pgconn; + char *error_message = "Out of Memory?"; + char *c_conninfo; + + CHECK_STRING (conninfo); + + TO_EXTERNAL_FORMAT(LISP_STRING, conninfo, + C_STRING_ALLOCA, c_conninfo, Qnative); + P = PQconnectdb (c_conninfo); + if (P && (PQstatus (P) == CONNECTION_OK)) + { + (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); + lisp_pgconn = allocate_pgconn(); + lisp_pgconn->pgconn = P; + return make_pgconn (lisp_pgconn); + } + else + { + /* Connection failed. Destroy the connection and signal an error. */ + char buf[BLCKSZ]; + strcpy (buf, error_message); + if (P) + { + /* storage for the error message gets erased when call PQfinish */ + /* so we must temporarily stash it somewhere */ + strncpy (buf, PQerrorMessage (P), sizeof (buf)); + buf[sizeof (buf) - 1] = '\0'; + PQfinish (P); + } + signal_ferror (Qprocess_error, "libpq: %s", buf); + } +} + +/* PQconnectStart Makes a new asynchronous connection to a backend. +PGconn *PQconnectStart(const char *conninfo) +*/ + +#ifdef HAVE_POSTGRESQLV7 +/* ###autoload */ +DEFUN ("pq-connect-start", Fpq_connect_start, 1, 1, 0, /* +Make a new asynchronous connection to a PostgreSQL backend. +*/ + (conninfo)) +{ + PGconn *P; + Lisp_PGconn *lisp_pgconn; + char *error_message = "Out of Memory?"; + char *c_conninfo; + + CHECK_STRING (conninfo); + TO_EXTERNAL_FORMAT (LISP_STRING, conninfo, + C_STRING_ALLOCA, c_conninfo, Qnative); + P = PQconnectStart (c_conninfo); + + if (P && (PQstatus (P) != CONNECTION_BAD)) + { + (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); + lisp_pgconn = allocate_pgconn(); + lisp_pgconn->pgconn = P; + + return make_pgconn (lisp_pgconn); + } + else + { + /* capture the error message before destroying the object */ + char buf[BLCKSZ]; + strcpy (buf, error_message); + if (P) + { + strncpy (buf, PQerrorMessage (P), sizeof (buf)); + buf[sizeof (buf) - 1] = '\0'; + PQfinish (P); + } + signal_ferror (Qprocess_error, "libpq: %s", buf); + } +} + +DEFUN ("pq-connect-poll", Fpq_connect_poll, 1, 1, 0, /* +Poll an asynchronous connection for completion +*/ + (conn)) +{ + PGconn *P; + PostgresPollingStatusType polling_status; + + CHECK_PGCONN (conn); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + polling_status = PQconnectPoll (P); + switch (polling_status) + { + case PGRES_POLLING_FAILED: + /* Something Bad has happened */ + { + char *e = PQerrorMessage (P); + signal_ferror (Qprocess_error, "libpq: %s", e); + } + case PGRES_POLLING_OK: + return Qpgres_polling_ok; + case PGRES_POLLING_READING: + return Qpgres_polling_reading; + case PGRES_POLLING_WRITING: + return Qpgres_polling_writing; + case PGRES_POLLING_ACTIVE: + return Qpgres_polling_active; + default: + /* they've added a new field we don't know about */ + signal_ferror (Qprocess_error, "Help! Unknown status code %08x from backend!", polling_status); + } +} + +#ifdef MULE +DEFUN ("pq-client-encoding", Fpq_client_encoding, 1, 1, 0, /* +Return client coding system. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return make_int (PQclientEncoding (P)); +} + +DEFUN ("pq-set-client-encoding", Fpq_set_client_encoding, 2, 2, 0, /* +Set client coding system. +*/ + (conn, encoding)) +{ + PGconn *P; + int rc; + char *c_encoding; + + CHECK_PGCONN (conn); + CHECK_STRING (encoding); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + TO_EXTERNAL_FORMAT (LISP_STRING, encoding, + C_STRING_ALLOCA, c_encoding, Qnative); + + if ((rc = PQsetClientEncoding (P, c_encoding)) < 0) + signal_error (Qinvalid_argument, "bad encoding", Qunbound); + else + return make_int (rc); +} + +#endif +#endif /* HAVE_POSTGRESQLV7 */ + +/* PQfinish Close the connection to the backend. Also frees memory + used by the PGconn object. +void PQfinish(PGconn *conn) +*/ +DEFUN ("pq-finish", Fpq_finish, 1, 1, 0, /* +Close the connection to the backend. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + PUKE_IF_NULL (P); + + PQfinish (P); + /* #### PQfinish deallocates the PGconn structure, so we now have a + dangling pointer. */ + /* Genocided all @'s ... */ + (XPGCONN (conn))->pgconn = (PGconn *)NULL; /* You feel DEAD inside */ + return Qnil; +} + +DEFUN ("pq-clear", Fpq_clear, 1, 1, 0, /* +Forcibly erase a PGresult object. +*/ + (res)) +{ + PGresult *R; + + CHECK_PGRESULT (res); + R = (XPGRESULT (res))->pgresult; + PUKE_IF_NULL (R); + + PQclear (R); + /* Genocided all @'s ... */ + (XPGRESULT (res))->pgresult = (PGresult *)NULL; /* You feel DEAD inside */ + + return Qnil; +} + +DEFUN ("pq-is-busy", Fpq_is_busy, 1, 1, 0, /* +Return t if PQgetResult would block waiting for input. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return PQisBusy (P) ? Qt : Qnil; +} + +DEFUN ("pq-consume-input", Fpq_consume_input, 1, 1, 0, /* +Consume any available input from the backend. +Returns nil if something bad happened. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return PQconsumeInput (P) ? Qt : Qnil; +} + +/* PQreset Reset the communication port with the backend. +void PQreset(PGconn *conn) +*/ +DEFUN ("pq-reset", Fpq_reset, 1, 1, 0, /* +Reset the connection to the backend. +This function will close the connection to the backend and attempt to +reestablish a new connection to the same postmaster, using all the same +parameters previously used. This may be useful for error recovery if a +working connection is lost. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + PUKE_IF_NULL (P);/* we can resurrect a BAD connection, but not a dead one. */ + + PQreset (P); + + return Qnil; +} + +#ifdef HAVE_POSTGRESQLV7 +DEFUN ("pq-reset-start", Fpq_reset_start, 1, 1, 0, /* +Reset connection to the backend asynchronously. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + if (PQresetStart (P)) return Qt; + { + char *e = PQerrorMessage (P); + signal_ferror (Qprocess_error, "libpq: %s", e); + } +} + +DEFUN ("pq-reset-poll", Fpq_reset_poll, 1, 1, 0, /* +Poll an asynchronous reset for completion. +*/ + (conn)) +{ + PGconn *P; + PostgresPollingStatusType polling_status; + + CHECK_PGCONN (conn); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + polling_status = PQresetPoll (P); + switch (polling_status) + { + case PGRES_POLLING_FAILED: + /* Something Bad has happened */ + { + char *e = PQerrorMessage (P); + signal_ferror (Qprocess_error, "libpq: %s", e); + } + case PGRES_POLLING_OK: + return Qpgres_polling_ok; + case PGRES_POLLING_READING: + return Qpgres_polling_reading; + case PGRES_POLLING_WRITING: + return Qpgres_polling_writing; + case PGRES_POLLING_ACTIVE: + return Qpgres_polling_active; + default: + /* they've added a new field we don't know about */ + signal_ferror (Qprocess_error, "Help! Unknown status code %08x from backend!", polling_status); + } +} +#endif + +DEFUN ("pq-request-cancel", Fpq_request_cancel, 1, 1, 0, /* +Attempt to request cancellation of the current operation. + +The return value is t if the cancel request was successfully +dispatched, nil if not (in which case conn->errorMessage is set). +Note: successful dispatch is no guarantee that there will be any effect at +the backend. The application must read the operation result as usual. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return PQrequestCancel (P) ? Qt : Qnil; +} + +/* accessor function for the PGconn object */ +DEFUN ("pq-pgconn", Fpq_pgconn, 2, 2, 0, /* +Accessor function for the PGconn object. +Currently recognized symbols for the field: +pq::db Database name +pq::user Database user name +pq::pass Database user's password +pq::host Hostname of PostgreSQL backend connected to +pq::port TCP port number of connection +pq::tty Debugging TTY (not used in Emacs) +pq::options Additional backend options +pq::status Connection status (either OK or BAD) +pq::error-message Last error message from the backend +pq::backend-pid Process ID of backend process +*/ + (conn, field)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + PUKE_IF_NULL (P); /* BAD connections still have state to query */ + + if (EQ(field, Qpqdb)) + /* PQdb Returns the database name of the connection. + char *PQdb(PGconn *conn) + */ + return build_ext_string (PQdb(P), PG_OS_CODING); + else if (EQ (field, Qpquser)) + /* PQuser Returns the user name of the connection. + char *PQuser(PGconn *conn) + */ + return build_ext_string (PQuser(P), PG_OS_CODING); + else if (EQ (field, Qpqpass)) + /* PQpass Returns the password of the connection. + char *PQpass(PGconn *conn) + */ + return build_ext_string (PQpass(P), PG_OS_CODING); + else if (EQ (field, Qpqhost)) + /* PQhost Returns the server host name of the connection. + char *PQhost(PGconn *conn) + */ + return build_ext_string (PQhost(P), PG_OS_CODING); + else if (EQ (field, Qpqport)) + { + char *p; + /* PQport Returns the port of the connection. + char *PQport(PGconn *conn) + */ + if ((p = PQport(P))) + return make_int(atoi(p)); + else + return make_int(-1); + } + else if (EQ (field, Qpqtty)) + /* PQtty Returns the debug tty of the connection. + char *PQtty(PGconn *conn) + */ + return build_ext_string (PQtty(P), PG_OS_CODING); + else if (EQ (field, Qpqoptions)) + /* PQoptions Returns the backend options used in the connection. + char *PQoptions(PGconn *conn) + */ + return build_ext_string (PQoptions(P), PG_OS_CODING); + else if (EQ (field, Qpqstatus)) + { + ConnStatusType cst; + /* PQstatus Returns the status of the connection. The status can be + CONNECTION_OK or CONNECTION_BAD. + ConnStatusType PQstatus(PGconn *conn) + */ + switch ((cst = PQstatus (P))) + { + case CONNECTION_OK: return Qpg_connection_ok; + case CONNECTION_BAD: return Qpg_connection_bad; +#ifdef HAVE_POSTGRESQLV7 + case CONNECTION_STARTED: return Qpg_connection_started; + case CONNECTION_MADE: return Qpg_connection_made; + case CONNECTION_AWAITING_RESPONSE: return Qpg_connection_awaiting_response; + case CONNECTION_AUTH_OK: return Qpg_connection_auth_ok; + case CONNECTION_SETENV: return Qpg_connection_setenv; +#endif /* HAVE_POSTGRESQLV7 */ + default: + /* they've added a new field we don't know about */ + signal_ferror (Qprocess_error, "Help! Unknown connection status code %08x from backend!", cst); + } + } + else if (EQ (field, Qpqerrormessage)) + /* PQerrorMessage Returns the error message most recently generated + by an operation on the connection. + char *PQerrorMessage(PGconn* conn); + */ + return build_ext_string (PQerrorMessage(P), PG_OS_CODING); + else if (EQ (field, Qpqbackendpid)) + /* PQbackendPID Returns the process ID of the backend server handling + this connection. + int PQbackendPID(PGconn *conn); + */ + return make_int (PQbackendPID(P)); + else + signal_error (Qinvalid_argument, "bad PGconn accessor", Qunbound); +} + +/* Query functions */ +DEFUN ("pq-exec", Fpq_exec, 2, 2, 0, /* +Submit a query to Postgres and wait for the result. +*/ + (conn, query)) +{ + PGconn *P; + Lisp_PGresult *lisp_pgresult; + PGresult *R; + char *c_query; + + CHECK_PGCONN (conn); + CHECK_STRING (query); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + TO_EXTERNAL_FORMAT (LISP_STRING, query, + C_STRING_ALLOCA, c_query, Qnative); + + R = PQexec (P, c_query); + { + char *tag, buf[BLCKSZ]; + + if (!R) out_of_memory ("query: out of memory", Qunbound); + else + switch (PQresultStatus (R)) + { + case PGRES_BAD_RESPONSE: + tag = "bad response [%s]"; + goto err; + case PGRES_NONFATAL_ERROR: + tag = "non-fatal error [%s]"; + goto err; + case PGRES_FATAL_ERROR: + tag = "fatal error [%s]"; +err: + strncpy (buf, PQresultErrorMessage (R), sizeof (buf)); + buf [sizeof (buf) - 1] = '\0'; + PQclear (R); + signal_ferror (Qprocess_error, tag, buf); + /*NOTREACHED*/ + default: + break; + } + } + + lisp_pgresult = allocate_pgresult (); + lisp_pgresult->pgresult = R; + + return make_pgresult (lisp_pgresult); +} + +DEFUN ("pq-send-query", Fpq_send_query, 2, 2, 0, /* +Submit a query to Postgres and don't wait for the result. +Returns: t if successfully submitted + nil if error (conn->errorMessage is set) +*/ + (conn, query)) +{ + PGconn *P; + char *c_query; + + CHECK_PGCONN (conn); + CHECK_STRING (query); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + TO_EXTERNAL_FORMAT (LISP_STRING, query, + C_STRING_ALLOCA, c_query, Qnative); + + if (PQsendQuery (P, c_query)) return Qt; + else signal_ferror (Qprocess_error, "async query: %s", PQerrorMessage (P)); +} + +DEFUN ("pq-get-result", Fpq_get_result, 1, 1, 0, /* +Retrieve an asynchronous result from a query. +NIL is returned when no more query work remains. +*/ + (conn)) +{ + PGconn *P; + Lisp_PGresult *lisp_pgresult; + PGresult *R; + + CHECK_PGCONN (conn); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + R = PQgetResult (P); + if (!R) return Qnil; /* not an error, there's no more data to get */ + + { + char *tag, buf[BLCKSZ]; + + switch (PQresultStatus (R)) + { + case PGRES_BAD_RESPONSE: + tag = "bad response [%s]"; + goto err; + case PGRES_NONFATAL_ERROR: + tag = "non-fatal error [%s]"; + goto err; + case PGRES_FATAL_ERROR: + tag = "fatal error [%s]"; +err: + strncpy (buf, PQresultErrorMessage (R), sizeof (buf)); + buf[sizeof (buf) - 1] = '\0'; + PQclear (R); + signal_ferror (Qprocess_error, tag, buf); + /*NOTREACHED*/ + default: + break; + } + } + + lisp_pgresult = allocate_pgresult(); + lisp_pgresult->pgresult = R; + + return make_pgresult (lisp_pgresult); +} + +DEFUN ("pq-result-status", Fpq_result_status, 1, 1, 0, /* +Return result status of the query. +*/ + (result)) +{ + PGresult *R; + ExecStatusType est; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + switch ((est = PQresultStatus (R))) { + case PGRES_EMPTY_QUERY: return Qpgres_empty_query; + case PGRES_COMMAND_OK: return Qpgres_command_ok; + case PGRES_TUPLES_OK: return Qpgres_tuples_ok; + case PGRES_COPY_OUT: return Qpgres_copy_out; + case PGRES_COPY_IN: return Qpgres_copy_in; + case PGRES_BAD_RESPONSE: return Qpgres_bad_response; + case PGRES_NONFATAL_ERROR: return Qpgres_nonfatal_error; + case PGRES_FATAL_ERROR: return Qpgres_fatal_error; + default: + /* they've added a new field we don't know about */ + signal_ferror (Qprocess_error, "Help! Unknown exec status code %08x from backend!", est); + } +} + +DEFUN ("pq-res-status", Fpq_res_status, 1, 1, 0, /* +Return stringified result status of the query. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQresStatus (PQresultStatus (R)), PG_OS_CODING); +} + +/* Sundry PGresult accessor functions */ +DEFUN ("pq-result-error-message", Fpq_result_error_message, 1, 1, 0, /* +Return last message associated with the query. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQresultErrorMessage (R), PG_OS_CODING); +} + +DEFUN ("pq-ntuples", Fpq_ntuples, 1, 1, 0, /* +Return the number of tuples (instances) in the query result. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQntuples (R)); +} + +DEFUN ("pq-nfields", Fpq_nfields, 1, 1, 0, /* +Return the number of fields (attributes) in each tuple of the query result. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQnfields (R)); +} + +DEFUN ("pq-binary-tuples", Fpq_binary_tuples, 1, 1, 0, /* +Return t if the query result contains binary data, nil otherwise. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return (PQbinaryTuples (R)) ? Qt : Qnil; +} + +DEFUN ("pq-fname", Fpq_fname, 2, 2, 0, /* +Return the field (attribute) name associated with the given field index. +Field indices start at 0. +*/ + (result, field_index)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (field_index); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQfname (R, XINT (field_index)), PG_OS_CODING); +} + +DEFUN ("pq-fnumber", Fpq_fnumber, 2, 2, 0, /* +Return the number of fields (attributes) in each tuple of the query result. +*/ + (result, field_name)) +{ + PGresult *R; + char *c_field_name; + + CHECK_PGRESULT (result); + CHECK_STRING (field_name); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + TO_EXTERNAL_FORMAT (LISP_STRING, field_name, + C_STRING_ALLOCA, c_field_name, Qnative); + + return make_int (PQfnumber (R, c_field_name)); +} + +DEFUN ("pq-ftype", Fpq_ftype, 2, 2, 0, /* +Return the field type associated with the given field index. +The integer returned is the internal coding of the type. Field indices +start at 0. +*/ + (result, field_num)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (field_num); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQftype (R, XINT (field_num))); +} + +DEFUN ("pq-fsize", Fpq_fsize, 2, 2, 0, /* +Return the field size in bytes associated with the given field index. +Field indices start at 0. +*/ + (result, field_index)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (field_index); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQftype (R, XINT (field_index))); +} + +DEFUN ("pq-fmod", Fpq_fmod, 2, 2, 0, /* +Return the type modifier associated with a field. +Field indices start at 0. +*/ + (result, field_index)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (field_index); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQfmod (R, XINT (field_index))); +} + +DEFUN ("pq-get-value", Fpq_get_value, 3, 3, 0, /* +Return a single field (attribute) value of one tuple of a PGresult. +Tuple and field indices start at 0. +*/ + (result, tup_num, field_num)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (tup_num); + CHECK_INT (field_num); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQgetvalue (R, XINT (tup_num), XINT (field_num)), + PG_OS_CODING); +} + +DEFUN ("pq-get-length", Fpq_get_length, 3, 3, 0, /* +Returns the length of a field value in bytes. +If result is binary, i.e. a result of a binary portal, then the +length returned does NOT include the size field of the varlena. (The +data returned by PQgetvalue doesn't either.) +*/ + (result, tup_num, field_num)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (tup_num); + CHECK_INT (field_num); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return make_int (PQgetlength (R, XINT (tup_num), XINT (field_num))); +} + +DEFUN ("pq-get-is-null", Fpq_get_is_null, 3, 3, 0, /* +Returns the null status of a field value. +*/ + (result, tup_num, field_num)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + CHECK_INT (tup_num); + CHECK_INT (field_num); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return PQgetisnull (R, XINT (tup_num), XINT (field_num)) ? Qt : Qnil; +} + +DEFUN ("pq-cmd-status", Fpq_cmd_status, 1, 1, 0, /* +Returns the command status string from the SQL command that generated the result. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQcmdStatus (R), PG_OS_CODING); +} + +DEFUN ("pq-cmd-tuples", Fpq_cmd_tuples, 1, 1, 0, /* +Returns the number of rows affected by the SQL command. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + + return build_ext_string (PQcmdTuples (R), PG_OS_CODING); +} + +DEFUN ("pq-oid-value", Fpq_oid_value, 1, 1, 0, /* +Returns the object id of the tuple inserted. +*/ + (result)) +{ + PGresult *R; + + CHECK_PGRESULT (result); + R = (XPGRESULT (result))->pgresult; + PUKE_IF_NULL (R); + +#ifdef HAVE_POSTGRESQLV7 + return make_int (PQoidValue (R)); +#else + /* Use the old interface */ + return make_int (atoi (PQoidStatus (R))); +#endif +} + +#ifdef HAVE_POSTGRESQLV7 +DEFUN ("pq-set-nonblocking", Fpq_set_nonblocking, 2, 2, 0, /* +Sets the PGconn's database connection non-blocking if the arg is TRUE +or makes it non-blocking if the arg is FALSE, this will not protect +you from PQexec(), you'll only be safe when using the non-blocking API. + +Needs to be called only on a connected database connection. +*/ + (conn, arg)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return make_int (PQsetnonblocking (P, !NILP (arg))); +} + +DEFUN ("pq-is-nonblocking", Fpq_is_nonblocking, 1, 1, 0, /* +Return the blocking status of the database connection. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return PQisnonblocking (P) ? Qt : Qnil; +} + +DEFUN ("pq-flush", Fpq_flush, 1, 1, 0, /* +Force the write buffer to be written (or at least try). +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return make_int (PQflush (P)); +} +#endif + +DEFUN ("pq-notifies", Fpq_notifies, 1, 1, 0, /* +Return the latest async notification that has not yet been handled. +If there has been a notification, then a list of two elements will be returned. +The first element contains the relation name being notified, the second +element contains the backend process ID number. nil is returned if there +aren't any notifications to process. +*/ + (conn)) +{ + /* This function cannot GC */ + PGconn *P; + PGnotify *PGN; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + PGN = PQnotifies (P); + if (!PGN) + return Qnil; + else + { + Lisp_Object temp; + + temp = list2 (build_ext_string (PGN->relname, PG_OS_CODING), make_int (PGN->be_pid)); + free ((void *)PGN); + return temp; + } +} + +#if defined (HAVE_POSTGRESQLV7) && defined(MULE) +/* ###autoload */ +DEFUN ("pq-env-2-encoding", Fpq_env_2_encoding, 0, 0, 0, /* +Get encoding id from environment variable PGCLIENTENCODING. +*/ + ()) +{ + return make_int (PQenv2encoding ()); +} +#endif /* MULE */ + +DEFUN ("pq-lo-import", Fpq_lo_import, 2, 2, 0, /* +*/ + (conn, filename)) +{ + PGconn *P; + char *c_filename; + + CHECK_PGCONN (conn); + CHECK_STRING (filename); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + TO_EXTERNAL_FORMAT (LISP_STRING, filename, + C_STRING_ALLOCA, c_filename, + Qfile_name); + + return make_int ((int)lo_import (P, c_filename)); +} + +DEFUN ("pq-lo-export", Fpq_lo_export, 3, 3, 0, /* +*/ + (conn, oid, filename)) +{ + PGconn *P; + char *c_filename; + + CHECK_PGCONN (conn); + CHECK_INT (oid); + CHECK_STRING (filename); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + TO_EXTERNAL_FORMAT (LISP_STRING, filename, + C_STRING_ALLOCA, c_filename, Qfile_name); + + return make_int ((int)lo_export (P, XINT (oid), c_filename)); +} + +DEFUN ("pq-make-empty-pgresult", Fpq_make_empty_pgresult, 2, 2, 0, /* +Make an empty PGresult object with the given status. +*/ + (conn, status)) +{ + PGconn *P; + Lisp_PGresult *lpgr; + PGresult *R; + ExecStatusType est; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); /* needed here? */ + + if (EQ (status, Qpgres_empty_query)) est = PGRES_EMPTY_QUERY; + else if (EQ (status, Qpgres_command_ok)) est = PGRES_COMMAND_OK; + else if (EQ (status, Qpgres_tuples_ok)) est = PGRES_TUPLES_OK; + else if (EQ (status, Qpgres_copy_out)) est = PGRES_COPY_OUT; + else if (EQ (status, Qpgres_copy_in)) est = PGRES_COPY_IN; + else if (EQ (status, Qpgres_bad_response)) est = PGRES_BAD_RESPONSE; + else if (EQ (status, Qpgres_nonfatal_error)) est = PGRES_NONFATAL_ERROR; + else if (EQ (status, Qpgres_fatal_error)) est = PGRES_FATAL_ERROR; + else invalid_constant ("bad status symbol", status); + + R = PQmakeEmptyPGresult (P, est); + if (!R) out_of_memory (0, Qunbound); + + lpgr = allocate_pgresult (); + lpgr->pgresult = R; + + return make_pgresult (lpgr); +} + +DEFUN ("pq-get-line", Fpq_get_line, 1, 1, 0, /* +Retrieve a line from server in copy in operation. +The return value is a dotted pair where the cons cell is an integer code: + -1: Copying is complete + 0: A record is complete + 1: A record is incomplete, it will be continued in the next `pq-get-line' + operation. +and the cdr cell is returned string data. + +The copy operation is complete when the value `\.' (backslash dot) is +returned. +*/ + (conn)) +{ + char buffer[BLCKSZ]; /* size of a Postgres disk block */ + PGconn *P; + int ret; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + ret = PQgetline (P, buffer, sizeof (buffer)); + + return Fcons (make_int (ret), build_ext_string (buffer, PG_OS_CODING)); +} + +DEFUN ("pq-put-line", Fpq_put_line, 2, 2, 0, /* +Send a line to the server in copy out operation. + +Returns t if the operation succeeded, nil otherwise. +*/ + (conn, string)) +{ + PGconn *P; + char *c_string; + + CHECK_PGCONN (conn); + CHECK_STRING (string); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + TO_EXTERNAL_FORMAT (LISP_STRING, string, + C_STRING_ALLOCA, c_string, Qnative); + + return !PQputline (P, c_string) ? Qt : Qnil; +} + +DEFUN ("pq-get-line-async", Fpq_get_line_async, 1, 1, 0, /* +Get a line from the server in copy in operation asynchronously. + +This routine is for applications that want to do "COPY to stdout" +asynchronously, that is without blocking. Having issued the COPY command +and gotten a PGRES_COPY_OUT response, the app should call PQconsumeInput +and this routine until the end-of-data signal is detected. Unlike +PQgetline, this routine takes responsibility for detecting end-of-data. + +On each call, PQgetlineAsync will return data if a complete newline- +terminated data line is available in libpq's input buffer, or if the +incoming data line is too long to fit in the buffer offered by the caller. +Otherwise, no data is returned until the rest of the line arrives. + +If -1 is returned, the end-of-data signal has been recognized (and removed +from libpq's input buffer). The caller *must* next call PQendcopy and +then return to normal processing. + +RETURNS: + -1 if the end-of-copy-data marker has been recognized + 0 if no data is available + >0 the number of bytes returned. +The data returned will not extend beyond a newline character. If possible +a whole line will be returned at one time. But if the buffer offered by +the caller is too small to hold a line sent by the backend, then a partial +data line will be returned. This can be detected by testing whether the +last returned byte is '\n' or not. +The returned string is *not* null-terminated. +*/ + (conn)) +{ + PGconn *P; + char buffer[BLCKSZ]; + int ret; + + CHECK_PGCONN (conn); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + ret = PQgetlineAsync (P, buffer, sizeof (buffer)); + + if (ret == -1) return Qt; /* done! */ + else if (!ret) return Qnil; /* no data yet */ + else return Fcons (make_int (ret), + make_ext_string ((Extbyte *) buffer, ret, PG_OS_CODING)); +} + +DEFUN ("pq-put-nbytes", Fpq_put_nbytes, 2, 2, 0, /* +Asynchronous copy out. +*/ + (conn, data)) +{ + /* NULs are not allowed. I don't think this matters at this time. */ + PGconn *P; + char *c_data; + + CHECK_PGCONN (conn); + CHECK_STRING (data); + + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + TO_EXTERNAL_FORMAT (LISP_STRING, data, + C_STRING_ALLOCA, c_data, Qnative); + + return !PQputnbytes (P, c_data, strlen (c_data)) ? Qt : Qnil; +} + +DEFUN ("pq-end-copy", Fpq_end_copy, 1, 1, 0, /* +End a copying operation. +*/ + (conn)) +{ + PGconn *P; + + CHECK_PGCONN (conn); + P = (XPGCONN (conn))->pgconn; + CHECK_LIVE_CONNECTION (P); + + return PQendcopy (P) ? Qt : Qnil; +} + +void +syms_of_postgresql(void) +{ +#ifndef RUNNING_XEMACS_21_1 + INIT_LRECORD_IMPLEMENTATION (pgconn); + INIT_LRECORD_IMPLEMENTATION (pgresult); +#endif + DEFSYMBOL (Qpostgresql); + + /* opaque exported types */ + DEFSYMBOL (Qpgconnp); + DEFSYMBOL (Qpgresultp); + + /* connection status types */ + defsymbol (&Qpg_connection_ok, "pg::connection-ok"); + defsymbol (&Qpg_connection_bad, "pg::connection-bad"); + defsymbol (&Qpg_connection_started, "pg::connection-started"); + defsymbol (&Qpg_connection_made, "pg::connection-made"); + defsymbol (&Qpg_connection_awaiting_response, "pg::connection-awaiting-response"); + defsymbol (&Qpg_connection_auth_ok, "pg::connection-auth-ok"); + defsymbol (&Qpg_connection_setenv, "pg::connection-setenv"); + + /* Fields of PGconn */ + defsymbol (&Qpqdb, "pq::db"); + defsymbol (&Qpquser, "pq::user"); + defsymbol (&Qpqpass, "pq::pass"); + defsymbol (&Qpqhost, "pq::host"); + defsymbol (&Qpqport, "pq::port"); + defsymbol (&Qpqtty, "pq::tty"); + defsymbol (&Qpqoptions, "pq::options"); + defsymbol (&Qpqstatus, "pq::status"); + defsymbol (&Qpqerrormessage, "pq::error-message"); + defsymbol (&Qpqbackendpid, "pq::backend-pid"); + + /* Query status results */ + defsymbol (&Qpgres_empty_query, "pgres::empty-query"); + defsymbol (&Qpgres_command_ok, "pgres::command-ok"); + defsymbol (&Qpgres_tuples_ok, "pgres::tuples-ok"); + defsymbol (&Qpgres_copy_out, "pgres::copy-out"); + defsymbol (&Qpgres_copy_in, "pgres::copy-in"); + defsymbol (&Qpgres_bad_response, "pgres::bad-response"); + defsymbol (&Qpgres_nonfatal_error, "pgres::nonfatal-error"); + defsymbol (&Qpgres_fatal_error, "pgres::fatal-error"); + + /* Poll status results */ + defsymbol (&Qpgres_polling_failed, "pgres::polling-failed"); + defsymbol (&Qpgres_polling_reading, "pgres::polling-reading"); + defsymbol (&Qpgres_polling_writing, "pgres::polling-writing"); + defsymbol (&Qpgres_polling_ok, "pgres::polling-ok"); + defsymbol (&Qpgres_polling_active, "pgres::polling-active"); + +#ifdef HAVE_POSTGRESQLV7 + DEFSUBR (Fpq_connect_start); + DEFSUBR (Fpq_connect_poll); +#ifdef MULE + DEFSUBR (Fpq_client_encoding); + DEFSUBR (Fpq_set_client_encoding); +#endif /* MULE */ +#endif /* HAVE_POSTGRESQLV7 */ + DEFSUBR (Fpq_conn_defaults); + DEFSUBR (Fpq_connectdb); + DEFSUBR (Fpq_finish); + DEFSUBR (Fpq_clear); + DEFSUBR (Fpq_is_busy); + DEFSUBR (Fpq_consume_input); + + DEFSUBR (Fpq_reset); +#ifdef HAVE_POSTGRESQLV7 + DEFSUBR (Fpq_reset_start); + DEFSUBR (Fpq_reset_poll); +#endif + DEFSUBR (Fpq_request_cancel); + DEFSUBR (Fpq_pgconn); + + DEFSUBR (Fpq_exec); + DEFSUBR (Fpq_send_query); + DEFSUBR (Fpq_get_result); + DEFSUBR (Fpq_result_status); + DEFSUBR (Fpq_res_status); + DEFSUBR (Fpq_result_error_message); + DEFSUBR (Fpq_ntuples); + DEFSUBR (Fpq_nfields); + DEFSUBR (Fpq_binary_tuples); + DEFSUBR (Fpq_fname); + DEFSUBR (Fpq_fnumber); + DEFSUBR (Fpq_ftype); + DEFSUBR (Fpq_fsize); + DEFSUBR (Fpq_fmod); + /***/ + DEFSUBR (Fpq_get_value); + DEFSUBR (Fpq_get_length); + DEFSUBR (Fpq_get_is_null); + DEFSUBR (Fpq_cmd_status); + DEFSUBR (Fpq_cmd_tuples); + DEFSUBR (Fpq_oid_value); + +#ifdef HAVE_POSTGRESQLV7 + DEFSUBR (Fpq_set_nonblocking); + DEFSUBR (Fpq_is_nonblocking); + DEFSUBR (Fpq_flush); +#endif + DEFSUBR (Fpq_notifies); + +#if defined (HAVE_POSTGRESQLV7) && defined(MULE) + DEFSUBR (Fpq_env_2_encoding); +#endif + + DEFSUBR (Fpq_lo_import); + DEFSUBR (Fpq_lo_export); + + DEFSUBR (Fpq_make_empty_pgresult); + + /* copy in/out functions */ + DEFSUBR (Fpq_get_line); + DEFSUBR (Fpq_put_line); + DEFSUBR (Fpq_get_line_async); + DEFSUBR (Fpq_put_nbytes); + DEFSUBR (Fpq_end_copy); +} + +void +vars_of_postgresql(void) +{ + Fprovide (Qpostgresql); +#ifdef HAVE_POSTGRESQLV7 + Fprovide (intern ("postgresqlv7")); +#endif +#ifndef RUNNING_XEMACS_21_1 + Vpg_coding_system = Qnative; + DEFVAR_LISP ("pg-coding-system", &Vpg_coding_system /* +Default Postgres client coding system. +*/ ); +#endif + + DEFVAR_LISP ("pg:host", &VXPGHOST /* +Default PostgreSQL server name. +If not set, the server running on the local host is used. The +initial value is set from the PGHOST environment variable. +*/ ); + + DEFVAR_LISP ("pg:user", &VXPGUSER /* +Default PostgreSQL user name. +This value is used when connecting to a database for authentication. +The initial value is set from the PGUSER environment variable. +*/ ); + + DEFVAR_LISP ("pg:options", &VXPGOPTIONS /* +Default PostgreSQL user name. +This value is used when connecting to a database for authentication. +The initial value is set from the PGUSER environment variable. +*/ ); + + DEFVAR_LISP ("pg:port", &VXPGPORT /* +Default port to connect to PostgreSQL backend. +This value is used when connecting to a database. +The initial value is set from the PGPORT environment variable. +*/ ); + + DEFVAR_LISP ("pg:tty", &VXPGTTY /* +Default debugging TTY. +There is no useful setting of this variable in the XEmacs Lisp API. +The initial value is set from the PGTTY environment variable. +*/ ); + + DEFVAR_LISP ("pg:database", &VXPGDATABASE /* +Default database to connect to. +The initial value is set from the PGDATABASE environment variable. +*/ ); + + DEFVAR_LISP ("pg:realm", &VXPGREALM /* +Default kerberos realm to use for authentication. +The initial value is set from the PGREALM environment variable. +*/ ); + +#ifdef MULE + /* It's not clear whether this is any use. My intent is to + autodetect the coding system from the database. */ + DEFVAR_LISP ("pg:client-encoding", &VXPGCLIENTENCODING /* +Default client encoding to use. +The initial value is set from the PGCLIENTENCODING environment variable. +*/ ); +#endif + +#if !defined(HAVE_POSTGRESQLV7) + DEFVAR_LISP ("pg:authtype", &VXPGAUTHTYPE /* +Default authentication to use. +The initial value is set from the PGAUTHTYPE environment variable. + +WARNING: This variable has gone away in versions of PostgreSQL newer +than 6.5. +*/ ); +#endif + + DEFVAR_LISP ("pg:geqo", &VXPGGEQO /* +Genetic Query Optimizer options. +The initial value is set from the PGGEQO environment variable. +*/ ); + + DEFVAR_LISP ("pg:cost-index", &VXPGCOSTINDEX /* +Default cost index options. +The initial value is set from the PGCOSTINDEX environment variable. +*/ ); + + DEFVAR_LISP ("pg:cost-heap", &VXPGCOSTHEAP /* +Default cost heap options. +The initial value is set from the PGCOSTHEAP environment variable. +*/ ); + + DEFVAR_LISP ("pg:tz", &VXPGTZ /* +Default timezone to use. +The initial value is set from the PGTZ environment variable. +*/ ); + + DEFVAR_LISP ("pg:date-style", &VXPGDATESTYLE /* +Default date style to use. +The initial value is set from the PGDATESTYLE environment variable. +*/ ); + +#ifdef HAVE_SHLIB + /* If we are building this as a module, we need the initializing function to + run at module load time. */ + init_postgresql_from_environment (); +#endif +} + +/* These initializations should not be done at dump-time. */ +void +init_postgresql_from_environment (void) +{ + Ibyte *p; + +#define FROB(envvar, var) \ + if ((p = egetenv (envvar))) \ + var = build_intstring (p); \ + else \ + var = Qnil + + if (initialized) + { + FROB ("PGHOST", VXPGHOST); + FROB ("PGUSER", VXPGUSER); + FROB ("PGOPTIONS", VXPGOPTIONS); + + if ((p = egetenv ("PGPORT"))) + VXPGPORT = make_int (atoi ((char *) p)); + else + VXPGPORT = Qnil; + + FROB ("PGTTY", VXPGTTY); + FROB ("PGDATABASE", VXPGDATABASE); + FROB ("PGREALM", VXPGREALM); +#ifdef MULE + /* It's not clear whether this is any use. My intent is to + autodetect the coding system from the database. */ + FROB ("PGCLIENTENCODING", VXPGCLIENTENCODING); +#endif + +#if !defined(HAVE_POSTGRESQLV7) + FROB ("PGAUTHTYPE", VXPGAUTHTYPE); +#endif + + FROB ("PGGEQO", VXPGGEQO); + FROB ("PGCOSTINDEX", VXPGCOSTINDEX); + FROB ("PGCOSTHEAP", VXPGCOSTHEAP); + FROB ("PGTZ", VXPGTZ); + FROB ("PGDATESTYLE", VXPGDATESTYLE); +#undef FROB + } +} + +#ifdef HAVE_SHLIB +void +unload_postgresql (void) +{ +#ifndef RUNNING_XEMACS_21_1 + /* Remove defined types */ + UNDEF_LRECORD_IMPLEMENTATION (pgconn); + UNDEF_LRECORD_IMPLEMENTATION (pgresult); +#endif + + /* Remove staticpro'ing of symbols */ + unstaticpro_nodump (&Qpostgresql); + unstaticpro_nodump (&Qpgconnp); + unstaticpro_nodump (&Qpgresultp); + unstaticpro_nodump (&Qpg_connection_ok); + unstaticpro_nodump (&Qpg_connection_bad); + unstaticpro_nodump (&Qpg_connection_started); + unstaticpro_nodump (&Qpg_connection_made); + unstaticpro_nodump (&Qpg_connection_awaiting_response); + unstaticpro_nodump (&Qpg_connection_auth_ok); + unstaticpro_nodump (&Qpg_connection_setenv); + unstaticpro_nodump (&Qpqdb); + unstaticpro_nodump (&Qpquser); + unstaticpro_nodump (&Qpqpass); + unstaticpro_nodump (&Qpqhost); + unstaticpro_nodump (&Qpqport); + unstaticpro_nodump (&Qpqtty); + unstaticpro_nodump (&Qpqoptions); + unstaticpro_nodump (&Qpqstatus); + unstaticpro_nodump (&Qpqerrormessage); + unstaticpro_nodump (&Qpqbackendpid); + unstaticpro_nodump (&Qpgres_empty_query); + unstaticpro_nodump (&Qpgres_command_ok); + unstaticpro_nodump (&Qpgres_tuples_ok); + unstaticpro_nodump (&Qpgres_copy_out); + unstaticpro_nodump (&Qpgres_copy_in); + unstaticpro_nodump (&Qpgres_bad_response); + unstaticpro_nodump (&Qpgres_nonfatal_error); + unstaticpro_nodump (&Qpgres_fatal_error); + unstaticpro_nodump (&Qpgres_polling_failed); + unstaticpro_nodump (&Qpgres_polling_reading); + unstaticpro_nodump (&Qpgres_polling_writing); + unstaticpro_nodump (&Qpgres_polling_ok); + unstaticpro_nodump (&Qpgres_polling_active); +} +#endif /* HAVE_SHLIB */ diff -r 4575a219af58 -r 25e260cb7994 modules/postgresql/postgresql.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postgresql/postgresql.h Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,64 @@ +/* + postgresql.h -- Emacs Lisp binding to libpq.so + Copyright (C) 2000 Electrotechnical Laboratory, JAPAN. + Licensed to the Free Software Foundation. + + Author: SL Baur + Maintainer: SL Baur + +Please send patches to this file to me first before submitting them to +xemacs-patches. +*/ + +#ifndef INCLUDED_postgresql_h_ +#define INCLUDED_postgresql_h_ 1 + +#define message message_ /* Yuck */ +#include LIBPQ_FE_H_FILE /* main PostgreSQL header file */ +#undef message + +#define BLCKSZ 8192 /* size of a default Postgres disk block */ +/* + This file contains the GCC bug workaround code for the private + LRECORD types. +*/ + +/* PGconn is an opaque object and we need to be able to store them in + Lisp code because libpq supports multiple connections. +*/ +struct Lisp_PGconn +{ + struct lcrecord_header header; + PGconn *pgconn; +}; +typedef struct Lisp_PGconn Lisp_PGconn; + +DECLARE_LRECORD (pgconn, Lisp_PGconn); + +#define XPGCONN(x) XRECORD (x, pgconn, Lisp_PGconn) +#define wrap_pgconn(p) wrap_record (p, pgconn) +#define PGCONNP(x) RECORDP (x, pgconn) +#define CHECK_PGCONN(x) CHECK_RECORD (x, pgconn) +#define CONCHECK_PGCONN(x) CONCHECK_RECORD (x, pgconn) + +/****/ + +/* PGresult is an opaque object and we need to be able to store them in + Lisp code. +*/ +struct Lisp_PGresult +{ + struct lcrecord_header header; + PGresult *pgresult; +}; +typedef struct Lisp_PGresult Lisp_PGresult; + +DECLARE_LRECORD (pgresult, Lisp_PGresult); + +#define XPGRESULT(x) XRECORD (x, pgresult, Lisp_PGresult) +#define wrap_pgresult(p) wrap_record (p, pgresult) +#define PGRESULTP(x) RECORDP (x, pgresult) +#define CHECK_PGRESULT(x) CHECK_RECORD (x, pgresult) +#define CONCHECK_PGRESULT(x) CONCHECK_RECORD (x, pgresult) + +#endif /* INCLUDED_postgresql_h_ */ diff -r 4575a219af58 -r 25e260cb7994 modules/sample/.cvsignore --- a/modules/sample/.cvsignore Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -*.ell -*_i.c diff -r 4575a219af58 -r 25e260cb7994 modules/sample/Makefile --- a/modules/sample/Makefile Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -# -# Sample makefile for a simple Emacs module. -# This is slightly more complicated than would normally be the case, -# as this makefile has been tailored to work in the Emacs source tree. -# For samples of how to compile modules outside of the source tree -# (as would be the case if a user had downloaded a module and wanted -# to compile it for use within Emacs), see the samples in the sub-directory -# 'installed'. -# - -SHELL=/bin/sh -RM=rm -f -CC=../../lib-src/ellcc -CFLAGS=-I. -I../../src -LD=$(CC) --mode=link -MKINIT=$(CC) --mode=init - -SRCS=sample.c -OBJS=$(SRCS:.c=.o) - -.c.o: - $(CC) $(CFLAGS) -c $< - -MODNAME=sample -MODVER=1.0.0 -MODTITLE="Sample loadable module" - -all: $(MODNAME).ell - -distclean: clean - -clean: - $(RM) $(MODNAME).ell $(OBJS) sample_i.o sample_i.c - -$(MODNAME).ell: $(OBJS) sample_i.o - $(LD) --mod-output=$@ $(OBJS) sample_i.o - -sample_i.o: sample_i.c -sample_i.c: $(SRCS) - ELLMAKEDOC=../../lib-src/make-docfile $(MKINIT) --mod-output=$@ \ - --mod-name=$(MODNAME) --mod-version=$(MODVER) \ - --mod-title=$(MODTITLE) $(SRCS) - diff -r 4575a219af58 -r 25e260cb7994 modules/sample/external/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/external/.cvsignore Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,2 @@ +*.ell +*_i.c diff -r 4575a219af58 -r 25e260cb7994 modules/sample/external/Makefile.in.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/external/Makefile.in.in Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,52 @@ +## Makefile for the sample module in XEmacs. +## Copyright (C) 2002 Jerry James. + +## This file is not part of XEmacs. + +### Specialize this part for your module +MODNAME=sample +MODVER=0.0.1 +MODTITLE="Sample module for XEmacs" +SRCS=sample.c + +### You should not need to modify anything below this line +SRC_SRCS=$(SRCS:%=$(srcdir)/%) +OBJS=$(SRCS:.c=.o) + +SHELL=/bin/sh +RM=rm -f +CFLAGS=@CFLAGS@ +LDFLAGS=@LDFLAGS@ + +srcdir=@srcdir@ +VPATH=@srcdir@ + +ELLCC=@ELLCC@ +MODARCHDIR=$(shell @ELLCC@ --mod-archdir) +INSTALLPATH=$(shell @ELLCC@ --mod-site-location) +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ + +.PHONY: clean distclean install +all: $(MODNAME).ell + +.c.o: + $(ELLCC) $(CFLAGS) --mode=compile --mod-output=$@ \ + -I$(MODARCHDIR)/include -c $< + +$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o + $(ELLCC) --mode=link --mod-output=$@ $^ $(LDFLAGS) + +$(MODNAME)_i.c: $(SRCS) + ELLMAKEDOC=$(MODARCHDIR)/make-docfile $(ELLCC) --mode=init \ + --mod-output=$@ --mod-name=$(MODNAME) --mod-version=$(MODVER) \ + --mod-title=$(MODTITLE) $(SRC_SRCS) + +clean: + $(RM) $(MODNAME).ell $(OBJS) $(MODNAME)_i.* *~ + +distclean: clean + $(RM) Makefile config.* configure + +install: $(MODNAME).ell + $(INSTALL_PROGRAM) $< $(INSTALLPATH) diff -r 4575a219af58 -r 25e260cb7994 modules/sample/external/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/external/configure.ac Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,26 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT([Sample module], [1.0], [xemacs-beta@xemacs.org]) +AC_PREREQ(2.53) +AC_REVISION($Revision: 1.1 $) +AC_COPYRIGHT([Configuration script for the sample module. +Copyright (C) 2002 Jerry James. + +This file is not part of XEmacs.]) + +AC_CONFIG_SRCDIR([sample.c]) +AC_PROG_CC +AC_PROG_INSTALL +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) + +# Find ELLCC +AC_ARG_VAR([ELLCC], [The path to the ellcc module compiler]) +AC_PATH_PROG([ELLCC], [ellcc], ["FAIL"]) +AS_IF([test "$ELLCC" = "FAIL"], [AS_ERROR([Cannot find ellcc])]) +AC_SUBST(ELLCC) + +# Insert autoconf macros here to find the headers, libraries, other +# programs, etc. needed by your module. + +AC_CONFIG_FILES([Makefile.in Makefile]) +AC_OUTPUT diff -r 4575a219af58 -r 25e260cb7994 modules/sample/external/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/external/install-sh Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + : + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 4575a219af58 -r 25e260cb7994 modules/sample/external/sample.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/external/sample.c Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,110 @@ +/* + * Very simple sample module. Illustrates most of the salient features + * of Emacs dynamic modules. + * (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved. + * (C) Copyright 2002 Jerry James. + */ + +#include +#include "lisp.h" + +/* + * This sample introduces three new Lisp objects to the Lisp reader. + * The first, a simple boolean value, and the second a string. The + * Third is a sample function that simply prints a message. + */ +int sample_bool; +Lisp_Object Vsample_string; + +DEFUN ("sample-function", Fsample_function, 0, 0, "", /* +This is a sample function loaded dynamically. + +You will notice in the source code for this module that the +declaration is identical to internal Emacs functions. This +makes it possible to use the exact same code in a dumped +version of Emacs. +*/ + ()) +{ + message ("Eureka! It worked"); + return Qt; +} + +/* + * Each dynamically loaded Emacs module is given a name at compile + * time. This is a short name, and must be a valid part of a C + * identifier. This name is used to construct the name of several + * functions which must appear in the module source code. + * The first such function, modules_of_XXXX, should load in any dependent + * modules. This function is optional, and the module will still load if + * it is not present in the module. + * + * The second function, which is NOT optional, is syms_of_XXXX, in which + * all functions that the module will be provided are declared. This + * function will contain calls to DEFSUBR(). + * + * The third function, which is also NOT optional, is vars_of_XXXX, in + * which you declare all variables that the module provides. This + * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc. + * + * When declaring functions and variables in the syms_of_XXXX and + * vars_of_XXXX functions, you use the exact same syntax that you + * would as if this module were being compiled into the pure Emacs. + * + * The fourth function, which is optional, is unload_XXXX, in which actions + * that must be taken to unload the module are listed. XEmacs will unbind + * functions and variables for you. Anything else that must be done should + * appear in this function. + * + * All four of these functions are declared as void functions, + * taking no parameters. Since this sample module is called 'sample', + * the functions will be named 'modules_of_sample', 'syms_of_sample', + * 'vars_of_sample', and 'unload_sample'. + */ + +void +modules_of_sample() +{ + /* + * This function isn't actually required as we will not be loading + * in any dependent modules, but if we were, we would do something like: + * emodules_load ("dependent.ell", "sample2", "1.0.0"); + */ +} + +void +syms_of_sample() +{ + DEFSUBR(Fsample_function); +} + +void +vars_of_sample() +{ + DEFVAR_LISP ("sample-string", &Vsample_string /* +This is a sample string, declared in a dynamic module. + +The syntax and conventions used for all normal Emacs variables +apply equally to modules, using an identical syntax. +*/ ); + + DEFVAR_BOOL ("sample-boolean", &sample_bool /* +*Sample boolean value, in a dynamic module. + +This is a user-settable variable, as indicated by the * +as the first character of the description. Declared in +a module exactly as it would be internally in Emacs. +*/ ); +} + +#ifdef HAVE_SHLIB +void +unload_sample() +{ + /* We don't need to do anything here in the sample case. However, if you + create any new types with INIT_LRECORD_IMPLEMENTATION (sample_type), then + UNDEF_LRECORD_IMPLEMENTATION (sample_type) must appear here. Also, any + symbols declared with DEFSYMBOL (Qsample_var), or one of its variants, + must have a corresponding unstaticpro_nodump (&Qsample_var) here. */ +} +#endif diff -r 4575a219af58 -r 25e260cb7994 modules/sample/internal/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/internal/.cvsignore Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,2 @@ +*.ell +*_i.c diff -r 4575a219af58 -r 25e260cb7994 modules/sample/internal/Makefile.in.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/internal/Makefile.in.in Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,85 @@ +## Makefile for the sample module in XEmacs. +## Copyright (C) 2002 Jerry James. + +## This file is part of XEmacs. + +## XEmacs is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. + +## XEmacs is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. + +## You should have received a copy of the GNU General Public License +## along with XEmacs; see the file COPYING. If not, write to +## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +## Boston, MA 02111-1307, USA. + +## Synched up with: Not synched with FSF. + +## This is more complicated than would normally be the case, as this makefile +## has been tailored to work both inside and independently of the XEmacs +## source tree, and to support both module and non-module building inside the +## source tree. + +### Specialize this part for your module +MODNAME=sample +MODVER=0.0.1 +MODTITLE="Sample module for XEmacs" +LDFLAGS=@LDFLAGS@ @sample_libs@ +SRCS=sample.c + +### You should not need to modify anything below this line +SRC_SRCS=$(SRCS:%=$(srcdir)/%) +OBJS=$(SRCS:.c=.o) + +SHELL=/bin/sh +RM=rm -f +PROGNAME=@PROGNAME@ +CFLAGS=@CFLAGS@ +INSTALL=@INSTALL@ +version=@version@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +instvardir=@instvardir@ +configuration=@configuration@ +moduledir=@moduledir@ +with_modules=@with_modules@ + +srcdir=@srcdir@ +VPATH=@srcdir@ + +CC=@MOD_CC@ +MODARCHDIR=@MODARCHDIR@ +MAKE_DOCFILE=@MAKE_DOCFILE@ +MODCFLAGS=@MODCFLAGS@ +INSTALLPATH=@INSTALLPATH@ +INSTALL_PROGRAM=@MOD_INSTALL_PROGRAM@ +OBJECT_TO_BUILD=@OBJECT_TO_BUILD@ + +.PHONY: clean distclean install +all: $(OBJECT_TO_BUILD) + +.c.o: + $(CC) $(MODCFLAGS) -c $< + +$(MODNAME).ell: $(OBJS) $(MODNAME)_i.o + $(CC) --mode=link --mod-output=$@ $^ $(LDFLAGS) + +$(MODNAME)_i.c: $(SRCS) + ELLMAKEDOC=$(MAKE_DOCFILE) $(CC) --mode=init --mod-output=$@ \ + --mod-name=$(MODNAME) --mod-version=$(MODVER) \ + --mod-title=$(MODTITLE) $(SRC_SRCS) + +clean: + $(RM) $(MODNAME).ell $(OBJS) $(MODNAME)_i.* *~ + +distclean: clean + $(RM) Makefile config.* configure + +install: $(OBJECT_TO_BUILD) + $(INSTALL_PROGRAM) $< $(INSTALLPATH) diff -r 4575a219af58 -r 25e260cb7994 modules/sample/internal/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/internal/configure.ac Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,53 @@ +# Process this file with autoconf to produce a configure script. +# This is only used for independent module building. +AC_INIT([Sample module], [1.0], [xemacs-beta@xemacs.org]) +AC_PREREQ(2.53) +AC_REVISION($Revision: 1.1 $) +AC_COPYRIGHT([Configuration script for the sample module. +Copyright (C) 2002 Jerry James. + +This file is part of XEmacs. + +XEmacs is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your +option) any later version. + +XEmacs is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with XEmacs; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA.]) + +AC_CONFIG_SRCDIR([sample.c]) +AC_PROG_CC +AC_PROG_INSTALL +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) + +# Find ELLCC +AC_ARG_VAR([ELLCC], [The path to the ellcc module compiler]) +AC_PATH_PROG([ELLCC], [ellcc], ["FAIL"]) +AS_IF([test "$ELLCC" = "FAIL"], [AS_ERROR([Cannot find ellcc])]) + +# Insert autoconf macros here to find the headers, libraries, other +# programs, etc. needed by your module. If other libraries will be linked +# with your module, then after detecting them, use a line of this form last: +AC_SUBST(sample_libs, "$LIBS") + +# This part should appear unchanged in every module configure.ac +AC_SUBST(PROGNAME, "module") +AC_SUBST(MOD_CC, "@ELLCC@") +AC_SUBST(MODARCHDIR, "\$(shell @ELLCC@ --mod-archdir)") +AC_SUBST(MAKE_DOCFILE, "\$(MODARCHDIR)/make-docfile") +AC_SUBST(MODCFLAGS, "\$(CFLAGS) --mode=compile --mod-output=\$@ -I\$(MODARCHDIR)/include") +AC_SUBST(INSTALLPATH, "\$(shell @ELLCC@ --mod-site-location)") +AC_SUBST(MOD_INSTALL_PROGRAM, "@INSTALL_PROGRAM@") +AC_SUBST(OBJECT_TO_BUILD, "\$(MODNAME).ell") + +AC_CONFIG_FILES([Makefile.in Makefile]) +AC_OUTPUT diff -r 4575a219af58 -r 25e260cb7994 modules/sample/internal/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/internal/install-sh Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + : + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 4575a219af58 -r 25e260cb7994 modules/sample/internal/sample.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/sample/internal/sample.c Tue Sep 10 15:27:39 2002 +0000 @@ -0,0 +1,110 @@ +/* + * Very simple sample module. Illustrates most of the salient features + * of Emacs dynamic modules. + * (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved. + * (C) Copyright 2002 Jerry James. + */ + +#include +#include "lisp.h" + +/* + * This sample introduces three new Lisp objects to the Lisp reader. + * The first, a simple boolean value, and the second a string. The + * Third is a sample function that simply prints a message. + */ +int sample_bool; +Lisp_Object Vsample_string; + +DEFUN ("sample-function", Fsample_function, 0, 0, "", /* +This is a sample function loaded dynamically. + +You will notice in the source code for this module that the +declaration is identical to internal Emacs functions. This +makes it possible to use the exact same code in a dumped +version of Emacs. +*/ + ()) +{ + message ("Eureka! It worked"); + return Qt; +} + +/* + * Each dynamically loaded Emacs module is given a name at compile + * time. This is a short name, and must be a valid part of a C + * identifier. This name is used to construct the name of several + * functions which must appear in the module source code. + * The first such function, modules_of_XXXX, should load in any dependent + * modules. This function is optional, and the module will still load if + * it is not present in the module. + * + * The second function, which is NOT optional, is syms_of_XXXX, in which + * all functions that the module will be provided are declared. This + * function will contain calls to DEFSUBR(). + * + * The third function, which is also NOT optional, is vars_of_XXXX, in + * which you declare all variables that the module provides. This + * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc. + * + * When declaring functions and variables in the syms_of_XXXX and + * vars_of_XXXX functions, you use the exact same syntax that you + * would as if this module were being compiled into the pure Emacs. + * + * The fourth function, which is optional, is unload_XXXX, in which actions + * that must be taken to unload the module are listed. XEmacs will unbind + * functions and variables for you. Anything else that must be done should + * appear in this function. + * + * All four of these functions are declared as void functions, + * taking no parameters. Since this sample module is called 'sample', + * the functions will be named 'modules_of_sample', 'syms_of_sample', + * 'vars_of_sample', and 'unload_sample'. + */ + +void +modules_of_sample() +{ + /* + * This function isn't actually required as we will not be loading + * in any dependent modules, but if we were, we would do something like: + * emodules_load ("dependent.ell", "sample2", "1.0.0"); + */ +} + +void +syms_of_sample() +{ + DEFSUBR(Fsample_function); +} + +void +vars_of_sample() +{ + DEFVAR_LISP ("sample-string", &Vsample_string /* +This is a sample string, declared in a dynamic module. + +The syntax and conventions used for all normal Emacs variables +apply equally to modules, using an identical syntax. +*/ ); + + DEFVAR_BOOL ("sample-boolean", &sample_bool /* +*Sample boolean value, in a dynamic module. + +This is a user-settable variable, as indicated by the * +as the first character of the description. Declared in +a module exactly as it would be internally in Emacs. +*/ ); +} + +#ifdef HAVE_SHLIB +void +unload_sample() +{ + /* We don't need to do anything here in the sample case. However, if you + create any new types with INIT_LRECORD_IMPLEMENTATION (sample_type), then + UNDEF_LRECORD_IMPLEMENTATION (sample_type) must appear here. Also, any + symbols declared with DEFSYMBOL (Qsample_var), or one of its variants, + must have a corresponding unstaticpro_nodump (&Qsample_var) here. */ +} +#endif diff -r 4575a219af58 -r 25e260cb7994 modules/sample/sample.c --- a/modules/sample/sample.c Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Very simple sample module. Illustrates most of the salient features - * of Emacs dynamic modules. - * (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved. - */ - -#include - -/* - * This sample introduces three new Lisp objects to the Lisp reader. - * The first, a simple boolean value, and the second a string. The - * Third is a sample function that simply prints a message. - */ -int sample_bool; -Lisp_Object Vsample_string; - -DEFUN ("sample-function", Fsample_function, 0, 0, "", /* -This is a sample function loaded dynamically. - -You will notice in the source code for this module that the -declaration is identical to internal Emacs functions. This -makes it possible to use the exact same code in a dumped -version of Emacs. -*/ - ()) -{ - message ("Eureka! It worked"); - return Qt; -} - -/* - * Each dynamically loaded Emacs module is given a name at compile - * time. This is a short name, and must be a valid part of a C - * identifier. This name is used to construct the name of several - * functions which must appear in the module source code. - * The first such function, modules_of_XXXX, should load in any dependent - * modules. This function is optional, and the module will still load if - * it is not present in the module. - * - * The second function, which is NOT optional, is syms_of_XXXX, in which - * all functions that the module will be provided are declared. This - * function will contain calls to DEFSUBR(). - * - * The third function, which is also NOT optional, is vars_of_XXXX, in - * which you declare all variables that the module provides. This - * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc. - * - * When declaring functions and variables in the syms_of_XXXX and - * vars_of_XXXX functions, you use the exact same syntax that you - * would as if this module were being compiled into the pure Emacs. - * - * All three of these functions are declared as void functions, - * taking no parameters. Since this sample module is called 'sample', - * the functions will be named 'modules_of_sample', 'syms_of_sample' - * and 'vars_of_sample'. - */ - -void -modules_of_sample() -{ - /* - * This function isn't actually required as we will not be loading - * in any dependent modules, but if we were, we would do something like: - * emodules_load ("dependent.ell", "sample2", "1.0.0"); - */ -} - -void -syms_of_sample() -{ - DEFSUBR(Fsample_function); -} - -void -vars_of_sample() -{ - DEFVAR_LISP ("sample-string", &Vsample_string /* -This is a sample string, declared in a dynamic module. - -The syntax and conventions used for all normal Emacs variables -apply equally to modules, using an identical syntax. -*/ ); - - DEFVAR_BOOL ("sample-boolean", &sample_bool /* -*Sample boolean value, in a dynamic module. - -This is a user-settable variable, as indicated by the * -as the first character of the description. Declared in -a module exactly as it would be internally in Emacs. -*/ ); -} - diff -r 4575a219af58 -r 25e260cb7994 src/ChangeLog --- a/src/ChangeLog Mon Sep 09 21:53:43 2002 +0000 +++ b/src/ChangeLog Tue Sep 10 15:27:39 2002 +0000 @@ -1,3 +1,49 @@ +2002-08-08 Jerry James + + * Makefile.in.in: ldap.o and postgresql.o have moved. + * alloc.c (unstaticpro_nodump_1): New function. + * alloc.c (unstaticpro_nodump): Ditto. + * depend: Regenerate. + * eldap.c: Move to modules/ldap. + * eldap.h: Ditto. + * emacs.c (main_1): Call LDAP and PostgreSQL initialization + functions only if they are not modules. + * emodules.c: Define EMODULES_DO_NOT_REDEFINE to skip changes to + core functions and macros made in emodules.h. + * emodules.c (unloading_module): New variable to flag when a + module unload is in progress. + * emodules.c (emodules_list): New member unload, to hold a + function for doing module cleanup at unload time. + * emodules.c (Fload_module): Note that users should not call this + function directly. + * emodules.c (Funload_module): Ditto. Compile it. Call the + module's unload function if it has one. + * emodules.c (emodules_load): Stop working around formerly broken + build_string() declaration. Update load-history for module + unloading. + * emodules.c (syms_of_module): Add new symbols. + * emodules.c (vars_of_module): Add unloading-module. Make + Vmodule_extensions use the new format. + * emodules.h: Block paths from module code into the dump_add* + functions. + * emodules.h (EMODULES_VERSION): New version. + * fileio.c: Add Qfile_name_nondirectory for use in emodules.c. + * inline.c: eldap.h and postgresql.h have moved. + * lisp.h: Add unstaticpro_nodump, unloading_module, Qmodule, and + Qfile_name_sans_extension declarations. + * lisp.h (Dynarr_delete_object): New macro. + * lrecord.h (UNDEF_LRECORD_IMPLEMENTATION): New macro. + * lrecord.h (UNDEF_EXTERNAL_LRECORD_IMPLEMENTATION): New macro. + * postgresql.c: Move to modules/postgresql. + * postgresql.h: Ditto. + * symbols.c (reject_constant_symbols): Allow it if we are + unloading a module. + * symbols.c (Fset): Allow unbinding constant value forward symbols + if we are unloading a module. + * symbols.c (defsubr): Update the load history for modules. + * symbols.c (defsubr_macro): Ditto. + * symbols.c (defvar_magic): Ditto. + 2002-08-29 Jerry James * eldap.c: Put #endif tokens in a comment. diff -r 4575a219af58 -r 25e260cb7994 src/Makefile.in.in --- a/src/Makefile.in.in Mon Sep 09 21:53:43 2002 +0000 +++ b/src/Makefile.in.in Tue Sep 10 15:27:39 2002 +0000 @@ -215,8 +215,8 @@ gpm_objs=gpmevent.o #endif -#ifdef HAVE_LDAP -ldap_objs=eldap.o +#if defined(HAVE_LDAP) && !defined(HAVE_SHLIB) +ldap_objs=../modules/ldap/eldap.o #endif #ifdef MULE @@ -231,8 +231,8 @@ mule_wnn_objs=mule-wnnfns.o #endif -#ifdef HAVE_POSTGRESQL -postgresql_objs=postgresql.o +#if defined(HAVE_POSTGRESQL) && !defined(HAVE_SHLIB) +postgresql_objs=../modules/postgresql/postgresql.o #endif #ifdef HAVE_WIN32_PROCESSES diff -r 4575a219af58 -r 25e260cb7994 src/alloc.c --- a/src/alloc.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/alloc.c Tue Sep 10 15:27:39 2002 +0000 @@ -2785,6 +2785,17 @@ Dynarr_add (staticpro_nodump_names, varname); } +#ifdef HAVE_SHLIB +/* Stop treating the Lisp_Object at non-heap VARADDRESS as a root object + for garbage collection, but not for dumping. */ +void +unstaticpro_nodump_1 (Lisp_Object *varaddress, char *varname) +{ + Dynarr_delete_object (staticpros, varaddress); + Dynarr_delete_object (staticpro_names, varname); +} +#endif + #else /* not DEBUG_XEMACS */ Lisp_Object_ptr_dynarr *staticpros; @@ -2824,6 +2835,16 @@ Dynarr_add (staticpros_nodump, varaddress); } +#ifdef HAVE_SHLIB +/* Unmark the Lisp_Object at non-heap VARADDRESS as a root object for + garbage collection, but not for dumping. */ +void +unstaticpro_nodump (Lisp_Object *varaddress) +{ + Dynarr_delete_object (staticpros, varaddress); +} +#endif + #endif /* not DEBUG_XEMACS */ #ifdef ERROR_CHECK_GC diff -r 4575a219af58 -r 25e260cb7994 src/depend --- a/src/depend Mon Sep 09 21:53:43 2002 +0000 +++ b/src/depend Tue Sep 10 15:27:39 2002 +0000 @@ -8,16 +8,16 @@ LISP_H=lisp.h config.h general-slots.h lrecord.h symeval.h symsinit.h text.h $(LISP_UNION_H) #if defined(HAVE_MS_WINDOWS) console-msw.o: $(LISP_H) conslots.h console-impl.h console-msw-impl.h console-msw.h console.h events.h intl-auto-encap-win32.h opaque.h systime.h syswindows.h -device-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-stream.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h intl-auto-encap-win32.h objects-msw.h objects.h redisplay.h sysdep.h systime.h syswindows.h +device-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-stream.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h intl-auto-encap-win32.h objects-msw.h objects.h opaque.h redisplay.h sysdep.h systime.h syswindows.h dialog-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h frame-impl.h frame.h frameslots.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h sysfile.h syswindows.h dired-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console-msw.h console.h intl-auto-encap-win32.h ndir.h regex.h syntax.h sysdir.h sysfile.h sysfloat.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h -event-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h lstream.h menubar-msw.h menubar.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h window-impl.h window.h winslots.h -frame-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h +event-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h lstream.h menubar-msw.h menubar.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h syswindows.h window-impl.h window.h winslots.h +frame-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h glyphs-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h imgproc.h insdel.h intl-auto-encap-win32.h lstream.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h syswindows.h window-impl.h window.h winslots.h -gui-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h events.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h +gui-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h events.h frame-impl.h frame.h frameslots.h glyphs.h gui.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h menubar-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h events.h frame-impl.h frame.h frameslots.h gui.h intl-auto-encap-win32.h menubar-msw.h menubar.h opaque.h redisplay.h scrollbar.h systime.h syswindows.h window-impl.h window.h winslots.h objects-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device-impl.h device.h devslots.h elhash.h insdel.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h specifier.h syswindows.h -redisplay-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h debug.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gutter.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h syswindows.h window-impl.h window.h winslots.h +redisplay-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h debug.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gutter.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h syswindows.h window-impl.h window.h winslots.h scrollbar-msw.o: $(LISP_H) conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device.h elhash.h events.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h systime.h syswindows.h window-impl.h window.h winslots.h select-msw.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h file-coding.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h opaque.h redisplay.h select.h syswindows.h toolbar-msw.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h device.h elhash.h faces.h frame-impl.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h intl-auto-encap-win32.h redisplay.h scrollbar.h specifier.h syswindows.h toolbar.h window-impl.h window.h winslots.h @@ -25,9 +25,9 @@ #if defined(HAVE_X_WINDOWS) balloon-x.o: $(LISP_H) balloon_help.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h xintrinsic.h console-x.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h process.h redisplay.h xintrinsic.h -device-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h sysfile.h systime.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmu.h +device-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h objects-x.h objects.h offix-types.h offix.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysdll.h sysfile.h systime.h window-impl.h window.h winslots.h xgccache.h xintrinsic.h xintrinsicp.h xmu.h dialog-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-x-impl.h console-x.h console.h events.h frame-impl.h frame.h frameslots.h gui-x.h gui.h opaque.h redisplay.h scrollbar.h systime.h window.h xintrinsic.h -frame-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gutter.h objects-impl.h objects-x-impl.h objects-x.h objects.h offix-types.h offix.h redisplay.h scrollbar-x.h scrollbar.h specifier.h systime.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h +frame-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h EmacsFrame.h EmacsFrameP.h EmacsManager.h EmacsShell.h ExternalShell.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gutter.h objects-impl.h objects-x-impl.h objects-x.h objects.h offix-types.h offix.h opaque.h redisplay.h scrollbar-x.h scrollbar.h specifier.h systime.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h xmprimitivep.h xmu.h glyphs-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h imgproc.h insdel.h lstream.h objects-impl.h objects-x-impl.h objects-x.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysfile.h sysproc.h syssignal.h systime.h window-impl.h window.h winslots.h xintrinsic.h xmu.h gui-x.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame.h glyphs.h gui-x.h gui.h menubar.h opaque.h redisplay.h scrollbar.h specifier.h systime.h window-impl.h window.h winslots.h xintrinsic.h intl-x.o: $(LISP_H) console-x.h console.h xintrinsic.h @@ -40,28 +40,28 @@ #endif #if defined(HAVE_TTY) console-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h faces.h file-coding.h frame.h glyphs.h lstream.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systty.h window-impl.h window.h winslots.h -device-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h lstream.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h systty.h -event-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h events.h frame.h process.h redisplay.h sysproc.h syssignal.h systime.h systty.h syswait.h -frame-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h systime.h systty.h +device-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame.h lstream.h opaque.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h systty.h +event-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h events.h frame.h opaque.h process.h redisplay.h sysproc.h syssignal.h systime.h systty.h syswait.h +frame-tty.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h opaque.h redisplay.h systime.h systty.h objects-tty.o: $(LISP_H) charset.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h insdel.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h specifier.h systty.h -redisplay-tty.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h +redisplay-tty.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h faces.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h #endif #if defined(HAVE_GTK) console-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h process.h redisplay.h -device-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h -dialog-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h console-gtk.h console.h events.h frame.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h systime.h window.h -event-gtk.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h event-gtk.h events.h file-coding.h frame-impl.h frame.h frameslots.h gtk-xemacs.h lstream.h objects-gtk.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h sysproc.h syssignal.h systime.h systty.h window.h xintrinsic.h -frame-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h sysdll.h systime.h ui-gtk.h window-impl.h window.h winslots.h +device-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h +dialog-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h events.h frame.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h systime.h window.h +event-gtk.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-tty.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h event-gtk.h events.h file-coding.h frame-impl.h frame.h frameslots.h gtk-xemacs.h lstream.h objects-gtk.h objects.h offix-types.h offix.h opaque.h process.h redisplay.h scrollbar.h sysproc.h syssignal.h systime.h systty.h window.h xintrinsic.h +frame-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h dragdrop.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gtk-xemacs.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h sysdll.h systime.h ui-gtk.h window-impl.h window.h winslots.h gccache-gtk.o: $(LISP_H) gccache-gtk.h hash.h glyphs-gtk.o: $(LISP_H) bitmaps.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h gui.h imgproc.h insdel.h lstream.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdll.h sysfile.h ui-gtk.h window-impl.h window.h winslots.h gui-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h frame.h gui-gtk.h gui.h opaque.h redisplay.h -menubar-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device.h events.h frame-impl.h frame.h frameslots.h gui-gtk.h gui.h opaque.h redisplay.h scrollbar.h sysdll.h systime.h ui-gtk.h window.h +menubar-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h gui-gtk.h gui.h menubar.h opaque.h redisplay.h scrollbar.h sysdll.h systime.h ui-gtk.h window-impl.h window.h winslots.h objects-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h insdel.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h specifier.h redisplay-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h debug.h device-impl.h device.h devslots.h faces.h file-coding.h frame-impl.h frame.h frameslots.h gccache-gtk.h glyphs-gtk.h glyphs.h gutter.h mule-ccl.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h sysproc.h syssignal.h systime.h window-impl.h window.h winslots.h scrollbar-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h frame-impl.h frame.h frameslots.h glyphs-gtk.h glyphs.h gui-gtk.h redisplay.h scrollbar-gtk.h scrollbar.h specifier.h window-impl.h window.h winslots.h select-gtk.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame.h opaque.h redisplay.h select-common.h select.h systime.h toolbar-gtk.o: $(LISP_H) conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h frame.h redisplay.h toolbar-common.h -ui-gtk.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console-gtk.h console.h device.h elhash.h emacs-marshals.c emacs-widget-accessors.c event-gtk.h events.h faces.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui-gtk.h gui.h hash.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h sysdll.h systime.h ui-byhand.c ui-gtk.h window-impl.h window.h winslots.h +ui-gtk.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console-gtk.h console.h device.h elhash.h emacs-marshals.c emacs-widget-accessors.c event-gtk.h events.h faces.h glade.c glyphs-gtk.h glyphs.h gtk-glue.c gui-gtk.h gui.h hash.h objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdll.h systime.h ui-byhand.c ui-gtk.h window-impl.h window.h winslots.h #endif #if defined(HAVE_DATABASE) database.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h database.h sysfile.h @@ -72,7 +72,6 @@ mule-charset.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h elhash.h faces.h lstream.h mule-ccl.h objects.h mule-coding.o: $(LISP_H) charset.h file-coding.h mule-ccl.h mule-wnnfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h redisplay.h scrollbar.h sysdep.h window.h -mule.o: $(LISP_H) regex.h #endif #if defined(EXTERNAL_WIDGET) ExternalClient-Xlib.o: extw-Xlib.h @@ -86,24 +85,24 @@ EmacsShell-sub.o: EmacsShell.h EmacsShellP.h config.h xintrinsic.h xintrinsicp.h EmacsShell.o: EmacsShell.h ExternalShell.h config.h xintrinsicp.h abbrev.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h insdel.h redisplay.h scrollbar.h syntax.h window.h -alloc.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h frame-impl.h frame.h frameslots.h glyphs.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h +alloc.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h systime.h window-impl.h window.h winslots.h alloca.o: $(LISP_H) balloon_help.o: balloon_help.h config.h xintrinsic.h blocktype.o: $(LISP_H) blocktype.h buffer.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h select.h specifier.h syntax.h sysdir.h sysfile.h syswindows.h window.h bytecode.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h opaque.h redisplay.h scrollbar.h syntax.h window.h -callint.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h events.h insdel.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h +callint.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h events.h insdel.h opaque.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h casefiddle.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h syntax.h casetab.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h opaque.h chartab.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h syntax.h cm.o: $(LISP_H) conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h frame.h lstream.h redisplay.h systty.h -cmdloop.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-msw.h console.h device.h events.h frame.h intl-auto-encap-win32.h redisplay.h scrollbar.h systime.h syswindows.h window.h +cmdloop.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-msw.h console.h device.h events.h frame.h intl-auto-encap-win32.h opaque.h redisplay.h scrollbar.h systime.h syswindows.h window.h cmds.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h extents.h insdel.h syntax.h -console-stream.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h sysdep.h sysfile.h systime.h systty.h window.h -console.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h sysdep.h systime.h systty.h window.h +console-stream.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h opaque.h redisplay.h scrollbar.h sysdep.h sysfile.h systime.h systty.h window.h +console.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h opaque.h redisplay.h scrollbar.h sysdep.h systime.h systty.h window.h data.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h sysfloat.h syssignal.h debug.o: $(LISP_H) bytecode.h debug.h -device.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h keymap.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h toolbar.h window.h +device.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console-msw-impl.h console-msw.h console-tty-impl.h console-tty.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h elhash.h events.h faces.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h keymap.h objects.h opaque.h redisplay.h scrollbar.h specifier.h sysdep.h syssignal.h systime.h systty.h syswindows.h toolbar.h window.h xintrinsic.h dgif_lib.o: $(LISP_H) gifrlib.h sysfile.h dialog.o: $(LISP_H) conslots.h console-impl.h console.h frame-impl.h frame.h frameslots.h redisplay.h dired.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h elhash.h intl-auto-encap-win32.h ndir.h opaque.h regex.h syntax.h sysdep.h sysdir.h sysfile.h syspwd.h systime.h syswindows.h @@ -113,8 +112,7 @@ dumper.o: $(LISP_H) console-stream.h console.h dumper.h elhash.h file-coding.h intl-auto-encap-win32.h specifier.h sysfile.h syswindows.h dynarr.o: $(LISP_H) ecrt0.o: config.h -editfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h events.h frame.h insdel.h line-number.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h window.h -eldap.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h eldap.h opaque.h sysdep.h +editfns.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h console.h device.h events.h frame.h insdel.h line-number.h ndir.h opaque.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h window.h elhash.o: $(LISP_H) bytecode.h elhash.h opaque.h emacs-marshals.o: hash.h emacs-widget-accessors.o: @@ -122,20 +120,20 @@ emodules.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h emodules.h file-coding.h frame.h insdel.h lstream.h redisplay.h scrollbar.h sysdep.h sysdll.h window.h esd.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h eval.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device.h frame.h lstream.h opaque.h redisplay.h scrollbar.h window.h -event-Xt.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h Emacs.ad.h EmacsFrame.h blocktype.h charset.h conslots.h console-impl.h console-tty.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-x.h objects.h offix-types.h offix.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h -event-stream.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h gui.h insdel.h keymap.h lstream.h macros.h menubar.h process.h redisplay.h scrollbar.h sysdep.h sysfile.h syssignal.h systime.h window-impl.h window.h winslots.h -event-unixoid.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device.h events.h lstream.h process.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h -events.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device.h events.h extents.h frame-impl.h frame.h frameslots.h glyphs.h keymap.h lstream.h redisplay.h scrollbar.h specifier.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h +event-Xt.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h Emacs.ad.h EmacsFrame.h blocktype.h charset.h conslots.h console-impl.h console-tty.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dragdrop.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h lstream.h objects-x.h objects.h offix-types.h offix.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysproc.h syssignal.h systime.h systty.h window-impl.h window.h winslots.h xintrinsic.h xintrinsicp.h +event-stream.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h events.h file-coding.h frame-impl.h frame.h frameslots.h gui.h insdel.h keymap.h lstream.h macros.h menubar.h opaque.h process.h redisplay.h scrollbar.h sysdep.h sysfile.h syssignal.h systime.h window-impl.h window.h winslots.h +event-unixoid.o: $(LISP_H) conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device.h events.h lstream.h opaque.h process.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h +events.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-tty-impl.h console-tty.h console-x.h console.h device.h events.h extents.h frame-impl.h frame.h frameslots.h glyphs.h keymap.h lstream.h opaque.h redisplay.h scrollbar.h specifier.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h xintrinsic.h extents.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h debug.h device.h elhash.h extents-impl.h extents.h faces.h frame.h glyphs.h gutter.h insdel.h keymap.h opaque.h process.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h faces.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h extents-impl.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h file-coding.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h elhash.h file-coding.h insdel.h lstream.h opaque.h -fileio.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h events.h file-coding.h frame.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h window-impl.h window.h winslots.h +fileio.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h events.h file-coding.h frame.h insdel.h intl-auto-encap-win32.h lstream.h ndir.h opaque.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h window-impl.h window.h winslots.h filelock.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h ndir.h paths.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h filemode.o: $(LISP_H) sysfile.h floatfns.o: $(LISP_H) sysfloat.h syssignal.h fns.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console.h device.h events.h extents.h frame.h insdel.h lstream.h opaque.h process.h redisplay.h sysfile.h sysproc.h syssignal.h systime.h font-lock.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h syntax.h -frame.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h menubar.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window-impl.h window.h winslots.h +frame.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h menubar.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window-impl.h window.h winslots.h free-hook.o: $(LISP_H) hash.h general.o: $(LISP_H) getloadavg.o: $(LISP_H) sysfile.h @@ -146,9 +144,9 @@ glyphs-widget.o: $(LISP_H) bytecode.h charset.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame.h glyphs.h gui.h insdel.h lstream.h objects.h opaque.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h glyphs.o: $(LISP_H) blocktype.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gui.h insdel.h objects-impl.h objects.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h sysfile.h window-impl.h window.h winslots.h gmalloc.o: $(LISP_H) getpagesize.h sysdep.h -gpmevent.o: $(LISP_H) commands.h console-tty.h console.h device.h events.h gpmevent.h lstream.h process.h sysdep.h sysproc.h syssignal.h systime.h systty.h -gtk-glue.o: -gtk-xemacs.o: $(LISP_H) charset.h console-gtk.h console.h device.h event-gtk.h faces.h frame.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +gpmevent.o: $(LISP_H) commands.h conslots.h console-impl.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame.h gpmevent.h lstream.h opaque.h process.h redisplay.h sysdep.h sysproc.h syssignal.h systime.h systty.h +gtk-glue.o: objects-gtk-impl.h objects-gtk.h objects-impl.h objects.h specifier.h +gtk-xemacs.o: $(LISP_H) charset.h conslots.h console-gtk-impl.h console-gtk.h console-impl.h console.h device-impl.h device.h devslots.h event-gtk.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gtk-xemacs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h gui.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h elhash.h gui.h menubar.h gutter.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h hash.o: $(LISP_H) hash.h @@ -156,15 +154,15 @@ hpplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h sound.h imgproc.o: $(LISP_H) imgproc.h indent.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h extents.h faces.h frame.h glyphs.h insdel.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h -inline.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h console-gtk.h console-msw.h console.h database.h device.h eldap.h elhash.h events.h extents.h faces.h file-coding.h frame.h glyphs-x.h glyphs.h gui-x.h gui.h intl-auto-encap-win32.h keymap.h lstream.h objects.h opaque.h postgresql.h process.h rangetab.h redisplay.h scrollbar.h specifier.h syntax.h sysdll.h sysfile.h systime.h syswindows.h toolbar.h tooltalk.h ui-gtk.h window-impl.h window.h winslots.h xintrinsic.h -input-method-motif.o: $(LISP_H) EmacsFrame.h console-x.h console.h device.h frame.h redisplay.h xintrinsic.h -input-method-xlib.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h xintrinsic.h +inline.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-gtk.h console-impl.h console-msw.h console.h database.h device-impl.h device.h devslots.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h intl-auto-encap-win32.h keymap.h lstream.h objects-impl.h objects.h opaque.h process.h rangetab.h redisplay.h scrollbar.h specifier.h syntax.h sysdll.h sysfile.h systime.h syswindows.h toolbar.h tooltalk.h ui-gtk.h window-impl.h window.h winslots.h xintrinsic.h +input-method-motif.o: $(LISP_H) EmacsFrame.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device.h frame-impl.h frame.h frameslots.h redisplay.h xintrinsic.h +input-method-xlib.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h opaque.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h xintrinsic.h insdel.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h device.h extents.h frame.h insdel.h line-number.h lstream.h redisplay.h intl-auto-encap-win32.o: $(LISP_H) intl-auto-encap-win32.h syswindows.h intl-encap-win32.o: $(LISP_H) console-msw.h console.h intl-auto-encap-win32.h syswindows.h intl-win32.o: $(LISP_H) charset.h conslots.h console-impl.h console-msw-impl.h console-msw.h console.h elhash.h faces.h file-coding.h frame-impl.h frame.h frameslots.h intl-auto-encap-win32.h objects-impl.h objects-msw-impl.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h syswindows.h window-impl.h window.h winslots.h intl.o: $(LISP_H) -keymap.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h elhash.h events.h extents.h frame.h insdel.h keymap.h redisplay.h scrollbar.h systime.h window.h +keymap.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h elhash.h events.h extents.h frame.h insdel.h keymap.h opaque.h redisplay.h scrollbar.h systime.h window.h lastfile.o: config.h libinterface.o: $(LISP_H) gifrlib.h libinterface.h libsst.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h libsst.h sound.h sysfile.h @@ -172,22 +170,21 @@ linuxplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h syssignal.h systty.h lread.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h elhash.h file-coding.h intl-auto-encap-win32.h lstream.h opaque.h sysfile.h sysfloat.h syswindows.h lstream.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h lstream.h sysfile.h -macros.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device.h events.h frame.h keymap.h macros.h redisplay.h scrollbar.h systime.h window.h +macros.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device.h events.h frame.h keymap.h macros.h opaque.h redisplay.h scrollbar.h systime.h window.h malloc.o: config.h getpagesize.h marker.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h md5.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h file-coding.h lstream.h menubar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h gui.h keymap.h menubar.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h -minibuf.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-stream.h console.h events.h frame-impl.h frame.h frameslots.h insdel.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h +minibuf.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-stream.h console.h events.h frame-impl.h frame.h frameslots.h insdel.h opaque.h redisplay.h scrollbar.h systime.h window-impl.h window.h winslots.h miscplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h miscplay.h sound.h sysfile.h syssignal.h nas.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h sound.h sysdep.h syssignal.h native-gtk-toolbar.o: $(LISP_H) charset.h console-gtk.h console.h faces.h frame.h glyphs-gtk.h glyphs.h objects-gtk.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window-impl.h window.h winslots.h nt.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h ndir.h process.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h syswindows.h ntheap.o: $(LISP_H) intl-auto-encap-win32.h sysdep.h syswindows.h ntplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h intl-auto-encap-win32.h sound.h sysfile.h syswindows.h -objects.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame.h glyphs.h objects-impl.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h +objects.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h elhash.h faces.h frame.h glyphs.h objects-impl.h objects-tty-impl.h objects-tty.h objects.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h offix.o: offix-cursors.h offix-types.h offix.h xintrinsic.h opaque.o: $(LISP_H) opaque.h -postgresql.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h postgresql.h process.h sysdep.h print.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h conslots.h console-impl.h console-msw.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h extents.h frame.h insdel.h intl-auto-encap-win32.h lstream.h opaque.h redisplay.h sysfile.h systty.h syswindows.h process-nt.o: $(LISP_H) console-msw.h console.h hash.h intl-auto-encap-win32.h lstream.h process.h procimpl.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h process-unix.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h console.h events.h file-coding.h frame.h hash.h lstream.h ndir.h opaque.h process.h procimpl.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h window.h @@ -197,14 +194,14 @@ rangetab.o: $(LISP_H) rangetab.h realpath.o: $(LISP_H) intl-auto-encap-win32.h sysfile.h syswindows.h redisplay-output.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h faces.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h -redisplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-tty.h console.h debug.h device-impl.h device.h devslots.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h insdel.h line-number.h menubar.h objects-impl.h objects.h process.h redisplay.h scrollbar.h specifier.h sysfile.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h +redisplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console-tty.h console.h debug.h device-impl.h device.h devslots.h elhash.h events.h extents-impl.h extents.h faces.h file-coding.h frame-impl.h frame.h frameslots.h glyphs.h gui.h gutter.h insdel.h line-number.h menubar.h objects-impl.h objects.h opaque.h process.h redisplay.h scrollbar.h specifier.h sysfile.h systime.h systty.h toolbar.h window-impl.h window.h winslots.h regex.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h regex.h syntax.h scrollbar.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h commands.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame-impl.h frame.h frameslots.h glyphs.h gutter.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h search.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h insdel.h opaque.h regex.h syntax.h select.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h extents.h frame.h objects.h opaque.h redisplay.h select.h sgiplay.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h libst.h sound.h sysfile.h sysproc.h syssignal.h systime.h sheap.o: $(LISP_H) sheap-adjust.h sysfile.h -signal.o: $(LISP_H) conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h process.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h +signal.o: $(LISP_H) conslots.h console-impl.h console.h device-impl.h device.h devslots.h events.h frame-impl.h frame.h frameslots.h opaque.h process.h redisplay.h sysdep.h sysfile.h syssignal.h systime.h sound.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h intl-auto-encap-win32.h redisplay.h sound.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h xintrinsic.h specifier.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h frame.h glyphs.h opaque.h rangetab.h redisplay.h scrollbar.h specifier.h window-impl.h window.h winslots.h strcat.o: config.h @@ -215,7 +212,7 @@ sunpro.o: $(LISP_H) symbols.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console.h elhash.h syntax.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h extents.h syntax.h -sysdep.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame.h intl-auto-encap-win32.h ndir.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h window.h +sysdep.o: $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h conslots.h console-impl.h console-stream-impl.h console-stream.h console-tty-impl.h console-tty.h console.h device-impl.h device.h devslots.h events.h frame.h intl-auto-encap-win32.h ndir.h opaque.h process.h redisplay.h scrollbar.h sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h syssignal.h systime.h systty.h syswait.h syswindows.h window.h sysdll.o: config.h sysdll.h termcap.o: $(LISP_H) console.h device.h terminfo.o: config.h diff -r 4575a219af58 -r 25e260cb7994 src/eldap.c --- a/src/eldap.c Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,858 +0,0 @@ -/* LDAP client interface for XEmacs. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of XEmacs. - -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Synched up with: Not in FSF. */ - -/* Author: Oscar Figueiredo with lots of support from Hrvoje Niksic */ - -/* This file provides lisp primitives for access to an LDAP library - conforming to the API defined in RFC 1823. - It has been tested with: - - UMich LDAP 3.3 (http://www.umich.edu/~dirsvcs/ldap/) - - OpenLDAP 1.2 (http://www.openldap.org/) - - Netscape's LDAP SDK (http://developer.netscape.com/) */ - - -#include -#include "lisp.h" -#include "opaque.h" -#include "sysdep.h" -#include "buffer.h" -#include "process.h" /* for report_process_error */ - -#include - -#include "eldap.h" - -static Fixnum ldap_default_port; -static Lisp_Object Vldap_default_base; - -/* Needed by the lrecord definition */ -Lisp_Object Qldapp; - -/* ldap-open plist keywords */ -static Lisp_Object Qport, Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit, Qsizelimit; -/* Search scope limits */ -static Lisp_Object Qbase, Qonelevel, Qsubtree; -/* Authentication methods */ -static Lisp_Object Qkrbv41, Qkrbv42; -/* Deref policy */ -static Lisp_Object Qnever, Qalways, Qfind; -/* Modification types (Qdelete is defined in general.c) */ -static Lisp_Object Qadd, Qreplace; - - -/************************************************************************/ -/* Utility Functions */ -/************************************************************************/ - -static void -signal_ldap_error (LDAP *ld, LDAPMessage *res, int ldap_err) -{ - if (ldap_err <= 0) - { -#if defined HAVE_LDAP_PARSE_RESULT - int err; - ldap_err = ldap_parse_result (ld, res, - &err, - NULL, NULL, NULL, NULL, 0); - if (ldap_err == LDAP_SUCCESS) - ldap_err = err; -#elif defined HAVE_LDAP_GET_LDERRNO - ldap_err = ldap_get_lderrno (ld, NULL, NULL); -#elif defined HAVE_LDAP_RESULT2ERROR - ldap_err = ldap_result2error (ld, res, 0); -#else - ldap_err = ld->ld_errno; -#endif - } - invalid_operation ("LDAP error", - build_string (ldap_err2string (ldap_err))); -} - - -/************************************************************************/ -/* ldap lrecord basic functions */ -/************************************************************************/ - -static Lisp_Object -make_ldap (Lisp_LDAP *ldap) -{ - return wrap_ldap (ldap); -} - -#ifdef USE_KKCC -static const struct lrecord_description ldap_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_LDAP, host) }, - { XD_END } -}; -#endif /* USE_KKCC */ - -static Lisp_Object -mark_ldap (Lisp_Object obj) -{ - return XLDAP (obj)->host; -} - -static void -print_ldap (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - Lisp_LDAP *ldap = XLDAP (obj); - - if (print_readably) - printing_unreadable_object ("#", XSTRING_DATA (ldap->host)); - - write_fmt_string_lisp (printcharfun, "#host); - if (!ldap->ld) - write_c_string (printcharfun,"(dead) "); - write_fmt_string (printcharfun, " 0x%lx>", (long)ldap); -} - -static Lisp_LDAP * -allocate_ldap (void) -{ - Lisp_LDAP *ldap = alloc_lcrecord_type (Lisp_LDAP, &lrecord_ldap); - - ldap->ld = NULL; - ldap->host = Qnil; - return ldap; -} - -static void -finalize_ldap (void *header, int for_disksave) -{ - Lisp_LDAP *ldap = (Lisp_LDAP *) header; - - if (for_disksave) - invalid_operation ("Can't dump an emacs containing LDAP objects", - make_ldap (ldap)); - - if (ldap->ld) - ldap_unbind (ldap->ld); - ldap->ld = NULL; -} - -#ifdef USE_KKCC -DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap, - 0, /*dumpable-flag*/ - mark_ldap, print_ldap, finalize_ldap, - NULL, NULL, ldap_description, Lisp_LDAP); -#else /* not USE_KKCC */ -DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap, - mark_ldap, print_ldap, finalize_ldap, - NULL, NULL, 0, Lisp_LDAP); -#endif /* not USE_KKCC */ - - - -/************************************************************************/ -/* Basic ldap accessors */ -/************************************************************************/ - -DEFUN ("ldapp", Fldapp, 1, 1, 0, /* -Return t if OBJECT is a LDAP connection. -*/ - (object)) -{ - return LDAPP (object) ? Qt : Qnil; -} - -DEFUN ("ldap-host", Fldap_host, 1, 1, 0, /* -Return the server host of the connection LDAP, as a string. -*/ - (ldap)) -{ - CHECK_LDAP (ldap); - return (XLDAP (ldap))->host; -} - -DEFUN ("ldap-live-p", Fldap_live_p, 1, 1, 0, /* -Return t if LDAP is an active LDAP connection. -*/ - (ldap)) -{ - CHECK_LDAP (ldap); - return (XLDAP (ldap))->ld ? Qt : Qnil; -} - -/************************************************************************/ -/* Opening/Closing a LDAP connection */ -/************************************************************************/ - - -DEFUN ("ldap-open", Fldap_open, 1, 2, 0, /* -Open a LDAP connection to HOST. -PLIST is a plist containing additional parameters for the connection. -Valid keys in that list are: - `port' the TCP port to use for the connection if different from -`ldap-default-port'. - `auth' is the authentication method to use, possible values depend on -the LDAP library XEmacs was compiled with: `simple', `krbv41' and `krbv42'. - `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax). - `passwd' is the password to use for simple authentication. - `deref' is one of the symbols `never', `always', `search' or `find'. - `timelimit' is the timeout limit for the connection in seconds. - `sizelimit' is the maximum number of matches to return. -*/ - (host, plist)) -{ - /* This function can GC */ - Lisp_LDAP *ldap; - LDAP *ld; - int ldap_port = 0; - int ldap_auth = LDAP_AUTH_SIMPLE; - char *ldap_binddn = NULL; - char *ldap_passwd = NULL; - int ldap_deref = LDAP_DEREF_NEVER; - int ldap_timelimit = 0; - int ldap_sizelimit = 0; - int err; - - CHECK_STRING (host); - - { - EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) - { - /* TCP Port */ - if (EQ (keyword, Qport)) - { - CHECK_INT (value); - ldap_port = XINT (value); - } - /* Authentication method */ - if (EQ (keyword, Qauth)) - { - if (EQ (value, Qsimple)) - ldap_auth = LDAP_AUTH_SIMPLE; -#ifdef LDAP_AUTH_KRBV41 - else if (EQ (value, Qkrbv41)) - ldap_auth = LDAP_AUTH_KRBV41; -#endif -#ifdef LDAP_AUTH_KRBV42 - else if (EQ (value, Qkrbv42)) - ldap_auth = LDAP_AUTH_KRBV42; -#endif - else - invalid_constant ("Invalid authentication method", value); - } - /* Bind DN */ - else if (EQ (keyword, Qbinddn)) - { - CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_binddn, Qnative); - } - /* Password */ - else if (EQ (keyword, Qpasswd)) - { - CHECK_STRING (value); - LISP_STRING_TO_EXTERNAL (value, ldap_passwd, Qnative); - } - /* Deref */ - else if (EQ (keyword, Qderef)) - { - if (EQ (value, Qnever)) - ldap_deref = LDAP_DEREF_NEVER; - else if (EQ (value, Qsearch)) - ldap_deref = LDAP_DEREF_SEARCHING; - else if (EQ (value, Qfind)) - ldap_deref = LDAP_DEREF_FINDING; - else if (EQ (value, Qalways)) - ldap_deref = LDAP_DEREF_ALWAYS; - else - invalid_constant ("Invalid deref value", value); - } - /* Timelimit */ - else if (EQ (keyword, Qtimelimit)) - { - CHECK_INT (value); - ldap_timelimit = XINT (value); - } - /* Sizelimit */ - else if (EQ (keyword, Qsizelimit)) - { - CHECK_INT (value); - ldap_sizelimit = XINT (value); - } - } - } - - if (ldap_port == 0) - { - ldap_port = ldap_default_port; - } - - /* Connect to the server and bind */ - slow_down_interrupts (); - ld = ldap_open ((char *) XSTRING_DATA (host), ldap_port); - speed_up_interrupts (); - - if (ld == NULL ) - report_process_error ("Failed connecting to host", host); - -#ifdef HAVE_LDAP_SET_OPTION - if ((err = ldap_set_option (ld, LDAP_OPT_DEREF, - (void *)&ldap_deref)) != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, err); - if ((err = ldap_set_option (ld, LDAP_OPT_TIMELIMIT, - (void *)&ldap_timelimit)) != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, err); - if ((err = ldap_set_option (ld, LDAP_OPT_SIZELIMIT, - (void *)&ldap_sizelimit)) != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, err); - if ((err = ldap_set_option (ld, LDAP_OPT_REFERRALS, - LDAP_OPT_ON)) != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, err); - if ((err = ldap_set_option (ld, LDAP_OPT_RESTART, - LDAP_OPT_ON)) != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, err); -#else /* not HAVE_LDAP_SET_OPTION */ - ld->ld_deref = ldap_deref; - ld->ld_timelimit = ldap_timelimit; - ld->ld_sizelimit = ldap_sizelimit; -#ifdef LDAP_REFERRALS - ld->ld_options = LDAP_OPT_REFERRALS; -#else /* not LDAP_REFERRALS */ - ld->ld_options = 0; -#endif /* not LDAP_REFERRALS */ - /* XEmacs uses interrupts (SIGIO,SIGALRM), LDAP calls need to ignore them */ - ld->ld_options |= LDAP_OPT_RESTART; -#endif /* not HAVE_LDAP_SET_OPTION */ - - err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth); - if (err != LDAP_SUCCESS) - { - Ibyte *interrmess; - EXTERNAL_TO_C_STRING (ldap_err2string (err), interrmess, Qnative); - signal_error (Qprocess_error, "Failed binding to the server", - build_intstring (interrmess)); - } - - ldap = allocate_ldap (); - ldap->ld = ld; - ldap->host = host; - - return make_ldap (ldap); -} - - - -DEFUN ("ldap-close", Fldap_close, 1, 1, 0, /* -Close an LDAP connection. -*/ - (ldap)) -{ - Lisp_LDAP *lldap; - CHECK_LIVE_LDAP (ldap); - lldap = XLDAP (ldap); - ldap_unbind (lldap->ld); - lldap->ld = NULL; - return Qnil; -} - - - -/************************************************************************/ -/* Working on a LDAP connection */ -/************************************************************************/ -struct ldap_unwind_struct -{ - LDAPMessage *res; - struct berval **vals; -}; - -static Lisp_Object -ldap_search_unwind (Lisp_Object unwind_obj) -{ - struct ldap_unwind_struct *unwind = - (struct ldap_unwind_struct *) get_opaque_ptr (unwind_obj); - if (unwind->res) - ldap_msgfree (unwind->res); - if (unwind->vals) - ldap_value_free_len (unwind->vals); - return Qnil; -} - -/* The following function is called `ldap-search-basic' instead of */ -/* plain `ldap-search' to maintain compatibility with the XEmacs 21.1 */ -/* API where `ldap-search' was the name of the high-level search */ -/* function */ - -DEFUN ("ldap-search-basic", Fldap_search_basic, 2, 8, 0, /* -Perform a search on an open LDAP connection. -LDAP is an LDAP connection object created with `ldap-open'. -FILTER is a filter string for the search as described in RFC 1558. -BASE is the distinguished name at which to start the search. -SCOPE is one of the symbols `base', `onelevel' or `subtree' indicating -the scope of the search. -ATTRS is a list of strings indicating which attributes to retrieve - for each matching entry. If nil return all available attributes. -If ATTRSONLY is non-nil then only the attributes are retrieved, not -the associated values. -If WITHDN is non-nil each entry in the result will be prepended with -its distinguished name DN. -If VERBOSE is non-nil progress messages will be echoed. -The function returns a list of matching entries. Each entry is itself -an alist of attribute/value pairs optionally preceded by the DN of the -entry according to the value of WITHDN. -*/ - (ldap, filter, base, scope, attrs, attrsonly, withdn, verbose)) -{ - /* This function can GC */ - - /* Vars for query */ - LDAP *ld; - LDAPMessage *e; - BerElement *ptr; - char *a, *dn; - int i, rc; - int matches; - struct ldap_unwind_struct unwind; - - int ldap_scope = LDAP_SCOPE_SUBTREE; - char **ldap_attributes = NULL; - - int speccount = specpdl_depth (); - - Lisp_Object list = Qnil; - Lisp_Object entry = Qnil; - Lisp_Object result = Qnil; - struct gcpro gcpro1, gcpro2, gcpro3; - - GCPRO3 (list, entry, result); - - unwind.res = NULL; - unwind.vals = NULL; - - /* Do all the parameter checking */ - CHECK_LIVE_LDAP (ldap); - ld = XLDAP (ldap)->ld; - - /* Filter */ - CHECK_STRING (filter); - - /* Search base */ - if (NILP (base)) - { - base = Vldap_default_base; - } - if (!NILP (base)) - { - CHECK_STRING (base); - } - - /* Search scope */ - if (!NILP (scope)) - { - if (EQ (scope, Qbase)) - ldap_scope = LDAP_SCOPE_BASE; - else if (EQ (scope, Qonelevel)) - ldap_scope = LDAP_SCOPE_ONELEVEL; - else if (EQ (scope, Qsubtree)) - ldap_scope = LDAP_SCOPE_SUBTREE; - else - invalid_constant ("Invalid scope", scope); - } - - /* Attributes to search */ - if (!NILP (attrs)) - { - CHECK_CONS (attrs); - ldap_attributes = alloca_array (char *, 1 + XINT (Flength (attrs))); - - i = 0; - EXTERNAL_LIST_LOOP (attrs, attrs) - { - Lisp_Object current = XCAR (attrs); - CHECK_STRING (current); - LISP_STRING_TO_EXTERNAL (current, ldap_attributes[i], Qnative); - ++i; - } - ldap_attributes[i] = NULL; - } - - /* Attributes only ? */ - CHECK_SYMBOL (attrsonly); - - /* Perform the search */ - if (ldap_search (ld, - NILP (base) ? (char *) "" : (char *) XSTRING_DATA (base), - ldap_scope, - NILP (filter) ? (char *) "" : (char *) XSTRING_DATA (filter), - ldap_attributes, - NILP (attrsonly) ? 0 : 1) - == -1) - { - signal_ldap_error (ld, NULL, 0); - } - - /* Ensure we don't exit without cleaning up */ - record_unwind_protect (ldap_search_unwind, - make_opaque_ptr (&unwind)); - - /* Build the results list */ - matches = 0; - - rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &unwind.res); - - while (rc == LDAP_RES_SEARCH_ENTRY) - { - QUIT; - matches ++; - e = ldap_first_entry (ld, unwind.res); - /* #### This call to message() is pretty fascist, because it - destroys the current echo area contents, even when invoked - from Lisp. It should use echo_area_message() instead, and - restore the old echo area contents later. */ - if (! NILP (verbose)) - message ("Parsing ldap results... %d", matches); - entry = Qnil; - /* Get the DN if required */ - if (! NILP (withdn)) - { - dn = ldap_get_dn (ld, e); - if (dn == NULL) - signal_ldap_error (ld, e, 0); - entry = Fcons (build_ext_string (dn, Qnative), Qnil); - } - for (a= ldap_first_attribute (ld, e, &ptr); - a != NULL; - a = ldap_next_attribute (ld, e, ptr) ) - { - list = Fcons (build_ext_string (a, Qnative), Qnil); - unwind.vals = ldap_get_values_len (ld, e, a); - if (unwind.vals != NULL) - { - for (i = 0; unwind.vals[i] != NULL; i++) - { - list = Fcons (make_ext_string ((Extbyte *) unwind.vals[i]->bv_val, - unwind.vals[i]->bv_len, - Qnative), - list); - } - } - entry = Fcons (Fnreverse (list), - entry); - ldap_value_free_len (unwind.vals); - unwind.vals = NULL; - } - result = Fcons (Fnreverse (entry), - result); - ldap_msgfree (unwind.res); - unwind.res = NULL; - - rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &(unwind.res)); - } - -#if defined HAVE_LDAP_PARSE_RESULT - { - int rc2 = ldap_parse_result (ld, unwind.res, - &rc, - NULL, NULL, NULL, NULL, 0); - if (rc2 != LDAP_SUCCESS) - rc = rc2; - } -#else - if (rc == 0) - signal_ldap_error (ld, NULL, LDAP_TIMELIMIT_EXCEEDED); - - if (rc == -1) - signal_ldap_error (ld, unwind.res, (unwind.res==NULL) ? ld->ld_errno : 0); - -#if defined HAVE_LDAP_RESULT2ERROR - rc = ldap_result2error (ld, unwind.res, 0); -#endif -#endif - - if (rc != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, rc); - - ldap_msgfree (unwind.res); - unwind.res = (LDAPMessage *)NULL; - - /* #### See above for calling message(). */ - if (! NILP (verbose)) - message ("Parsing ldap results... done"); - - unbind_to (speccount); - UNGCPRO; - return Fnreverse (result); -} - -DEFUN ("ldap-add", Fldap_add, 3, 3, 0, /* -Add an entry to an LDAP directory. -LDAP is an LDAP connection object created with `ldap-open'. -DN is the distinguished name of the entry to add. -ENTRY is an entry specification, i.e., a list of cons cells -containing attribute/value string pairs. -*/ - (ldap, dn, entry)) -{ - LDAP *ld; - LDAPMod *ldap_mods, **ldap_mods_ptrs; - struct berval *bervals; - int rc; - int i, j; - Elemcount len; - - Lisp_Object current = Qnil; - Lisp_Object values = Qnil; - struct gcpro gcpro1, gcpro2; - - GCPRO2 (current, values); - - /* Do all the parameter checking */ - CHECK_LIVE_LDAP (ldap); - ld = XLDAP (ldap)->ld; - - /* Check the DN */ - CHECK_STRING (dn); - - /* Check the entry */ - CHECK_CONS (entry); - if (NILP (entry)) - invalid_operation ("Cannot add void entry", entry); - - /* Build the ldap_mods array */ - len = (Elemcount) XINT (Flength (entry)); - ldap_mods = alloca_array (LDAPMod, len); - ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); - i = 0; - EXTERNAL_LIST_LOOP (entry, entry) - { - current = XCAR (entry); - CHECK_CONS (current); - CHECK_STRING (XCAR (current)); - ldap_mods_ptrs[i] = &(ldap_mods[i]); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); - ldap_mods[i].mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; - values = XCDR (current); - if (CONSP (values)) - { - len = (Elemcount) XINT (Flength (values)); - bervals = alloca_array (struct berval, len); - ldap_mods[i].mod_vals.modv_bvals = - alloca_array (struct berval *, 1 + len); - j = 0; - EXTERNAL_LIST_LOOP (values, values) - { - current = XCAR (values); - CHECK_STRING (current); - ldap_mods[i].mod_vals.modv_bvals[j] = &(bervals[j]); - TO_EXTERNAL_FORMAT (LISP_STRING, current, - ALLOCA, (bervals[j].bv_val, - bervals[j].bv_len), - Qnative); - j++; - } - ldap_mods[i].mod_vals.modv_bvals[j] = NULL; - } - else - { - CHECK_STRING (values); - bervals = alloca_array (struct berval, 1); - ldap_mods[i].mod_vals.modv_bvals = alloca_array (struct berval *, 2); - ldap_mods[i].mod_vals.modv_bvals[0] = &(bervals[0]); - TO_EXTERNAL_FORMAT (LISP_STRING, values, - ALLOCA, (bervals[0].bv_val, - bervals[0].bv_len), - Qnative); - ldap_mods[i].mod_vals.modv_bvals[1] = NULL; - } - i++; - } - ldap_mods_ptrs[i] = NULL; - rc = ldap_add_s (ld, (char *) XSTRING_DATA (dn), ldap_mods_ptrs); - if (rc != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, rc); - - UNGCPRO; - return Qnil; -} - -DEFUN ("ldap-modify", Fldap_modify, 3, 3, 0, /* -Add an entry to an LDAP directory. -LDAP is an LDAP connection object created with `ldap-open'. -DN is the distinguished name of the entry to modify. -MODS is a list of modifications to apply. -A modification is a list of the form (MOD-OP ATTR VALUE1 VALUE2 ...) -MOD-OP and ATTR are mandatory, VALUEs are optional depending on MOD-OP. -MOD-OP is the type of modification, one of the symbols `add', `delete' -or `replace'. ATTR is the LDAP attribute type to modify. -*/ - (ldap, dn, mods)) -{ - LDAP *ld; - LDAPMod *ldap_mods, **ldap_mods_ptrs; - struct berval *bervals; - int i, j, rc; - Lisp_Object mod_op; - Elemcount len; - - Lisp_Object current = Qnil; - Lisp_Object values = Qnil; - struct gcpro gcpro1, gcpro2; - - /* Do all the parameter checking */ - CHECK_LIVE_LDAP (ldap); - ld = XLDAP (ldap)->ld; - - /* Check the DN */ - CHECK_STRING (dn); - - /* Check the entry */ - CHECK_CONS (mods); - if (NILP (mods)) - return Qnil; - - /* Build the ldap_mods array */ - len = (Elemcount) XINT (Flength (mods)); - ldap_mods = alloca_array (LDAPMod, len); - ldap_mods_ptrs = alloca_array (LDAPMod *, 1 + len); - i = 0; - - GCPRO2 (current, values); - EXTERNAL_LIST_LOOP (mods, mods) - { - current = XCAR (mods); - CHECK_CONS (current); - CHECK_SYMBOL (XCAR (current)); - mod_op = XCAR (current); - ldap_mods_ptrs[i] = &(ldap_mods[i]); - ldap_mods[i].mod_op = LDAP_MOD_BVALUES; - if (EQ (mod_op, Qadd)) - ldap_mods[i].mod_op |= LDAP_MOD_ADD; - else if (EQ (mod_op, Qdelete)) - ldap_mods[i].mod_op |= LDAP_MOD_DELETE; - else if (EQ (mod_op, Qreplace)) - ldap_mods[i].mod_op |= LDAP_MOD_REPLACE; - else - invalid_constant ("Invalid LDAP modification type", mod_op); - current = XCDR (current); - CHECK_STRING (XCAR (current)); - LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type, Qnative); - values = XCDR (current); - len = (Elemcount) XINT (Flength (values)); - bervals = alloca_array (struct berval, len); - ldap_mods[i].mod_vals.modv_bvals = - alloca_array (struct berval *, 1 + len); - j = 0; - EXTERNAL_LIST_LOOP (values, values) - { - current = XCAR (values); - CHECK_STRING (current); - ldap_mods[i].mod_vals.modv_bvals[j] = &(bervals[j]); - TO_EXTERNAL_FORMAT (LISP_STRING, current, - ALLOCA, (bervals[j].bv_val, - bervals[j].bv_len), - Qnative); - j++; - } - ldap_mods[i].mod_vals.modv_bvals[j] = NULL; - i++; - } - ldap_mods_ptrs[i] = NULL; - rc = ldap_modify_s (ld, (char *) XSTRING_DATA (dn), ldap_mods_ptrs); - if (rc != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, rc); - - UNGCPRO; - return Qnil; -} - - -DEFUN ("ldap-delete", Fldap_delete, 2, 2, 0, /* -Delete an entry to an LDAP directory. -LDAP is an LDAP connection object created with `ldap-open'. -DN is the distinguished name of the entry to delete. -*/ - (ldap, dn)) -{ - LDAP *ld; - int rc; - - /* Check parameters */ - CHECK_LIVE_LDAP (ldap); - ld = XLDAP (ldap)->ld; - CHECK_STRING (dn); - - rc = ldap_delete_s (ld, (char *) XSTRING_DATA (dn)); - if (rc != LDAP_SUCCESS) - signal_ldap_error (ld, NULL, rc); - - return Qnil; -} - -void -syms_of_eldap (void) -{ - INIT_LRECORD_IMPLEMENTATION (ldap); - - DEFSYMBOL (Qldapp); - DEFSYMBOL (Qport); - DEFSYMBOL (Qauth); - DEFSYMBOL (Qbinddn); - DEFSYMBOL (Qpasswd); - DEFSYMBOL (Qderef); - DEFSYMBOL (Qtimelimit); - DEFSYMBOL (Qsizelimit); - DEFSYMBOL (Qbase); - DEFSYMBOL (Qonelevel); - DEFSYMBOL (Qsubtree); - DEFSYMBOL (Qkrbv41); - DEFSYMBOL (Qkrbv42); - DEFSYMBOL (Qnever); - DEFSYMBOL (Qalways); - DEFSYMBOL (Qfind); - DEFSYMBOL (Qadd); - DEFSYMBOL (Qreplace); - - DEFSUBR (Fldapp); - DEFSUBR (Fldap_host); - DEFSUBR (Fldap_live_p); - DEFSUBR (Fldap_open); - DEFSUBR (Fldap_close); - DEFSUBR (Fldap_search_basic); - DEFSUBR (Fldap_add); - DEFSUBR (Fldap_modify); - DEFSUBR (Fldap_delete); -} - -void -vars_of_eldap (void) -{ - - ldap_default_port = LDAP_PORT; - Vldap_default_base = Qnil; - - DEFVAR_INT ("ldap-default-port", &ldap_default_port /* -Default TCP port for LDAP connections. -Initialized from the LDAP library. Default value is 389. -*/ ); - - DEFVAR_LISP ("ldap-default-base", &Vldap_default_base /* -Default base for LDAP searches. -This is a string using the syntax of RFC 1779. -For instance, "o=ACME, c=US" limits the search to the -Acme organization in the United States. -*/ ); - -} - - diff -r 4575a219af58 -r 25e260cb7994 src/eldap.h --- a/src/eldap.h Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* Definitions for the LDAP client interface for XEmacs. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of XEmacs. - -XEmacs is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -XEmacs is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef INCLUDED_eldap_h_ -#define INCLUDED_eldap_h_ - -#include -#include - -/* - * The following structure records pertinent information about a - * LDAP connection. - */ - -struct Lisp_LDAP -{ - /* lcrecord header */ - struct lcrecord_header header; - /* The LDAP connection handle used by the LDAP API */ - LDAP *ld; - /* Name of the host we connected to */ - Lisp_Object host; -}; -typedef struct Lisp_LDAP Lisp_LDAP; - - -DECLARE_LRECORD (ldap, Lisp_LDAP); -#define XLDAP(x) XRECORD (x, ldap, Lisp_LDAP) -#define wrap_ldap(p) wrap_record (p, ldap) -#define LDAPP(x) RECORDP (x, ldap) -#define CHECK_LDAP(x) CHECK_RECORD (x, ldap) -#define CONCHECK_LDAP(x) CONCHECK_RECORD (x, ldap) - -#define CHECK_LIVE_LDAP(ldap) do { \ - CHECK_LDAP (ldap); \ - if (!XLDAP (ldap)->ld) \ - invalid_operation ("Attempting to access closed LDAP connection", \ - ldap); \ -} while (0) - - -Lisp_Object Fldapp (Lisp_Object object); -Lisp_Object Fldap_host (Lisp_Object ldap); -Lisp_Object Fldap_live_p (Lisp_Object ldap); -Lisp_Object Fldap_open (Lisp_Object host, - Lisp_Object ldap_plist); -Lisp_Object Fldap_close (Lisp_Object ldap); -Lisp_Object Fldap_search_basic (Lisp_Object ldap, - Lisp_Object filter, - Lisp_Object base, - Lisp_Object scope, - Lisp_Object attrs, - Lisp_Object attrsonly, - Lisp_Object withdn, - Lisp_Object verbose); -Lisp_Object Fldap_add (Lisp_Object ldap, - Lisp_Object dn, - Lisp_Object entry); -Lisp_Object Fldap_modify (Lisp_Object ldap, - Lisp_Object dn, - Lisp_Object entry); -Lisp_Object Fldap_delete (Lisp_Object ldap, - Lisp_Object dn); - -#endif /* INCLUDED_eldap_h_ */ diff -r 4575a219af58 -r 25e260cb7994 src/emacs.c --- a/src/emacs.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/emacs.c Tue Sep 10 15:27:39 2002 +0000 @@ -1413,7 +1413,7 @@ syms_of_sunpro (); #endif -#ifdef HAVE_LDAP +#if defined (HAVE_LDAP) && !defined (HAVE_SHLIB) syms_of_eldap (); #endif @@ -1421,7 +1421,7 @@ syms_of_gpmevent (); #endif -#ifdef HAVE_POSTGRESQL +#if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB) syms_of_postgresql (); #endif @@ -1903,11 +1903,11 @@ vars_of_sunpro (); #endif -#ifdef HAVE_LDAP +#if defined (HAVE_LDAP) && !defined (HAVE_SHLIB) vars_of_eldap (); #endif -#ifdef HAVE_POSTGRESQL +#if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB) vars_of_postgresql (); #endif @@ -2255,7 +2255,7 @@ #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) init_hpplay (); #endif -#ifdef HAVE_POSTGRESQL +#if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB) /* Set some values taken from environment variables */ init_postgresql_from_environment (); #endif diff -r 4575a219af58 -r 25e260cb7994 src/emodules.c --- a/src/emodules.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/emodules.c Tue Sep 10 15:27:39 2002 +0000 @@ -18,6 +18,10 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* This gross hack is so that we can make DEFVAR_foo register with the + portable dumper in core, but not do so in modules. Since the hackery to do + that is in emodules.h, we have to turn it off for this file. */ +#define EMODULES_DO_NOT_REDEFINE #include "emodules.h" #include "sysdll.h" @@ -29,19 +33,24 @@ /* Do we do our work quietly? */ int load_modules_quietly; +/* Set this while unloading a module. This should NOT be made set by users, + as it allows the unbinding of symbol-value-forward variables. */ +int unloading_module; + /* Load path */ Lisp_Object Vmodule_load_path; - Lisp_Object Qdll_error; +Lisp_Object Qmodule, Qunload_module, module_tag; typedef struct _emodules_list { - int used; /* Is this slot used? */ - char *soname; /* Name of the shared object loaded (full path) */ - char *modname; /* The name of the module */ - char *modver; /* The version that the module is at */ - char *modtitle; /* How the module announces itself */ - dll_handle dlhandle; /* Dynamic lib handle */ + int used; /* Is this slot used? */ + char *soname; /* Name of the shared object loaded (full path) */ + char *modname; /* The name of the module */ + char *modver; /* The module version string */ + char *modtitle; /* How the module announces itself */ + void (*unload)(void); /* Module cleanup function to run before unloading */ + dll_handle dlhandle; /* Dynamic lib handle */ } emodules_list; static Lisp_Object Vmodule_extensions; @@ -51,7 +60,8 @@ static emodules_list *modules; static int modnum; -static int find_make_module (const char *mod, const char *name, const char *ver, int make_or_find); +static int find_make_module (const char *mod, const char *name, + const char *ver, int make_or_find); static Lisp_Object module_load_unwind (Lisp_Object); static void attempt_module_delete (int mod); @@ -59,6 +69,8 @@ Load in a C Emacs Extension module named FILE. The optional NAME and VERSION are used to identify specific modules. +DO NOT USE THIS FUNCTION in your programs. Use `require' instead. + This function is similar in intent to `load' except that it loads in pre-compiled C or C++ code, using dynamic shared objects. If NAME is specified, then the module is only loaded if its internal name matches @@ -74,7 +86,7 @@ modules have been loaded as dynamic shared objects by examining the return value of the function `list-modules'. -It is possible, although unwise, to unload modules using `unload-module'. +It is possible, although unwise, to unload modules using `unload-feature'. The preferred mechanism for unloading or reloading modules is to quit XEmacs, and then reload those new or changed modules that are required. @@ -108,10 +120,10 @@ return Qt; } -#ifdef DANGEROUS_NASTY_SCARY_MONSTER +DEFUN ("unload-module", Funload_module, 1, 3, 0, /* +Unload a module previously loaded with load-module. -DEFUN ("unload-module", Fmodule_unload, 1, 3, 0, /* -Unload a module previously loaded with load-module. +DO NOT USE THIS FUNCTION in your programs. Use `unload-feature' instead. As with load-module, this function requires at least the module FILE, and optionally the module NAME and VERSION to unload. It may not be possible @@ -124,10 +136,17 @@ { int x; char *mod, *mname, *mver; + Lisp_Object foundname = Qnil; + struct gcpro gcpro1; CHECK_STRING(file); - mod = (char *)XSTRING_DATA (file); + GCPRO1 (foundname); + if (locate_file (Vmodule_load_path, file, Vmodule_extensions, &foundname, 0) + < 0) + return Qt; + mod = (char *)XSTRING_DATA (foundname); + UNGCPRO; if (NILP (name)) mname = ""; @@ -141,10 +160,13 @@ x = find_make_module (mod, mname, mver, 1); if (x != -1) - attempt_module_delete (x); + { + if (modules[x].unload != NULL) + modules[x].unload (); + attempt_module_delete (x); + } return Qt; } -#endif /* DANGEROUS_NASTY_SCARY_MONSTER */ DEFUN ("list-modules", Flist_modules, 0, 0, "", /* Produce a list of loaded dynamic modules. @@ -308,10 +330,11 @@ void emodules_load(const char *module, const char *modname, const char *modver) { + Lisp_Object old_load_list; Lisp_Object filename; - Lisp_Object foundname; - int fd, x, mpx; - char *soname, *tmod; + Lisp_Object foundname, lisp_modname; + int x, mpx; + char *soname; const char **f; const long *ellcc_rev; char *mver, *mname, *mtitle, *symname; @@ -319,8 +342,9 @@ void (*modsyms)(void) = 0; void (*modvars)(void) = 0; void (*moddocs)(void) = 0; + void (*modunld)(void) = 0; emodules_list *mp; - struct gcpro gcpro1,gcpro2; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; filename = Qnil; foundname = Qnil; @@ -331,22 +355,16 @@ if ((module == (const char *)0) || (module[0] == '\0')) invalid_argument ("Empty module name", Qunbound); - /* This is to get around the fact that build_string() is not declared - as taking a const char * as an argument. I HATE compiler warnings. */ - tmod = (char *)ALLOCA (strlen (module) + 1); - strcpy (tmod, module); - - GCPRO2(filename, foundname); - filename = build_string (tmod); - fd = locate_file (Vmodule_load_path, filename, Vmodule_extensions, - &foundname, -1); - UNGCPRO; - - if (fd < 0) + GCPRO4(filename, foundname, old_load_list, lisp_modname); + filename = build_string (module); + if (locate_file (Vmodule_load_path, filename, Vmodule_extensions, + &foundname, 0) < 0) signal_error (Qdll_error, "Cannot open dynamic module", filename); soname = (char *)ALLOCA (XSTRING_LENGTH (foundname) + 1); strcpy (soname, (char *)XSTRING_DATA (foundname)); + lisp_modname = call1 (Qfile_name_sans_extension, + Ffile_name_nondirectory (foundname)); dlhandle = dll_open (soname); if (dlhandle == (dll_handle)0) @@ -419,6 +437,11 @@ if (moddocs == (void (*)(void))0) goto missing_symbol; + /* Now look for the optional unload function. */ + strcpy (symname, "unload_"); + strcat (symname, mname); + modunld = (void (*)(void))dll_function (dlhandle, symname); + if (modname && modname[0] && strcmp (modname, mname)) signal_error (Qdll_error, "Module name mismatch", Qunbound); @@ -454,8 +477,14 @@ mp->modver = xstrdup (mver); mp->modtitle = xstrdup (mtitle); mp->dlhandle = dlhandle; + mp->unload = modunld; dlhandle = 0; + old_load_list = Vcurrent_load_list; + Vcurrent_load_list = Qnil; + LOADHIST_ATTACH (lisp_modname); + LOADHIST_ATTACH (module_tag); + /* * Now we need to call the module init function and perform the various * startup tasks. @@ -474,6 +503,9 @@ if (!load_modules_quietly) message ("Loaded module %s v%s (%s)", mname, mver, mtitle); + Vload_history = Fcons (Fnreverse (Vcurrent_load_list), Vload_history); + Vcurrent_load_list = old_load_list; + UNGCPRO; emodules_depth--; if (emodules_depth == 0) @@ -531,11 +563,14 @@ syms_of_module (void) { DEFERROR_STANDARD (Qdll_error, Qerror); + DEFSYMBOL (Qmodule); + DEFSYMBOL (Qunload_module); DEFSUBR(Fload_module); DEFSUBR(Flist_modules); -#ifdef DANGEROUS_NASTY_SCARY_MONSTER DEFSUBR(Funload_module); -#endif + module_tag = Fcons (Qmodule, Qnil); + staticpro (&module_tag); + Fput (Qunload_module, Qdisabled, Qt); } void @@ -593,8 +628,15 @@ when a dynamic module is loaded. */); + DEFVAR_BOOL ("unloading-module", &unloading_module /* +Used internally by `unload-feature'. Do not set this variable. +Danger, danger, Will Robinson! +*/); + /* #### Export this to Lisp */ - Vmodule_extensions = build_string (":.ell:.so:.dll"); + Vmodule_extensions = list3 (build_string (".ell"), + build_string (".so"), + build_string (".dll")); staticpro (&Vmodule_extensions); load_modules_quietly = 0; @@ -603,4 +645,3 @@ } #endif /* HAVE_SHLIB */ - diff -r 4575a219af58 -r 25e260cb7994 src/emodules.h --- a/src/emodules.h Mon Sep 09 21:53:43 2002 +0000 +++ b/src/emodules.h Tue Sep 10 15:27:39 2002 +0000 @@ -24,9 +24,9 @@ #define EMODULES_HDR #endif -#define EMODULES_VERSION "1.0.0" +#define EMODULES_VERSION "1.1.0" #define EMODULES_MAJOR 1 -#define EMODULES_MINOR 0 +#define EMODULES_MINOR 1 #define EMODULES_PATCH 0 #define EMODULES_REVISION (long)((EMODULES_MAJOR * 1000) + \ (EMODULES_MINOR * 10) + \ @@ -80,4 +80,23 @@ #define CDOCSYM(Sname, DOC) emodules_doc_sym (Sname, DOC) #endif /* EMODULES_GATHER_VERSION */ +/* We should not expose module entities to the portable dumper. */ +#if defined(PDUMP) && !defined(EMODULES_DO_NOT_REDEFINE) +#define dump_add_root_struct_ptr(varaddr,descaddr) DO_NOTHING +#define dump_add_opaque(varaddr,size) DO_NOTHING +#define dump_add_root_block(ptraddress,desc) DO_NOTHING +#define dump_add_opaque_int(int_varaddr) DO_NOTHING +#define dump_add_opaque_fixnum(fixnum_varaddr) DO_NOTHING +#define dump_add_root_object(varaddr) DO_NOTHING +#define dump_add_weak_object_chain(varaddr) DO_NOTHING +#define staticpro(DSF_location) staticpro_nodump(DSF_location) + +#undef DEFSYMBOL +#undef DEFSYMBOL_MULTIWORD_PREDICATE +#define DEFSYMBOL(name) DEFSYMBOL_NO_DUMP (name) +#define DEFSYMBOL_MULTIWORD_PREDICATE(name) \ + DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP (name) +#define defsymbol(location,name) defsymbol_nodump (location, name) +#endif + #endif /* EMODULES_HDR */ diff -r 4575a219af58 -r 25e260cb7994 src/fileio.c --- a/src/fileio.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/fileio.c Tue Sep 10 15:27:39 2002 +0000 @@ -218,6 +218,7 @@ Lisp_Object Qdirectory_file_name; Lisp_Object Qfile_name_directory; Lisp_Object Qfile_name_nondirectory; +Lisp_Object Qfile_name_sans_extension; Lisp_Object Qunhandled_file_name_directory; Lisp_Object Qfile_name_as_directory; Lisp_Object Qcopy_file; @@ -4208,6 +4209,7 @@ DEFSYMBOL (Qdirectory_file_name); DEFSYMBOL (Qfile_name_directory); DEFSYMBOL (Qfile_name_nondirectory); + DEFSYMBOL (Qfile_name_sans_extension); DEFSYMBOL (Qunhandled_file_name_directory); DEFSYMBOL (Qfile_name_as_directory); DEFSYMBOL (Qcopy_file); diff -r 4575a219af58 -r 25e260cb7994 src/inline.c --- a/src/inline.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/inline.c Tue Sep 10 15:27:39 2002 +0000 @@ -67,12 +67,12 @@ #include "syntax.h" #include "window.h" -#ifdef HAVE_LDAP -#include "eldap.h" +#if defined (HAVE_LDAP) && !defined (HAVE_SHLIB) +#include "../modules/ldap/eldap.h" #endif -#ifdef HAVE_POSTGRESQL -#include "postgresql.h" +#if defined (HAVE_POSTGRESQL) && !defined (HAVE_SHLIB) +#include "../modules/postgresql/postgresql.h" #endif #ifdef HAVE_TOOLBARS diff -r 4575a219af58 -r 25e260cb7994 src/lisp.h --- a/src/lisp.h Mon Sep 09 21:53:43 2002 +0000 +++ b/src/lisp.h Tue Sep 10 15:27:39 2002 +0000 @@ -1205,6 +1205,18 @@ #define Dynarr_delete_by_pointer(d, p) \ Dynarr_delete_many (d, (p) - ((d)->base), 1) +#define Dynarr_delete_object(d, el) \ +do { \ + if (d != NULL) { \ + REGISTER int i; \ + for (i = Dynarr_length (d) - 1; i >= 0; i--) { \ + if (el == Dynarr_at (d, i)) { \ + Dynarr_delete_many (d, i, 1); \ + } \ + } \ + } \ +} while (0) + #ifdef MEMORY_USAGE_STATS struct overhead_stats; Bytecount Dynarr_memory_usage (void *d, struct overhead_stats *stats); @@ -3232,6 +3244,11 @@ #define staticpro(ptr) staticpro_1 (ptr, #ptr) #define staticpro_nodump(ptr) staticpro_nodump_1 (ptr, #ptr) +#ifdef HAVE_SHLIB +void unstaticpro_nodump_1 (Lisp_Object *, char *); +#define unstaticpro_nodump(ptr) unstaticpro_nodump_1 (ptr, #ptr) +#endif + #else /* Call staticpro (&var) to protect static variable `var'. */ @@ -3241,6 +3258,11 @@ /* var will not be saved at dump time */ void staticpro_nodump (Lisp_Object *); +#ifdef HAVE_SHLIB +/* Call unstaticpro_nodump (&var) to stop protecting static variable `var'. */ +void unstaticpro_nodump (Lisp_Object *); +#endif + #endif void register_post_gc_action (void (*fun) (void *), void *arg); @@ -3678,9 +3700,11 @@ void zero_out_command_line_status_vars (void); /* Defined in emodules.c */ +#ifdef HAVE_SHLIB EXFUN (Flist_modules, 0); EXFUN (Fload_module, 3); - +extern int unloading_module; +#endif /* Defined in eval.c */ EXFUN (Fapply, MANY); @@ -4984,7 +5008,8 @@ extern Lisp_Object Qend_of_buffer, Qend_of_file, Qend_open, Qerror; extern Lisp_Object Qerror_conditions, Qerror_lacks_explanatory_string; extern Lisp_Object Qerror_message, Qevent_live_p, Qexit, Qextent_live_p; -extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error, Qfinal; +extern Lisp_Object Qexternal_debugging_output, Qfeaturep, Qfile_error; +extern Lisp_Object Qfile_name_sans_extension, Qfinal; extern Lisp_Object Qforeground, Qformat, Qframe_live_p, Qgraphic, Qgtk; extern Lisp_Object Qgui_error, Qicon_glyph_p, Qidentity, Qinhibit_quit; extern Lisp_Object Qinhibit_read_only, Qinteger_char_or_marker_p; @@ -4995,7 +5020,7 @@ extern Lisp_Object Qinvalid_read_syntax, Qinvalid_state, Qio_error, Qlambda; extern Lisp_Object Qlayout, Qlist_formation_error, Qlistp, Qload, Qlock_shift; extern Lisp_Object Qlong_name, Qmacro, Qmakunbound, Qmalformed_list; -extern Lisp_Object Qmalformed_property_list, Qmark; +extern Lisp_Object Qmalformed_property_list, Qmark, Qmodule; extern Lisp_Object Qmono_pixmap_image_instance_p, Qmouse_leave_buffer_hook; extern Lisp_Object Qnative_layout, Qnatnump, Qnetwork_error, Qno_catch; extern Lisp_Object Qnothing_image_instance_p, Qnumber_char_or_marker_p; diff -r 4575a219af58 -r 25e260cb7994 src/lrecord.h --- a/src/lrecord.h Mon Sep 09 21:53:43 2002 +0000 +++ b/src/lrecord.h Tue Sep 10 15:27:39 2002 +0000 @@ -770,6 +770,24 @@ INIT_LRECORD_IMPLEMENTATION(type); \ } while (0) +#ifdef HAVE_SHLIB +/* Allow undefining types in order to support module unloading. */ + +#define UNDEF_LRECORD_IMPLEMENTATION(type) do { \ + lrecord_implementations_table[lrecord_type_##type] = NULL; \ + lrecord_markers[lrecord_type_##type] = NULL; \ +} while (0) + +#define UNDEF_EXTERNAL_LRECORD_IMPLEMENTATION(type) do { \ + if (lrecord_##type.lrecord_type_index == lrecord_type_count - 1) { \ + /* This is the most recently defined type. Clean up nicely. */ \ + lrecord_type_##type = lrecord_type_count--; \ + } /* Else we can't help leaving a hole with this implementation. */ \ + UNDEF_LRECORD_IMPLEMENTATION(type); \ +} while (0) + +#endif /* HAVE_SHLIB */ + #define LRECORDP(a) (XTYPE (a) == Lisp_Type_Record) #define XRECORD_LHEADER(a) ((struct lrecord_header *) XPNTR (a)) diff -r 4575a219af58 -r 25e260cb7994 src/postgresql.c --- a/src/postgresql.c Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1870 +0,0 @@ -/* - postgresql.c -- Emacs Lisp binding to libpq.so - Copyright (C) 2000 Electrotechnical Laboratory, JAPAN. - Licensed to the Free Software Foundation. - - Author: SL Baur - Maintainer: SL Baur - -Please send patches to this file to me first before submitting them to -xemacs-patches. - - -KNOWN PROBLEMS (Last update 15-March-2000) -+ None. - -Implementation notes: -0. Supported PostgreSQL versions - This code was developed against libpq-6.5.3 and libpq-7.0-beta1. Earlier - versions may work. V7 support is more complete than V6.5 support. -1. Mule - Non-ASCII databases have been tested on both 6.5 and 7.0. -2. Asynchronous Operation - Starting with libpq-7.0, an asynchronous interface is offered. This - binding supports the asynchronous calls to a limited extent. Since the - XEmacs 21.2 core does not support a sensible interface to add managed but - unreadable (by XEmacs) file descriptors to the main select code, polling - is required to drive the asynchronous calls. XtAppAddInput would work - fine, but we want to be able to use the database when running strictly in - tty mode. -3. Completeness - Various calls have been deliberately not exported to Lisp. The - unexported calls are either left-over backwards compatibility code that - aren't needed, calls that cannot be implemented sensibly, or calls that - cannot be implemented safely. A list of all global functions in libpq - but not exported to Lisp is below. -4. Policy - This interface tries very hard to not set any policy towards how database - code in Emacs Lisp will be written. -5. Documentation - For full lisp programming documentation, see the XEmacs Lisp Reference - Manual. For PostgreSQL documentation, see the PostgreSQL distribution. - -TODO (in rough order of priority): -1. Asynchronous notifies need to be implemented to the extent they can be. -2. The large object interface needs work with Emacs buffers in addition - to files. Need two functions buffer->large_object, and large_object-> - buffer. -*/ - -/* - Unimplemented functions: [TODO] - PQsetNoticeProcessor - - Implemented, but undocumented functions: [TODO] - PQgetline (copy in/out) - PQputline (copy in/out) - PQgetlineAsync (copy in/out Asynch.) - PQputnbytes (copy in/out Asynch.) - PQendcopy (copy in/out) - - Unsupported functions: - PQsetdbLogin -- This function is deprecated, has a subset of the - functionality of PQconnectdb, and is better done in Lisp. - PQsetdb -- Same as for PQsetdbLogin - PQsocket -- Abstraction error, file descriptors should not be leaked - into Lisp code - PQprint -- print to a file descriptor, deprecated, better done in Lisp - PQdisplayTuples -- deprecated - PQprintTuples -- really, really deprecated - PQmblen -- Returns the length in bytes of multibyte character encoded - string. - PQtrace -- controls debug print tracing to a tty. - PQuntrace -- Ditto. I don't see any way to do this sensibly. - PQoidStatus -- deprecated and nearly identical to PQoidValue - PQfn -- "Fast path" interface - lo_open (large object) [*] - lo_close (large object) [*] - lo_read (large object) [*] - lo_write (large object) [*] - lo_lseek (large object) [*] - lo_creat (large object) [*] - lo_tell (large object) [*] - lo_unlink (large object) [*] -*/ - -#include - -/* This must be portable with XEmacs 21.1 so long as it is the official - released version of XEmacs and provides the basis of InfoDock. The - interface to lcrecord handling has changed with 21.2, so unfortunately - we will need a few snippets of backwards compatibility code. -*/ -#if (EMACS_MAJOR_VERSION == 21) && (EMACS_MINOR_VERSION < 2) -#define RUNNING_XEMACS_21_1 1 -#endif - -/* #define POSTGRES_LO_IMPORT_IS_VOID 1 */ - -#include "lisp.h" -#include "sysdep.h" - -#include "buffer.h" -#include "postgresql.h" -#include "process.h" - -#ifdef RUNNING_XEMACS_21_1 /* handle interface changes */ -#define PG_OS_CODING FORMAT_FILENAME -#define TO_EXTERNAL_FORMAT(a,from,b,to,c) GET_C_STRING_EXT_DATA_ALLOCA(from,FORMAT_FILENAME,to) -#else -#ifdef MULE -#define PG_OS_CODING get_coding_system_for_text_file (Vpg_coding_system, 1) -#else -#define PG_OS_CODING Qnative -#endif -Lisp_Object Vpg_coding_system; -#endif - -#define CHECK_LIVE_CONNECTION(P) do { \ - if (!P || (PQstatus (P) != CONNECTION_OK)) { \ - char *e = "bad value"; \ - if (P) e = PQerrorMessage (P); \ - signal_ferror (Qprocess_error, "dead connection [%s]", e); \ - } } while (0) -#define PUKE_IF_NULL(p) do { \ - if (!p) signal_error (Qinvalid_argument, "bad value", Qunbound); \ - } while (0) - -static Lisp_Object VXPGHOST; -static Lisp_Object VXPGUSER; -static Lisp_Object VXPGOPTIONS; -static Lisp_Object VXPGPORT; -static Lisp_Object VXPGTTY; /* This needs to be blanked! */ -static Lisp_Object VXPGDATABASE; -static Lisp_Object VXPGREALM; -#ifdef MULE -static Lisp_Object VXPGCLIENTENCODING; -#endif /* MULE */ - -/* Other variables: - PGAUTHTYPE -- not used after PostgreSQL 6.5 - PGGEQO - PGCOSTINDEX - PGCOSTHEAP - PGTZ - PGDATESTYLE -*/ -#ifndef HAVE_POSTGRESQLV7 -static Lisp_Object VXPGAUTHTYPE; -#endif -static Lisp_Object VXPGGEQO, VXPGCOSTINDEX, VXPGCOSTHEAP, VXPGTZ, VXPGDATESTYLE; - -static Lisp_Object Qpostgresql; -static Lisp_Object Qpg_connection_ok, Qpg_connection_bad; -static Lisp_Object Qpg_connection_started, Qpg_connection_made; -static Lisp_Object Qpg_connection_awaiting_response, Qpg_connection_auth_ok; -static Lisp_Object Qpg_connection_setenv; - -static Lisp_Object Qpqdb, Qpquser, Qpqpass, Qpqhost, Qpqport, Qpqtty; -static Lisp_Object Qpqoptions, Qpqstatus, Qpqerrormessage, Qpqbackendpid; - -static Lisp_Object Qpgres_empty_query, Qpgres_command_ok, Qpgres_tuples_ok; -static Lisp_Object Qpgres_copy_out, Qpgres_copy_in, Qpgres_bad_response; -static Lisp_Object Qpgres_nonfatal_error, Qpgres_fatal_error; - -static Lisp_Object Qpgres_polling_failed, Qpgres_polling_reading; -static Lisp_Object Qpgres_polling_writing, Qpgres_polling_ok; -static Lisp_Object Qpgres_polling_active; -/****/ - -/* PGconn is an opaque object and we need to be able to store them in - Lisp code because libpq supports multiple connections. -*/ -Lisp_Object Qpgconnp; - -static Lisp_Object -make_pgconn (Lisp_PGconn *pgconn) -{ - return wrap_pgconn (pgconn); -} - -#ifdef USE_KKCC -static const struct lrecord_description pgconn_description [] = { - { XD_END } -}; -#endif /* USE_KKCC */ - -static Lisp_Object -#ifdef RUNNING_XEMACS_21_1 -mark_pgconn (Lisp_Object obj, void (*markobj) (Lisp_Object)) -#else -mark_pgconn (Lisp_Object obj) -#endif -{ - return Qnil; -} - -static void -print_pgconn (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[256]; - PGconn *P; - ConnStatusType cst; - char *host="", *db="", *user="", *port=""; - - P = (XPGCONN (obj))->pgconn; - - if (!P) /* this may happen since we allow PQfinish() to be called */ - strcpy (buf, "#"); /* evil! */ - else if ((cst = PQstatus (P)) == CONNECTION_OK) - { - if (!(host = PQhost (P))) - host = ""; - port = PQport (P); - db = PQdb (P); - if (!(user = PQuser (P))) - user = ""; - sprintf (buf, "#", /* evil! */ - !strlen (host) ? "localhost" : host, - port, - user, - db); - } - else if (cst == CONNECTION_BAD) - strcpy (buf, "#"); /* evil! */ - else - strcpy (buf, "#"); /* evil! */ - - if (print_readably) - printing_unreadable_object ("%s", buf); - else - write_c_string (printcharfun, buf); -} - -static Lisp_PGconn * -allocate_pgconn (void) -{ -#ifdef RUNNING_XEMACS_21_1 - Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn, - lrecord_pgconn); -#else - Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn, - &lrecord_pgconn); -#endif - pgconn->pgconn = (PGconn *)NULL; - return pgconn; -} - -static void -finalize_pgconn (void *header, int for_disksave) -{ - Lisp_PGconn *pgconn = (Lisp_PGconn *)header; - - if (for_disksave) - invalid_operation ("Can't dump an emacs containing PGconn objects", - make_pgconn (pgconn)); - - if (pgconn->pgconn) - { - PQfinish (pgconn->pgconn); - pgconn->pgconn = (PGconn *)NULL; - } -} - -#ifdef RUNNING_XEMACS_21_1 -DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, - mark_pgconn, print_pgconn, finalize_pgconn, - NULL, NULL, - Lisp_PGconn); -#else -#ifdef USE_KKCC -DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, - 0, /*dumpable-flag*/ - mark_pgconn, print_pgconn, finalize_pgconn, - NULL, NULL, - pgconn_description, - Lisp_PGconn); -#else /* not USE_KKCC */ -DEFINE_LRECORD_IMPLEMENTATION ("pgconn", pgconn, - mark_pgconn, print_pgconn, finalize_pgconn, - NULL, NULL, - 0, - Lisp_PGconn); -#endif /* not USE_KKCC */ -#endif -/****/ - -/* PGresult is an opaque object and we need to be able to store them in - Lisp code. -*/ -Lisp_Object Qpgresultp; - -static Lisp_Object -make_pgresult (Lisp_PGresult *pgresult) -{ - return wrap_pgresult (pgresult); -} - -#ifdef USE_KKCC -static const struct lrecord_description pgresult_description [] = { - { XD_END } -}; -#endif /* USE_KKCC */ - - -static Lisp_Object -#ifdef RUNNING_XEMACS_21_1 -mark_pgresult (Lisp_Object obj, void (*markobj) (Lisp_Object)) -#else -mark_pgresult (Lisp_Object obj) -#endif -{ - return Qnil; -} - -#define RESULT_TUPLES_FMT "#" -#define RESULT_CMD_TUPLES_FMT "#" -#define RESULT_DEFAULT_FMT "#" -static void -print_pgresult (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[1024]; - PGresult *res; - - res = (XPGRESULT (obj))->pgresult; - - if (res) - { - switch (PQresultStatus (res)) - { - case PGRES_TUPLES_OK: - /* Add number of tuples of result to output */ - sprintf (buf, RESULT_TUPLES_FMT, /* evil! */ - PQresStatus (PQresultStatus (res)), - PQntuples (res), - PQcmdStatus (res)); - break; - case PGRES_COMMAND_OK: - /* Add number of tuples affected by output-less command */ - if (!strlen (PQcmdTuples (res))) goto notuples; - sprintf (buf, RESULT_CMD_TUPLES_FMT, /* evil! */ - PQresStatus (PQresultStatus (res)), - PQcmdTuples (res), - PQcmdStatus (res)); - break; - default: -notuples: - /* No counts to print */ - sprintf (buf, RESULT_DEFAULT_FMT, /* evil! */ - PQresStatus (PQresultStatus (res)), - PQcmdStatus (res)); - break; - } - } - else - strcpy (buf, "#"); /* evil! */ - - if (print_readably) - printing_unreadable_object ("%s", buf); - else - write_c_string (printcharfun, buf); -} - -#undef RESULT_TUPLES_FMT -#undef RESULT_CMD_TUPLES_FMT -#undef RESULT_DEFAULT_FMT - -static Lisp_PGresult * -allocate_pgresult (void) -{ -#ifdef RUNNING_XEMACS_21_1 - Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult, - lrecord_pgresult); -#else - Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult, - &lrecord_pgresult); -#endif - pgresult->pgresult = (PGresult *)NULL; - return pgresult; -} - -static void -finalize_pgresult (void *header, int for_disksave) -{ - Lisp_PGresult *pgresult = (Lisp_PGresult *)header; - - if (for_disksave) - invalid_operation ("Can't dump an emacs containing PGresult objects", - make_pgresult (pgresult)); - - if (pgresult->pgresult) - { - PQclear (pgresult->pgresult); - pgresult->pgresult = (PGresult *)NULL; - } -} - -#ifdef RUNNING_XEMACS_21_1 -DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, - mark_pgresult, print_pgresult, finalize_pgresult, - NULL, NULL, - Lisp_PGresult); -#else -#ifdef USE_KKCC -DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, - 0, /*dumpable-flag*/ - mark_pgresult, print_pgresult, finalize_pgresult, - NULL, NULL, - pgresult_description, - Lisp_PGresult); -#else /* not USE_KKCC */ -DEFINE_LRECORD_IMPLEMENTATION ("pgresult", pgresult, - mark_pgresult, print_pgresult, finalize_pgresult, - NULL, NULL, - 0, - Lisp_PGresult); -#endif /* not USE_KKCC */ -#endif - -/***********************/ - -/* notices */ -static void -xemacs_notice_processor (void *arg, const char *msg) -{ - warn_when_safe (Qpostgresql, Qnotice, "%s", msg); -} - -/* There are four ways (as of PostgreSQL v7) to connect to a database. - Two of them, PQsetdb and PQsetdbLogin, are deprecated. Both of those - routines take a number of positional parameters and are better done in Lisp. - Note that PQconnectStart does not exist prior to v7. -*/ - -DEFUN ("pq-conn-defaults", Fpq_conn_defaults, 0, 0, 0, /* -Return a connection default structure. -*/ - ()) -{ - /* This function can GC */ - PQconninfoOption *pcio; - Lisp_Object temp, temp1; - int i; - - pcio = PQconndefaults(); - if (!pcio) return Qnil; /* can never happen in libpq-7.0 */ - temp = list1 (Fcons (build_ext_string (pcio[0].keyword, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].envvar, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].compiled, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].val, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].label, PG_OS_CODING), - Fcons (build_ext_string (pcio[0].dispchar, PG_OS_CODING), - Fcons (make_int (pcio[0].dispsize), Qnil)))))))); - - for (i = 1; pcio[i].keyword; i++) - { - temp1 = list1 (Fcons (build_ext_string (pcio[i].keyword, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].envvar, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].compiled, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].val, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].label, PG_OS_CODING), - Fcons (build_ext_string (pcio[i].dispchar, PG_OS_CODING), - Fcons (make_int (pcio[i].dispsize), Qnil)))))))); - { - Lisp_Object args[2]; - args[0] = temp; - args[1] = temp1; - /* Fappend GCPROs its arguments */ - temp = Fappend (2, args); - } - } - - return temp; -} - -/* PQconnectdb Makes a new connection to a backend. -PGconn *PQconnectdb(const char *conninfo) -*/ - -DEFUN ("pq-connectdb", Fpq_connectdb, 1, 1, 0, /* -Make a new connection to a PostgreSQL backend. -*/ - (conninfo)) -{ - PGconn *P; - Lisp_PGconn *lisp_pgconn; - char *error_message = "Out of Memory?"; - char *c_conninfo; - - CHECK_STRING (conninfo); - - TO_EXTERNAL_FORMAT(LISP_STRING, conninfo, - C_STRING_ALLOCA, c_conninfo, Qnative); - P = PQconnectdb (c_conninfo); - if (P && (PQstatus (P) == CONNECTION_OK)) - { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); - lisp_pgconn = allocate_pgconn(); - lisp_pgconn->pgconn = P; - return make_pgconn (lisp_pgconn); - } - else - { - /* Connection failed. Destroy the connection and signal an error. */ - char buf[BLCKSZ]; - strcpy (buf, error_message); - if (P) - { - /* storage for the error message gets erased when call PQfinish */ - /* so we must temporarily stash it somewhere */ - strncpy (buf, PQerrorMessage (P), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQfinish (P); - } - signal_ferror (Qprocess_error, "libpq: %s", buf); - } -} - -/* PQconnectStart Makes a new asynchronous connection to a backend. -PGconn *PQconnectStart(const char *conninfo) -*/ - -#ifdef HAVE_POSTGRESQLV7 -DEFUN ("pq-connect-start", Fpq_connect_start, 1, 1, 0, /* -Make a new asynchronous connection to a PostgreSQL backend. -*/ - (conninfo)) -{ - PGconn *P; - Lisp_PGconn *lisp_pgconn; - char *error_message = "Out of Memory?"; - char *c_conninfo; - - CHECK_STRING (conninfo); - TO_EXTERNAL_FORMAT (LISP_STRING, conninfo, - C_STRING_ALLOCA, c_conninfo, Qnative); - P = PQconnectStart (c_conninfo); - - if (P && (PQstatus (P) != CONNECTION_BAD)) - { - (void)PQsetNoticeProcessor (P, xemacs_notice_processor, NULL); - lisp_pgconn = allocate_pgconn(); - lisp_pgconn->pgconn = P; - - return make_pgconn (lisp_pgconn); - } - else - { - /* capture the error message before destroying the object */ - char buf[BLCKSZ]; - strcpy (buf, error_message); - if (P) - { - strncpy (buf, PQerrorMessage (P), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQfinish (P); - } - signal_ferror (Qprocess_error, "libpq: %s", buf); - } -} - -DEFUN ("pq-connect-poll", Fpq_connect_poll, 1, 1, 0, /* -Poll an asynchronous connection for completion -*/ - (conn)) -{ - PGconn *P; - PostgresPollingStatusType polling_status; - - CHECK_PGCONN (conn); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - polling_status = PQconnectPoll (P); - switch (polling_status) - { - case PGRES_POLLING_FAILED: - /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } - case PGRES_POLLING_OK: - return Qpgres_polling_ok; - case PGRES_POLLING_READING: - return Qpgres_polling_reading; - case PGRES_POLLING_WRITING: - return Qpgres_polling_writing; - case PGRES_POLLING_ACTIVE: - return Qpgres_polling_active; - default: - /* they've added a new field we don't know about */ - signal_ferror (Qprocess_error, "Help! Unknown status code %08x from backend!", polling_status); - } -} - -#ifdef MULE -DEFUN ("pq-client-encoding", Fpq_client_encoding, 1, 1, 0, /* -Return client coding system. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return make_int (PQclientEncoding (P)); -} - -DEFUN ("pq-set-client-encoding", Fpq_set_client_encoding, 2, 2, 0, /* -Set client coding system. -*/ - (conn, encoding)) -{ - PGconn *P; - int rc; - char *c_encoding; - - CHECK_PGCONN (conn); - CHECK_STRING (encoding); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - TO_EXTERNAL_FORMAT (LISP_STRING, encoding, - C_STRING_ALLOCA, c_encoding, Qnative); - - if ((rc = PQsetClientEncoding (P, c_encoding)) < 0) - signal_error (Qinvalid_argument, "bad encoding", Qunbound); - else - return make_int (rc); -} - -#endif -#endif /* HAVE_POSTGRESQLV7 */ - -/* PQfinish Close the connection to the backend. Also frees memory - used by the PGconn object. -void PQfinish(PGconn *conn) -*/ -DEFUN ("pq-finish", Fpq_finish, 1, 1, 0, /* -Close the connection to the backend. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - PUKE_IF_NULL (P); - - PQfinish (P); - /* #### PQfinish deallocates the PGconn structure, so we now have a - dangling pointer. */ - /* Genocided all @'s ... */ - (XPGCONN (conn))->pgconn = (PGconn *)NULL; /* You feel DEAD inside */ - return Qnil; -} - -DEFUN ("pq-clear", Fpq_clear, 1, 1, 0, /* -Forcibly erase a PGresult object. -*/ - (res)) -{ - PGresult *R; - - CHECK_PGRESULT (res); - R = (XPGRESULT (res))->pgresult; - PUKE_IF_NULL (R); - - PQclear (R); - /* Genocided all @'s ... */ - (XPGRESULT (res))->pgresult = (PGresult *)NULL; /* You feel DEAD inside */ - - return Qnil; -} - -DEFUN ("pq-is-busy", Fpq_is_busy, 1, 1, 0, /* -Return t if PQgetResult would block waiting for input. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return PQisBusy (P) ? Qt : Qnil; -} - -DEFUN ("pq-consume-input", Fpq_consume_input, 1, 1, 0, /* -Consume any available input from the backend. -Returns nil if something bad happened. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return PQconsumeInput (P) ? Qt : Qnil; -} - -/* PQreset Reset the communication port with the backend. -void PQreset(PGconn *conn) -*/ -DEFUN ("pq-reset", Fpq_reset, 1, 1, 0, /* -Reset the connection to the backend. -This function will close the connection to the backend and attempt to -reestablish a new connection to the same postmaster, using all the same -parameters previously used. This may be useful for error recovery if a -working connection is lost. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - PUKE_IF_NULL (P);/* we can resurrect a BAD connection, but not a dead one. */ - - PQreset (P); - - return Qnil; -} - -#ifdef HAVE_POSTGRESQLV7 -DEFUN ("pq-reset-start", Fpq_reset_start, 1, 1, 0, /* -Reset connection to the backend asynchronously. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - if (PQresetStart (P)) return Qt; - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } -} - -DEFUN ("pq-reset-poll", Fpq_reset_poll, 1, 1, 0, /* -Poll an asynchronous reset for completion. -*/ - (conn)) -{ - PGconn *P; - PostgresPollingStatusType polling_status; - - CHECK_PGCONN (conn); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - polling_status = PQresetPoll (P); - switch (polling_status) - { - case PGRES_POLLING_FAILED: - /* Something Bad has happened */ - { - char *e = PQerrorMessage (P); - signal_ferror (Qprocess_error, "libpq: %s", e); - } - case PGRES_POLLING_OK: - return Qpgres_polling_ok; - case PGRES_POLLING_READING: - return Qpgres_polling_reading; - case PGRES_POLLING_WRITING: - return Qpgres_polling_writing; - case PGRES_POLLING_ACTIVE: - return Qpgres_polling_active; - default: - /* they've added a new field we don't know about */ - signal_ferror (Qprocess_error, "Help! Unknown status code %08x from backend!", polling_status); - } -} -#endif - -DEFUN ("pq-request-cancel", Fpq_request_cancel, 1, 1, 0, /* -Attempt to request cancellation of the current operation. - -The return value is t if the cancel request was successfully -dispatched, nil if not (in which case conn->errorMessage is set). -Note: successful dispatch is no guarantee that there will be any effect at -the backend. The application must read the operation result as usual. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return PQrequestCancel (P) ? Qt : Qnil; -} - -/* accessor function for the PGconn object */ -DEFUN ("pq-pgconn", Fpq_pgconn, 2, 2, 0, /* -Accessor function for the PGconn object. -Currently recognized symbols for the field: -pq::db Database name -pq::user Database user name -pq::pass Database user's password -pq::host Hostname of PostgreSQL backend connected to -pq::port TCP port number of connection -pq::tty Debugging TTY (not used in Emacs) -pq::options Additional backend options -pq::status Connection status (either OK or BAD) -pq::error-message Last error message from the backend -pq::backend-pid Process ID of backend process -*/ - (conn, field)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - PUKE_IF_NULL (P); /* BAD connections still have state to query */ - - if (EQ(field, Qpqdb)) - /* PQdb Returns the database name of the connection. - char *PQdb(PGconn *conn) - */ - return build_ext_string (PQdb(P), PG_OS_CODING); - else if (EQ (field, Qpquser)) - /* PQuser Returns the user name of the connection. - char *PQuser(PGconn *conn) - */ - return build_ext_string (PQuser(P), PG_OS_CODING); - else if (EQ (field, Qpqpass)) - /* PQpass Returns the password of the connection. - char *PQpass(PGconn *conn) - */ - return build_ext_string (PQpass(P), PG_OS_CODING); - else if (EQ (field, Qpqhost)) - /* PQhost Returns the server host name of the connection. - char *PQhost(PGconn *conn) - */ - return build_ext_string (PQhost(P), PG_OS_CODING); - else if (EQ (field, Qpqport)) - { - char *p; - /* PQport Returns the port of the connection. - char *PQport(PGconn *conn) - */ - if ((p = PQport(P))) - return make_int(atoi(p)); - else - return make_int(-1); - } - else if (EQ (field, Qpqtty)) - /* PQtty Returns the debug tty of the connection. - char *PQtty(PGconn *conn) - */ - return build_ext_string (PQtty(P), PG_OS_CODING); - else if (EQ (field, Qpqoptions)) - /* PQoptions Returns the backend options used in the connection. - char *PQoptions(PGconn *conn) - */ - return build_ext_string (PQoptions(P), PG_OS_CODING); - else if (EQ (field, Qpqstatus)) - { - ConnStatusType cst; - /* PQstatus Returns the status of the connection. The status can be - CONNECTION_OK or CONNECTION_BAD. - ConnStatusType PQstatus(PGconn *conn) - */ - switch ((cst = PQstatus (P))) - { - case CONNECTION_OK: return Qpg_connection_ok; - case CONNECTION_BAD: return Qpg_connection_bad; -#ifdef HAVE_POSTGRESQLV7 - case CONNECTION_STARTED: return Qpg_connection_started; - case CONNECTION_MADE: return Qpg_connection_made; - case CONNECTION_AWAITING_RESPONSE: return Qpg_connection_awaiting_response; - case CONNECTION_AUTH_OK: return Qpg_connection_auth_ok; - case CONNECTION_SETENV: return Qpg_connection_setenv; -#endif /* HAVE_POSTGRESQLV7 */ - default: - /* they've added a new field we don't know about */ - signal_ferror (Qprocess_error, "Help! Unknown connection status code %08x from backend!", cst); - } - } - else if (EQ (field, Qpqerrormessage)) - /* PQerrorMessage Returns the error message most recently generated - by an operation on the connection. - char *PQerrorMessage(PGconn* conn); - */ - return build_ext_string (PQerrorMessage(P), PG_OS_CODING); - else if (EQ (field, Qpqbackendpid)) - /* PQbackendPID Returns the process ID of the backend server handling - this connection. - int PQbackendPID(PGconn *conn); - */ - return make_int (PQbackendPID(P)); - else - signal_error (Qinvalid_argument, "bad PGconn accessor", Qunbound); -} - -/* Query functions */ -DEFUN ("pq-exec", Fpq_exec, 2, 2, 0, /* -Submit a query to Postgres and wait for the result. -*/ - (conn, query)) -{ - PGconn *P; - Lisp_PGresult *lisp_pgresult; - PGresult *R; - char *c_query; - - CHECK_PGCONN (conn); - CHECK_STRING (query); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - TO_EXTERNAL_FORMAT (LISP_STRING, query, - C_STRING_ALLOCA, c_query, Qnative); - - R = PQexec (P, c_query); - { - char *tag, buf[BLCKSZ]; - - if (!R) out_of_memory ("query: out of memory", Qunbound); - else - switch (PQresultStatus (R)) - { - case PGRES_BAD_RESPONSE: - tag = "bad response [%s]"; - goto err; - case PGRES_NONFATAL_ERROR: - tag = "non-fatal error [%s]"; - goto err; - case PGRES_FATAL_ERROR: - tag = "fatal error [%s]"; -err: - strncpy (buf, PQresultErrorMessage (R), sizeof (buf)); - buf [sizeof (buf) - 1] = '\0'; - PQclear (R); - signal_ferror (Qprocess_error, tag, buf); - /*NOTREACHED*/ - default: - break; - } - } - - lisp_pgresult = allocate_pgresult (); - lisp_pgresult->pgresult = R; - - return make_pgresult (lisp_pgresult); -} - -DEFUN ("pq-send-query", Fpq_send_query, 2, 2, 0, /* -Submit a query to Postgres and don't wait for the result. -Returns: t if successfully submitted - nil if error (conn->errorMessage is set) -*/ - (conn, query)) -{ - PGconn *P; - char *c_query; - - CHECK_PGCONN (conn); - CHECK_STRING (query); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - TO_EXTERNAL_FORMAT (LISP_STRING, query, - C_STRING_ALLOCA, c_query, Qnative); - - if (PQsendQuery (P, c_query)) return Qt; - else signal_ferror (Qprocess_error, "async query: %s", PQerrorMessage (P)); -} - -DEFUN ("pq-get-result", Fpq_get_result, 1, 1, 0, /* -Retrieve an asynchronous result from a query. -NIL is returned when no more query work remains. -*/ - (conn)) -{ - PGconn *P; - Lisp_PGresult *lisp_pgresult; - PGresult *R; - - CHECK_PGCONN (conn); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - R = PQgetResult (P); - if (!R) return Qnil; /* not an error, there's no more data to get */ - - { - char *tag, buf[BLCKSZ]; - - switch (PQresultStatus (R)) - { - case PGRES_BAD_RESPONSE: - tag = "bad response [%s]"; - goto err; - case PGRES_NONFATAL_ERROR: - tag = "non-fatal error [%s]"; - goto err; - case PGRES_FATAL_ERROR: - tag = "fatal error [%s]"; -err: - strncpy (buf, PQresultErrorMessage (R), sizeof (buf)); - buf[sizeof (buf) - 1] = '\0'; - PQclear (R); - signal_ferror (Qprocess_error, tag, buf); - /*NOTREACHED*/ - default: - break; - } - } - - lisp_pgresult = allocate_pgresult(); - lisp_pgresult->pgresult = R; - - return make_pgresult (lisp_pgresult); -} - -DEFUN ("pq-result-status", Fpq_result_status, 1, 1, 0, /* -Return result status of the query. -*/ - (result)) -{ - PGresult *R; - ExecStatusType est; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - switch ((est = PQresultStatus (R))) { - case PGRES_EMPTY_QUERY: return Qpgres_empty_query; - case PGRES_COMMAND_OK: return Qpgres_command_ok; - case PGRES_TUPLES_OK: return Qpgres_tuples_ok; - case PGRES_COPY_OUT: return Qpgres_copy_out; - case PGRES_COPY_IN: return Qpgres_copy_in; - case PGRES_BAD_RESPONSE: return Qpgres_bad_response; - case PGRES_NONFATAL_ERROR: return Qpgres_nonfatal_error; - case PGRES_FATAL_ERROR: return Qpgres_fatal_error; - default: - /* they've added a new field we don't know about */ - signal_ferror (Qprocess_error, "Help! Unknown exec status code %08x from backend!", est); - } -} - -DEFUN ("pq-res-status", Fpq_res_status, 1, 1, 0, /* -Return stringified result status of the query. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQresStatus (PQresultStatus (R)), PG_OS_CODING); -} - -/* Sundry PGresult accessor functions */ -DEFUN ("pq-result-error-message", Fpq_result_error_message, 1, 1, 0, /* -Return last message associated with the query. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQresultErrorMessage (R), PG_OS_CODING); -} - -DEFUN ("pq-ntuples", Fpq_ntuples, 1, 1, 0, /* -Return the number of tuples (instances) in the query result. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQntuples (R)); -} - -DEFUN ("pq-nfields", Fpq_nfields, 1, 1, 0, /* -Return the number of fields (attributes) in each tuple of the query result. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQnfields (R)); -} - -DEFUN ("pq-binary-tuples", Fpq_binary_tuples, 1, 1, 0, /* -Return t if the query result contains binary data, nil otherwise. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return (PQbinaryTuples (R)) ? Qt : Qnil; -} - -DEFUN ("pq-fname", Fpq_fname, 2, 2, 0, /* -Return the field (attribute) name associated with the given field index. -Field indices start at 0. -*/ - (result, field_index)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (field_index); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQfname (R, XINT (field_index)), PG_OS_CODING); -} - -DEFUN ("pq-fnumber", Fpq_fnumber, 2, 2, 0, /* -Return the number of fields (attributes) in each tuple of the query result. -*/ - (result, field_name)) -{ - PGresult *R; - char *c_field_name; - - CHECK_PGRESULT (result); - CHECK_STRING (field_name); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - TO_EXTERNAL_FORMAT (LISP_STRING, field_name, - C_STRING_ALLOCA, c_field_name, Qnative); - - return make_int (PQfnumber (R, c_field_name)); -} - -DEFUN ("pq-ftype", Fpq_ftype, 2, 2, 0, /* -Return the field type associated with the given field index. -The integer returned is the internal coding of the type. Field indices -start at 0. -*/ - (result, field_num)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (field_num); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQftype (R, XINT (field_num))); -} - -DEFUN ("pq-fsize", Fpq_fsize, 2, 2, 0, /* -Return the field size in bytes associated with the given field index. -Field indices start at 0. -*/ - (result, field_index)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (field_index); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQftype (R, XINT (field_index))); -} - -DEFUN ("pq-fmod", Fpq_fmod, 2, 2, 0, /* -Return the type modifier associated with a field. -Field indices start at 0. -*/ - (result, field_index)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (field_index); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQfmod (R, XINT (field_index))); -} - -DEFUN ("pq-get-value", Fpq_get_value, 3, 3, 0, /* -Return a single field (attribute) value of one tuple of a PGresult. -Tuple and field indices start at 0. -*/ - (result, tup_num, field_num)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (tup_num); - CHECK_INT (field_num); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQgetvalue (R, XINT (tup_num), XINT (field_num)), - PG_OS_CODING); -} - -DEFUN ("pq-get-length", Fpq_get_length, 3, 3, 0, /* -Returns the length of a field value in bytes. -If result is binary, i.e. a result of a binary portal, then the -length returned does NOT include the size field of the varlena. (The -data returned by PQgetvalue doesn't either.) -*/ - (result, tup_num, field_num)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (tup_num); - CHECK_INT (field_num); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return make_int (PQgetlength (R, XINT (tup_num), XINT (field_num))); -} - -DEFUN ("pq-get-is-null", Fpq_get_is_null, 3, 3, 0, /* -Returns the null status of a field value. -*/ - (result, tup_num, field_num)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - CHECK_INT (tup_num); - CHECK_INT (field_num); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return PQgetisnull (R, XINT (tup_num), XINT (field_num)) ? Qt : Qnil; -} - -DEFUN ("pq-cmd-status", Fpq_cmd_status, 1, 1, 0, /* -Returns the command status string from the SQL command that generated the result. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQcmdStatus (R), PG_OS_CODING); -} - -DEFUN ("pq-cmd-tuples", Fpq_cmd_tuples, 1, 1, 0, /* -Returns the number of rows affected by the SQL command. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - - return build_ext_string (PQcmdTuples (R), PG_OS_CODING); -} - -DEFUN ("pq-oid-value", Fpq_oid_value, 1, 1, 0, /* -Returns the object id of the tuple inserted. -*/ - (result)) -{ - PGresult *R; - - CHECK_PGRESULT (result); - R = (XPGRESULT (result))->pgresult; - PUKE_IF_NULL (R); - -#ifdef HAVE_POSTGRESQLV7 - return make_int (PQoidValue (R)); -#else - /* Use the old interface */ - return make_int (atoi (PQoidStatus (R))); -#endif -} - -#ifdef HAVE_POSTGRESQLV7 -DEFUN ("pq-set-nonblocking", Fpq_set_nonblocking, 2, 2, 0, /* -Sets the PGconn's database connection non-blocking if the arg is TRUE -or makes it non-blocking if the arg is FALSE, this will not protect -you from PQexec(), you'll only be safe when using the non-blocking API. - -Needs to be called only on a connected database connection. -*/ - (conn, arg)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return make_int (PQsetnonblocking (P, !NILP (arg))); -} - -DEFUN ("pq-is-nonblocking", Fpq_is_nonblocking, 1, 1, 0, /* -Return the blocking status of the database connection. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return PQisnonblocking (P) ? Qt : Qnil; -} - -DEFUN ("pq-flush", Fpq_flush, 1, 1, 0, /* -Force the write buffer to be written (or at least try). -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return make_int (PQflush (P)); -} -#endif - -DEFUN ("pq-notifies", Fpq_notifies, 1, 1, 0, /* -Return the latest async notification that has not yet been handled. -If there has been a notification, then a list of two elements will be returned. -The first element contains the relation name being notified, the second -element contains the backend process ID number. nil is returned if there -aren't any notifications to process. -*/ - (conn)) -{ - /* This function cannot GC */ - PGconn *P; - PGnotify *PGN; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - PGN = PQnotifies (P); - if (!PGN) - return Qnil; - else - { - Lisp_Object temp; - - temp = list2 (build_ext_string (PGN->relname, PG_OS_CODING), make_int (PGN->be_pid)); - free ((void *)PGN); - return temp; - } -} - -#if defined (HAVE_POSTGRESQLV7) && defined(MULE) -DEFUN ("pq-env-2-encoding", Fpq_env_2_encoding, 0, 0, 0, /* -Get encoding id from environment variable PGCLIENTENCODING. -*/ - ()) -{ - return make_int (PQenv2encoding ()); -} -#endif /* MULE */ - -DEFUN ("pq-lo-import", Fpq_lo_import, 2, 2, 0, /* -*/ - (conn, filename)) -{ - PGconn *P; - char *c_filename; - - CHECK_PGCONN (conn); - CHECK_STRING (filename); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, - Qfile_name); - - return make_int ((int)lo_import (P, c_filename)); -} - -DEFUN ("pq-lo-export", Fpq_lo_export, 3, 3, 0, /* -*/ - (conn, oid, filename)) -{ - PGconn *P; - char *c_filename; - - CHECK_PGCONN (conn); - CHECK_INT (oid); - CHECK_STRING (filename); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - TO_EXTERNAL_FORMAT (LISP_STRING, filename, - C_STRING_ALLOCA, c_filename, Qfile_name); - - return make_int ((int)lo_export (P, XINT (oid), c_filename)); -} - -DEFUN ("pq-make-empty-pgresult", Fpq_make_empty_pgresult, 2, 2, 0, /* -Make an empty PGresult object with the given status. -*/ - (conn, status)) -{ - PGconn *P; - Lisp_PGresult *lpgr; - PGresult *R; - ExecStatusType est; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); /* needed here? */ - - if (EQ (status, Qpgres_empty_query)) est = PGRES_EMPTY_QUERY; - else if (EQ (status, Qpgres_command_ok)) est = PGRES_COMMAND_OK; - else if (EQ (status, Qpgres_tuples_ok)) est = PGRES_TUPLES_OK; - else if (EQ (status, Qpgres_copy_out)) est = PGRES_COPY_OUT; - else if (EQ (status, Qpgres_copy_in)) est = PGRES_COPY_IN; - else if (EQ (status, Qpgres_bad_response)) est = PGRES_BAD_RESPONSE; - else if (EQ (status, Qpgres_nonfatal_error)) est = PGRES_NONFATAL_ERROR; - else if (EQ (status, Qpgres_fatal_error)) est = PGRES_FATAL_ERROR; - else invalid_constant ("bad status symbol", status); - - R = PQmakeEmptyPGresult (P, est); - if (!R) out_of_memory (0, Qunbound); - - lpgr = allocate_pgresult (); - lpgr->pgresult = R; - - return make_pgresult (lpgr); -} - -DEFUN ("pq-get-line", Fpq_get_line, 1, 1, 0, /* -Retrieve a line from server in copy in operation. -The return value is a dotted pair where the cons cell is an integer code: - -1: Copying is complete - 0: A record is complete - 1: A record is incomplete, it will be continued in the next `pq-get-line' - operation. -and the cdr cell is returned string data. - -The copy operation is complete when the value `\.' (backslash dot) is -returned. -*/ - (conn)) -{ - char buffer[BLCKSZ]; /* size of a Postgres disk block */ - PGconn *P; - int ret; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - ret = PQgetline (P, buffer, sizeof (buffer)); - - return Fcons (make_int (ret), build_ext_string (buffer, PG_OS_CODING)); -} - -DEFUN ("pq-put-line", Fpq_put_line, 2, 2, 0, /* -Send a line to the server in copy out operation. - -Returns t if the operation succeeded, nil otherwise. -*/ - (conn, string)) -{ - PGconn *P; - char *c_string; - - CHECK_PGCONN (conn); - CHECK_STRING (string); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, string, - C_STRING_ALLOCA, c_string, Qnative); - - return !PQputline (P, c_string) ? Qt : Qnil; -} - -DEFUN ("pq-get-line-async", Fpq_get_line_async, 1, 1, 0, /* -Get a line from the server in copy in operation asynchronously. - -This routine is for applications that want to do "COPY to stdout" -asynchronously, that is without blocking. Having issued the COPY command -and gotten a PGRES_COPY_OUT response, the app should call PQconsumeInput -and this routine until the end-of-data signal is detected. Unlike -PQgetline, this routine takes responsibility for detecting end-of-data. - -On each call, PQgetlineAsync will return data if a complete newline- -terminated data line is available in libpq's input buffer, or if the -incoming data line is too long to fit in the buffer offered by the caller. -Otherwise, no data is returned until the rest of the line arrives. - -If -1 is returned, the end-of-data signal has been recognized (and removed -from libpq's input buffer). The caller *must* next call PQendcopy and -then return to normal processing. - -RETURNS: - -1 if the end-of-copy-data marker has been recognized - 0 if no data is available - >0 the number of bytes returned. -The data returned will not extend beyond a newline character. If possible -a whole line will be returned at one time. But if the buffer offered by -the caller is too small to hold a line sent by the backend, then a partial -data line will be returned. This can be detected by testing whether the -last returned byte is '\n' or not. -The returned string is *not* null-terminated. -*/ - (conn)) -{ - PGconn *P; - char buffer[BLCKSZ]; - int ret; - - CHECK_PGCONN (conn); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - ret = PQgetlineAsync (P, buffer, sizeof (buffer)); - - if (ret == -1) return Qt; /* done! */ - else if (!ret) return Qnil; /* no data yet */ - else return Fcons (make_int (ret), - make_ext_string ((Extbyte *) buffer, ret, PG_OS_CODING)); -} - -DEFUN ("pq-put-nbytes", Fpq_put_nbytes, 2, 2, 0, /* -Asynchronous copy out. -*/ - (conn, data)) -{ - /* NULs are not allowed. I don't think this matters at this time. */ - PGconn *P; - char *c_data; - - CHECK_PGCONN (conn); - CHECK_STRING (data); - - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - TO_EXTERNAL_FORMAT (LISP_STRING, data, - C_STRING_ALLOCA, c_data, Qnative); - - return !PQputnbytes (P, c_data, strlen (c_data)) ? Qt : Qnil; -} - -DEFUN ("pq-end-copy", Fpq_end_copy, 1, 1, 0, /* -End a copying operation. -*/ - (conn)) -{ - PGconn *P; - - CHECK_PGCONN (conn); - P = (XPGCONN (conn))->pgconn; - CHECK_LIVE_CONNECTION (P); - - return PQendcopy (P) ? Qt : Qnil; -} - -void -syms_of_postgresql(void) -{ -#ifndef RUNNING_XEMACS_21_1 - INIT_LRECORD_IMPLEMENTATION (pgconn); - INIT_LRECORD_IMPLEMENTATION (pgresult); -#endif - DEFSYMBOL (Qpostgresql); - - /* opaque exported types */ - DEFSYMBOL (Qpgconnp); - DEFSYMBOL (Qpgresultp); - - /* connection status types */ - defsymbol (&Qpg_connection_ok, "pg::connection-ok"); - defsymbol (&Qpg_connection_bad, "pg::connection-bad"); - defsymbol (&Qpg_connection_started, "pg::connection-started"); - defsymbol (&Qpg_connection_made, "pg::connection-made"); - defsymbol (&Qpg_connection_awaiting_response, "pg::connection-awaiting-response"); - defsymbol (&Qpg_connection_auth_ok, "pg::connection-auth-ok"); - defsymbol (&Qpg_connection_setenv, "pg::connection-setenv"); - - /* Fields of PGconn */ - defsymbol (&Qpqdb, "pq::db"); - defsymbol (&Qpquser, "pq::user"); - defsymbol (&Qpqpass, "pq::pass"); - defsymbol (&Qpqhost, "pq::host"); - defsymbol (&Qpqport, "pq::port"); - defsymbol (&Qpqtty, "pq::tty"); - defsymbol (&Qpqoptions, "pq::options"); - defsymbol (&Qpqstatus, "pq::status"); - defsymbol (&Qpqerrormessage, "pq::error-message"); - defsymbol (&Qpqbackendpid, "pq::backend-pid"); - - /* Query status results */ - defsymbol (&Qpgres_empty_query, "pgres::empty-query"); - defsymbol (&Qpgres_command_ok, "pgres::command-ok"); - defsymbol (&Qpgres_tuples_ok, "pgres::tuples-ok"); - defsymbol (&Qpgres_copy_out, "pgres::copy-out"); - defsymbol (&Qpgres_copy_in, "pgres::copy-in"); - defsymbol (&Qpgres_bad_response, "pgres::bad-response"); - defsymbol (&Qpgres_nonfatal_error, "pgres::nonfatal-error"); - defsymbol (&Qpgres_fatal_error, "pgres::fatal-error"); - - /* Poll status results */ - defsymbol (&Qpgres_polling_failed, "pgres::polling-failed"); - defsymbol (&Qpgres_polling_reading, "pgres::polling-reading"); - defsymbol (&Qpgres_polling_writing, "pgres::polling-writing"); - defsymbol (&Qpgres_polling_ok, "pgres::polling-ok"); - defsymbol (&Qpgres_polling_active, "pgres::polling-active"); - -#ifdef HAVE_POSTGRESQLV7 - DEFSUBR (Fpq_connect_start); - DEFSUBR (Fpq_connect_poll); -#ifdef MULE - DEFSUBR (Fpq_client_encoding); - DEFSUBR (Fpq_set_client_encoding); -#endif /* MULE */ -#endif /* HAVE_POSTGRESQLV7 */ - DEFSUBR (Fpq_conn_defaults); - DEFSUBR (Fpq_connectdb); - DEFSUBR (Fpq_finish); - DEFSUBR (Fpq_clear); - DEFSUBR (Fpq_is_busy); - DEFSUBR (Fpq_consume_input); - - DEFSUBR (Fpq_reset); -#ifdef HAVE_POSTGRESQLV7 - DEFSUBR (Fpq_reset_start); - DEFSUBR (Fpq_reset_poll); -#endif - DEFSUBR (Fpq_request_cancel); - DEFSUBR (Fpq_pgconn); - - DEFSUBR (Fpq_exec); - DEFSUBR (Fpq_send_query); - DEFSUBR (Fpq_get_result); - DEFSUBR (Fpq_result_status); - DEFSUBR (Fpq_res_status); - DEFSUBR (Fpq_result_error_message); - DEFSUBR (Fpq_ntuples); - DEFSUBR (Fpq_nfields); - DEFSUBR (Fpq_binary_tuples); - DEFSUBR (Fpq_fname); - DEFSUBR (Fpq_fnumber); - DEFSUBR (Fpq_ftype); - DEFSUBR (Fpq_fsize); - DEFSUBR (Fpq_fmod); - /***/ - DEFSUBR (Fpq_get_value); - DEFSUBR (Fpq_get_length); - DEFSUBR (Fpq_get_is_null); - DEFSUBR (Fpq_cmd_status); - DEFSUBR (Fpq_cmd_tuples); - DEFSUBR (Fpq_oid_value); - -#ifdef HAVE_POSTGRESQLV7 - DEFSUBR (Fpq_set_nonblocking); - DEFSUBR (Fpq_is_nonblocking); - DEFSUBR (Fpq_flush); -#endif - DEFSUBR (Fpq_notifies); - -#if defined (HAVE_POSTGRESQLV7) && defined(MULE) - DEFSUBR (Fpq_env_2_encoding); -#endif - - DEFSUBR (Fpq_lo_import); - DEFSUBR (Fpq_lo_export); - - DEFSUBR (Fpq_make_empty_pgresult); - - /* copy in/out functions */ - DEFSUBR (Fpq_get_line); - DEFSUBR (Fpq_put_line); - DEFSUBR (Fpq_get_line_async); - DEFSUBR (Fpq_put_nbytes); - DEFSUBR (Fpq_end_copy); -} - -void -vars_of_postgresql(void) -{ - Fprovide (Qpostgresql); -#ifdef HAVE_POSTGRESQLV7 - Fprovide (intern ("postgresqlv7")); -#endif -#ifndef RUNNING_XEMACS_21_1 - Vpg_coding_system = Qnative; - DEFVAR_LISP ("pg-coding-system", &Vpg_coding_system /* -Default Postgres client coding system. -*/ ); -#endif - - DEFVAR_LISP ("pg:host", &VXPGHOST /* -Default PostgreSQL server name. -If not set, the server running on the local host is used. The -initial value is set from the PGHOST environment variable. -*/ ); - - DEFVAR_LISP ("pg:user", &VXPGUSER /* -Default PostgreSQL user name. -This value is used when connecting to a database for authentication. -The initial value is set from the PGUSER environment variable. -*/ ); - - DEFVAR_LISP ("pg:options", &VXPGOPTIONS /* -Default PostgreSQL user name. -This value is used when connecting to a database for authentication. -The initial value is set from the PGUSER environment variable. -*/ ); - - DEFVAR_LISP ("pg:port", &VXPGPORT /* -Default port to connect to PostgreSQL backend. -This value is used when connecting to a database. -The initial value is set from the PGPORT environment variable. -*/ ); - - DEFVAR_LISP ("pg:tty", &VXPGTTY /* -Default debugging TTY. -There is no useful setting of this variable in the XEmacs Lisp API. -The initial value is set from the PGTTY environment variable. -*/ ); - - DEFVAR_LISP ("pg:database", &VXPGDATABASE /* -Default database to connect to. -The initial value is set from the PGDATABASE environment variable. -*/ ); - - DEFVAR_LISP ("pg:realm", &VXPGREALM /* -Default kerberos realm to use for authentication. -The initial value is set from the PGREALM environment variable. -*/ ); - -#ifdef MULE - /* It's not clear whether this is any use. My intent is to - autodetect the coding system from the database. */ - DEFVAR_LISP ("pg:client-encoding", &VXPGCLIENTENCODING /* -Default client encoding to use. -The initial value is set from the PGCLIENTENCODING environment variable. -*/ ); -#endif - -#if !defined(HAVE_POSTGRESQLV7) - DEFVAR_LISP ("pg:authtype", &VXPGAUTHTYPE /* -Default authentication to use. -The initial value is set from the PGAUTHTYPE environment variable. - -WARNING: This variable has gone away in versions of PostgreSQL newer -than 6.5. -*/ ); -#endif - - DEFVAR_LISP ("pg:geqo", &VXPGGEQO /* -Genetic Query Optimizer options. -The initial value is set from the PGGEQO environment variable. -*/ ); - - DEFVAR_LISP ("pg:cost-index", &VXPGCOSTINDEX /* -Default cost index options. -The initial value is set from the PGCOSTINDEX environment variable. -*/ ); - - DEFVAR_LISP ("pg:cost-heap", &VXPGCOSTHEAP /* -Default cost heap options. -The initial value is set from the PGCOSTHEAP environment variable. -*/ ); - - DEFVAR_LISP ("pg:tz", &VXPGTZ /* -Default timezone to use. -The initial value is set from the PGTZ environment variable. -*/ ); - - DEFVAR_LISP ("pg:date-style", &VXPGDATESTYLE /* -Default date style to use. -The initial value is set from the PGDATESTYLE environment variable. -*/ ); -} - -/* These initializations should not be done at dump-time. */ -void -init_postgresql_from_environment (void) -{ - Ibyte *p; - -#define FROB(envvar, var) \ - if ((p = egetenv (envvar))) \ - var = build_intstring (p); \ - else \ - var = Qnil - - if (initialized) - { - FROB ("PGHOST", VXPGHOST); - FROB ("PGUSER", VXPGUSER); - FROB ("PGOPTIONS", VXPGOPTIONS); - - if ((p = egetenv ("PGPORT"))) - VXPGPORT = make_int (atoi ((char *) p)); - else - VXPGPORT = Qnil; - - FROB ("PGTTY", VXPGTTY); - FROB ("PGDATABASE", VXPGDATABASE); - FROB ("PGREALM", VXPGREALM); -#ifdef MULE - /* It's not clear whether this is any use. My intent is to - autodetect the coding system from the database. */ - FROB ("PGCLIENTENCODING", VXPGCLIENTENCODING); -#endif - -#if !defined(HAVE_POSTGRESQLV7) - FROB ("PGAUTHTYPE", VXPGAUTHTYPE); -#endif - - FROB ("PGGEQO", VXPGGEQO); - FROB ("PGCOSTINDEX", VXPGCOSTINDEX); - FROB ("PGCOSTHEAP", VXPGCOSTHEAP); - FROB ("PGTZ", VXPGTZ); - FROB ("PGDATESTYLE", VXPGDATESTYLE); -#undef FROB - } -} - diff -r 4575a219af58 -r 25e260cb7994 src/postgresql.h --- a/src/postgresql.h Mon Sep 09 21:53:43 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - postgresql.h -- Emacs Lisp binding to libpq.so - Copyright (C) 2000 Electrotechnical Laboratory, JAPAN. - Licensed to the Free Software Foundation. - - Author: SL Baur - Maintainer: SL Baur - -Please send patches to this file to me first before submitting them to -xemacs-patches. -*/ - -#ifndef INCLUDED_postgresql_h_ -#define INCLUDED_postgresql_h_ 1 - -#define message message_ /* Yuck */ -#include LIBPQ_FE_H_FILE /* main PostgreSQL header file */ -#undef message - -#define BLCKSZ 8192 /* size of a default Postgres disk block */ -/* - This file contains the GCC bug workaround code for the private - LRECORD types. -*/ - -/* PGconn is an opaque object and we need to be able to store them in - Lisp code because libpq supports multiple connections. -*/ -struct Lisp_PGconn -{ - struct lcrecord_header header; - PGconn *pgconn; -}; -typedef struct Lisp_PGconn Lisp_PGconn; - -DECLARE_LRECORD (pgconn, Lisp_PGconn); - -#define XPGCONN(x) XRECORD (x, pgconn, Lisp_PGconn) -#define wrap_pgconn(p) wrap_record (p, pgconn) -#define PGCONNP(x) RECORDP (x, pgconn) -#define CHECK_PGCONN(x) CHECK_RECORD (x, pgconn) -#define CONCHECK_PGCONN(x) CONCHECK_RECORD (x, pgconn) - -/****/ - -/* PGresult is an opaque object and we need to be able to store them in - Lisp code. -*/ -struct Lisp_PGresult -{ - struct lcrecord_header header; - PGresult *pgresult; -}; -typedef struct Lisp_PGresult Lisp_PGresult; - -DECLARE_LRECORD (pgresult, Lisp_PGresult); - -#define XPGRESULT(x) XRECORD (x, pgresult, Lisp_PGresult) -#define wrap_pgresult(p) wrap_record (p, pgresult) -#define PGRESULTP(x) RECORDP (x, pgresult) -#define CHECK_PGRESULT(x) CHECK_RECORD (x, pgresult) -#define CONCHECK_PGRESULT(x) CONCHECK_RECORD (x, pgresult) - -#endif /* INCLUDED_postgresql_h_ */ diff -r 4575a219af58 -r 25e260cb7994 src/symbols.c --- a/src/symbols.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/symbols.c Tue Sep 10 15:27:39 2002 +0000 @@ -603,8 +603,12 @@ invalid_change ("Use `set-specifier' to change a specifier's value", sym); - if (symbol_is_constant (sym, val) - || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym))) + if ( +#ifdef HAVE_SHLIB +!(unloading_module && UNBOUNDP(newval)) && +#endif + (symbol_is_constant (sym, val) + || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym)))) signal_error_1 (Qsetting_constant, UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); } @@ -1807,12 +1811,41 @@ goto retry; case SYMVAL_FIXNUM_FORWARD: + case SYMVAL_CONST_FIXNUM_FORWARD: case SYMVAL_BOOLEAN_FORWARD: - case SYMVAL_OBJECT_FORWARD: + case SYMVAL_CONST_BOOLEAN_FORWARD: case SYMVAL_DEFAULT_BUFFER_FORWARD: case SYMVAL_DEFAULT_CONSOLE_FORWARD: if (UNBOUNDP (newval)) - invalid_change ("Cannot makunbound", symbol); + { +#ifdef HAVE_SHLIB + if (unloading_module) + { + sym->value = newval; + return newval; + } + else +#endif + invalid_change ("Cannot makunbound", symbol); + } + break; + + case SYMVAL_OBJECT_FORWARD: + case SYMVAL_CONST_OBJECT_FORWARD: + if (UNBOUNDP (newval)) + { +#ifdef HAVE_SHLIB + if (unloading_module) + { + unstaticpro_nodump (symbol_value_forward_forward + (XSYMBOL_VALUE_FORWARD (valcontents))); + sym->value = newval; + return newval; + } + else +#endif + invalid_change ("Cannot makunbound", symbol); + } break; /* case SYMVAL_UNBOUND_MARKER: break; */ @@ -3501,6 +3534,12 @@ fun = wrap_subr (subr); XSYMBOL (sym)->function = fun; + +#ifdef HAVE_SHLIB + /* If it is declared in a module, update the load history */ + if (initialized) + LOADHIST_ATTACH (sym); +#endif } /* Define a lisp macro using a Lisp_Subr. */ @@ -3515,6 +3554,12 @@ fun = wrap_subr (subr); XSYMBOL (sym)->function = Fcons (Qmacro, fun); + +#ifdef HAVE_SHLIB + /* If it is declared in a module, update the load history */ + if (initialized) + LOADHIST_ATTACH (sym); +#endif } static void @@ -3655,14 +3700,17 @@ { Lisp_Object sym; -#if defined(HAVE_SHLIB) +#ifdef HAVE_SHLIB /* * As with defsubr(), this will only be called in a dumped Emacs when * we are adding variables from a dynamically loaded module. That means * we can't use purespace. Take that into account. */ if (initialized) - sym = Fintern (build_string (symbol_name), Qnil); + { + sym = Fintern (build_string (symbol_name), Qnil); + LOADHIST_ATTACH (sym); + } else #endif sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name,