Browse code

generic foo-config --cflags/libs test

Originally committed as revision 8033 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2007/02/20 08:15:15
Showing 1 changed files
... ...
@@ -502,6 +502,23 @@ require2(){
502 502
     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
503 503
 }
504 504
 
505
+check_foo_config(){
506
+    cfg=$1
507
+    pkg=$2
508
+    header=$3
509
+    func=$4
510
+    shift 4
511
+    disable $cfg
512
+    check_cmd ${pkg}-config --version
513
+    err=$?
514
+    if test "$err" = 0; then
515
+        temp_cflags `${pkg}-config --cflags`
516
+        temp_extralibs `${pkg}-config --libs`
517
+        check_lib "$@" $header $func && enable $cfg
518
+    fi
519
+    return $err
520
+}
521
+
505 522
 apply(){
506 523
     file=$1
507 524
     shift
... ...
@@ -1575,27 +1592,8 @@ enabled audio_beos && add_extralibs "-lmedia -lbe"
1575 1575
 
1576 1576
 enabled mingw32 && add_extralibs -lws2_32
1577 1577
 
1578
-##########################################
1579
-# imlib check
1580
-
1581
-imlib2=no
1582
-if imlib2-config --version >/dev/null 2>&1; then
1583
-    temp_cflags `imlib2-config --cflags`
1584
-    temp_extralibs `imlib2-config --libs`
1585
-    check_lib Imlib2.h imlib_load_font && enable imlib2
1586
-    restore_flags
1587
-fi
1588
-
1589
-##########################################
1590
-# FreeType check
1591
-
1592
-freetype2=no
1593
-if freetype-config --version >/dev/null 2>&1; then
1594
-    temp_cflags `freetype-config --cflags`
1595
-    temp_extralibs `freetype-config --libs`
1596
-    check_lib ft2build.h FT_Init_FreeType && enable freetype2
1597
-    restore_flags
1598
-fi
1578
+check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1579
+check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1599 1580
 
1600 1581
 ##########################################
1601 1582
 # SDL check