Do not compile xmlrpc-c (and related code) when curl wasn't found

This commit is contained in:
Sanel Zukan 2009-07-06 15:10:53 +00:00
parent dfd2355c18
commit fffdfec7e7
2 changed files with 99 additions and 80 deletions

View File

@ -23,98 +23,106 @@ XMLRPC_C_FLAGS =
-I [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmltok ] ; -I [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmltok ] ;
# ede-bug-report related builds # ede-bug-report related builds
SOURCE = Bugzilla.cpp BugzillaSender.cpp PulseProgress.cpp ede-bug-report.cpp ; SOURCE = ede-bug-report.cpp ;
BINARY = ede-bug-report ; BINARY = ede-bug-report ;
# with curl compile the rest
if $(CURL_CFLAGS) || $(CURL_LIBS) {
SOURCE += Bugzilla.cpp BugzillaSender.cpp PulseProgress.cpp ;
}
ObjectC++Flags $(SOURCE) : $(WNO_LONG_LONG) $(XMLRPC_C_FLAGS) $(CURL_CFLAGS) ; ObjectC++Flags $(SOURCE) : $(WNO_LONG_LONG) $(XMLRPC_C_FLAGS) $(CURL_CFLAGS) ;
EdeProgram $(BINARY) : $(SOURCE) ; EdeProgram $(BINARY) : $(SOURCE) ;
TranslationStrings locale : $(SOURCE) ; TranslationStrings locale : $(SOURCE) ;
# link against xmlrpc-c libraries if $(CURL_CFLAGS) || $(CURL_LIBS) {
LinkAgainst $(BINARY) : -L$(XMLRPC_C_LIB_DIR) # link against xmlrpc-c libraries
-lxmlrpc_local LinkAgainst $(BINARY) : -L$(XMLRPC_C_LIB_DIR)
-lcurl_transport_local -lxmlrpc_local
-lxmlrpc_util_local -lcurl_transport_local
-lxmlrpc_obj_local -lxmlrpc_util_local
-lxmlparse_local -lxmlrpc_obj_local
-lxmltok_local -lxmlparse_local
$(CURL_LIBS) -lxmltok_local
$(PTHREAD_CFLAGS) $(CURL_LIBS)
$(PTHREAD_LIBS) ; $(PTHREAD_CFLAGS)
$(PTHREAD_LIBS) ;
# xmlrpc-c related builds # xmlrpc-c related builds
rule XmlrpcLibrary { rule XmlrpcLibrary {
local lib = [ FDirName $(XMLRPC_C_LIB_DIR) $(<) ] ; local lib = [ FDirName $(XMLRPC_C_LIB_DIR) $(<) ] ;
# compile it with OPTIMFLAGS got from top Jamconfig # compile it with OPTIMFLAGS got from top Jamconfig
ObjectCcFlags $(>) : $(XMLRPC_C_FLAGS) $(OPTIMFLAGS) ; ObjectCcFlags $(>) : $(XMLRPC_C_FLAGS) $(OPTIMFLAGS) ;
StaticLibrary $(lib) : $(>) ; StaticLibrary $(lib) : $(>) ;
# make sure libraries are build first # make sure libraries are build first
LocalDepends $(BINARY) : $(lib:S=$(SUFLIB)) ; LocalDepends $(BINARY) : $(lib:S=$(SUFLIB)) ;
} }
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) src ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) src ] ;
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps util ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps util ] ;
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps libutil ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps libutil ] ;
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps curl-transport ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps curl-transport ] ;
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmlparse ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmlparse ] ;
SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmltok ] ; SEARCH_SOURCE += [ FDirName $(XMLRPC_C_SRC_PATH) deps expat xmltok ] ;
XMLRPC_C_SRC = XMLRPC_C_SRC =
double.c double.c
parse_value.c parse_value.c
resource.c resource.c
trace.c trace.c
version.c version.c
xmlrpc_data.c xmlrpc_data.c
xmlrpc_datetime.c xmlrpc_datetime.c
xmlrpc_string.c xmlrpc_string.c
xmlrpc_array.c xmlrpc_array.c
xmlrpc_struct.c xmlrpc_struct.c
xmlrpc_build.c xmlrpc_build.c
xmlrpc_decompose.c xmlrpc_decompose.c
xmlrpc_parse.c xmlrpc_parse.c
xmlrpc_serialize.c xmlrpc_serialize.c
xmlrpc_base64.c xmlrpc_base64.c
xmlrpc_authcookie.c xmlrpc_authcookie.c
xmlrpc_client.c xmlrpc_client.c
xmlrpc_client_global.c xmlrpc_client_global.c
xmlrpc_expat.c xmlrpc_expat.c
xmlrpc_server_info.c ; xmlrpc_server_info.c ;
ObjectCcFlags $(XMLRPC_C_SRC) : -DMUST_BUILD_CURL_CLIENT ; ObjectCcFlags $(XMLRPC_C_SRC) : -DMUST_BUILD_CURL_CLIENT ;
CURL_TRANSPORT_SRC = CURL_TRANSPORT_SRC =
xmlrpc_curl_transport.c xmlrpc_curl_transport.c
curltransaction.c curltransaction.c
curlmulti.c curlmulti.c
lock_pthread.c ; lock_pthread.c ;
UTIL_SRC = UTIL_SRC =
casprintf.c casprintf.c
cmdline_parser.c cmdline_parser.c
getoptx.c getoptx.c
string_parser.c string_parser.c
stripcaseeq.c ; stripcaseeq.c ;
LIBUTIL_SRC = LIBUTIL_SRC =
asprintf.c asprintf.c
error.c error.c
make_printable.c make_printable.c
memblock.c memblock.c
select.c select.c
sleep.c sleep.c
time.c time.c
utf8.c ; utf8.c ;
XMLPARSE_SRC = xmlparse.c ; XMLPARSE_SRC = xmlparse.c ;
XMLTOK_SRC = xmltok.c xmlrole.c ; XMLTOK_SRC = xmltok.c xmlrole.c ;
XmlrpcLibrary libxmlrpc_local : $(XMLRPC_C_SRC) ; XmlrpcLibrary libxmlrpc_local : $(XMLRPC_C_SRC) ;
XmlrpcLibrary libxmlrpc_obj_local : $(UTIL_SRC) ; XmlrpcLibrary libxmlrpc_obj_local : $(UTIL_SRC) ;
XmlrpcLibrary libxmlrpc_util_local : $(LIBUTIL_SRC) ; XmlrpcLibrary libxmlrpc_util_local : $(LIBUTIL_SRC) ;
XmlrpcLibrary libxmlparse_local : $(XMLPARSE_SRC) ; XmlrpcLibrary libxmlparse_local : $(XMLPARSE_SRC) ;
XmlrpcLibrary libxmltok_local : $(XMLTOK_SRC) ; XmlrpcLibrary libxmltok_local : $(XMLTOK_SRC) ;
XmlrpcLibrary libcurl_transport_local : $(CURL_TRANSPORT_SRC) ; XmlrpcLibrary libcurl_transport_local : $(CURL_TRANSPORT_SRC) ;
} # CURL_CFLAGS || CURL_LIBS

View File

@ -31,10 +31,12 @@
#include <edelib/Regex.h> #include <edelib/Regex.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include "BugzillaSender.h" #ifdef HAVE_CURL
#include "BugzillaSender.h"
#include "BugImage.h" #include "BugImage.h"
#include "icons/bug.xpm" #include "icons/bug.xpm"
#endif
EDELIB_NS_USING(String) EDELIB_NS_USING(String)
EDELIB_NS_USING(Regex) EDELIB_NS_USING(Regex)
@ -42,6 +44,7 @@ EDELIB_NS_USING(alert)
EDELIB_NS_USING(message) EDELIB_NS_USING(message)
EDELIB_NS_USING(RX_CASELESS) EDELIB_NS_USING(RX_CASELESS)
#ifdef HAVE_CURL
static Fl_Input *bug_title_input; static Fl_Input *bug_title_input;
static Fl_Input *email_input; static Fl_Input *email_input;
static Fl_Text_Buffer *text_buf; static Fl_Text_Buffer *text_buf;
@ -125,8 +128,15 @@ static void send_cb(Fl_Widget*, void *w) {
if(bugzilla_send_with_progress(title.c_str(), content.c_str())) if(bugzilla_send_with_progress(title.c_str(), content.c_str()))
close_cb(0, w); close_cb(0, w);
} }
#endif /* HAVE_CURL */
int main(int argc, char** argv) { int main(int argc, char** argv) {
#ifndef HAVE_CURL
alert(_("ede-bug-report was compiled without cURL support.\n"
"You can install cURL either via your distribution package management system, or download "
"it from http://curl.haxx.se. After this, you'll have to recompile ede-bug-report again"));
return 1;
#else
/* in case if debugger output was given */ /* in case if debugger output was given */
const char *gdb_output = NULL; const char *gdb_output = NULL;
@ -181,4 +191,5 @@ int main(int argc, char** argv) {
/* win->show(argc, argv); */ /* win->show(argc, argv); */
win->show(); win->show();
return Fl::run(); return Fl::run();
#endif /* HAVE_CURL */
} }