Skip to content

Commit

Permalink
Greatly clean up quickbuild's handling of parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
tukuyomi authored and Themaister committed Jun 2, 2012
1 parent 7a4ef58 commit d7c16c7
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 195 deletions.
5 changes: 3 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

echo ""

. qb/config.params.sh
PACKAGE_NAME=ssnes
PACKAGE_VERSION=0.9.6-rc1

parse_input "$@"
. qb/qb.params.sh

. qb/qb.comp.sh
. qb/config.libs.sh
Expand Down
29 changes: 14 additions & 15 deletions qb/config.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ -d /opt/local/lib ]; then
add_library_dirs /opt/local/lib
fi

if [ $OS = BSD ]; then
if [ "$OS" = BSD ]; then
DYLIB=-lc
else
DYLIB=-ldl
Expand All @@ -28,7 +28,7 @@ else
HAVE_DYNAMIC=no
fi

if [ $HAVE_DYNAMIC != yes ]; then
if [ "$HAVE_DYNAMIC" != yes ]; then
check_lib_cxx RETRO $LIBRETRO retro_init $DYLIB
check_critical RETRO "Cannot find libretro."
add_define_make libretro $LIBRETRO
Expand All @@ -38,10 +38,10 @@ check_lib THREADS -lpthread pthread_create
check_lib DYLIB $DYLIB dlopen

check_lib NETPLAY -lc socket
if [ $HAVE_NETPLAY = yes ]; then
if [ "$HAVE_NETPLAY" = yes ]; then
HAVE_GETADDRINFO=auto
check_lib GETADDRINFO -lc getaddrinfo
if [ $HAVE_GETADDRINFO = yes ]; then
if [ "$HAVE_GETADDRINFO" = yes ]; then
HAVE_SOCKET_LEGACY=no
else
HAVE_SOCKET_LEGACY=yes
Expand All @@ -51,10 +51,9 @@ else
HAVE_NETWORK_CMD=no
fi


check_lib GETOPT_LONG -lc getopt_long

if [ $HAVE_DYLIB = no ] && [ $HAVE_DYNAMIC = yes ]; then
if [ "$HAVE_DYLIB" = no ] && [ "$HAVE_DYNAMIC" = yes ]; then
echo "Dynamic loading of libsnes is enabled, but your platform does not appear to have dlopen(), use --disable-dynamic or --with-libsnes=\"-lsnes\"".
exit 1
fi
Expand All @@ -64,13 +63,13 @@ check_header OSS sys/soundcard.h
check_header OSS_BSD soundcard.h
check_lib OSS_LIB -lossaudio

if [ $OS = Darwin ]; then
if [ "$OS" = Darwin ]; then
check_lib AL "-framework OpenAL" alcOpenDevice
else
check_lib AL -lopenal alcOpenDevice
fi

if [ $OS = Darwin ]; then
if [ "$OS" = Darwin ]; then
check_lib FBO "-framework OpenGL" glFramebufferTexture2D
else
check_lib FBO -lGL glFramebufferTexture2D
Expand All @@ -87,7 +86,7 @@ check_pkgconf SDL sdl 1.2.10
check_critical SDL "Cannot find SDL library."

# On some distros, -lCg doesn't link against -lstdc++ it seems ...
if [ $HAVE_OPENGL != no ]; then
if [ "$HAVE_OPENGL" != no ]; then
check_lib_cxx CG -lCg cgCreateContext
else
echo "Ignoring Cg. OpenGL is not enabled."
Expand All @@ -97,17 +96,17 @@ fi
check_pkgconf XML libxml-2.0
check_pkgconf SDL_IMAGE SDL_image

if [ $HAVE_THREADS != no ]; then
if [ $HAVE_FFMPEG != no ]; then
if [ "$HAVE_THREADS" != no ]; then
if [ "$HAVE_FFMPEG" != no ]; then
check_pkgconf AVCODEC libavcodec
check_pkgconf AVFORMAT libavformat
check_pkgconf AVUTIL libavutil
check_pkgconf SWSCALE libswscale

( [ $HAVE_FFMPEG = auto ] && ( [ $HAVE_AVCODEC = no ] || [ $HAVE_AVFORMAT = no ] || [ $HAVE_AVUTIL = no ] || [ $HAVE_SWSCALE = no ] ) && HAVE_FFMPEG=no ) || HAVE_FFMPEG=yes
( [ "$HAVE_FFMPEG" = auto ] && ( [ "$HAVE_AVCODEC" = no ] || [ "$HAVE_AVFORMAT" = no ] || [ "$HAVE_AVUTIL" = no ] || [ "$HAVE_SWSCALE" = no ] ) && HAVE_FFMPEG=no ) || HAVE_FFMPEG=yes
fi

if [ $HAVE_FFMPEG = yes ]; then
if [ "$HAVE_FFMPEG" = yes ]; then
check_lib FFMPEG_ALLOC_CONTEXT3 "$AVCODEC_LIBS" avcodec_alloc_context3
check_lib FFMPEG_AVCODEC_OPEN2 "$AVCODEC_LIBS" avcodec_open2
check_lib FFMPEG_AVCODEC_ENCODE_AUDIO2 "$AVCODEC_LIBS" avcodec_encode_audio2
Expand All @@ -117,7 +116,7 @@ if [ $HAVE_THREADS != no ]; then
check_lib FFMPEG_AVCODEC_ENCODE_VIDEO2 "$AVCODEC_LIBS" avcodec_encode_video2
fi

if [ $HAVE_FFMPEG = no ] && [ $HAVE_X264RGB = yes ]; then
if [ "$HAVE_FFMPEG" = no ] && [ "$HAVE_X264RGB" = yes ]; then
echo "x264 RGB recording is enabled, but FFmpeg is not. --enable-x264rgb will not have any effect."
fi
else
Expand All @@ -130,7 +129,7 @@ check_lib DYNAMIC $DYLIB dlopen
check_pkgconf FREETYPE freetype2
check_pkgconf X11 x11
check_pkgconf XEXT xext
if [ $HAVE_X11 = yes ] && [ $HAVE_XEXT = yes ]; then
if [ "$HAVE_X11" = yes ] && [ "$HAVE_XEXT" = yes ]; then
check_pkgconf XVIDEO xv
else
echo "X11 or Xext not present. Skipping XVideo."
Expand Down
61 changes: 26 additions & 35 deletions qb/config.params.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
. qb/qb.params.sh

PACKAGE_NAME=ssnes
PACKAGE_VERSION=0.9.6-rc1

# Adds a command line opt to ./configure --help
# $1: Variable (HAVE_ALSA, HAVE_OSS, etc)
# $2: Comment
# $3: Default arg. auto implies that HAVE_ALSA will be set according to library checks later on.
add_command_line_enable DYNAMIC "Disable dynamic loading of libsnes library" yes
add_command_line_string LIBRETRO "libretro library used" ""
add_command_line_enable THREADS "Threading support" auto
add_command_line_enable FFMPEG "Enable FFmpeg recording support" auto
add_command_line_enable X264RGB "Enable lossless X264 RGB recording" no
add_command_line_enable DYLIB "Enable dynamic loading support" auto
add_command_line_enable NETPLAY "Enable netplay support" auto
add_command_line_enable CONFIGFILE "Disable support for config file" yes
add_command_line_enable OPENGL "Disable OpenGL support" yes
add_command_line_enable CG "Enable Cg shader support" auto
add_command_line_enable XML "Enable bSNES-style XML shader support" auto
add_command_line_enable FBO "Enable render-to-texture (FBO) support" auto
add_command_line_enable ALSA "Enable ALSA support" auto
add_command_line_enable OSS "Enable OSS support" auto
add_command_line_enable RSOUND "Enable RSound support" auto
add_command_line_enable ROAR "Enable RoarAudio support" auto
add_command_line_enable AL "Enable OpenAL support" auto
add_command_line_enable JACK "Enable JACK support" auto
add_command_line_enable COREAUDIO "Enable CoreAudio support" auto
add_command_line_enable PULSE "Enable PulseAudio support" auto
add_command_line_enable FREETYPE "Enable FreeType support" auto
add_command_line_enable XVIDEO "Enable XVideo support" auto
add_command_line_enable SDL_IMAGE "Enable SDL_image support" auto
add_command_line_enable PYTHON "Enable Python 3 support for shaders" auto
add_command_line_enable SINC "Disable SINC resampler" yes
add_command_line_enable BSV_MOVIE "Disable BSV movie support" yes
HAVE_DYNAMIC=yes # Disable dynamic loading of libsnes library
HAVE_LIBRETRO= # libretro library used
HAVE_THREADS=auto # Threading support
HAVE_FFMPEG=auto # Enable FFmpeg recording support
HAVE_X264RGB=no # Enable lossless X264 RGB recording
HAVE_DYLIB=auto # Enable dynamic loading support
HAVE_NETPLAY=auto # Enable netplay support
HAVE_CONFIGFILE=yes # Disable support for config file
HAVE_OPENGL=yes # Disable OpenGL support
HAVE_CG=auto # Enable Cg shader support
HAVE_XML=auto # Enable bSNES-style XML shader support
HAVE_FBO=auto # Enable render-to-texture (FBO) support
HAVE_ALSA=auto # Enable ALSA support
HAVE_OSS=auto # Enable OSS support
HAVE_RSOUND=auto # Enable RSound support
HAVE_ROAR=auto # Enable RoarAudio support
HAVE_AL=auto # Enable OpenAL support
HAVE_JACK=auto # Enable JACK support
HAVE_COREAUDIO=auto # Enable CoreAudio support
HAVE_PULSE=auto # Enable PulseAudio support
HAVE_FREETYPE=auto # Enable FreeType support
HAVE_XVIDEO=auto # Enable XVideo support
HAVE_SDL_IMAGE=auto # Enable SDL_image support
HAVE_PYTHON=auto # Enable Python 3 support for shaders
HAVE_SINC=yes # Disable SINC resampler
HAVE_BSV_MOVIE=yes # Disable BSV movie support
4 changes: 2 additions & 2 deletions qb/qb.comp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [ "$USE_LANG_C" = yes ]; then

rm -rf $TEMP_C $TEMP_EXE

[ $answer = no ] && echo "Can't find suitable C compiler. Exiting ..." && exit 1
[ "$answer" = no ] && echo "Can't find suitable C compiler. Exiting ..." && exit 1
fi

# Checking for working C++ compiler
Expand All @@ -64,6 +64,6 @@ if [ "$USE_LANG_CXX" = "yes" ]; then

rm -rf $TEMP_CXX $TEMP_EXE

[ $answer = no ] && echo "Can't find suitable C++ compiler. Exiting ..." && exit 1
[ "$answer" = no ] && echo "Can't find suitable C++ compiler. Exiting ..." && exit 1
fi

Loading

0 comments on commit d7c16c7

Please sign in to comment.