Index: configure.in =================================================================== RCS file: /cvsroot/squid/squid3/configure.in,v retrieving revision 1.31 diff -u -p -r1.31 configure.in --- configure.in 23 Apr 2003 02:14:19 -0000 1.31 +++ configure.in 26 Apr 2003 19:00:20 -0000 @@ -1240,6 +1240,16 @@ AC_ARG_ENABLE(mempools, fi ]) +dnl Enable WIN32 Service compile mode +AC_ARG_ENABLE(win32-service, +[ --enable-win32-service Compile Squid as a WIN32 Service + Works only on Windows NT and Windows 2000 Platforms.], +[ if test "$enableval" = "yes" ; then + echo "Enabling WIN32 run service mode" + AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode]) + fi +]) + SAMBASOURCES='$(top_srcdir)/include/samba' AC_ARG_WITH(samba-sources, Index: src/main.cc =================================================================== RCS file: /cvsroot/squid/squid3/src/main.cc,v retrieving revision 1.21 diff -u -p -r1.21 main.cc --- src/main.cc 26 Apr 2003 02:14:04 -0000 1.21 +++ src/main.cc 26 Apr 2003 19:00:21 -0000 @@ -99,15 +99,27 @@ static void usage(void) { fprintf(stderr, +#if USE_WIN32_SERVICE + "Usage: %s [-dhirsvzCDFNRVYX] [-f config-file] [-[au] port] [-k signal] [-n name] [-O CommandLine]\n" +#else "Usage: %s [-dhsvzCDFNRVYX] [-f config-file] [-[au] port] [-k signal]\n" +#endif " -a port Specify HTTP port number (default: %d).\n" " -d level Write debugging to stderr also.\n" " -f file Use given config-file instead of\n" " %s\n" " -h Print help message.\n" +#if USE_WIN32_SERVICE + " -i Installs as a Windows Service (see -n option).\n" +#endif " -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse\n" " Parse configuration file, then send signal to \n" " running copy (except -k parse) and exit.\n" +#if USE_WIN32_SERVICE + " -n name Specify Windows Service name to use for service operations\n" + " default is: " _WIN_SQUID_DEFAULT_SERVICE_NAME ".\n" + " -r Removes a Windows Service (see -n option).\n" +#endif " -s Enable logging to syslog.\n" " -u port Specify ICP port number (default: %d), disable with 0.\n" " -v Print version.\n" @@ -116,6 +128,10 @@ usage(void) " -D Disable initial DNS tests.\n" " -F Don't serve any requests until store is rebuilt.\n" " -N No daemon mode.\n" +#if USE_WIN32_SERVICE + " -O options\n" + " Set Windows Service Command line options in Registry.\n" +#endif " -R Do not set REUSEADDR on port.\n" " -S Double-check swap during rebuild.\n" " -V Virtual host httpd-accelerator.\n" @@ -131,7 +147,14 @@ mainParseOptions(int argc, char *argv[]) extern char *optarg; int c; +#if USE_WIN32_SERVICE + + while ((c = getopt(argc, argv, "CDFNO:RSVYXa:d:f:hik:m::n:rsu:vz?")) != -1) { +#else + while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hk:m::su:vz?")) != -1) { +#endif + switch (c) { case 'C': @@ -149,6 +172,13 @@ mainParseOptions(int argc, char *argv[]) case 'N': opt_no_daemon = 1; break; +#if USE_WIN32_SERVICE + + case 'O': + opt_command_line = 1; + WIN32_Command_Line = xstrdup(optarg); + break; +#endif case 'R': opt_reuseaddr = 0; @@ -185,6 +215,12 @@ mainParseOptions(int argc, char *argv[]) opt_reload_hit_only = 1; break; +#if USE_WIN32_SERVICE + + case 'i': + opt_install_service = TRUE; + break; +#endif case 'a': add_http_port(optarg); @@ -272,6 +308,24 @@ mainParseOptions(int argc, char *argv[]) #endif } + +#if USE_WIN32_SERVICE + + case 'n': + xfree(WIN32_Service_name); + + WIN32_Service_name = xstrdup(optarg); + + opt_signal_service = TRUE; + + break; + + case 'r': + opt_remove_service = TRUE; + + break; + +#endif case 's': #if HAVE_SYSLOG