-
Notifications
You must be signed in to change notification settings - Fork 13
/
configure.in
executable file
·244 lines (210 loc) · 5.31 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_HEADERS([src/newt_core/incs/NewtConf.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_LEX
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
#
AC_CANONICAL_SYSTEM
case "$target_os" in
freebsd*)
export LDFLAGS=-L/usr/local/lib
export CPPFLAGS=-I/usr/local/include
;;
esac
# Checks for libraries.
AC_SEARCH_LIBS(iconv_open, iconv)
test "$ac_cv_search" != "no" && AC_DEFINE(HAVE_LIBICONV)
HAVE_DLOPEN='no'
AC_MSG_CHECKING(checking for dlopen)
AC_TRY_LINK([
#include <dlfcn.h>
], [
void * install_call;
void * lib;
lib = dlopen("", RTLD_LAZY);
install_call = dlsym(lib, "");
dlclose(lib);
],
HAVE_DLOPEN='yes',
SAVE_LIBS="$LIBS"
LIBS="$LIBS -ldl"
AC_TRY_LINK([
#include <dlfcn.h>
], [
void * install_call;
void * lib;
lib = dlopen("", RTLD_LAZY);
install_call = dlsym(lib, "");
dlclose(lib);
],
HAVE_DLOPEN='yes'
LIBDL=" -ldl")
LIBS="$SAVE_LIBS")
AC_MSG_RESULT($HAVE_DLOPEN)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h string.h unistd.h termios.h endian.h machine/endian.h gnu/lib-names.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd memchr memmove memset regcomp strcasecmp strchr strdup strncasecmp mmap chdir getpwnam])
HAVE_OBJC='no'
AC_LANG_PUSH([Objective C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [
have_objc_compiler=yes
], [
have_objc_compiler=no
])
if test "$have_objc_compiler" != "no"; then
AC_CHECK_HEADERS([Cocoa/Cocoa.h], [
AC_CHECK_HEADERS([objc/objc.h], [
AC_CHECK_HEADERS([Foundation/Foundation.h], [
HAVE_OBJC='yes'
])
])
])
fi
AC_LANG_POP([Objective C])
#
# AC_CANONICAL_SYSTEM
case "$target_os" in
darwin*)
LIBNEWT_LDSHARED='$(CC) -dynamic -bundle -undefined suppress -flat_namespace'
DLEXT='dylib'
;;
cygwin*|mingw*)
AC_DEFINE(__WIN32__)
HAVE_DLOPEN='yes'
NEWT_LDIMPORT='$(build)/libnewt.a'
NEWT_LDFLAGS='-Wl,--export-all-symbols,--out-implib=$(LDIMPORT)'
LIBNEWT_LDSHARED='$(CC) -shared'
LIBREGEX='$(LIBREGEX)'
DLEXT='dll'
;;
linux*)
NEWT_LDFLAGS='-rdynamic'
LIBNEWT_LDSHARED='$(CC) -shared'
NEWT_CFLAGS='-fPIC'
DLEXT='so'
;;
freebsd*)
NEWT_LDFLAGS='-rdynamic'
LIBNEWT_LDSHARED='$(CC) -shared'
DLEXT='so'
;;
beos*)
# NEWT_LDFLAGS='-ldl'
LIBNEWT_LDSHARED='$(CC) -nostart $(build)/_APP_'
LINK_NEWT_APP_='cd $@; ln -s newt _APP_'
DLEXT='so'
;;
*)
NEWT_LDFLAGS='-rdynamic'
LIBNEWT_LDSHARED='$(CC) -shared'
DLEXT='so'
;;
esac
case "$target_cpu" in
i586|i686)
NEWT_LDFLAGS="$NEWT_LDFLAGS"
LIBNEWT_LDSHARED="$LIBNEWT_LDSHARED"
NEWT_CFLAGS="$NEWT_CFLAGS"
;;
esac
case "$target_vendor" in
*ipod*)
AC_DEFINE(__IPOD__)
NEWT_LDFLAGS=
;;
esac
case "$HAVE_DLOPEN" in
yes)
AC_DEFINE(HAVE_DLOPEN)
MAKE_EXT='ext'
HAVE_LIBFFI='no'
AC_SEARCH_LIBS(ffi_call, ffi)
if test "$ac_cv_search" != "no"; then
AC_CHECK_HEADERS([ffi/ffi.h, ffi.h], [HAVE_LIBFFI='yes'])
fi
;;
esac
test "x$prefix" = xNONE && prefix=$ac_default_prefix
AC_ARG_WITH(sitedir,
AS_HELP_STRING([--with-sitedir=DIR],
[site libraries in DIR [[PREFIX/lib/newt0]]]),
[sitedir=$withval],
[sitedir='${prefix}/lib/newt0'])
SITE_DIR="`eval \"echo ${sitedir}\"`"
AC_ARG_ENABLE(compat,
AS_HELP_STRING([--enable-compat],
[enable compatibility with the Newton, and break many features on the desktop]),
[compat='yes'],
[compat='no'])
AC_ARG_ENABLE(contrib,
AS_HELP_STRING([--enable-contrib],
[include contrib packages (inwt, NativeCalls, and NewtObjC)]),
[
MAKE_CONTRIB='contrib'
if test "x$HAVE_LIBFFI" = "xyes"; then
MAKE_CONTRIB_LIBFFI='contrib_libffi'
fi
if test "x$HAVE_OBJC" = "xyes"; then
MAKE_CONTRIB_OBJC='contrib_objc'
fi
])
test "x$compat" = xno && AC_DEFINE(__NAMED_MAGIC_POINTER__)
AC_DEFINE_UNQUOTED(__PLATFORM__, "$target_os")
AC_DEFINE_UNQUOTED(__DYLIBSUFFIX__, ".$DLEXT")
AC_DEFINE_UNQUOTED(__LIBDIR__, "${SITE_DIR}")
NEWT_LDFLAGS="$NEWT_LDFLAGS $LIBDL"
AC_SUBST(NEWT_LDIMPORT)
AC_SUBST(NEWT_LDFLAGS)
AC_SUBST(NEWT_CFLAGS)
AC_SUBST(LIBNEWT_LDSHARED)
AC_SUBST(LINK_NEWT_APP_)
AC_SUBST(DLEXT)
AC_SUBST(MAKE_EXT)
AC_SUBST(MAKE_CONTRIB)
AC_SUBST(MAKE_CONTRIB_LIBFFI)
AC_SUBST(MAKE_CONTRIB_OBJC)
AC_SUBST(BINDIR)
AC_SUBST(sitedir)
AC_SUBST(__NAMED_MAGIC_POINTER__)
AC_SUBST(LIBREGEX)
dnl
dnl How to create static libraries
dnl
AC_PROG_RANLIB
AC_PATH_PROG(AR, ar)
if test "x$AR" = "x:"; then
AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
fi
if test "x$RANLIB" != "x:"; then
LIBCOMMAND="$AR cr"
else
LIBCOMMAND="$AR crs"
fi
AC_SUBST(LIBCOMMAND)
LIBEXT=".a"
AC_SUBST(LIBEXT)
AC_CONFIG_FILES([Makefile
ext/protoFILE/Makefile
ext/protoREGEX/Makefile
contrib/inwt/Makefile
contrib/NativeCalls/Makefile
contrib/NewtObjC/Makefile])
AC_OUTPUT