+echo "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';" > conftest.c
+$CC $CFLAGS conftest.c -c -o conftest.o 2>$DEVNULL || die "endian test failed"
+grep -q BIGE conftest.o && CFLAGS="$CFLAGS -DWORDS_BIGENDIAN"
+
+# autodetect options that weren't forced nor disabled
+
+libpthread=""
+if test "$pthread" = "auto" ; then
+ pthread="no"
+ case $SYS in
+ BEOS)
+ pthread="yes"
+ ;;
+ MINGW)
+ if cc_check pthread.h -lpthread "pthread_create(0,0,0,0);" ; then
+ pthread="yes"
+ libpthread="-lpthread"
+ elif cc_check pthread.h -lpthreadGC2 "pthread_create(0,0,0,0);" ; then
+ pthread="yes"
+ libpthread="-lpthreadGC2"
+ elif cc_check pthread.h "-lpthreadGC2 -lwsock32 -DPTW32_STATIC_LIB" "pthread_create(0,0,0,0);" ; then
+ pthread="yes"
+ libpthread="-lpthreadGC2 -lwsock32"
+ CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
+ fi
+ ;;
+ *)
+ cc_check pthread.h -lpthread && pthread="yes" && libpthread="-lpthread"
+ ;;
+ esac
+fi
+if test "$pthread" = "yes" ; then
+ CFLAGS="$CFLAGS -DHAVE_PTHREAD"
+ LDFLAGS="$LDFLAGS $libpthread"
+fi
+
+MP4_LDFLAGS="-lgpac_static"
+if [ $SYS = MINGW ]; then
+ MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
+fi
+if [ "$mp4_output" = "auto" ] ; then
+ mp4_output="no"
+ cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
+fi
+if [ "$mp4_output" = "yes" ] ; then
+ echo "#define MP4_OUTPUT" >> config.h
+ LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
+fi
+
+if [ "$avis_input" = "auto" ] ; then
+ if [ $SYS = MINGW ]; then
+ avis_input="yes"
+ else
+ avis_input="no";
+ fi
+fi
+if [ "$avis_input" = "yes" ] ; then
+ echo "#define AVIS_INPUT" >> config.h
+ LDFLAGS="$LDFLAGS -lvfw32"
+fi
+
+if [ "$pic" = "yes" ] ; then
+ CFLAGS="$CFLAGS -fPIC"
+ ASFLAGS="$ASFLAGS -DPIC"
+ # resolve textrels in the x86 asm
+ cc_check stdio.h -Wl,-Bsymbolic && LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
+fi
+
+if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
+ CFLAGS="$CFLAGS -s -fomit-frame-pointer"
+ LDFLAGS="$LDFLAGS -s"
+fi
+
+if [ "$debug" = "yes" ]; then
+ CFLAGS="-O1 -g $CFLAGS"
+else
+ CFLAGS="-O4 -ffast-math $CFLAGS"
+fi
+
+if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
+ echo "#define fseek fseeko" >> config.h
+ echo "#define ftell ftello" >> config.h
+elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
+ echo "#define fseek fseeko64" >> config.h
+ echo "#define ftell ftello64" >> config.h
+fi
+
+rm -f conftest*
+
+# generate config files
+