summaryrefslogtreecommitdiff
path: root/makefiledir/Makefile.libdetection
blob: a5160a309b2f9657dc0712758001a4365a2d368f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# this file detects what OS and libs the computer have/are running

ifndef CONFIG_VERSION
CONFIG_VERSION:=0
endif

ifeq ($(shell expr $(CONFIG_VERSION) \< 9), 1)

ifndef BYPASS_OS_DETECT

# Automatically recognize if building on Win32
ifdef WINDIR
ifndef UNIX
WIN32:=1
CYGWIN:=1
MINGW:=1
STATIC:=1
SKIP_STATIC_CHECK:=1
endif
else
UNIX:=1
endif

# Automatically recognize if building on FreeBSD
ifeq ($(shell uname),FreeBSD)
FREEBSD:=1
endif

# Automatically recognize if building on MacOSX
ifeq ($(shell uname), Darwin)
OSX:=1
# OSX uses the unix setup too
UNIX:=1
endif

# Automatically recognize if building on MorphOS
ifeq ($(shell uname), MorphOS)
MORPHOS:=1
# MorphOS uses UNIX setup too
UNIX:=1
endif

# Automatically recognize if building on BeOS
ifeq ($(shell uname), BeOS)
BEOS:=1
# BeOS uses UNIX setup too
UNIX:=1
# Except that in BeOS 5.0 we need to use net_server, not BONE networking
ifeq ($(shell uname -r), 5.0)
BEOS_NET_SERVER:=1
endif
endif

# Automatically recognize if building on SunOS/Solaris
ifeq ($(shell uname), SunOS)
SUNOS:=1
# SunOS uses UNIX setup too
UNIX:=1
endif

# END BYPASS_OS_DETECT
endif

SDL_CONFIG:=sdl-config

# set libpng-config to the default value
LIBPNG_CONFIG :=libpng-config

# set freetype-config to the default value
FREETYPE_CONFIG:=freetype-config

# Networking, enabled by default
WITH_NETWORK:=1

# Library detections
WITH_SDL:=$(shell $(SDL_CONFIG) --version 2>/dev/null)

# libpng detection
WITH_PNG:=$(shell $(LIBPNG_CONFIG) --version 2>/dev/null)

# Freetype detection
WITH_FREETYPE:=$(shell $(FREETYPE_CONFIG) --ftversion 2>/dev/null)

ifdef WITH_PNG
	# LibPNG depends on Zlib
	WITH_ZLIB:=1
else
# We go looking for zlib with a little hack
WITH_ZLIB:=$(shell ls /usr/include | grep "zlib.h" 2>/dev/null) \
$(shell ls /usr/local/include | grep "zlib.h" 2>/dev/null)
ifdef WITH_ZLIB
WITH_ZLIB:=1
endif
endif

ifdef WITH_ZLIB
	TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a")
	ifdef TEMP
		STATIC_ZLIB_PATH:=/lib/$(TEMP)
	else
		TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
		ifdef TEMP
			STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
		else
			TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
			ifdef TEMP
				STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
			endif
		endif
	endif
endif

# sets the default paths
ifdef UNIX
ifndef OSX
ifndef MORPHOS
ifndef BIN_DIR
#BINARY_DIR:=
#DATA_DIR_PREFIX:=
#INSTALL_DIR:=/usr/local/
#USE_HOMEDIR:=
endif
endif
endif
endif

ifdef OSX
# we prefer to use cocoa drivers rather than SDL drivers
# if you really want SDL drivers, you can always modify Makefile.config
ifndef DEDICATED
WITH_COCOA:=1
WITH_SDL:=
endif
endif


# workaround
# cygwin have problems with libpng, so we will just disable it for now until the problem is solved
ifdef CYGWIN
WITH_PNG:=
endif

endif