1 # m m mm mmm .----------. .---------------------. mmm mm m m
2 # 8 8 88 888 | .--------` | .------------------` 888 88 8 8
3 # 8 8 88 888 | ```````|`V```````| |``||``|`````| 888 88 8 8
4 # 8 8 88 888 `------ | | [] | |``````|| | [] | 888 88 8 8
5 # 8 8 88 888 |`````` | | | ````|```` | | 888 88 8 8
6 # ` ` `` ``` ``````````````> |````````````| |`` ``` `` ` `
7 # ==============` `---`
8 # L A B O R A T O R I E S
10 #This file is part of Hacker Radio Rec.
12 #Hacker Radio Rec is free software: you can redistribute it and/or
13 #modify it under the terms of the GNU General Public License as
14 #published by the Free Software Foundation, either version 3 of
15 #the License or (at your option) any later version.
17 #Hacker Radio Rec is distributed in the hope that it will be
18 #useful, but WITHOUT ANY WARRANTY; without even the implied
19 #warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 #See the GNU General Public License for more details.
22 # Copyright (C) 2009, Thea DeSilva
23 # You can find a copy of GNU General Public License in COPYING
28 AC_REVISION($Revision: 1 $)
31 AC_CONFIG_HEADER([config.h])
35 AC_DEFUN(AC_PROGRAM_SOURCE,
36 [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
42 eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
48 [echo "$1" 1>&AC_FD_MSG
53 AC_PREFIX_PROGRAM(hrr)
54 AC_PREFIX_PROGRAM(gzip)
59 AC_PROG_GCC_TRADITIONAL
62 AC_TRY_RUN(main(){exit(0);},,[
63 if test $CC != cc ; then
66 exec $0 $configure_args
70 AC_TRY_RUN(main(){exit(0);},,
73 AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
75 AC_MSG_ERROR(Can't run the compiler - sorry))
80 int __something_strange_();
81 __something_strange_(0);
83 ],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
87 if test -f etc/toolcheck; then
88 AC_CHECKING(for buggy tools)
89 sh etc/toolcheck 1>&AC_FD_MSG
95 dnl **** special unix variants ****
97 if test -n "$ISC"; then
98 AC_DEFINE(ISC) LIBS="$LIBS -linet"
101 dnl AC_CHECKING(for OSF1)
102 dnl if test -f /bin/uname ; then
103 dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
104 dnl AC_DEFINE(OSF1) # this disables MIPS again....
108 if test -f /sysV68 ; then
112 AC_CHECKING(for MIPS)
113 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
115 test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
116 dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable"
117 AC_CHECKING(mld library)
118 AC_TRY_LINK(,,,LIBS="$oldlibs")
121 if test -r /dev/ptc; then
124 AC_TRY_LINK(,[wait3();], ,
126 AC_TRY_LINK(,[wait2();],
127 dnl John Rouillard (rouilj@sni-usa.com):
128 dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
130 dnl Detect RISCOS if wait2 is present, but not wait3.
131 AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
136 AC_CHECKING(for Ultrix)
138 [#if defined(ultrix) || defined(__ultrix)
143 if test -f /usr/lib/libpyr.a ; then
146 AC_CHECKING(Pyramid OSX)
147 AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
150 dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
151 dnl BBN butterfly is not POSIX, but a MACH BSD system.
152 dnl Do not define POSIX and TERMIO.
153 AC_CHECKING(for butterfly)
155 [#if defined(butterfly)
160 if test -z "$butterfly"; then
161 if test -n "$ULTRIX"; then
162 test -z "$GCC" && CC="$CC -YBSD"
164 AC_CHECKING(for POSIX.1)
166 [#include <sys/types.h>
169 #ifdef _POSIX_VERSION
172 ], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
175 AC_CHECKING(for System V)
177 [#include <sys/types.h>
179 #include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
181 AC_CHECKING(for sequent/ptx)
186 ], LIBS="$LIBS -lsocket -linet";seqptx=1)
191 AC_TRY_LINK([#include <utmpx.h>
193 [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
194 [AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
197 AC_CHECKING(for Solaris 2.x)
199 [#if defined(SVR4) && defined(sun)
202 ], LIBS="$LIBS -lsocket -lnsl -lkstat")
205 dnl **** typedefs ****
207 dnl (currently not used)
209 AC_CHECKING(for pid_t)
210 AC_EGREP_CPP(pid_t,[#include <sys/types.h>
211 ],AC_DEFINE(PID_T_DEFINED))
213 AC_CHECKING(for sig_t)
214 AC_EGREP_CPP(sig_t,[#include <sys/types.h>
216 ],AC_DEFINE(SIG_T_DEFINED))
218 AC_CHECKING(for uid_t)
219 AC_EGREP_CPP(uid_t,[#include <sys/types.h>
220 ],AC_DEFINE(UID_T_DEFINED))
223 dnl **** setreuid(), seteuid() ****
225 AC_CHECKING(setreuid)
232 ], AC_DEFINE(HAVE_SETREUID))
235 dnl linux seteuid was broken before V1.1.11
236 dnl NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
237 dnl Solaris seteuid doesn't change the saved uid, bad for
238 dnl multiuser screen sessions
241 #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
242 seteuid_is_broken(0);
246 ], AC_DEFINE(HAVE_SETEUID))
249 dnl **** signal handling ****
251 if test -n "$posix" ; then
253 dnl POSIX has reliable signals with void return type.
254 AC_NOTE(assuming posix signal definition)
259 AC_CHECKING(return type of signal handlers)
261 [#include <sys/types.h>
266 extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
269 #include <sys/types.h>
273 sigset(0, (void (*)())0);
275 sigset(0, (int (*)())0);
277 ], AC_DEFINE(USESIGSET))
278 AC_CHECKING(signal implementation)
280 #include <sys/types.h>
284 #define SIGCLD SIGCHLD
287 #define signal sigset
302 /* on hpux we use sigvec to get bsd signals */
304 (void)signal(SIGCLD, hand);
305 kill(getpid(), SIGCLD);
306 kill(getpid(), SIGCLD);
312 ],,AC_DEFINE(SYSVSIGS))
317 dnl **** misc things ****
319 AC_CHECKING(wait union)
320 AC_TRY_COMPILE([#include <sys/types.h>
321 #include <sys/wait.h>
328 ],AC_DEFINE(BSDWAIT))
330 if test -z "$butterfly"; then
331 AC_CHECKING(for termio or termios)
332 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
333 if test -n "$posix"; then
334 AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
340 AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
344 strcpy(buf, "abcdefghi");
345 bcopy(buf, buf + 2, 3);
346 if (strncmp(buf, "ababcf", 6))
348 strcpy(buf, "abcdefghi");
349 bcopy(buf + 2, buf, 3);
350 if (strncmp(buf, "cdedef", 6))
352 exit(0); /* libc version works properly. */
353 }], AC_DEFINE(USEBCOPY))
356 #define bcopy(s,d,l) memmove(d,s,l)
359 strcpy(buf, "abcdefghi");
360 bcopy(buf, buf + 2, 3);
361 if (strncmp(buf, "ababcf", 6))
363 strcpy(buf, "abcdefghi");
364 bcopy(buf + 2, buf, 3);
365 if (strncmp(buf, "cdedef", 6))
367 exit(0); /* libc version works properly. */
368 }], AC_DEFINE(USEMEMMOVE))
372 #define bcopy(s,d,l) memcpy(d,s,l)
375 strcpy(buf, "abcdefghi");
376 bcopy(buf, buf + 2, 3);
377 if (strncmp(buf, "ababcf", 6))
379 strcpy(buf, "abcdefghi");
380 bcopy(buf + 2, buf, 3);
381 if (strncmp(buf, "cdedef", 6))
383 exit(0); /* libc version works properly. */
384 }], AC_DEFINE(USEMEMCPY))
386 AC_MSG_CHECKING(long file names)
387 (echo 1 > /tmp/conftest9012345) 2>/dev/null
388 (echo 2 > /tmp/conftest9012346) 2>/dev/null
389 val=`cat /tmp/conftest9012345 2>/dev/null`
390 if test -f /tmp/conftest9012345 && test "$val" = 1; then
394 AC_DEFINE(NAME_MAX, 14)
398 AC_MSG_CHECKING(for vsprintf)
399 AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
403 AC_MSG_CHECKING(for setenv)
404 AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
406 AC_MSG_CHECKING(for putenv)
407 AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
410 if test -z "$old_CFLAGS"; then
411 if test "x$CFLAGS" = "x-g"; then
415 dnl Ptx bug workaround -- insert -lc after -ltermcap
417 AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
419 $CC -o errors errors.c
421 if ! test -a errors; then
422 echo "Can't use the compiler to compile errors.c, which is used in the rest of this configuration"
426 AC_CHECK_PROG([HAVELEX], [lex], "true", "false")
427 if test "$HAVELEX" = "false"; then
432 HRR_CHECK_HEAD(Xlib.h, X11/, no_x11)
433 HRR_CHECK_LIB(X11,XOpenDisplay)
436 HRR_CHECK_HEAD(SDL.h, SDL/, no_sdl_head)
437 HRR_CHECK_LIB(SDL, SDL_Init, no_sdl)
440 HRR_CHECK_HEAD(SDL_image.h, SDL/, no_sdl_image_head)
441 HRR_CHECK_LIB(SDL_image, IMG_Load, no_sdl_image)
445 dnl ** check for libav libraries/headers
448 HRR_CHECK_HEAD(avdevice.h, libavdevice/, no_ffmpeg_devel)
449 HRR_CHECK_HEAD(avformat.h, libavformat/, no_ffmpeg_devel)
450 HRR_CHECK_HEAD(avcodec.h, libavcodec/, no_ffmpeg_devel)
451 HRR_CHECK_HEAD(swscale.h, libswscale/, no_ffmpeg_devel)
452 HRR_CHECK_HEAD(fifo.h, libavutil/, no_ffmpeg_devel)
453 HRR_CHECK_HEAD(avstring.h, libavutil/, no_ffmpeg_devel)
457 HRR_CHECK_LIB(avcodec, avpicture_fill, no_ffmpeg)
458 HRR_CHECK_LIB(avformat, av_read_frame, no_ffmpeg)
459 HRR_CHECK_LIB(swscale, sws_scale, no_ffmpeg)
460 HRR_CHECK_LIB(avutil, av_rescale, no_ffmpeg)
461 HRR_CHECK_LIB(avdevice, avdevice_register_all, no_ffmpeg)
463 HRR_CHECK_LIB(bz2, BZ2_bzopen, no_bz2)
464 HRR_CHECK_LIB(pthread, pthread_kill, no_pthread)
466 AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN,1,[big_endian])],
467 [AC_DEFINE(LITTLE_ENDIAN,1,[little_endian])])
469 if test "$prefix" = "/"; then
479 AC_CHECK_PROG([PERL_PATH], [perl], `which perl`, "false")
480 if test "$PERL_PATH" = "false"; then
490 dnl *** wow, hope all that worked
495 AC_OUTPUT(Makefile gui/Makefile audio/Makefile not/Makefile tools/bin2head)
497 chmod +x tools/bin2head
498 cat confdefs.h >> config.h