More debug-logging for loading fontsets
[notion/jeffpc.git] / system-autodetect.mk
blob5cdfc46637477dc94d6f33eaf27793b8b5862787
1 ##
2 ## System settings
3 ##
5 ##
6 ## Installation paths
7 ##
9 # Installation path prefix. Unless you know what you're doing, the default
10 # of /usr/local is likely the correct choice.
11 #DIST: PREFIX=/usr/local
12 PREFIX=/usr/local
14 # Unless you are creating a package conforming to some OS's standards, you
15 # probably do not want to modify the following directories:
17 # Main binaries
18 BINDIR=$(PREFIX)/bin
19 # Configuration .lua files
20 ETCDIR=$(PREFIX)/etc/notion
21 # Some .lua files and ion-* shell scripts
22 SHAREDIR=$(PREFIX)/share/notion
23 # Manual pages
24 MANDIR=$(PREFIX)/share/man
25 # Some documents
26 DOCDIR=$(PREFIX)/share/doc/notion
27 # Nothing at the moment
28 INCDIR=$(PREFIX)/include/notion
29 # Nothing at the moment
30 LIBDIR=$(PREFIX)/lib
31 # Modules
32 MODULEDIR=$(LIBDIR)/notion/mod
33 # Compiled Lua source code
34 LCDIR=$(LIBDIR)/notion/lc
35 # ion-completefile (does not belong in SHAREDIR being a binary file)
36 EXTRABINDIR=$(LIBDIR)/notion/bin
37 # For notion-completeman system-wide cache
38 VARDIR=/var/cache/notion
39 # Message catalogs
40 LOCALEDIR=$(PREFIX)/share/locale
42 # Executable suffix (for Cygwin).
43 #BIN_SUFFIX = .exe
47 ## Modules
50 # Set PRELOAD_MODULES=1 if your system does not support dynamically loaded
51 # modules through 'libdl' or has non-standard naming conventions.
52 # You will likely need this option on e.g. Cygwin and Mac OS X.
53 #PRELOAD_MODULES=1
55 # Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
56 # setting (for e.g. Lua, when not instructed by pkg-config).
57 DL_LIBS=-ldl
61 ## Lua
64 # To skip auto-detection of lua uncomment this and edit the variables below to
65 # suit your installation of lua.
66 #LUA_MANUAL=1
68 # Default to paths and names that should work for a build installed from the
69 # official Lua 5.1 source tarball.
70 LUA_DIR=/usr/local
71 LUA_LIBS=-L$(LUA_DIR)/lib -llua
72 LUA_INCLUDES = -I$(LUA_DIR)/include
74 ifneq ($(shell which lua),)
75 LUA=$(LUA_DIR)/bin/lua
76 LUAC=$(LUA_DIR)/bin/luac
77 endif
79 # Attempt to autodect lua using pkg-config.
81 ifndef LUA_MANUAL
83 # lua libraries and includes:
85 ifeq (5.2,$(findstring 5.2,$(shell pkg-config --exists lua5.2 && pkg-config --modversion lua5.2)))
86 ifneq ($(shell which lua5.2),)
87 HAS_LUA52=true
88 HAS_LUA=true
89 endif
90 endif
92 ifeq (5.1,$(findstring 5.1,$(shell pkg-config --exists lua5.1 && pkg-config --modversion lua5.1)))
93 ifneq ($(shell which lua5.1),)
94 HAS_LUA51=true
95 HAS_LUA=true
96 endif
97 endif
99 ifeq (5.1,$(findstring 5.1,$(shell pkg-config --exists lua && pkg-config --modversion lua)))
100 ifneq ($(shell which lua),)
101 HAS_LUA=true
102 endif
103 endif
105 ifdef HAS_LUA52
107 LUA_LIBS=`pkg-config --libs lua5.2`
108 LUA_INCLUDES=`pkg-config --cflags lua5.2`
109 LUA=`which lua5.2`
110 LUAC=`which luac5.2`
112 else ifdef HAS_LUA51
114 LUA_LIBS=`pkg-config --libs lua5.1`
115 LUA_INCLUDES=`pkg-config --cflags lua5.1`
116 LUA=`which lua5.1`
117 LUAC=`which luac5.1`
119 else ifdef HAS_LUA
121 LUA_LIBS=`pkg-config --libs lua`
122 LUA_INCLUDES=`pkg-config --cflags lua`
123 LUA=`which lua`
124 LUAC=`which luac`
126 endif # lua
128 endif # lua manual
131 ## X libraries, includes and options
134 # Paths
135 X11_PREFIX=/usr/X11R6
136 # SunOS/Solaris
137 #X11_PREFIX=/usr/openwin
139 X11_LIBS=-L$(X11_PREFIX)/lib -lX11 -lXext
140 X11_INCLUDES=-I$(X11_PREFIX)/include
142 # XFree86 libraries up to 4.3.0 have a bug that can cause a segfault.
143 # The following setting should work around that situation.
144 DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
146 # Use the Xutf8 routines (XFree86 extension) instead of the Xmb routines
147 # in an UTF-8 locale. (No, you don't need this in UTF-8 locales, and
148 # most likely don't even want. It's only there because both Xmb and
149 # Xutf8 routines are broken, in different ways.)
150 #DEFINES += -DCF_DE_USE_XUTF8
152 # Remap F11 key to SunF36 and F12 to SunF37? You may want to set this
153 # on SunOS.
154 #DEFINES += -DCF_SUN_F1X_REMAP
158 ## Localisation
161 # If you're on an archaic system (such as relatively recent *BSD releases)
162 # without even dummy multibyte/widechar and localisation support, you may
163 # have to uncomment the following line:
164 #DEFINES += -DCF_NO_LOCALE -DCF_NO_GETTEXT
166 # On some other systems you may need to explicitly link against libintl.
167 #EXTRA_LIBS += -lintl
168 # You may also need to give the location of its headers. The following
169 # should work on Mac OS X (which needs the above option as well) with
170 # macports.
171 #EXTRA_INCLUDES += -I/opt/local/include
175 ## libc
178 # You may uncomment this if you know that your system C libary provides
179 # asprintf and vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
180 # defined, an implementation provided in libtu/sprintf_2.2/ is used.
181 HAS_SYSTEM_ASPRINTF=1
183 # The following setting is needed with GNU libc for clock_gettime and the
184 # monotonic clock. Other systems may not need it, or may not provide a
185 # monotonic clock at all (which Ion can live with, and usually detect).
186 EXTRA_LIBS += -lrt
188 # Cygwin needs this.
189 #DEFINES += -DCF_NO_GETLOADAVG
193 # If you're using/have gcc, it is unlikely that you need to modify
194 # any of the settings below this line.
196 #####################################################################
200 ## C compiler.
203 CC=gcc
205 # Same as '-Wall -pedantic' without '-Wunused' as callbacks often
206 # have unused variables.
207 WARN= -W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
208 -Wtrigraphs -Wformat -Wchar-subscripts \
209 -Wparentheses -pedantic -Wuninitialized
211 CFLAGS=-Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -DHAS_SYSTEM_ASPRINTF=$(HAS_SYSTEM_ASPRINTF)
213 LDFLAGS=-Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
214 EXPORT_DYNAMIC=-Xlinker --export-dynamic
216 # The following options are mainly for development use and can be used
217 # to check that the code seems to conform to some standards. Depending
218 # on the version and vendor of you libc, the options may or may not have
219 # expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
220 # may also have to define the other.
222 #C89_SOURCE=-ansi
224 POSIX_SOURCE=-D_POSIX_C_SOURCE=200112L
226 # Most systems
227 #XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
228 # SunOS, (Irix)
229 #XOPEN_SOURCE=-D__EXTENSIONS__
231 #C99_SOURCE=-std=c99 -DCF_HAS_VA_COPY
233 # The -DCF_HAS_VA_COPY option should allow for some optimisations, and
234 # in some cases simply defining
235 #C99_SOURCE=-DCF_HAS_VA_COPY
236 # might allow for those optimisations to be taken without any special
237 # libc or compiler options.
241 ## make depend
244 DEPEND_FILE=.depend
245 DO_MAKE_DEPEND=$(CC) -MM $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
246 MAKE_DEPEND=$(DO_MAKE_DEPEND) $(SOURCES) > $(DEPEND_FILE)
250 ## AR
253 AR=ar
254 ARFLAGS=cr
255 RANLIB=ranlib
259 ## Install & strip
262 INSTALL=sh $(TOPDIR)/install-sh -c
263 INSTALL_STRIP=-s
264 INSTALLDIR=mkdir -p
266 BIN_MODE=755
267 DATA_MODE=644
269 RM=rm
273 ## Debugging
276 INSTALL_STRIP =
277 CFLAGS += -g
279 ifeq ($(PRELOAD_MODULES),1)
280 X11_LIBS += -lXinerama -lXrandr
281 endif