aboutsummaryrefslogblamecommitdiff
path: root/tmp/configure-caro-avisynth.in
blob: d1b06e8121f640e6c312f678db73d4350133175b (plain) (tree)
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
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818

















































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                       
dnl ==========================================================================
dnl
dnl Autoconf script for XviD
dnl
dnl Copyright(C) 2003-2004 Edouard Gomez <ed.gomez@free.fr>
dnl
dnl ==========================================================================
dnl
dnl Modified for Avisynth 3.0
dnl
dnl Copyright(C) 2005 Vincent TORRI <vtorri@univ-evry.fr>
dnl
dnl ==========================================================================

dnl ==========================================================================
dnl Prerequisites
dnl ==========================================================================

AC_PREREQ([2.52])

dnl ==========================================================================
dnl Default initialization, install prefix and checks build type
dnl ==========================================================================

AC_INIT([Avisynth], [3.0], [http://forum.doom9.org])

AC_PREFIX_DEFAULT("/usr/local")

AC_CONFIG_AUX_DIR([.])

AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE

dnl AC_CONFIG_SRCDIR([../../src/core.h])
AC_CONFIG_MACRO_DIR([m4])

dnl Do not forget to increase that when needed.
API_MAJOR="3"
API_MINOR="0"
VERSION="${API_MAJOR}.${API_MINOR}"

dnl NASM version requirement
minimum_nasm_patch_version=34
nasm_prog="nasm"

dnl BOOST version requirement
BOOST_VERSION_MAJOR="1"
BOOST_VERSION_MINOR="33"
BOOST_VERSION="${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}"

dnl Gstreamer version requirement
GST_REQS=0.8.11
GSTPLUG_REQS=0.8.11

dnl Gtk+ version requirement
GTK_REQS=2.4

dnl Default CFLAGS -- Big impact on overall speed
our_cxxflags_defaults="-O2 -Wall -Wno-non-virtual-dtor -fexceptions"
our_cxxflags_defaults="$our_cxxflags_defaults -fstrength-reduce"
our_cxxflags_defaults="$our_cxxflags_defaults -finline-functions"
our_cxxflags_defaults="$our_cxxflags_defaults -ffast-math"

dnl Default GEN_SOURCES for gen_source.sh
dnl On Linux, Vfw and COM files should be removed
GEN_SOURCES=

dnl ==========================================================================
dnl Features - configure options
dnl
dnl modified
dnl
dnl ==========================================================================

FEATURES=""

dnl Compilers version to use
AC_ARG_ENABLE(
   [gcc-3-3-4],
   AC_HELP_STRING(
      [--enable-gcc-3-3-4],
      [Use g++ 3.3.4]),
      [if test "$enable_gcc_3_3_4" = "yes" ; then
          gpp="/usr/gcc/bin/g++-3.3.4"
       fi],
      [])

dnl Debug mode
AC_ARG_ENABLE(
   [core-debug],
   AC_HELP_STRING(
      [--enable-core-debug],
      [Enable debug mode for avs' core (default=no)]),
   [if test "$enable_core_debug" = "no" ; then
       core_debug_mode="no"
    else
       if test "$enable_core_debug" = "yes" ; then
          core_debug_mode="yes"
       fi
    fi],
   [core_debug_mode="no"])

dnl Assembly code
AC_ARG_ENABLE(
   [assembly],
   AC_HELP_STRING(
      [--disable-assembly],
      [Disable assembly code]),
   [if test "$enable_assembly" = "no" ; then
       assembly="no"
    else
       if test "$enable_assembly" = "yes" ; then
          assembly="yes"
       fi
    fi],
   [assembly="yes"])

dnl Build as a module not a shared lib on darwin
AC_ARG_ENABLE(
   [macosx_module],
   AC_HELP_STRING(
      [--enable-macosx_module],
      [Build as a module on MacOS X]),
   [if test "$enable_macosx_module" = "yes" ; then
       macosx_module="yes"
    else 
       macosx_module="no"
    fi],
   [macosx_module="no"])

dnl ==========================================================================
dnl Check for the C compiler (could be passed on command line)
dnl ==========================================================================

dnl
dnl First we test if CXXFLAGS have been passed on command line
dnl I do that because autoconf defaults (-g -O2) suck and they would kill
dnl performance. To prevent that we define a good defult CXXFLAGS at the end
dnl of the script if and only if CXXFLAGS has not been passed on the command
dnl line
dnl
AC_MSG_CHECKING(whether to use default CXXFLAGS)
if test  x"$CXXFLAGS" = x"" ; then
   force_default_cxx_options="yes"
   AC_MSG_RESULT([yes])
else
   force_default_cxx_options="no"
   AC_MSG_RESULT([no])
fi

dnl Now we can safely check for the C++ compiler
AC_LANG([C++])
AC_PROG_CXX([${gpp}])
AC_PROG_CXXCPP([${gpp}])

dnl ==========================================================================
dnl Check for the visibility feature of GCC 4.0
dnl ==========================================================================

GCC_VISIBILITY_FEATURE=
AC_MSG_CHECKING([whether ${CXX} supports -fvisibility=hidden])
save_CXXFLAGS=${CXXFLAGS}
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
AC_TRY_LINK(
   [],
   [return 0;],
   [HAVE_GCC_VISIBILITY_FEATURE="-DHAVE_GCC_VISIBILITY_FEATURE"
    visibility="yes"],
   [visibility="no"])
AC_MSG_RESULT(${visibility})
CXXFLAGS=${save_CXXFLAGS}

dnl ==========================================================================
dnl Check for the install program
dnl ==========================================================================

AC_PROG_INSTALL

dnl ==========================================================================
dnl Check for the symbolic links
dnl ==========================================================================

AC_PROG_LN_S

dnl ==========================================================================
dnl Check for the ranlib program to generate static library index
dnl ==========================================================================

AC_PROG_RANLIB

dnl ==========================================================================
dnl
dnl This part looks for:
dnl
dnl ARCHITECTURE : The platform architecture
dnl                - IA32 for mmx, mmx-ext, mmx2, sse assembly
dnl                - IA64
dnl                - PPC for PowerPC assembly routines
dnl                - GENERIC for plain C sources only
dnl
dnl BUS: Address bus size (in bits)
dnl      - 32
dnl      - 64
dnl
dnl ==========================================================================

dnl
dnl Looking what sources have to be compiled according to the CPU type
dnl

ARCHITECTURE=""

AC_MSG_CHECKING([for whether to use assembly code])
if test x"$assembly" = x"yes" ; then
   AC_MSG_RESULT([yes])
   AC_MSG_CHECKING([for architecture type])
   case "$target_cpu" in
      i[[3456]]86)
         AC_MSG_RESULT(ia32)
         ARCHITECTURE="IA32"
      ;;	
      powerpc)
         AC_MSG_RESULT(PowerPC)
         dnl ATM the ppc port is out of date 
         dnl ARCHITECTURE="PPC"
         assembly="no"
      ;;
      ia64)
         AC_MSG_RESULT(ia64)
         ARCHITECTURE="IA64"
      ;;
      *)
         AC_MSG_RESULT($target_cpu)
         assembly="no"
      ;;
   esac
else
   AC_MSG_RESULT([no])
   assembly="no"
fi

dnl ==========================================================================
dnl
dnl Check for OS specific variables
dnl    - SHARED_EXTENSION, STATIC_EXTENSION, OBJECT_EXTENSION
dnl
dnl ==========================================================================

AC_MSG_CHECKING(for build extensions)
SHARED_EXTENSION=""
STATIC_EXTENSION=""
OBJECT_EXTENSION=""
case "$target_os" in
     *bsd*|linux*|beos|irix*|solaris*)
	AC_MSG_RESULT([.so .a .o])
	STATIC_EXTENSION="a"
	SHARED_EXTENSION="so"
	OBJECT_EXTENSION="o"
	;;
     [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
	AC_MSG_RESULT([.dll .a .obj])
	STATIC_EXTENSION="a"
	SHARED_EXTENSION="dll"
	OBJECT_EXTENSION="obj"
	;;
     darwin*|raphsody*)
	if test x"$macosx_module" = x"yes"; then
	   AC_MSG_RESULT([.so .a .o])
	   SHARED_EXTENSION="so"
        else
	   AC_MSG_RESULT([.dynlib .a .o])
	   SHARED_EXTENSION="dylib"
	fi
	STATIC_EXTENSION="a"
	OBJECT_EXTENSION="o"
	;;
     *)
        AC_MSG_RESULT([Unknown OS - Using .so .a .o])
	STATIC_EXTENSION="a"
	SHARED_EXTENSION="so"
	OBJECT_EXTENSION="o"
	;;
esac

dnl ==========================================================================
dnl
dnl Determines best options for CC and LD
dnl  - STATIC_LIB, SHARED_LIB, SPECIFIC_CFLAGS, SPECIFIC_LDLAGS
dnl
dnl
dnl
dnl ==========================================================================

AC_MSG_CHECKING(for platform specific LDFLAGS/CFLAGS)
SPECIFIC_LDFLAGS=""
SPECIFIC_CFLAGS=""
PRE_SHARED_LIB=""
case "$target_os" in
     *bsd*|linux*|irix*|solaris*)
	AC_MSG_RESULT([ok])
	STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)"
	SHARED_LIB="libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR).\$(API_MINOR)"
	SPECIFIC_LDFLAGS="-Wl,-soname,libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR) -shared -lc -lm -lrt -ldl"
	SPECIFIC_CFLAGS="-pthread -fPIC"
	GEN_SOURCES="/com\\\\/d;/vfw\\\\/d;"
	;;
     [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
	AC_MSG_RESULT([ok])
	STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)"
	SHARED_LIB="avisynth.\$(SHARED_EXTENSION)"
	SPECIFIC_LDFLAGS="-lgdi32 -lvfw32 -luuid -lole32 -lmsacm32 -shared -Wl,--out-implib,\$@.a libavisynth.def"
	SPECIFIC_CFLAGS="-Os -mno-cygwin"
	;;
     darwin*|raphsody*)
	STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)"
	SPECIFIC_CFLAGS="-fPIC -fno-common -no-cpp-precomp"
	if test x"$macosx_module" = x"no"; then
	   AC_MSG_RESULT([dylib options])
	   SHARED_LIB="libavisynth.\$(API_MAJOR).\$(SHARED_EXTENSION)"
	   SPECIFIC_LDFLAGS="-dynamiclib -flat_namespace -compatibility_version \$(API_MAJOR) -current_version \$(API_MAJOR).\$(API_MINOR) -install_name \$(libdir)/\$(SHARED_LIB)"
	else 
	   AC_MSG_RESULT([module options])
 	   PRE_SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)-temp.o"
	   SHARED_LIB="libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR)"
	   SPECIFIC_LDFLAGS="-r -keep_private_externs -nostdlib && \$(CC) \$(LDFLAGS) \$(PRE_SHARED_LIB) -o libavisynth.\$(SHARED_EXTENSION).\$(API_MAJOR) -bundle -flat_namespace -undefined suppress"
	fi
	GEN_SOURCES="/vfw\\/d;"
	;;
     beos)
	AC_MSG_RESULT([ok])
	STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)"
	SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)"
	SPECIFIC_LDFLAGS="-nostart"
	SPECIFIC_CFLAGS="-fPIC"
	;;
     *)
        AC_MSG_RESULT([Unknown Platform (Using default -shared -lc -lm)])
	STATIC_LIB="libavisynth.\$(STATIC_EXTENSION)"
	SHARED_LIB="libavisynth.\$(SHARED_EXTENSION)"
	SPECIFIC_LDFLAGS=""
	SPECIFIC_CFLAGS=""
	;;
esac

if test x"$PRE_SHARED_LIB" = x; then 
  PRE_SHARED_LIB=$SHARED_LIB
fi

dnl ==========================================================================
dnl
dnl Assembler stuff
dnl  - AS, AFLAGS, ASSEMBLY_EXTENSION, SOURCES
dnl
dnl ==========================================================================

AS=""
AFLAGS=""
ASSEMBLY_EXTENSION=""
ASSEMBLY_SOURCES=""

dnl
dnl IA32
dnl

if test "$ARCHITECTURE" = "IA32" ; then

   dnl
   dnl Checking nasm existence
   dnl
   AC_CHECK_PROG([ac_nasm], [$nasm_prog], [yes], [no], , [yes])
   if test "$ac_nasm" = "yes" ; then

      dnl
      dnl Checking nasm patch version
      dnl
      AC_MSG_CHECKING([for nasm patch version])
      nasm_patch=`nasm -r | cut -d '.' -f 3 | cut -d ' ' -f 1`
      if test -z $nasm_patch ; then
        nasm_patch=-1
      fi
      AC_MSG_RESULT([$nasm_patch])


      if test "$nasm_patch" -lt "$minimum_nasm_patch_version" ; then
        AC_MSG_ERROR([nasm patch version too old - Update nasm])
      else

         dnl
         dnl Checking nasm format - win32 or elf
         dnl
         AC_MSG_CHECKING([for nasm object format])
         case "$target_os" in
              *bsd*|linux*|beos|irix*|solaris*)
                  AC_MSG_RESULT([elf])
                  NASM_FORMAT="elf"
		  PREFIX=""
                  ;;
              [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
                  AC_MSG_RESULT([win32])
                  NASM_FORMAT="win32"
		  PREFIX="-DPREFIX"
                  ;;
          esac
          AS=nasm
          AFLAGS="-I\$(<D)/ -f $NASM_FORMAT $PREFIX -D_FORCE_NASM"
          ASSEMBLY_EXTENSION="asm"
          ASSEMBLY_SOURCES="SRC_IA32"
       fi

   else
	AC_MSG_ERROR([nasm not found - nasm is needed for Avisynth 3.0])
   fi

fi

dnl
dnl PPC
dnl

if test "$ARCHITECTURE" = "PPC" ; then
   AS="\$(CC)"
   AFLAGS="-c"
   ASSEMBLY_EXTENSION="s"
   ASSEMBLY_SOURCES="SRC_PPC"
   AC_MSG_CHECKING([for Altivec support])
   cat > conftest.S << EOF
         .text
         vxor 0,0,0
EOF
   if $CC -c conftest.S 2>/dev/null 1>/dev/null ; then
      AC_MSG_RESULT(yes)
      SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS -DARCH_IS_PPC_ALTIVEC"
      ASSEMBLY_SOURCES="SRC_ALTIVEC"
   else
      AC_MSG_RESULT(no)
   fi
   rm -f conftest.*
fi

dnl
dnl IA64
dnl

if test "$ARCHITECTURE" = "IA64" ; then
   AS="\$(CC)"
   AFLAGS="-c"
   ASSEMBLY_EXTENSION="s"
   ASSEMBLY_SOURCES="SRC_IA64"
   case `basename $CC` in
      *ecc*)
         DCT_IA64_SOURCES="SRC_IA64_IDCT_ECC"

         dnl If the compiler is ecc, then i don't know its options
         dnl fallback to "no options"
         if test "$force_default_cxx_options" = "yes" ; then
            our_cflags_defaults=""
         fi
      ;;
      *)
         DCT_IA64_SOURCES="SRC_IA64_IDCT_GCC"
      ;;
   esac
fi

dnl ==========================================================================
dnl
dnl Check arguments
dnl
dnl ==========================================================================


dnl Check debug mode
if test "$core_debug_mode" = "yes" ; then
   CORE_DEBUG_MODE_CFLAGS="-g"
   our_cxxflags_defaults="-Wall -Wno-non-virtual-dtor -fexceptions"
else
   CORE_DEBUG_MODE_CFLAGS="-DNDEBUG"
   SPECIFIC_LDFLAGS="-s ${SPECIFIC_LDFLAGS}"
fi


dnl ==========================================================================
dnl
dnl Check for header files
dnl
dnl ==========================================================================

dnl ==========================================================================
dnl Standard header files
dnl ==========================================================================

AC_CHECK_HEADERS(
   [malloc.h assert.h],
   [],
   [AC_MSG_ERROR(Missing header file)])

case "$target_os" in 
   *bsd*|linux*|beos|irix*|solaris*)
      AC_CHECK_HEADER(
         [pthread.h],
         [],
         [AC_MSG_ERROR(Missing header file)])
      AC_CHECK_HEADER(
         [time.h],
         [AC_CHECK_LIB(
            [rt],
            [clock_gettime],
            [],
            [AC_MSG_ERROR(Missing function: clock_gettime)])],
         [AC_MSG_ERROR(Missing header file)])
      AC_CHECK_HEADER(
         [dlfcn.h],
         [AC_CHECK_LIB(
            [dl],
            [dlopen],
            [],
            [AC_MSG_ERROR(Missing function: dlopen)])
          AC_CHECK_LIB(
            [dl],
            [dlclose],
            [],
            [AC_MSG_ERROR(Missing function: dlclose)])
          AC_CHECK_LIB(
            [dl],
            [dlsym],
            [],
            [AC_MSG_ERROR(Missing function: dlsym)])],
         [AC_MSG_ERROR(Missing header file)])
   ;;
   [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
      AC_CHECK_HEADERS(
         [initguid.h objbase.h windows.h vfw.h],
         [],
         [AC_MSG_ERROR(Missing header file)])
      AC_CHECK_HEADERS(
         [winbase.h wingdi.h],
         [],
         [AC_MSG_ERROR(Missing header file)],
         [#include <windows.h>])
   ;;
esac

dnl ==========================================================================
dnl STLPORT header and library files
dnl ==========================================================================

AM_CHECK_STLPORT(
   [${target_os}],
   [],
   [AC_MSG_ERROR("STLport is needed !")])

dnl ==========================================================================
dnl BOOST header and library files
dnl ==========================================================================

AM_CHECK_BOOST(
   [${BOOST_VERSION}],
   [${target_os}],
   [], 
   [AC_MSG_ERROR("Boost is needed !")])

dnl ==========================================================================
dnl FFMPEG header and library files
dnl ==========================================================================

AM_CHECK_FFMPEG(
   [],
   [our_cxxflags_defaults="-ansi ${our_cxxflags_defaults}"])

dnl ==========================================================================
dnl Gstreamer header and library files
dnl ==========================================================================

GST_MAJORMINOR=0.8
PKG_CHECK_MODULES(
   [GST],
   [gstreamer-$GST_MAJORMINOR >= $GST_REQS],
   [HAVE_GSTREAMER="yes"],
   [HAVE_GSTREAMER="no"])

PKG_CHECK_MODULES(
   [GSTPLUG],
   [gstreamer-interfaces-$GST_MAJORMINOR >= $GSTPLUG_REQS],
   [HAVE_GSTPLUG="yes"],
   [HAVE_GSTPLUG="no"])

AM_GST_ELEMENT_CHECK(
   [ffmpeg],
   [HAVE_GSTFFMPEG="yes"],
   [HAVE_GSTFFMPEG="no"])

case "$target_os" in
   *bsd*|linux*|beos|irix*|solaris*)
      if test "${ffmpeg_enable}" = "no" && test "${HAVE_GSTREAMER}" = "no" ; then
         AC_MSG_ERROR([FFMPEG or Gstreamer support are needed when building Avisynth 3.0 on linux])
      fi
   ;;
esac

dnl ==========================================================================
dnl FREETYPE header and library files
dnl ==========================================================================

FREETYPE_CONFIG="freetype-config"
AC_ARG_WITH(
   [freetype-config],
   [--with-freetype-config=FILE   freetype-config script to use (eg /usr/bin/freetype-config)],
   [
    FREETYPE_CONFIG=${withval}
    AC_CHECK_PROG(
       [FREETYPE_CONFIG_IN_PATH],
       [${FREETYPE_CONFIG}],
       [yes],
       [no])
    if test ${FREETYPE_CONFIG_IN_PATH} = no ; then
       echo "ERROR:"
       echo "The freetype-config development script you specified:"
       echo "${FREETYPE_CONFIG}"
       echo "was not found.  Please check the path and make sure "
       echo "the script exists and is executable."
       AC_MSG_ERROR([Fatal Error: no freetype-config detected.])
       exit;
    fi
    with_freetype_arg="yes"
    FREETYPE_CFLAGS=`${FREETYPE_CONFIG} --cflags`
    FREETYPE_LIBS=`${FREETYPE_CONFIG} --libs`
   ],
   [
    AC_CHECK_PROG(FREETYPE_CONFIG_IN_PATH, $FREETYPE_CONFIG, yes, no)
    if test $FREETYPE_CONFIG_IN_PATH = no; then
       echo "ERROR:"
       echo "The freetype-config development script was not found in your execute"
       echo "path. This may mean one of several things"
       echo "1. You may not have installed the freetype-devel (or freetype-dev)"
       echo "   packages."
       echo "2. You may have freetype installed somewhere not covered by your path."
       echo ""
       echo "If this is the case make sure you have the packages installed, AND"
       echo "that the freetype-config script is in your execute path (see your"
       echo "shell's manual page on setting the \$PATH environment variable), OR"
       echo "alternatively, specify the script to use with --with-freetype-config."
       AC_MSG_ERROR([Fatal Error: no freetype-config detected.])
       exit;
    fi
    with_freetype_arg="yes"
    FREETYPE_CFLAGS=`${FREETYPE_CONFIG} --cflags`
    FREETYPE_LIBS=`${FREETYPE_CONFIG} --libs`
   ])

dnl ==========================================================================
dnl Gtk+ header and library files
dnl ==========================================================================

PROG=""
HAVE_GTK="no"
GTK_MAJORMINOR=2.0
PKG_CHECK_MODULES(
   [GTK],
   [gtk+-$GTK_MAJORMINOR >= $GTK_REQS],
   [HAVE_GTK="yes"],
   [HAVE_GTK="no"])

case "$target_os" in
   *bsd*|linux*|beos|irix*|solaris*)
      if test "${HAVE_GTK}" = "no" ; then
         AC_MSG_WARN([Test application not built])
      else
         PROG="avisynth_test"
      fi
   ;;
esac

dnl ==========================================================================
dnl x264 header and library files
dnl ==========================================================================

dnl AM_CHECK_X264(
dnl    [],
dnl    [], 
dnl    [AC_MSG_WARN("x264 not found !")])

dnl ==========================================================================
dnl
dnl Now we can set CXXFLAGS if needed
dnl
dnl ==========================================================================

if test "$force_default_cxx_options" = "yes" ; then
   CXXFLAGS="$our_cxxflags_defaults"
fi

dnl ==========================================================================
dnl
dnl Profiling stuff goes here
dnl  - adds options to SPECIFIC_CFLAGS, SPECIFIC_LDLAGS
dnl  - removes incompatible options from CFLAGS
dnl
dnl ==========================================================================

SPECIFIC_LDFLAGS="$SPECIFIC_LDFLAGS $GNU_PROF_LDFLAGS"
SPECIFIC_CFLAGS="$SPECIFIC_CFLAGS $GNU_PROF_CFLAGS"

if test "$enable_gnuprofile" = "yes" ; then
   CFLAGS=`echo $CFLAGS | sed s/'-fomit-frame-pointer'/''/`
fi

dnl ==========================================================================
dnl
dnl SOURCES
dnl
dnl ==========================================================================

GENERIC_BIN_SOURCES="SRC_BIN_GENERIC"
GENERIC_LIB_SOURCES="SRC_LIB_GENERIC"

dnl ==========================================================================
dnl
dnl Substitions
dnl
dnl ==========================================================================


AC_SUBST(FEATURES)
AC_SUBST(ARCHITECTURE)
AC_SUBST(SHARED_EXTENSION)
AC_SUBST(STATIC_EXTENSION)
AC_SUBST(OBJECT_EXTENSION)
AC_SUBST(NASM_FORMAT)
AC_SUBST(AS)
AC_SUBST(AFLAGS)
AC_SUBST(ASSEMBLY_EXTENSION)
AC_SUBST(GENERIC_SOURCES)
AC_SUBST(ASSEMBLY_SOURCES)
AC_SUBST(CXX)
AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(SPECIFIC_CFLAGS)
AC_SUBST(SPECIFIC_LDFLAGS)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(CORE_DEBUG_MODE_CFLAGS)
AC_SUBST(INSTALL)
AC_SUBST(LN_S)
AC_SUBST(RANLIB)
AC_SUBST(PACKAGE)
AC_SUBST(API_MAJOR)
AC_SUBST(API_MINOR)
AC_SUBST(VERSION)
AC_SUBST(STATIC_LIB)
AC_SUBST(PRE_SHARED_LIB)
AC_SUBST(SHARED_LIB)
AC_SUBST(GENERIC_BIN_SOURCES)
AC_SUBST(GENERIC_LIB_SOURCES)
AC_SUBST(PROG)

AC_SUBST(exec_prefix)
AC_SUBST(bindir)
AC_SUBST(libdir)
AC_SUBST(includedir)


dnl ==========================================================================
dnl
dnl Output files
dnl
dnl ==========================================================================

AC_CONFIG_FILES([config.h])
AC_CONFIG_FILES([platform.inc])
AC_CONFIG_FILES([gen_sources.sh],
                [chmod +x gen_sources.sh && ./gen_sources.sh])
AC_CONFIG_FILES([avisynth-3.0.pc])

AC_OUTPUT

#####################################################################
## Info

echo
echo "------------------------------------------------------------------------"
echo " $PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo " OS..................: $target_os"
echo
echo " Visibility feature..: $visibility"
echo " Core debug mode.....: $core_debug_mode"
echo " ASM support.........: $assembly"
echo
echo " FFMPEG support......: $ffmpeg_enable"
echo " FFMPEG debug mode...: $ffmpeg_debug_mode"
echo
echo " Gstreamer support...: $HAVE_GSTREAMER"
echo "    Gst-Plugin.......: $HAVE_GSTPLUG"
echo "    Gst-FFmpeg.......: $HAVE_GSTFFMPEG"
echo
echo " Gtk+................: $HAVE_GTK"
echo
echo
echo " Install path........: $prefix"
echo "   binaries..........: $bindir"
echo "   libraries.........: ${libdir}"
echo "   headers...........: ${includedir}/avisynth-3.0"
echo "   data..............: ${datadir}/avisynth-3.0"
echo
echo " Compilation.........: make"
echo " Installation........: make install"
echo

if test x"$HAVE_GSTFFMPEG" = x"no" ; then
  echo " WARNING: Gst-FFmpeg is not installed. This means that most"
  echo "          of the usual video streams will not be decoded"
  echo "          (xvid, divx, x264 for example). We recommend that"
  echo "          you install it."
  echo
fi