-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
273 lines (232 loc) · 5.21 KB
/
configure.in
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# AC_PREREQ(2.61)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE
AM_CONDITIONAL([am__fastdepOBJC], false)
AM_CONDITIONAL([am__fastdepCXX], false)
AC_CANONICAL_HOST
dnl Include gmake Check related definitions
builtin(include,src/confdb/check_gnu_make.m4)
#
dnl Include zlib Check related definitions
builtin(include,src/confdb/ax_check_zlib.m4)
#
dnl Include pkg-config Check
builtin(include,src/confdb/pkg.m4)
#
AC_CONFIG_SRCDIR([src/programs/VIEWER/kemoviewer_glfw_gtk.c])
# AC_CONFIG_HEADER([config.h])
AC_ARG_ENABLE(cocoa,
[ --enable-cocoa Use Cocoa framework],[USE_Cocoa='yes'],[USE_Cocoa='no'])
AC_MSG_RESULT(enable-cocoa... "${USE_Cocoa}")
USE_gl='yes'
USE_gtk='yes'
USE_glfw='yes'
USE_libpng='yes'
with_zlib='yes'
# Checks for programs.
AC_PROG_CC
AC_PROG_FC
if test -z ${FC}
then
FC=${F77}
else
F77=${FC}
fi
if test -z ${AR}
then
ar_bin="ar"
else
ar_bin="${AR}"
fi
AC_SUBST(ar_bin)
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_MSG_RESULT(RANLIB... "${RANLIB}")
#GNU make check
CHECK_GNU_MAKE()
GMAKE=$_cv_gnu_make_command
AC_SUBST(GMAKE)
AC_MSG_RESULT(GNU MAKE... "${GMAKE}")
# libtool check
PKG_PROG_PKG_CONFIG
# Checks using C compiler
AC_LANG_SAVE
AC_LANG(C)
AC_LANG_RESTORE
# Checks using Fortran Compiler
AC_LANG_SAVE
AC_LANG(Fortran)
AC_LANG_RESTORE
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor memset sqrt strrchr strtol])
# Check zlib
if test ${with_zlib} != "no"
then
PKG_CHECK_MODULES([ZLIB], zlib, have_zlib=yes, AC_MSG_ERROR(Cannot find zlib))
echo "have_zlib=$have_zlib"
if test ${have_zlib} = "yes"
then
PKGFLAGS_ZLIB="z"
else
AX_CHECK_ZLIB
if test -n "${LIBS}"
then
ZLIB_CFLAGS="${CPPFLAGS}"
ZLIB_LIBS="${LDFLAGS} ${LIBS}"
fi
fi
AC_SUBST(PKGFLAGS_ZLIB)
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
fi
# Check libpng
if test ${USE_libpng} = "yes"
then
PKG_CHECK_MODULES([PNG], libpng, have_libpng=yes, AC_MSG_ERROR(Cannot find libpng))
echo "have_libpng=$have_libpng"
fi
if test ${have_libpng} = "yes"
then
PKGFLAGS_PNG="png"
else
PKGFLAGS_PNG=""
PNG_CFLAGS=""
PNG_LIBS=""
fi
AC_SUBST(PKGFLAGS_PNG)
AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)
# Checks for Xwindow
AC_PATH_X
AC_PATH_XTRA
X_LIBS="${X_LIBS} -lX11"
AC_SUBST(X_LIBS)
AC_SUBST(X_CFLAGS)
# Checks for Cocoa framework
if test ${USE_Cocoa} = "yes"
then
X_LIBS="-L/usr/X11/lib -lX11"
AC_SUBST(X_LIBS)
USE_gl = "yes"
GL_LIBS="-framework OpenGL -framework CoreVideo -framework IOKit -framework Cocoa"
GL_INC="-I/usr/X11/include"
COCOA_FLAG="-D__APPLE__"
else
COCOA_FLAG=""
# Checks for OpenGL
if test ${USE_gl} = "yes"
then
PKG_CHECK_MODULES([GL], gl, have_gl=yes, AC_MSG_ERROR(Cannot find OpenGL))
echo "have_gl=$have_gl"
fi
if test ${have_gl} = "yes"
then
PKGFLAGS_GL="OpenGL"
else
PKGFLAGS_GL=""
fi
fi
AC_SUBST(COCOA_FLAG)
AC_SUBST(PKGFLAGS_GL)
AC_SUBST(GL_LIBS)
AC_SUBST(GL_INC)
if test -n "${GL_LIBS}"
then
# Check GTK+3
if test ${USE_gtk} = "yes"
then
PKG_CHECK_MODULES([GTK3], gtk+-3.0, have_gtk=yes, AC_MSG_ERROR(Cannot find GTK+ 3.0))
echo "have_gtk=$have_gtk"
fi
if test ${have_gtk} = "yes"
then
PKGFLAGS_GTK="gtk+-3.0"
else
PKGFLAGS_GTK=""
fi
else
CXX=""
PKGFLAGS_GTK=""
GTK3_CFLAGS=""
GTK3_LIBS=""
fi
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
AC_SUBST(PKGFLAGS_GTK)
AC_SUBST(GTK3_CFLAGS)
AC_SUBST(GTK3_LIBS)
if test -n "${GTK3_LIBS}"
then
# Check GLFW3
if test ${USE_glfw} = "yes"
then
PKG_CHECK_MODULES([GLFW], glfw3, have_glfw=yes, AC_MSG_ERROR(Cannot find GLFW))
fi
if test ${have_glfw} = "yes"
then
PKGFLAGS_GLFW="glfw-3"
else
PKGFLAGS_GLFW=""
fi
else
PKGFLAGS_GLFW=""
GLFW_CFLAGS=""
GLFW_LIBS=""
fi
AC_SUBST(PKGFLAGS_GTK)
AC_SUBST(GTK3_CFLAGS)
AC_SUBST(GTK3_LIBS)
AC_SUBST(PKGFLAGS_GLFW)
AC_SUBST(GLFW_CFLAGS)
AC_SUBST(GLFW_LIBS)
AC_MSG_RESULT()
AC_MSG_RESULT(----- Configuration summary -------------------------------)
AC_MSG_RESULT()
AC_MSG_RESULT( host: "${host}")
AC_MSG_RESULT()
if test -n "${COCOA_FLAG}"; then
AC_MSG_RESULT( Use Cocoa... yes)
else
AC_MSG_RESULT( Use Cocoa... no)
fi
if test -n "${X_LIBS}"; then
AC_MSG_RESULT( Use X Window... yes)
else
AC_MSG_RESULT( Use X Window... no)
fi
AC_MSG_RESULT()
if test -n "${ZLIB_LIBS}"; then
AC_MSG_RESULT( Use zlib ... yes)
else
AC_MSG_RESULT( Use zlib ... no)
fi
if test -n "${PNG_LIBS}"; then
AC_MSG_RESULT( Use PNG output... yes)
else
AC_MSG_RESULT( Use PNG output... no)
fi
AC_MSG_RESULT()
if test -n "${GTK3_LIBS}"; then
AC_MSG_RESULT( Use GTK3+... yes)
else
AC_MSG_RESULT( Use GTK3+... no)
fi
if test -n "${GLFW_LIBS}"; then
AC_MSG_RESULT( Use GLFW... yes)
else
AC_MSG_RESULT( Use GLFW... no)
fi
AC_MSG_RESULT()
AC_MSG_RESULT(---------------------------------------------------------------)
AC_MSG_RESULT()
AC_CONFIG_FILES([Makefile])
AC_OUTPUT