File: configure.in

package info (click to toggle)
libsdl1.0 1.0.1-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,272 kB
  • ctags: 3,116
  • sloc: ansic: 27,493; sh: 8,214; asm: 1,327; cpp: 1,042; makefile: 653; perl: 57
file content (749 lines) | stat: -rw-r--r-- 24,477 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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)

dnl Set various version strings - taken gratefully from the GTk sources
#
# Making releases:
# Edit include/SDL/SDL_version.h and change the version, then:
#   SDL_MICRO_VERSION += 1;
#   SDL_INTERFACE_AGE += 1;
#   SDL_BINARY_AGE += 1;
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
#
SDL_MAJOR_VERSION=1
SDL_MINOR_VERSION=0
SDL_MICRO_VERSION=1
SDL_INTERFACE_AGE=1
SDL_BINARY_AGE=1
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION

AC_SUBST(SDL_MAJOR_VERSION)
AC_SUBST(SDL_MINOR_VERSION)
AC_SUBST(SDL_MICRO_VERSION)
AC_SUBST(SDL_INTERFACE_AGE)
AC_SUBST(SDL_BINARY_AGE)
AC_SUBST(SDL_VERSION)

# libtool versioning
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
LT_REVISION=$SDL_INTERFACE_AGE
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`

AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

dnl Setup for automake
AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Check for tools

AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

dnl The alpha architecture needs special flags for binary portability
AC_CANONICAL_TARGET
case "$target" in
    alpha*-*-linux*)
        CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
        ;;
esac

dnl Check for compiler environment

AC_C_CONST

dnl Initialize the compiler and linker flags for SDL applications

SDL_CFLAGS=""
SDL_LIBS="-lSDL"

dnl Enable/disable various subsystems of the SDL library

AC_ARG_ENABLE(audio,
[  --enable-audio          Enable the audio subsystem [default=yes]],
              , enable_audio=yes)
if test x$enable_audio = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
    SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
else
    CFLAGS="$CFLAGS -DDISABLE_AUDIO"
fi
AC_ARG_ENABLE(video,
[  --enable-video          Enable the video subsystem [default=yes]],
              , enable_video=yes)
if test x$enable_video = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS video"
    SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
else
    CFLAGS="$CFLAGS -DDISABLE_VIDEO"
fi
AC_ARG_ENABLE(events,
[  --enable-events         Enable the events subsystem [default=yes]],
              , enable_events=yes)
if test x$enable_video = xyes -a x$enable_events = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS events"
    SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
else
    CFLAGS="$CFLAGS -DDISABLE_EVENTS"
fi
AC_ARG_ENABLE(cdrom,
[  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
              , enable_cdrom=yes)
if test x$enable_cdrom = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
    SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
else
    CFLAGS="$CFLAGS -DDISABLE_CDROM"
fi
AC_ARG_ENABLE(threads,
[  --enable-threads        Enable the threading subsystem [default=yes]],
              , enable_threads=yes)
if test x$enable_threads = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
    SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
else
    CFLAGS="$CFLAGS -DDISABLE_THREADS"
fi
AC_ARG_ENABLE(timers,
[  --enable-timers         Enable the timer subsystem [default=yes]],
              , enable_timers=yes)
if test x$enable_timers = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
    SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
else
    CFLAGS="$CFLAGS -DDISABLE_TIMERS"
fi
AC_ARG_ENABLE(endian,
[  --enable-endian         Enable the endian subsystem [default=yes]],
              , enable_endian=yes)
if test x$enable_endian = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
    SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
else
    CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
fi
AC_ARG_ENABLE(file,
[  --enable-file           Enable the file subsystem [default=yes]],
              , enable_file=yes)
if test x$enable_file = xyes; then
    SDL_EXTRADIRS="$SDL_EXTRADIRS file"
    SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
else
    CFLAGS="$CFLAGS -DDISABLE_FILE"
fi

dnl Find the ESD includes and libraries
CheckESD()
{
    AC_ARG_ENABLE(esd,
[  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
                  , enable_esd=yes)
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
        AM_PATH_ESD(0.2.8, [
            CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
            SYSTEM_LIBS="$SYSTEM_LIBS -lesd"
        ])
    fi
}

dnl See if we can use x86 assembly blitters
CheckNASM()
{
    dnl Check for NASM (for assembly blit routines)
    AC_ARG_ENABLE(nasm,
[  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
                  , enable_nasm=yes)
    if test x$enable_video = xyes -a x$enable_nasm = xyes; then
        AC_PATH_PROG(NASM, nasm)
        if test x$NASM = x -o x$NASM = x'"$NASM"'; then
            : # nasm isn't installed
        else
            CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
            case $ARCH in
              win32)
                  NASMFLAGS="-f win32"
                  ;;
              *)
                  NASMFLAGS="-f elf"
                  ;;
            esac
            AC_SUBST(NASMFLAGS)
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
            SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
            SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
        fi
    fi
}

dnl Find the X11 include and library directories
CheckX11()
{
    AC_ARG_ENABLE(video_x11,
[  --enable-video-x11      use X11 video driver [default=yes]],
                  , enable_video_x11=yes)
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
        AC_PATH_X
        AC_PATH_XTRA
        if test x$have_x = xyes; then
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11"
            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"

            AC_ARG_ENABLE(video-x11-dga,
[  --enable-video-x11-dga  use X11 DGA fullscreen video driver [default=yes]],
                          , enable_video_x11_dga=yes)
            if test x$enable_video_x11_dga = xyes; then
                AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
                video_x11_dga=no
                AC_TRY_COMPILE([
                 #include <X11/Xlib.h>
                 #include <X11/extensions/xf86dga.h>
                 #include <X11/extensions/xf86vmode.h>
                ],[
                ],[
                video_x11_dga=yes
                ])
                AC_MSG_RESULT($video_x11_dga)
                if test x$video_x11_dga = xyes; then
                    CFLAGS="$CFLAGS -DXFREE86_DGA"
                    SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga -lXxf86vm"
                fi
            fi
    
            AC_ARG_ENABLE(video-x11-mtrr,
[  --enable-video-x11-mtrr use Memory Type Range Register support [default=yes]],
                          , enable_video_x11_mtrr=yes)
            if test x$enable_video_x11_mtrr = xyes; then
                AC_MSG_CHECKING(for Memory Type Range Register support)
                video_x11_mtrr=no
                AC_TRY_COMPILE([
                 #include <asm/mtrr.h>
                ],[
                 struct mtrr_sentry entry;
                ],[
                video_x11_mtrr=yes
                ])
                AC_MSG_RESULT($video_x11_mtrr)
                if test x$video_x11_mtrr = xyes; then
                    CFLAGS="$CFLAGS -DMTRR_SUPPORT"
                fi
            fi
        fi
    fi
}

dnl Find the framebuffer console includes
CheckFBCON()
{
    AC_ARG_ENABLE(video-fbcon,
[  --enable-video-fbcon    use framebuffer console video driver [default=no]],
                  , enable_video_fbcon=yes)
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
        AC_MSG_CHECKING(for framebuffer console support)
        video_fbcon=no
        AC_TRY_COMPILE([
         #include <linux/fb.h>
         #include <linux/kd.h>
         #include <linux/keyboard.h>
        ],[
        ],[
        video_fbcon=yes
        ])
        AC_MSG_RESULT($video_fbcon)
        if test x$video_fbcon = xyes; then
            CFLAGS="$CFLAGS -DENABLE_FBCON"
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
            VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
        fi
    fi
}

dnl Find the GGI includes
CheckGGI()
{
    AC_ARG_ENABLE(video-ggi,
[  --enable-video-ggi      use GGI video driver [default=no]],
                  , enable_video_ggi=no)
    if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
        AC_MSG_CHECKING(for GGI support)
        video_ggi=no
        AC_TRY_COMPILE([
         #include <ggi/ggi.h>
         #include <ggi/gii.h>
        ],[
        ],[
        video_ggi=yes
        ])
        AC_MSG_RESULT($video_ggi)
        if test x$video_ggi = xyes; then
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
            SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
            VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
        fi
    fi
}

dnl Find the SVGAlib includes and libraries
CheckSVGA()
{
    AC_ARG_ENABLE(video-svga,
[  --enable-video-svga     use SVGAlib video driver [default=no]],
                  , enable_video_svga=no)
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
        video_svga=no
        AC_TRY_COMPILE([
         #include <vga.h>
         #include <vgamouse.h>
         #include <vgakeyboard.h>
         #include <linux/kd.h>
         #include <linux/keyboard.h>
        ],[
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
             exit(0);
         }
        ],[
        video_svga=yes
        ])
        AC_MSG_RESULT($video_svga)
        if test x$video_svga = xyes; then
            CFLAGS="$CFLAGS -DENABLE_SVGALIB"
            SYSTEM_LIBS="$SYSTEM_LIBS -lvga"

            VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
            VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
        fi
    fi
}

dnl See what type of thread model to use on Linux and Solaris
CheckPTHREAD()
{
    dnl Check for pthread support
    AC_ARG_ENABLE(pthreads,
[  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
                  , enable_pthreads=yes)
    ac_save_libs="$LIBS"
    case "$target" in
        *-*-freebsd*)
            pthread_lib="-lc_r"
            ;;
        *)
            pthread_lib="-lpthread"
            ;;
    esac
    LIBS="$LIBS $pthread_lib"
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
        AC_MSG_CHECKING(for pthreads)
        use_pthreads=no
        AC_TRY_LINK([
         #include <pthread.h>
        ],[
         pthread_attr_t type;
         pthread_attr_init(&type);
        ],[
        use_pthreads=yes
        ])
        AC_MSG_RESULT($use_pthreads)
        if test x$use_pthreads = xyes; then
            CFLAGS="$CFLAGS -D_REENTRANT -DSDL_USE_PTHREADS"
            SDL_CFLAGS="$SDL_CFLAGS -D_REENTRANT"
            SDL_LIBS="$SDL_LIBS $pthread_lib"
        fi
    fi
    LIBS="$ac_save_libs"

    # See if we can use clone() on Linux directly
    use_clone=no
    if test x$use_pthreads != xyes; then
        case "$target" in
            *-*-linux*)
                use_clone=yes
                ;;
            *)
                CFLAGS="$CFLAGS -DFORK_HACK"
                ;;
        esac
    fi
    AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
}

dnl Determine whether the compiler can produce Win32 executables
CheckWIN32()
{
    AC_MSG_CHECKING(Win32 compiler)
    have_win32_gcc=no
    AC_TRY_COMPILE([
     #include <windows.h>
    ],[
    ],[
    have_win32_gcc=yes
    ])
    AC_MSG_RESULT($have_win32_gcc)
    if test x$have_win32_gcc != xyes; then
       AC_MSG_ERROR([
*** Your compiler ($CC) does not produce Win32 executables!
       ])
    fi
}

dnl Find the DirectX includes and libraries
CheckDIRECTX()
{
    AC_ARG_ENABLE(directx,
[  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
                  , enable_directx=yes)
    if test x$enable_directx = xyes; then
        AC_MSG_CHECKING(for DirectX headers and libraries)
        use_directx=no
        AC_TRY_COMPILE([
         #include "src/video/windx5/directx.h"
        ],[
        ],[
        use_directx=yes
        ])
        AC_MSG_RESULT($use_directx)
    fi
    AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)

    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
    SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
    VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
    # Enable the DIB driver
    CFLAGS="$CFLAGS -DENABLE_WINDIB"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
    VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
    # See if we should enable the DirectX driver
    if test x$use_directx = xyes; then
        CFLAGS="$CFLAGS -DENABLE_DIRECTX"
        SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
        VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
    fi
}

dnl Set up the BWindow video driver on BeOS
CheckBWINDOW()
{
    CFLAGS="$CFLAGS -DENABLE_BWINDOW"
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
    VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
}

dnl Set up the Mac toolbox video driver on MacOS
CheckTOOLBOX()
{
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS toolbox"
    VIDEO_DRIVERS="$VIDEO_DRIVERS toolbox/libvideo_toolbox.la"
}

case "$target" in
    *-*-linux*)
        ARCH=linux
        CheckESD
        CheckNASM
        CheckX11
        CheckFBCON
        CheckGGI
        CheckSVGA
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, linux, SDL_lowaudio.h)
            COPY_ARCH_SRC(src/audio, linux, SDL_sysaudio.c)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            if test x$use_pthreads != xyes; then
                COPY_ARCH_SRC(src/thread, linux, clone.S)
            fi
            COPY_ARCH_SRC(src/thread, linux, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_timer.c)
        fi
        ;;
    *-*-solaris*)
        ARCH=solaris
        CheckESD
        CheckX11
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, solaris, SDL_lowaudio.h)
            COPY_ARCH_SRC(src/audio, solaris, SDL_sysaudio.c)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_timer.c)
        fi
        ;;
    *-*-irix*)
        ARCH=irix
        CheckESD
        CheckX11
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, irix, SDL_lowaudio.h)
            COPY_ARCH_SRC(src/audio, irix, SDL_sysaudio.c)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, irix, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_timer.c)
        fi
        ;;
    *-*-freebsd*)
        ARCH=freebsd
        CheckESD
        CheckX11
        CheckPTHREAD
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, linux, SDL_lowaudio.h)
            COPY_ARCH_SRC(src/audio, linux, SDL_sysaudio.c)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, freebsd, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, linux, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, linux, SDL_timer.c)
        fi
        ;;
    *-*-mingw32*)
        ARCH=win32
        if test "$build" != "$target"; then # cross-compiling
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
        fi
        CheckWIN32
        CheckDIRECTX
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, win32, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, win32, SDL_dibaudio.h)
            COPY_ARCH_SRC(src/audio, win32, SDL_dibaudio.c)
            if test x$use_directx = xyes; then
                COPY_ARCH_SRC(src/audio, win32, SDL_dx5audio.h)
                COPY_ARCH_SRC(src/audio, win32, SDL_dx5audio.c)
            fi
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, win32, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, win32, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, win32, SDL_timer.c)
        fi
        # The Win32 platform requires special setup
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS"
      # Grumble .. Until libtool can handle cross-compile DLL linking
      SDL_LIBS="$SDL_LIBS -luser32 -lgdi32 -lwinmm"
      if test x$use_directx = xyes; then
          SDL_LIBS="$SDL_LIBS -ldxguid"
      fi
        SDL_LIBS="$SDL_LIBS -mwindows"
        ;;
    *-*-beos*)
        ARCH=beos
        ac_default_prefix=/boot/develop/tools/gnupro
        CheckNASM
        CheckBWINDOW
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, linux, SDL_main.c)
        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc)
        COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, beos, SDL_lowaudio.h)
            COPY_ARCH_SRC(src/audio, beos, SDL_beaudio.cc)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, beos, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, beos, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, beos, SDL_timer.c)
        fi
        # The BeOS platform requires special libraries
        LIBS="$LIBS -lroot -lbe -lmedia -ltextencoding"
        ;;
    *-*-macos*)
        ARCH=macos
        CheckTOOLBOX
        # Set up files for the main() stub
        COPY_ARCH_SRC(src/main, macos, SDL_main.c)
        # Set up files for the audio library
        if test x$enable_audio = xyes; then
            COPY_ARCH_SRC(src/audio, macos, SDL_romaudio.h)
            COPY_ARCH_SRC(src/audio, macos, SDL_romaudio.c)
        fi
        # Set up files for the cdrom library
        if test x$enable_cdrom = xyes; then
            COPY_ARCH_SRC(src/cdrom, macos, SDL_syscdrom.c)
        fi
        # Set up files for the thread library
        if test x$enable_threads = xyes; then
            COPY_ARCH_SRC(src/thread, macos, SDL_mutex.c)
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            COPY_ARCH_SRC(src/timer, macos, SDL_timer.c)
        fi
        # The MacOS platform requires special setup
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
        SDL_LIBS="-lSDLmain $SDL_LIBS"
        ;;
    *)             
        AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
        ;;
esac
AC_SUBST(ARCH)

# Set the conditional variables for this target
AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)

dnl Output the video drivers we use
if test x$enable_video = xtrue; then
    if test "$VIDEO_SUBDIRS" = ""; then
        AC_MSG_ERROR(*** No video drivers are enabled!)
    fi
fi
AC_SUBST(VIDEO_SUBDIRS)
AC_SUBST(VIDEO_DRIVERS)
AC_SUBST(SDL_EXTRADIRS)
AC_SUBST(SDL_EXTRALIBS)
AC_SUBST(SYSTEM_LIBS)

dnl Expand the cflags and libraries needed by apps using SDL
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)

dnl Expand the include directories for building SDL
CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
CXXFLAGS="$CFLAGS"

# Finally create all the generated files
dnl Important: Any directory that you want to be in the distcheck should
dnl            have a file listed here, so that configure generates the
dnl            subdirectories on the build target.
AC_OUTPUT([
Makefile
docs/Makefile
include/Makefile
src/Makefile
src/main/Makefile
src/audio/Makefile
src/video/Makefile
src/video/x11/Makefile
src/video/fbcon/Makefile
src/video/ggi/Makefile
src/video/svga/Makefile
src/video/wincommon/Makefile
src/video/windib/Makefile
src/video/windx5/Makefile
src/video/bwindow/Makefile
src/video/toolbox/Makefile
src/events/Makefile
src/cdrom/Makefile
src/thread/Makefile
src/timer/Makefile
src/endian/Makefile
src/file/Makefile
src/hermes/Makefile
sdl-config
sdl.spec
], [chmod +x sdl-config])