1 |
# configure.in for GNUstep GUI library |
2 |
# Process this file with autoconf to produce a configure script. |
3 |
# |
4 |
# Copyright (C) 1996 Free Software Foundation, Inc. |
5 |
# |
6 |
# Author: Adam Fedor <fedor@gnu.org> |
7 |
# |
8 |
# This file is part of the GNUstep GUI frontend (AppKit). |
9 |
# |
10 |
# This library is free software; you can redistribute it and/or |
11 |
# modify it under the terms of the GNU Library General Public |
12 |
# License as published by the Free Software Foundation; either |
13 |
# version 2 of the License, or (at your option) any later version. |
14 |
# |
15 |
# This library is distributed in the hope that it will be useful, |
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 |
# Library General Public License for more details. |
19 |
# |
20 |
# You should have received a copy of the GNU Library General Public |
21 |
# License along with this library; see the file COPYING.LIB. |
22 |
# If not, write to the Free Software Foundation, |
23 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
24 |
# |
25 |
AC_INIT |
26 |
AC_CONFIG_SRCDIR([Source/NSApplication.m]) |
27 |
|
28 |
if test -z "$GNUSTEP_SYSTEM_ROOT"; then |
29 |
AC_MSG_ERROR([You must run the GNUstep initialization script first!]) |
30 |
fi |
31 |
|
32 |
#-------------------------------------------------------------------- |
33 |
# Use config.guess, config.sub and install-sh provided by gnustep-make |
34 |
#-------------------------------------------------------------------- |
35 |
AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES) |
36 |
|
37 |
AC_CONFIG_HEADER(Headers/Additions/GNUstepGUI/config.h) |
38 |
|
39 |
#-------------------------------------------------------------------- |
40 |
# Determine the host, build, and target systems |
41 |
#-------------------------------------------------------------------- |
42 |
AC_CANONICAL_TARGET([]) |
43 |
|
44 |
#-------------------------------------------------------------------- |
45 |
# Add target OS directories as necessary |
46 |
#-------------------------------------------------------------------- |
47 |
ADDITIONAL_INCLUDE_DIRS="$CPPFLAGS" |
48 |
ADDITIONAL_LIB_DIRS="$LDFLAGS" |
49 |
case "$target_os" in |
50 |
freebsd* | openbsd* ) |
51 |
CPPFLAGS="$CPPFLAGS -I/usr/local/include" |
52 |
LDFLAGS="$LDFLAGS -L/usr/local/lib";; |
53 |
netbsd*) CPPFLAGS="$CPPFLAGS -I/usr/pkg/include" |
54 |
LDFLAGS="$LDFLAGS -L/usr/pkg/lib";; |
55 |
esac |
56 |
|
57 |
#-------------------------------------------------------------------- |
58 |
# The following is so that headers and custom libraries |
59 |
# in the GNUstep root are used before the standard ones |
60 |
#-------------------------------------------------------------------- |
61 |
# Set location of GNUstep dirs for later use |
62 |
GNUSTEP_HDIR=$GNUSTEP_SYSTEM_ROOT/Library/Headers |
63 |
if test "$GNUSTEP_FLATTENED" = yes; then |
64 |
GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Library/Libraries |
65 |
else |
66 |
clean_target_os=`$GNUSTEP_MAKEFILES/clean_os.sh $target_os` |
67 |
clean_target_cpu=`$GNUSTEP_MAKEFILES/clean_cpu.sh $target_cpu` |
68 |
obj_dir=$clean_target_cpu/$clean_target_os |
69 |
GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Library/Libraries/$obj_dir |
70 |
fi |
71 |
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_HDIR" |
72 |
LDFLAGS="$LDFLAGS -L$GNUSTEP_LDIR/$LIBRARY_COMBO -L$GNUSTEP_LDIR" |
73 |
|
74 |
#-------------------------------------------------------------------- |
75 |
# Find the compiler |
76 |
#-------------------------------------------------------------------- |
77 |
AC_PROG_CC |
78 |
AC_PROG_CPP |
79 |
|
80 |
AC_CHECK_LIB(m, main) |
81 |
AC_CHECK_FUNCS(rint rintf) |
82 |
|
83 |
#-------------------------------------------------------------------- |
84 |
# Find for JPEG |
85 |
#-------------------------------------------------------------------- |
86 |
GRAPHIC_LIBS= |
87 |
GRAPHIC_CFLAGS= |
88 |
GRAPHIC_LFLAGS= |
89 |
|
90 |
AC_ARG_WITH(jpeg_library, |
91 |
[ --with-jpeg-library=DIR JPEG library file are in DIR], , |
92 |
with_jpeg_library=) |
93 |
AC_ARG_WITH(jpeg_include, |
94 |
[ --with-jpeg-include=DIR JPEG include files are in DIR], , |
95 |
with_jpeg_include=) |
96 |
|
97 |
if test -n "$with_jpeg_library"; then |
98 |
with_jpeg_library="-L$with_jpeg_library" |
99 |
fi |
100 |
if test -n "$with_jpeg_include"; then |
101 |
with_jpeg_include="-I$with_jpeg_include" |
102 |
fi |
103 |
|
104 |
AC_DEFUN(AC_CHECK_JPEGLIB, |
105 |
[jpeg_check_lib_save_header=${CPPFLAGS} |
106 |
CPPFLAGS="$1 $2 ${CPPFLAGS}" |
107 |
|
108 |
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, |
109 |
jpeg_ok=yes, |
110 |
jpeg_ok=no) |
111 |
if test "$jpeg_ok" = yes; then |
112 |
AC_MSG_CHECKING([for jpeglib.h]) |
113 |
AC_TRY_CPP([#include <stdio.h> |
114 |
#undef PACKAGE |
115 |
#undef VERSION |
116 |
#undef HAVE_STDLIB_H |
117 |
#include <jpeglib.h>], |
118 |
jpeg_ok=yes, |
119 |
jpeg_ok=no) |
120 |
AC_MSG_RESULT($jpeg_ok) |
121 |
|
122 |
if test "$jpeg_ok" = yes; then |
123 |
GRAPHIC_LFLAGS="$1 $GRAPHIC_LFLAGS" |
124 |
GRAPHIC_CFLAGS="$2 $GRAPHIC_CFLAGS" |
125 |
fi |
126 |
fi |
127 |
CPPFLAGS="${jpeg_check_lib_save_header}"]) |
128 |
|
129 |
AC_CHECK_JPEGLIB(${with_jpeg_library}, ${with_jpeg_include}) |
130 |
|
131 |
#-------------------------------------------------------------------- |
132 |
# Find for TIFF |
133 |
#-------------------------------------------------------------------- |
134 |
AC_ARG_WITH(tiff_library, |
135 |
[ --with-tiff-library=DIR TIFF library file are in DIR], , |
136 |
with_tiff_library=) |
137 |
AC_ARG_WITH(tiff_include, |
138 |
[ --with-tiff-include=DIR TIFF include files are in DIR], , |
139 |
with_tiff_include=) |
140 |
|
141 |
if test -n "$with_tiff_library"; then |
142 |
with_tiff_library="-L$with_tiff_library" |
143 |
fi |
144 |
if test -n "$with_tiff_include"; then |
145 |
with_tiff_include="-I$with_tiff_include" |
146 |
fi |
147 |
|
148 |
AC_DEFUN(AC_CHECK_TIFFLIB, |
149 |
[tiff_check_lib_save_header=${CPPFLAGS} |
150 |
tiff_check_lib_save_libs=${LIBS} |
151 |
CPPFLAGS="$1 ${JPEG_LIB} $2 ${JPEG_INCLUDE} ${CPPFLAGS}" |
152 |
AC_CHECK_LIB(z, main, HAVE_LIBZ=1, HAVE_LIBZ=0) |
153 |
|
154 |
AC_MSG_CHECKING(for -ltiff without -ljpeg nor -lz) |
155 |
LIBS="-ltiff -lm $LIBS" |
156 |
AC_TRY_LINK([char TIFFReadScanline();], [TIFFReadScanline()], |
157 |
jpeg_notneeded=yes, |
158 |
jpeg_notneeded=no) |
159 |
AC_MSG_RESULT($jpeg_notneeded) |
160 |
LIBS=${tiff_check_lib_save_libs} |
161 |
JPEG= |
162 |
if test "$jpeg_notneeded" = no; then |
163 |
JPEG=-ljpeg |
164 |
fi |
165 |
|
166 |
if test $HAVE_LIBZ = 1; then |
167 |
AC_MSG_CHECKING(for -ltiff without -lz) |
168 |
LIBS="-ltiff $JPEG -lm $LIBS" |
169 |
AC_TRY_LINK([char TIFFReadScanline();], [TIFFReadScanline()], |
170 |
libz_notneeded=yes, |
171 |
libz_notneeded=no) |
172 |
AC_MSG_RESULT($libz_notneeded) |
173 |
LIBS=${tiff_check_lib_save_libs} |
174 |
if test "$libz_notneeded" = no; then |
175 |
JPEG="$JPEG -lz" |
176 |
fi |
177 |
fi |
178 |
|
179 |
AC_CHECK_LIB(tiff, TIFFReadScanline, tiff_ok=yes, tiff_ok=no, $JPEG -lm) |
180 |
if test "$tiff_ok" = yes; then |
181 |
AC_CHECK_HEADER(tiffio.h, tiff_ok=yes, tiff_ok=no) |
182 |
if test "$tiff_ok" = yes; then |
183 |
GRAPHIC_LFLAGS="$1 $GRAPHIC_LFLAGS" |
184 |
GRAPHIC_CFLAGS="$2 $GRAPHIC_CFLAGS" |
185 |
GRAPHIC_LIBS="-ltiff $JPEG $GRAPHIC_LIBS" |
186 |
else |
187 |
AC_MSG_WARN(Cannot find libtiff header tiffio) |
188 |
echo "* The GUI library requres the TIFF library" |
189 |
echo "* Use --with-tiff-include to specify the tiff header directory" |
190 |
echo "* and --with-tiff-library to specify the tiff library directory" |
191 |
echo "* if it is not in the usual place(s)" |
192 |
AC_MSG_ERROR(gnustep-gui will not compile without tiff includes) |
193 |
fi |
194 |
else |
195 |
AC_MSG_WARN(Cannot find libtiff) |
196 |
echo "* The GUI library reqiures the TIFF library" |
197 |
echo "* Use --with-tiff-library to specify the tiff library" |
198 |
echo "* directory if it is not in the usual place(s)" |
199 |
echo "* You may also have to specify --with-jpeg-library if the jpeg" |
200 |
echo "* library is needed by tiff", |
201 |
AC_MSG_ERROR(gnustep-gui will not compile without tiff) |
202 |
fi |
203 |
CPPFLAGS="${tiff_check_lib_save_header}"]) |
204 |
|
205 |
AC_CHECK_TIFFLIB(${with_tiff_library}, ${with_tiff_include}) |
206 |
|
207 |
ADDITIONAL_INCLUDE_DIRS="$ADDITIONAL_INCLUDE_DIRS $GRAPHIC_CFLAGS" |
208 |
ADDITIONAL_LIB_DIRS="$ADDITIONAL_LIB_DIRS $GRAPHIC_LFLAGS" |
209 |
ADDITIONAL_DEPENDS="$GRAPHIC_LIBS" |
210 |
|
211 |
#-------------------------------------------------------------------- |
212 |
# NSSound |
213 |
#-------------------------------------------------------------------- |
214 |
AC_ARG_ENABLE(gsnd, |
215 |
[ --disable-gsnd Disable gsnd server],, |
216 |
enable_gsnd=yes) |
217 |
audio_ok=no |
218 |
BUILD_GSND= |
219 |
|
220 |
AC_ARG_WITH(audiofile_library, |
221 |
[ --with-audiofile-library=DIR AUDIOFILE library file are in DIR], , |
222 |
with_audiofile_library=) |
223 |
AC_ARG_WITH(audiofile_include, |
224 |
[ --with-audiofile-include=DIR AUDIOFILE include files are in DIR], , |
225 |
with_audiofile_include=) |
226 |
|
227 |
if test -n "$with_audiofile_library"; then |
228 |
with_audiofile_library="-L$with_audiofile_library" |
229 |
fi |
230 |
if test -n "$with_audiofile_include"; then |
231 |
with_audiofile_include="-I$with_audiofile_include" |
232 |
fi |
233 |
|
234 |
audiofile_check_lib_save_headers=$CPPFLAGS |
235 |
audiofile_check_lib_save_libs=$LIBS |
236 |
CPPFLAGS="${with_audiofile_include} $CPPFLAGS" |
237 |
LIBS="${with_audiofile_library} $LIBS" |
238 |
AC_CHECK_LIB(audiofile, afGetVirtualFrameSize, audio_ok=yes, audio_ok=no) |
239 |
|
240 |
if test $audio_ok = yes -a $enable_gsnd = yes; then |
241 |
AC_CHECK_HEADERS(audiofile.h) |
242 |
ADDITIONAL_DEPENDS="$ADDITIONAL_DEPENDS -laudiofile" |
243 |
ADDITIONAL_INCLUDE_DIRS="$ADDITIONAL_INCLUDE_DIRS ${with_audiofile_include}" |
244 |
ADDITIONAL_LIB_DIRS="$ADDITIONAL_LIB_DIRS ${with_audiofile_library}" |
245 |
BUILD_GSND=gsnd |
246 |
fi |
247 |
AC_SUBST(BUILD_GSND) |
248 |
|
249 |
LIBS=${audiofile_check_lib_save_libs} |
250 |
CPPFLAGS=${audiofile_check_lib_save_headers} |
251 |
|
252 |
#-------------------------------------------------------------------- |
253 |
# Record the version |
254 |
#-------------------------------------------------------------------- |
255 |
AC_MSG_CHECKING(for the version of gnustep-gui we are compiling) |
256 |
if test -f "Version"; then |
257 |
. ./Version |
258 |
fi |
259 |
AC_MSG_RESULT($GNUSTEP_GUI_VERSION) |
260 |
AC_SUBST(GNUSTEP_GUI_VERSION) |
261 |
AC_SUBST(GNUSTEP_GUI_MAJOR_VERSION) |
262 |
AC_SUBST(GNUSTEP_GUI_MINOR_VERSION) |
263 |
AC_SUBST(GNUSTEP_GUI_SUBMINOR_VERSION) |
264 |
|
265 |
AC_SUBST(ADDITIONAL_LIB_DIRS) |
266 |
AC_SUBST(ADDITIONAL_INCLUDE_DIRS) |
267 |
AC_SUBST(ADDITIONAL_DEPENDS) |
268 |
|
269 |
#-------------------------------------------------------------------- |
270 |
# Configure |
271 |
#-------------------------------------------------------------------- |
272 |
AH_BOTTOM([ |
273 |
/* Define for those who don't have rintf and/or rint */ |
274 |
#ifndef HAVE_RINTF |
275 |
#define rintf rint |
276 |
#endif |
277 |
#ifndef HAVE_RINT |
278 |
#define DEFINE_RINT_IF_MISSING \ |
279 |
static double rint(double a) \ |
280 |
{ \ |
281 |
return (floor(a+0.5)); \ |
282 |
} |
283 |
#else |
284 |
#define DEFINE_RINT_IF_MISSING |
285 |
#endif |
286 |
]) |
287 |
|
288 |
AC_CONFIG_FILES([config.make gui.make Headers/Additions/GNUstepGUI/GSVersion.h]) |
289 |
AC_OUTPUT |
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|