forked from lc-soft/LCUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
executable file
·220 lines (196 loc) · 6.97 KB
/
configure.ac
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# 具体用法,可参考Automake的中文文档:
# http://www.linuxforum.net/books/autoconf.html
# 也可以到这看英文版的:
# http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/index.html
AC_PREREQ([2.68])
AC_INIT(LCUI, 0.12.6, [email protected])
# Check system type
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([include/LCUI_Build.h])
AC_CONFIG_HEADERS([config.h])
# Make --enable-silent-rules the default.
# To get verbose build output you may configure
# with --disable-silent-rules or use "make V=1".
# 默认情况下,是 Make --enable-silent-rules, 也就是启用无声规则,make时输出的是精简的信息。
# 要获得详细的编译输出,你可以在运行configurue时加上--disable-silent-rules参数或使用"make V=1".
AM_SILENT_RULES([yes])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
# Checks for libraries.
# 检测LCUI所依赖的库是否存在并且能正常使用
want_iconv=no
AC_ARG_WITH(iconv, [ --with-iconv use libiconv (default)])
if test "x$with_iconv" != "xno"; then
AC_CHECK_LIB([iconv], [iconv_open], want_iconv=yes, want_iconv=no)
if test "x$want_iconv" != "xno"; then
ICONV_LIBS=-liconv
AC_SUBST(ICONV_LIBS)
fi
fi
##检测是否启用线程支持
want_thread=no
thread_name=pthread
AC_ARG_WITH(pthread, [ --with-pthread use pthread (default)])
if test "x$with_pthread" != "xno"; then
AC_CHECK_LIB([pthread], [pthread_create], want_thread=yes, want_thread=no)
if test "x$want_thread" != "xno"; then
THREAD_LIBS=-lpthread
AC_CHECK_HEADERS([pthread.h],want_thread=yes,want_thread=no)
AC_SUBST(THREAD_LIBS)
fi
fi
##检测是否有freetype库
want_freetype=no
AC_ARG_WITH(freetype, [ --with-freetype use freetype (default)])
if test "x$with_freetype" != "xno"; then
AC_CHECK_LIB([freetype], [FT_Init_FreeType], want_freetype=yes, want_freetype=no)
if test "x$want_freetype" != "xno"; then
FREETYPE_LIBS=-lfreetype
AC_CHECK_HEADERS([ft2build.h],want_freetype=yes,want_freetype=no)
AC_SUBST(FREETYPE_LIBS)
fi
fi
## 检测图形输出设备
want_graph_display=yes
graph_output_dev="framebuffer"
AC_ARG_ENABLE(graph-display, AC_HELP_STRING([--enable-graph-display],
[turn on graph display [[default=yes]]]), want_graph_display=$enableval)
if test $want_graph_display = "yes"; then
AC_CHECK_HEADERS([linux/fb.h],
[graph_output_dev="framebuffer"], [graph_output_dev="none"])
else
want_graph_display=no
graph_output_dev=none
fi
want_ts=no
AC_ARG_WITH(ts, [ --with-ts use tslib (default)])
if test "x$with_ts" != "xno"; then
AC_CHECK_LIB([ts], [ts_open], want_ts=yes, want_ts=no)
if test "x$want_ts" != "xno"; then
TS_LIBS=-lts
AC_SUBST(TS_LIBS)
fi
fi
want_png=no
AC_ARG_WITH(png, [ --with-png use libpng (default)])
if test "x$with_png" != "xno"; then
AC_CHECK_LIB([png], [png_sig_cmp],want_png=yes,want_png=no)
if test "x$want_png" != "xno"; then
PNG_LIBS=-lpng
AC_CHECK_HEADERS([png.h],want_png=yes,want_png=no)
AC_SUBST(PNG_LIBS)
fi
fi
want_jpeg=no
AC_ARG_WITH(jpeg, [ --with-jpeg use libjpeg (default)])
if test "x$with_jpeg" != "xno"; then
AC_CHECK_LIB([jpeg], [jpeg_start_decompress],want_jpeg=yes,want_jpeg=no)
if test "x$want_jpeg" != "xno"; then
JPEG_LIBS=-ljpeg
AC_CHECK_HEADERS([jpeglib.h setjmp.h],want_jpeg=yes,want_jpeg=no)
AC_SUBST(JPEG_LIBS)
fi
fi
# DEBUG option
# 调试选项,如果需要对项目进行调试,可启用调试选项
want_debug=no
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
[turn on debugging [[default=no]]]), want_debug=$enableval)
if test "$want_debug" = "yes"; then
CFLAGS="-O2 -g -Wall -D _GNU_SOURCE"
CXXFLAG="-O2 -g -Wall -D _GNU_SOURCE"
AC_MSG_RESULT(yes)
else
CFLAGS="-O2 -Wall -D _GNU_SOURCE"
CXXFLAGS="-O2 -Wall -D _GNU_SOURCE"
AC_MSG_RESULT(no)
fi
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h memory.h stddef.h stdlib.h string.h strings.h sys/ioctl.h termio.h unistd.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_STDBOOL
AC_C_RESTRICT
AC_TYPE_UINT32_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset munmap select strcasecmp sysinfo])
#根据之前的检测结果,定义相应宏
if test "$want_png" = "yes"; then
AC_DEFINE_UNQUOTED(USE_LIBPNG, 1, Define to 1 if you have the libpng)
fi
if test "$want_jpeg" = "yes"; then
AC_DEFINE_UNQUOTED(USE_LIBJPEG, 1, Define to 1 if you have the libjpeg)
fi
if test "$want_ts" = "yes"; then
AC_DEFINE_UNQUOTED(USE_TSLIB, 1, Define to 1 if you have the tslib)
fi
if test "$want_freetype" = "yes"; then
AC_DEFINE_UNQUOTED(USE_FREETYPE, 1, Define to 1 if you have the FreeType font engine)
fi
if test "$want_iconv" = "yes"; then
AC_DEFINE_UNQUOTED(USE_LIBICONV, 1, Define to 1 if you have the libiconv)
fi
if test "$want_thread" = "yes"; then
if test "$thread_name" = "pthread"; then
AC_DEFINE_UNQUOTED(USE_PTHREAD, 1, Define to 1 if you select pthread for thread support)
else
thread_name=none
fi
else
thread_name=none
fi
if test "$want_graph_display" = "yes"; then
if test "$graph_output_dev" = "framebuffer"; then
AC_DEFINE_UNQUOTED(GRAPH_OUTPUT_USE_FRAMEBUFFER, 1, Define to 1 if you select FrameBuffer for graph display support)
else
AC_DEFINE_UNQUOTED(GRAPH_OUTPUT_USE_DUMMY, 1, Define to 1 if you disable graph display support)
graph_output_dev=none
fi
else
AC_DEFINE_UNQUOTED(GRAPH_OUTPUT_USE_DUMMY, 1, Define to 1 if you disable graph display support)
graph_output_dev=none
fi
##输出文件
AC_OUTPUT([Makefile
lcui.pc
include/Makefile
include/LCUI/Makefile
src/Makefile
src/font/Makefile
src/font/in-core/Makefile
src/draw/Makefile
src/draw/in-core/Makefile
src/thread/Makefile
src/bmp/Makefile
src/misc/Makefile
src/input/Makefile
src/output/Makefile
src/widget/Makefile
test/Makefile
test/mora/Makefile
test/photoviewer/Makefile
test/clock/Makefile
test/screenlock/Makefile])
echo
echo
echo -e "Build with tslib support ............. : $want_ts"
echo -e "Build with libpng support ............ : $want_png"
echo -e "Build with libjpeg support ........... : $want_jpeg"
echo -e "Build with libiconv support .......... : $want_iconv"
echo -e "Build with freetype support .......... : $want_freetype"
echo -e "Build with thread support ............ : $thread_name"
echo -e "Build with graph display support ..... : $graph_output_dev"
echo