1
1
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3
dnl ***** BEGIN LICENSE BLOCK *****
4
dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
dnl The contents of this file are subject to the Mozilla Public License Version
7
dnl 1.1 (the "License"); you may not use this file except in compliance with
8
dnl the License. You may obtain a copy of the License at
9
dnl http://www.mozilla.org/MPL/
11
dnl Software distributed under the License is distributed on an "AS IS" basis,
12
dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
dnl for the specific language governing rights and limitations under the
16
dnl The Original Code is the Netscape Portable Runtime (NSPR).
18
dnl The Initial Developer of the Original Code is
19
dnl Netscape Communications Corporation.
20
dnl Portions created by the Initial Developer are Copyright (C) 1998
21
dnl the Initial Developer. All Rights Reserved.
24
dnl Christopher Seawood <cls@seawood.org>
25
dnl Howard Chu <hyc@symas.com>
26
dnl Mark Mentovai <mark@moxienet.com>
28
dnl Alternatively, the contents of this file may be used under the terms of
29
dnl either the GNU General Public License Version 2 or later (the "GPL"), or
30
dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31
dnl in which case the provisions of the GPL or the LGPL are applicable instead
32
dnl of those above. If you wish to allow use of your version of this file only
33
dnl under the terms of either the GPL or the LGPL, and not to allow others to
34
dnl use your version of this file under the terms of the MPL, indicate your
35
dnl decision by deleting the provisions above and replace them with the notice
36
dnl and other provisions required by the GPL or the LGPL. If you do not delete
37
dnl the provisions above, a recipient may use your version of this file under
38
dnl the terms of any one of the MPL, the GPL or the LGPL.
40
dnl ***** END LICENSE BLOCK *****
3
dnl This Source Code Form is subject to the terms of the Mozilla Public
4
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
43
8
AC_INIT(config/libc_r.h)
139
104
AC_ARG_WITH(android-ndk,
140
105
[ --with-android-ndk=DIR
141
location where the Android NDK can be found],
106
location where the Android NDK can be found],
142
107
android_ndk=$withval)
144
109
AC_ARG_WITH(android-toolchain,
145
110
[ --with-android-toolchain=DIR
146
location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
111
location of the Android toolchain],
147
112
android_toolchain=$withval)
114
AC_ARG_WITH(android-version,
115
[ --with-android-version=VER
116
Android platform version, default 5],
117
android_version=$withval,
149
120
AC_ARG_WITH(android-platform,
150
121
[ --with-android-platform=DIR
151
location of platform dir, default NDK/build/platforms/android-5/arch-arm],
122
location of platform dir],
152
123
android_platform=$withval)
154
125
case "$target" in
155
126
arm-linux*-android*|*-linuxandroid*)
156
127
android_tool_prefix="arm-linux-androideabi"
159
android_tool_prefix="arm-eabi"
130
android_tool_prefix="i686-android-linux"
133
android_tool_prefix="mipsel-linux-android"
162
136
android_tool_prefix="$target_os"
140
dnl ========================================================
141
dnl = Gonk is a fork of Android used for Mozilla's B2G project.
142
dnl = Configuration is done largely by the top level config
143
dnl = and the specified gonk directory doesn't matter here.
144
dnl ========================================================
147
[ --with-gonk=DIR location of gonk dir],
150
if test -n "$gonkdir" ; then
151
dnl Most things are directly configured by env vars when building for gonk
153
dnl prevent cross compile section from using these flags as host flags
154
if test -z "$HOST_CPPFLAGS" ; then
157
if test -z "$HOST_CFLAGS" ; then
160
if test -z "$HOST_CXXFLAGS" ; then
163
if test -z "$HOST_LDFLAGS" ; then
166
169
case "$target" in
167
170
*-android*|*-linuxandroid*)
168
171
if test -z "$android_ndk" ; then
172
175
if test -z "$android_toolchain" ; then
173
android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
176
AC_MSG_CHECKING([for android toolchain directory])
178
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
180
case "$target_cpu" in
182
target_name=arm-linux-androideabi-4.4.3
185
target_name=x86-4.4.3
188
target_name=mipsel-linux-android-4.4.3
191
android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
193
if test -d "$android_toolchain" ; then
194
AC_MSG_RESULT([$android_toolchain])
196
AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
176
200
if test -z "$android_platform" ; then
177
android_platform="$android_ndk"/build/platforms/android-5/arch-arm
201
AC_MSG_CHECKING([for android platform directory])
203
case "$target_cpu" in
215
android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
217
if test -d "$android_platform" ; then
218
AC_MSG_RESULT([$android_platform])
220
AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
180
224
dnl set up compilers
188
232
STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
190
234
CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
191
CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
192
CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
235
CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
236
CXXFLAGS="-mandroid -I$android_platform/usr/include -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
193
237
LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
195
239
dnl prevent cross compile section from using these flags as host flags
209
WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
211
253
AC_DEFINE(ANDROID)
254
AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
215
259
dnl ========================================================
499
543
dnl ========================================================
500
544
dnl Checks for compilers.
501
545
dnl ========================================================
502
if test "$target" != "$host"; then
547
dnl Explicitly honor $CROSS_COMPILE to allow cross-compiling
548
dnl between toolkits on the same architecture, as when
549
dnl targeting the iOS Simulator from OS X.
550
if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
503
551
echo "cross compiling from $host to $target"
504
552
cross_compiling=yes
541
589
dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
542
590
dnl checks will fail. Fake a working SDK in that case.
543
591
_SAVE_CFLAGS=$CFLAGS
544
_SAVE_CXXFLAGS=$CXXLAGS
592
_SAVE_CXXFLAGS=$CXXFLAGS
545
593
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
546
594
CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
596
*:arm*-apple-darwin*)
597
dnl The arm compiler doesn't appear to know about its root by default,
598
dnl so explicitly pass it one here. Later on we'll put this in CFLAGS
601
_SAVE_CXXFLAGS=$CXXFLAGS
602
CFLAGS="-isysroot $MACOS_SDK_DIR $CFLAGS"
603
CXXFLAGS="-isysroot $MACOS_SDK_DIR $CXXFLAGS"
550
607
AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
551
608
unset ac_cv_prog_CC
559
616
case "$build:$target" in
560
powerpc-apple-darwin8*:i?86-apple-darwin*)
617
powerpc-apple-darwin8*:i?86-apple-darwin*|*:arm*-apple-darwin*)
561
618
dnl Revert the changes made above. From this point on, the target
562
619
dnl compiler will never be used without applying the SDK to CFLAGS
563
620
dnl (see --with-macos-sdk below).
1177
1235
RESOLVE_LINK_SYMBOLS=1
1180
*-android*|*-linuxandroid*)
1181
if test -z "$USE_NSPR_THREADS"; then
1186
AC_DEFINE(_GNU_SOURCE)
1187
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1189
CFLAGS="$CFLAGS -Wall"
1190
CXXFLAGS="$CXXFLAGS -Wall"
1191
MDCPUCFG_H=_linux.cfg
1193
MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
1195
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(SONAME)'
1197
_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
1198
# combo is not yet good at debugging inlined
1199
# functions (even when using DWARF2 as the
1208
1239
AC_DEFINE(XP_BEOS)
1209
1240
AC_DEFINE(BeOS)
1748
1790
CXXFLAGS="$CXXFLAGS -Wall"
1749
1791
MDCPUCFG_H=_linux.cfg
1750
1792
PR_MD_CSRCS=linux.c
1751
MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
1793
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1752
1794
DSO_CFLAGS=-fPIC
1753
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(SONAME)'
1795
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1754
1796
_OPTIMIZE_FLAGS=-O2
1755
1797
_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
1756
1798
# combo is not yet good at debugging inlined
3135
3180
if test -n "$_WRAP_MALLOC"; then
3136
if test "$GNU_CC"; then
3137
WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
3138
DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS"
3181
if test -n "$GNU_CC"; then
3182
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
3183
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
3184
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
3185
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
3140
AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
3187
AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
3146
3193
dnl ========================================================
3147
3194
AC_ARG_WITH(wrap-malloc,
3148
3195
[ --with-wrap-malloc=SHAREDLIB Location of malloc wrapper library],
3149
WRAP_MALLOC_LIB=$withval)
3196
WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
3151
3198
dnl ========================================================
3152
3199
dnl Substitution of found variables.
3260
3306
dnl Generate output files.
3261
3307
dnl ========================================================
3273
lib/libc/include/Makefile
3274
lib/libc/src/Makefile
3278
pkg/solaris/Makefile
3279
pkg/solaris/SUNWpr/Makefile
3280
pkg/solaris/SUNWprd/Makefile
3283
pr/include/md/Makefile
3284
pr/include/obsolete/Makefile
3285
pr/include/private/Makefile
3288
pr/src/linking/Makefile
3289
pr/src/malloc/Makefile
3291
pr/src/md/${PR_MD_ARCH_DIR}/Makefile
3292
pr/src/memory/Makefile
3293
pr/src/misc/Makefile
3294
pr/src/threads/Makefile
3296
pr/tests/dll/Makefile
3319
lib/libc/include/Makefile
3320
lib/libc/src/Makefile
3325
pr/include/md/Makefile
3326
pr/include/obsolete/Makefile
3327
pr/include/private/Makefile
3330
pr/src/linking/Makefile
3331
pr/src/malloc/Makefile
3333
pr/src/md/${PR_MD_ARCH_DIR}/Makefile
3334
pr/src/memory/Makefile
3335
pr/src/misc/Makefile
3336
pr/src/threads/Makefile
3338
pr/tests/dll/Makefile
3299
dnl lib/tests/Makefile
3300
dnl pr/tests/w16gui/Makefile
3341
if test "$OS_TARGET" = "Linux"; then
3342
MAKEFILES="$MAKEFILES
3345
elif test "$OS_TARGET" = "SunOS"; then
3346
MAKEFILES="$MAKEFILES
3347
pkg/solaris/Makefile
3348
pkg/solaris/SUNWpr/Makefile
3349
pkg/solaris/SUNWprd/Makefile
3303
3353
if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
3304
MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
3354
MAKEFILES="$MAKEFILES
3355
pr/src/threads/combined/Makefile
3305
3357
elif test -n "$USE_PTHREADS"; then
3306
MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
3358
MAKEFILES="$MAKEFILES
3359
pr/src/pthreads/Makefile
3307
3361
elif test -n "$USE_BTHREADS"; then
3308
MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
3362
MAKEFILES="$MAKEFILES
3363
pr/src/bthreads/Makefile
3311
3367
if test -n "$USE_CPLUS"; then
3312
MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
3368
MAKEFILES="$MAKEFILES
3369
pr/src/cplus/Makefile
3370
pr/src/cplus/tests/Makefile
3315
3374
echo $MAKEFILES > unallmakefiles