]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/chocolate-doom/0004-configure-Switch-to-pkg-config-macros.patch
lrzsz: install symlinks for XMODEM and YMODEM
[coffee/buildroot.git] / package / chocolate-doom / 0004-configure-Switch-to-pkg-config-macros.patch
1 From 3163bf87d7b955d08dedd5ebaccb1b2a86ffdcb9 Mon Sep 17 00:00:00 2001
2 From: Simon Howard <fraggle@soulsphere.org>
3 Date: Thu, 25 Feb 2016 22:55:04 -0500
4 Subject: [PATCH] configure: Switch to pkg-config macros.
5
6 All dependency libraries install pkg-config .pc files nowadays, which
7 makes the process of looking them up a lot simpler. Get rid of the SDL
8 workaround macro as it's not needed.
9
10 [Backported from upstream commit 3163bf87d7b955d08dedd5ebaccb1b2a86ffdcb9.
11 Fixes static linking issues with SDL_mixer.]
12
13 Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
14 ---
15  configure.ac                    | 117 ++++++++++++++--------------------------
16  opl/examples/Makefile.am        |   2 +-
17  src/Makefile.am                 |   7 ++-
18  textscreen/Makefile.am          |   2 +-
19  textscreen/examples/Makefile.am |   2 +-
20  5 files changed, 49 insertions(+), 81 deletions(-)
21
22 diff --git a/configure.ac b/configure.ac
23 index 7b03485..48f83ef 100644
24 --- a/configure.ac
25 +++ b/configure.ac
26 @@ -33,89 +33,54 @@ then
27          CFLAGS="-O$OPT_LEVEL -g $WARNINGS $orig_CFLAGS"
28  fi
29  
30 -dnl Search for SDL ...
31 -
32 -AM_PATH_SDL(1.1.3)
33 -
34 -# Add the SDL compiler flags to the default compiler flag variables. 
35 -# It is important to do this now, before checking for headers and
36 -# library functions.  The reason being that on Windows, sdl-config
37 -# sets the -mno-cygwin compiler option in order to generate MinGW 
38 -# executables.  If we don't do this now, we might end up discovering
39 -# header files that are not actually available to us when we come
40 -# to compile.
41 -
42 -CFLAGS="$CFLAGS $SDL_CFLAGS"
43 -LDFLAGS="$LDFLAGS $SDL_LIBS"
44 -
45 -# On some platforms, SDL renames main() to SDL_main() using a #define,
46 -# so that its own main, stored in the SDLmain library, can be run first.
47 -# Unfortunately, this causes problems for autoconf, which builds
48 -# test programs to probe the system.  All library/header/symbol checks
49 -# must be run in this block, that performs a workaround for the problem.
50 -
51 -AC_SDL_MAIN_WORKAROUND([
52 -
53 -    # Check for SDL_mixer.
54 -
55 -    AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[
56 -        SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer"
57 -    ],[
58 -        echo "*** Could not find SDL_mixer.  Please install it."
59 -        exit -1
60 -    ])
61 -
62 -    # Check for SDL_net.
63 -
64 -    AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[
65 -        SDLNET_LIBS="$SDLNET_LIBS -lSDL_net"
66 -    ],[
67 -        echo "*** Could not find SDL_net.  Please install it."
68 -        exit -1
69 -    ])
70 -
71 -    # Check for libsamplerate.
72 -    AC_ARG_WITH([libsamplerate],
73 -    AS_HELP_STRING([--without-libsamplerate],
74 -        [Build without libsamplerate @<:@default=check@:>@]),
75 -    [],
76 -    [
77 -        [with_libsamplerate=check]
78 -    ])
79 -    AS_IF([test "x$with_libsamplerate" != xno], [
80 -        AC_CHECK_LIB(samplerate, src_new, [], [
81 -            AS_IF([test "x$with_libsamplerate" != xcheck], [AC_MSG_FAILURE(
82 -                [--with-libsamplerate was given, but test for libsamplerate failed])
83 -            ])
84 +PKG_CHECK_MODULES([SDL], [sdl])
85 +PKG_CHECK_MODULES([SDLMIXER], [SDL_mixer])
86 +PKG_CHECK_MODULES([SDLNET], [SDL_net])
87 +
88 +# Check for libsamplerate.
89 +AC_ARG_WITH([libsamplerate],
90 +AS_HELP_STRING([--without-libsamplerate],
91 +    [Build without libsamplerate @<:@default=check@:>@]),
92 +[],
93 +[
94 +    [with_libsamplerate=check]
95 +])
96 +AS_IF([test "x$with_libsamplerate" != xno], [
97 +    PKG_CHECK_MODULES([SAMPLERATE], [samplerate >= 0.1.8], [
98 +        AC_DEFINE([HAVE_LIBSAMPLERATE], [1], [libsamplerate installed])
99 +    ], [
100 +        AS_IF([test "x$with_libsamplerate" != xcheck], [AC_MSG_FAILURE(
101 +            [--with-libsamplerate was given, but test for libsamplerate failed])
102          ])
103      ])
104 -    # Check for libpng.
105 -    AC_ARG_WITH([libpng],
106 -    AS_HELP_STRING([--without-libpng],
107 -        [Build without libpng @<:@default=check@:>@]),
108 -    [],
109 -    [
110 -        [with_libpng=check]
111 -    ])
112 -    AS_IF([test "x$with_libpng" != xno], [
113 -        AC_CHECK_LIB(z, zlibVersion)
114 -        AC_CHECK_LIB(png, png_get_io_ptr, [], [
115 -            AS_IF([test "x$with_libpng" != xcheck], [AC_MSG_FAILURE(
116 -                [--with-libpng was given, but test for libpng failed])
117 -            ])
118 +])
119 +# Check for libpng.
120 +AC_ARG_WITH([libpng],
121 +AS_HELP_STRING([--without-libpng],
122 +    [Build without libpng @<:@default=check@:>@]),
123 +[],
124 +[
125 +    [with_libpng=check]
126 +])
127 +AS_IF([test "x$with_libpng" != xno], [
128 +    PKG_CHECK_MODULES([PNG], [libpng >= 1.6.10], [
129 +        AC_DEFINE([HAVE_LIBPNG], [1], [libpng installed])
130 +    ], [
131 +        AS_IF([test "x$with_libpng" != xcheck], [AC_MSG_FAILURE(
132 +            [--with-libpng was given, but test for libpng failed])
133          ])
134      ])
135 -    AC_CHECK_LIB(m, log)
136 +])
137 +AC_CHECK_LIB(m, log)
138  
139 -    AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
140 -    AC_CHECK_FUNCS(mmap ioperm)
141 +AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
142 +AC_CHECK_FUNCS(mmap ioperm)
143  
144 -    # OpenBSD I/O i386 library for I/O port access.
145 -    # (64 bit has the same thing with a different name!)
146 +# OpenBSD I/O i386 library for I/O port access.
147 +# (64 bit has the same thing with a different name!)
148  
149 -    AC_CHECK_LIB(i386, i386_iopl)
150 -    AC_CHECK_LIB(amd64, amd64_iopl)
151 -])
152 +AC_CHECK_LIB(i386, i386_iopl)
153 +AC_CHECK_LIB(amd64, amd64_iopl)
154  
155  case $host in
156    *cygwin* | *mingw* )
157 diff --git a/opl/examples/Makefile.am b/opl/examples/Makefile.am
158 index 9afcd51..54c37f8 100644
159 --- a/opl/examples/Makefile.am
160 +++ b/opl/examples/Makefile.am
161 @@ -1,5 +1,5 @@
162  
163 -AM_CFLAGS = -I$(top_srcdir)/opl
164 +AM_CFLAGS = -I$(top_srcdir)/opl @SDL_CFLAGS@
165  
166  noinst_PROGRAMS=droplay
167  
168 diff --git a/src/Makefile.am b/src/Makefile.am
169 index 78ee3ba..9624e01 100644
170 --- a/src/Makefile.am
171 +++ b/src/Makefile.am
172 @@ -21,7 +21,8 @@ execgames_SCRIPTS = $(SETUP_BINARIES)
173  AM_CFLAGS = -I$(top_srcdir)/textscreen            \
174              -I$(top_srcdir)/opl                   \
175              -I$(top_srcdir)/pcsound               \
176 -            @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
177 +            @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@     \
178 +            @SAMPLERATE_CFLAGS@ @PNG_CFLAGS@
179  
180  # Common source files used by absolutely everything:
181  
182 @@ -150,7 +151,9 @@ EXTRA_LIBS =                                               \
183                 @LDFLAGS@                                   \
184                 @SDL_LIBS@                                  \
185                 @SDLMIXER_LIBS@                             \
186 -               @SDLNET_LIBS@
187 +               @SDLNET_LIBS@                               \
188 +               @SAMPLERATE_LIBS@                           \
189 +               @PNG_LIBS@
190  
191  if HAVE_WINDRES
192  @PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES_WITH_DEH) resource.rc
193 diff --git a/textscreen/Makefile.am b/textscreen/Makefile.am
194 index 628d4ff..427ed40 100644
195 --- a/textscreen/Makefile.am
196 +++ b/textscreen/Makefile.am
197 @@ -1,5 +1,5 @@
198  
199 -AM_CFLAGS = -I$(top_srcdir)/src
200 +AM_CFLAGS = -I$(top_srcdir)/src @SDL_CFLAGS@
201  
202  CTAGS_ARGS=-I TXT_UNCAST_ARG+
203  
204 diff --git a/textscreen/examples/Makefile.am b/textscreen/examples/Makefile.am
205 index 4632d92..b857748 100644
206 --- a/textscreen/examples/Makefile.am
207 +++ b/textscreen/examples/Makefile.am
208 @@ -1,5 +1,5 @@
209  
210 -AM_CFLAGS =  -I$(top_srcdir)/src -I$(top_srcdir)/textscreen
211 +AM_CFLAGS =  -I$(top_srcdir)/src -I$(top_srcdir)/textscreen @SDL_CFLAGS@
212  
213  noinst_PROGRAMS=guitest calculator
214  
215 -- 
216 2.1.4
217