+enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
+
+# check for some common methods of building with pthread support
+# do this before the optional library checks as some of them require pthreads
+if enabled pthreads; then
+ { check_cflags -pthread && check_ldflags -pthread; } ||
+ { check_cflags -pthreads && check_ldflags -pthreads; } ||
+ check_lib pthread.h pthread_create -lpthread ||
+ check_func pthread_create ||
+ die "ERROR: can't find pthreads library"
+fi
+
+# these are off by default, so fail if requested and not available
+enabled dts && require libdts dts.h dts_init -ldts
+enabled libgsm && require libgsm gsm.h gsm_create -lgsm
+enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
+enabled vorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
+enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
+enabled xvid && require XviD xvid.h xvid_global -lxvidcore
+enabled x264 && require x264 x264.h x264_encoder_open -lx264
+enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
+enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
+
+# Ugh, faac uses stdcall calling convention on win32 so we can't use
+# the generic test functions
+if enabled faac; then
+ save_flags
+ temp_extralibs -lfaac
+ check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
+#include <stdint.h>
+#include <faac.h>
+int main(){
+ char *id, *cpr;
+ faacEncGetVersion(&id, &cpr);
+ return 0;
+}
+EOF