From 6ec526e706483cd2de6c8de4bafa885522a782cd Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Tue, 1 Dec 2009 19:58:32 -0800 Subject: [PATCH] remove #if BUILD_HTTPD Add httpd_stubs.c to provide no-op implementations of httpd_start() and httpd_stop(). Allows these routines to be called unconditionally and ensures the libocdserver ABI remains unchanged regardless of whether this feature was built-in or not. Prints a DEBUG message when the stub implementation is included. --- configure.in | 6 ------ src/openocd.c | 4 ---- src/server/Makefile.am | 1 + src/server/httpd_stubs.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/server/httpd_stubs.c diff --git a/configure.in b/configure.in index 1a4299d30a..9cb2b0f5ae 100644 --- a/configure.in +++ b/configure.in @@ -614,12 +614,6 @@ else AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.]) fi -if test $build_httpd = yes; then - AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.]) -else - AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.]) -fi - if test $build_at91rm9200 = yes; then build_bitbang=yes AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.]) diff --git a/src/openocd.c b/src/openocd.c index 1f45837270..9a080191e4 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -244,10 +244,8 @@ int openocd_main(int argc, char *argv[]) if (ret != ERROR_OK) return EXIT_FAILURE; -#if BUILD_HTTPD if (httpd_start(cmd_ctx) != ERROR_OK) return EXIT_FAILURE; -#endif ret = server_init(cmd_ctx); if (ERROR_OK != ret) @@ -266,9 +264,7 @@ int openocd_main(int argc, char *argv[]) server_quit(); -#if BUILD_HTTPD httpd_stop(); -#endif unregister_all_commands(cmd_ctx, NULL); diff --git a/src/server/Makefile.am b/src/server/Makefile.am index b47b8d09e3..989a682ce3 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -14,6 +14,7 @@ libserver_la_SOURCES = server.c telnet_server.c gdb_server.c if HTTPD libserver_la_SOURCES += httpd.c else +libserver_la_SOURCES += httpd_stubs.c if !ECOSBOARD libserver_la_SOURCES += server_stubs.c endif diff --git a/src/server/httpd_stubs.c b/src/server/httpd_stubs.c new file mode 100644 index 0000000000..0a63362c6b --- /dev/null +++ b/src/server/httpd_stubs.c @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2009 Zachary T Welch * + * * + * This program 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 of the License, or * + * (at your option) any later version. * + * * + * This program 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 this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "httpd.h" + +int httpd_start(struct command_context *cmd_ctx) +{ + LOG_DEBUG("libocdserver was built without HTTPD support"); + return ERROR_OK; +} +void httpd_stop(void) +{ +} -- 2.30.2