src/Makefile.am: build static lib for unit tests if enabled

This commit is contained in:
Kamil Dudka 2013-05-03 23:03:58 +02:00
parent 2de20dd9a1
commit 683f2b8323
3 changed files with 21 additions and 2 deletions

View file

@ -66,6 +66,14 @@ curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)
curl_DEPENDENCIES = $(top_builddir)/lib/libcurl.la
# if unit tests are enabled, build a static library to link them with
if BUILD_UNITTESTS
noinst_LTLIBRARIES = libcurltool.la
libcurltool_la_CFLAGS = -DUNITTESTS
libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
libcurltool_la_SOURCES = $(curl_SOURCES)
endif
BUILT_SOURCES = tool_hugehelp.c
CLEANFILES = tool_hugehelp.c
# Use the C locale to ensure that only ASCII characters appear in the

View file

@ -55,6 +55,9 @@
int vms_show = 0;
#endif
/* if we build a static library for unit tests, there is no main() function */
#ifndef UNITTESTS
/*
* Ensure that file descriptors 0, 1 and 2 (stdin, stdout, stderr) are
* open before starting to run. Otherwise, the first three network
@ -118,3 +121,4 @@ int main(int argc, char *argv[])
#endif
}
#endif /* ndef UNITTESTS */