File: configure.in

package info (click to toggle)
crossfire-client 1.2.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,880 kB
  • ctags: 2,012
  • sloc: ansic: 21,003; sh: 2,703; makefile: 540; perl: 48
file content (341 lines) | stat: -rw-r--r-- 9,415 bytes parent folder | download
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
dnl Process this file with autoconf to produce a configure script.
AC_INIT(crossfire-client.spec)


dnl This file creates the configure script for the GTK CrossFire Client.
dnl I borrowed some bits of code (CFLAGS hacks) from the GIMP's configure.in.
dnl
dnl ChangeLog:
dnl 1998-05-24 Raphael Quinet: Wrote the first version.
dnl 1998-06-03 Raphael Quinet: Re-wrote it from scratch after having
dnl                            lost the first version accidentally.  Oops!
dnl 1998-06-24 Raphael Quinet: Removed unused definitions of version number.

AC_CONFIG_AUX_DIR(utils/)

AC_CANONICAL_SYSTEM

AM_INIT_AUTOMAKE(gcfclient, 1.2.0)

AC_CONFIG_HEADER(common/config.h)

AM_ACLOCAL_INCLUDE(macros)

dnl Check for some neeed programs
AC_PATH_PROG(MKDIR, mkdir)
AC_PATH_PROG(TAR, tar)
AC_PATH_PROG(DEPEND, makedepend)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(RM, rm)
AC_PATH_PROG(PERL, perl)
AC_PATH_PROG(AR, ar)


SOUNDDIR=/usr/local/lib/sounds

dnl Add some options to 'configure'.
AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]],
if eval "test x$enable_debug = xyes"; then
  DEBUGFLAG="-g"
fi)

AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
		    , enable_ansi=no)


AC_ARG_ENABLE(sound, [  --disable-sound         disable sound support [default=implement sound support if supported libraries exist]],
		sound=no, sound=yes )

dnl This is because some of us use OSS sound, even with ALSA libs installed

AC_ARG_ENABLE(alsa, [  --disable-alsa          disable ALSA sound support [default=use alsa sound support if alsa libraries exist]],
		alsa=no, alsa=yes )

AC_ARG_WITH(sound-dir, [  --with-sound-dir=dir    Directory where the sounds are located (default=/usr/local/lib/sounds)        ],
		SOUNDDIR="$withval")


dnl The follow two are really just a way to specify where the xpm information
dnl resides if not with the normal X11 stuff (ie, in /usr/local and not /usr
dnl /usr/X11

AC_ARG_WITH(ldflags, [  --with-ldflags=dir      provide addition linker directives to find libraries ],
		EXTRA_LIB="$withval")

AC_ARG_WITH(includes, [  --with-includes=dir     provide different compiler options to find headers with ],
		EXTRA_INC="$withval")


AC_ARG_ENABLE(gtk, [  --disable-gtk           make x11 client [default=make gtk client if available]],
		gtk=no, gtk=yes )

AC_ARG_ENABLE(gnome, [  --disable-gnome         don't make gnome client [default=make gnome client if available]],
		gnome=no, gnome=yes )

AC_ARG_ENABLE(sdl, [  --disable-sdl              Disable linking with the SDL library, default is to use it if available ],
                use_sdl=no, use_sdl=yes)


AC_PROG_CC

AC_C_BIGENDIAN

networklibs="yes"

dnl these are subdirectories that have make files in them
SUBDIRS="common sound-src x11"

case "$target" in
  alpha-dec-osf*)
    # If we are not using gcc, we want the ansi version of cc. 
    if test -z "$GCC"; then
#      CFLAGS="$CFLAGS -std1 -warnprotos" # Not yet ready for warnprotos...
      CFLAGS="$CFLAGS -std1"
    fi
    ;;
  dnl SGI systems don't need -lnsl -lsocket
  mips*-sgi-irix*)
	networklibs="no"
	;;
  dnl linux systems don't appear to need -lnsl
  *-linux-*)
	networklibs="no"
	;;
  *-*-solaris2*)
	need_r_flag="yes"
	;;
  *)
    ;;
esac


dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_CPP
AC_PROG_RANLIB

dnl Check for GTK >= 1.0.0.
dnl The XLib client (without GTK) should use AC_PATH_X instead of this.

dnl Simple hack - if we want standard x11 client, don't check for the gtk
dnl libraries.  Then we fall through below

if eval "test x$gtk = xyes"; then
AM_PATH_GTK(1.0.0,CFGTK="yes",CFGTK="no")
fi


AC_SUBST(CFGTK)

AC_PATH_XTRA

if eval "test x$CFGTK = xyes"; then
	AC_MSG_RESULT(GTK found - building both gtk and x11 client)
	GTK_LIBS=$GTK_LIBS
	GTK_CFLAGS="$GTK_CFLAGS"
	AC_SUBST(GTK_LIBS)
	AC_SUBST(GTK_CFLAGS)
	SUBDIRS="$SUBDIRS gtk"
	dnl AC_DEFINE(GTK_CLIENT)
else
	AC_MSG_RESULT(GTK not found - building xlib client)
fi
dnl common to everything 

X_LIBS="$X_LIBS -lX11"
AC_SUBST(X_LIBS)
AC_SUBST(X_CFLAGS)
echo Xlibs: $X_LIBS
echo Extras: $X_EXTRA_LIBS
echo Xpre: $X_PRE_LIBS

CPPFLAGS="$CPPFLAGS $EXTRA_INC"
LDFLAGS="$LDFLAGS $EXTRA_LIB"
if eval "test x$need_r_flag = xyes"; then
    LDFLAGS="$LDFLAGS"
fi

if eval "test x$sound = xyes"; then
  if eval "test x$alsa = xyes"; then
    AC_CHECK_LIB(asound, main, alsa_sound=yes, , -lm)
  fi
  AC_CHECK_LIB(audio, alNewConfig, sgi_sound=yes, )
  AC_CHECK_HEADER(sys/soundcard.h, oss_sound=yes, oss_sound=no)
  AC_CHECK_HEADER(sys/audioio.h, sun_sound=yes, sun_sound=no)

  if eval "test x$alsa_sound = xyes"; then
	echo "Using ALSA sound system"
	CFLAGS="$CFLAGS -DALSA_SOUND  -DBINDIR='\"$bindir/\"'"
	SND_LIBS="-lasound -lm"
  else 
    if eval "test x$sgi_sound = xyes"; then
	echo "Using SGI sound system"
	CFLAGS="$CFLAGS -DSGI_SOUND -DBINDIR='\"$bindir/\"'"
	SND_LIBS="-laudio"
    else
      if eval "test x$oss_sound = xyes"; then
	echo "Using OSS sound system"
	CFLAGS="$CFLAGS -DOSS_SOUND -DBINDIR='\"$bindir/\"'"
	SND_LIBS="-lm"
      else
        if eval "test x$sun_sound = xyes"; then
	      echo "Using solaris sound system"
	      CFLAGS="$CFLAGS -DSUN_SOUND -DBINDIR='\"$bindir/\"'"
	      SND_LIBS="-lm"
	else
	      echo "No suitable sound system found."
        fi
      fi
    fi
  fi
  # this fi is for the sound == yes check above
fi

AC_PATH_PROG(GNOMECONFIG, gnome-config)

if test -z "$GNOMECONFIG" ; then
	gnome=no
	echo "Can't find gnome-config, not building Gnome client."
fi

if eval "test x$gnome = xyes"; then
	GNOME_INIT
	GNOME_COMPILE_WARNINGS
	GNOME_X_CHECKS
	AM_PATH_GDK_PIXBUF(0.11.0, , echo "gdk-pixbuf 0.11.0 or higher is needed for the Gnome client so I'm not building it." ; gnome=no)
	if eval "test x$gnome = xyes"; then
		SUBDIRS="$SUBDIRS gnome"
	fi
fi

AC_SUBST(GUI_OBJS)
AC_SUBST(GUI_SRCS)
AC_SUBST(SND_LIBS)
AC_SUBST(LDFLAGS)
AC_SUBST(TARGET)
AC_SUBST(SUBDIRS)

dnl Check for SDL 1.1.3 and sdl_image
dnl note SDL_image does not ship with an sdl-image-config
dnl so I'll just assume it is in the same dir as SDL
if eval "test x$use_sdl = xyes"; then
  AM_PATH_SDL(1.1.3)
  if eval "test x$no_sdl = x"; then
      AC_CHECK_LIB( SDL_image, IMG_LoadPNG_RW, 
                    have_sdlimage="yes", have_sdlimage="no", $SDL_CFLAGS) 
      if eval "test x$have_sdlimage = xyes"; then
          SDL_LIBS="$SDL_LIBS -lSDL_image"
      else
          no_sdl=yes
      fi
  fi

  if eval "test x$no_sdl = x"; then
          AC_DEFINE(HAVE_SDL)
  fi
fi

AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)

dnl The following hacks for modifying CFLAGS were borrowed from the GIMP.
if test -n "$DEBUGFLAG"; then
  CFLAGS="$DEBUGFLAG $CFLAGS"
fi

if eval "test x$GCC = xyes"; then
  if echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null; then
    CFLAGS="$CFLAGS"
  else
    CFLAGS="$CFLAGS -Wall"
  fi

  if eval "test x$enable_ansi = xyes"; then
    if echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null; then
      CFLAGS="$CFLAGS"
    else
      CFLAGS="$CFLAGS -ansi"
    fi

    if echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null; then
      CFLAGS="$CFLAGS"
    else
      CFLAGS="$CFLAGS -pedantic"
    fi
  fi
fi


dnl We need to check for socket/nsl here - some versions of the windowing
dnl systems need these to properly link with X (I though AC_PATH_XTRA should
dnl take care of this, but apparantly is doesnt).  IF it isn't here,
dnl the check for xpm fails, and configure quits.

if eval "test x$networklibs = xyes"; then
  AC_CHECK_LIB(nsl, main, LIBS="$LIBS -lnsl")
  AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket")
fi

dnl Save and modify CPPFLAGS and LIBS (to include X and GTK paths temporarily).
gcfc_save_CPPFLAGS="$CPPFLAGS"
gcfc_save_LIBS="$LIBS"
CPPFLAGS="$GTK_CFLAGS $CPPFLAGS $X_CFLAGS $EXTRA_INC"
LIBS="$LIBS $GTK_LIBS $X_LIBS"

dnl Put this here so we get the gdk libs
dnl AC_CHECK_LIB(gdk_imlib, main,GTK_LIBS="$GTK_LIBS -lgdk_imlib")

dnl Need to check for Xext while we still have X_LIBS set.
AC_CHECK_LIB(Xext, main, X_LIBS="$X_LIBS -lXext")

dnl AC_CHECK_LIB(Imlib, main, X_LIBS="$X_LIBS -lImlib")

dnl Restore previous CPPFLAGS and LIBS.
CPPFLAGS="$gcfc_save_CPPFLAGS"
LIBS="$gcfc_save_LIBS"

AC_SUBST(LIBS)

dnl sound.c needs sqrt.  So does png (on some systems)
AC_CHECK_LIB(m, sqrt)

dnl png on some systems need the zlib, so check for it
AC_CHECK_LIB(z, main)

AC_CHECK_LIB(png, main, , [AC_MSG_ERROR([You must have the png library installed to compile the client])])

dnl not strictly needed, but since the X11 client uses it, lets use it here
AC_CHECK_LIB(dmalloc, main, DMALLOC_LIB="-ldmalloc")

AC_SUBST(DMALLOC_LIB)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h dmalloc.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(mkdir socket strcspn sysconf)

AC_SUBST(XPM)
AC_SUBST(SOUNDDIR)
AC_SUBST(LIBXPM_LIB)

dnl Make all makefiles, even if SUBDIRS are not set for that directory.
dnl since SUBDIRS won't be set in the top level makefile, we don't
dnl descend into these subdirs.

OUTPUT_FILES="Makefile gtk/Makefile x11/Makefile common/Makefile sound-src/Makefile gnome/Makefile"

if eval "test x$gnome = xyes"; then
	OUTPUT_FILES="$OUTPUT_FILES gnome/gnome-cfclient.soundlist"
fi

AC_OUTPUT(${OUTPUT_FILES})