File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,28 @@ CC ?= gcc
2
2
AR ?= ar
3
3
RANLIB ?= ranlib
4
4
CFLAGS ?= -g -Wall -O3 -Wsign-compare
5
- LIBS = -lcurl - lm -lz
5
+ LIBS = -lm -lz
6
6
EXTRA_CFLAGS_PIC = -fpic
7
7
LDFLAGS =
8
8
LDLIBS =
9
9
INCLUDES =
10
10
11
+ # Create a simple test-program to check if gcc can compile with curl
12
+ tmpfile: =$(shell mktemp --suffix=.c)
13
+ $(file >$(tmpfile),# include <curl/curl.h>)
14
+ $(file >>$(tmpfile),int main() { return 0; })
15
+ HAVE_CURL: =$(shell $(CC ) $(CFLAGS ) $(EXTRA_CFLAGS_PIC ) $(LIBS ) -lcurl $(tmpfile ) -o /dev/null >/dev/null 2>&1 && echo "YES")
16
+ $(shell rm $(tmpfile))
17
+
18
+ ifeq ($(HAVE_CURL ) ,YES)
19
+ # If yes, add the library
20
+ LIBS += -lcurl
21
+ else
22
+ # and if not, disable CURL specific code compilation
23
+ CFLAGS += -DNOCURL
24
+ endif
25
+
26
+
11
27
prefix = /usr/local
12
28
includedir = $(prefix ) /include
13
29
libdir = $(exec_prefix ) /lib
You can’t perform that action at this time.
0 commit comments