]>
Dogcows Code - chaz/yoink/blob - configure
5 # Execute this file to configure the build system.
10 BUGREPORT
="chaz@dogcows.com"
17 This script prepares Yoink for building on your system.
18 Usage: ./configure [OPTION]... [VAR=VALUE]...
21 -h, --help display this help and exit
22 --host=HOST cross-compile program to run on HOST
24 --prefix=DIR base directory to install program
25 --bindir=DIR directory to install executables
26 --libdir=DIR directory to install libraries
27 --datadir=DIR directory to install shared data files
28 --mandir=DIR directory to install manual pages
31 --enable-debug include debugging symbols and code paths
32 --enable-double-precision use doubles instead of floats
33 --enable-profile compile in gprof profiling instructions
34 --enable-extra-warnings make the gcc compiler give more warnings
35 --enable-link-sh try to decrease the number of direct dependencies
36 --enable-clock_gettime use clock_gettime() instead of SDL
37 --enable-threads use threads for concurrency where appropriate
38 --enable-hotloading monitor assets and reload them when they change
40 --with-gtk use gtk2 modal dialogs
41 --with-qt4 use qt4 modal dialogs; overridden by --with-gtk
46 . "build/functions.sh"
50 # Perform a quick sanity check.
53 test -f configure -a -f Makefile || die <<"END"
54 You must
`cd' to the project root directory where the Makefile resides.
59 # Define some default values.
75 datadir='$prefix/share/yoink'
76 mandir='$prefix/share/man'
78 host=$(./build/config.guess)
79 althost=$(./build/config.sub $host)
84 # Parse the command-line options.
96 host=$(parse_argument host $opt)
100 prefix=$(parse_argument prefix $opt)
103 bindir=$(parse_argument bindir $opt)
106 libdir=$(parse_argument libdir $opt)
109 datadir=$(parse_argument datadir $opt)
112 mandir=$(parse_argument mandir $opt)
116 cflags="$cflags -O0 -Wall -Wno-uninitialized"
119 --enable-double-precision)
120 define "USE_DOUBLE_PRECISION"
124 define "PROFILING_ENABLED"
126 --enable-extra-warnings)
127 cflags="$cflags -Wextra -Wno-unused-parameter"
132 --enable-clock_gettime)
139 define "USE_HOTLOADING"
148 if echo "$opt" | grep -q '^[A-Za-z0-9_]*=.*'
152 echo "warning: unknown option: $opt"
160 # Evaluate any dependent paths.
163 eval bindir="$bindir"
164 eval datadir="$datadir"
165 eval libdir="$libdir"
166 eval mandir="$mandir"
168 is_defined "DEBUG" || define "NDEBUG"
170 export PKG_CONFIG_PATH="$libdir/pkgconfig:$PKG_CONFIG_PATH"
172 define_string "YOINK_DATADIR" "$datadir"
176 # Determine the target platform.
180 *mingw32*) HOST=win32 ;;
181 *netbsd*) HOST=netbsd ;;
186 # Define the check functions.
189 # Run a command and return its exit code. If the third argument is given,
190 # stdin will be read and written to the specified file before the command
191 # is executed. If the command creates any files inside the current
192 # directory, they will be removed automatically.
193 # $1 The command to run.
194 # $2 The arguments to be passed to the command.
195 # $3 Optional filename where stdin will be written.
198 tmpdir=$(mktemp -d "tmp-XXXXXXXX") || die "could not create temp directory"
199 cd $tmpdir || die "could not enter temp directory"
213 if test -x "$path/$1"
215 eval "$1 $2" 2>&1 >/dev/null
233 # Do some common checks.
236 if test "x$cross_compile" = xno
238 # If we are not cross-compiling, we also want to consider tools without
243 extra_ranlib="ranlib"
244 extra_windres="windres"
247 for exe in $CC $host-gcc $host-cc $althost-gcc $althost-cc $extra_cc
249 if check_run_command "$exe" "test.c" "test.c" <<"END"
253 printf("Hello world!\n");
263 for exe in $CXX $host-g++ $host-c++ $althost-g++ $althost-c++ $extra_cxx
265 if check_run_command "$exe" "test.cpp" "test.cpp" <<"END"
269 std::cout << "Hello world!" << std::endl;
279 for exe in $AR $host-ar $althost-ar $extra_ar
281 if check_run_command "$exe" "--version"
288 for exe in $RANLIB $host-ranlib $althost-ranlib $extra_ranlib
290 if check_run_command "$exe" "--version"
297 if test x$HOST = xwin32
299 for exe in $WINDRES $host-windres $althost-windres $extra_windres
301 if check_run_command "$exe" "--version"
309 if test "x$CC" = x -o "x$CXX" = x -o "x$AR" = x -o "x$RANLIB" = x
312 A working version of one or more of these required tools is missing:
322 # Check for the libraries we need.
325 deps="sdl gl glu libpng openal vorbisfile lua"
329 deps="$deps gtk+-2.0"
330 elif test x$qt4 = xyes
335 pc_cflags=$(pkg-config --cflags $deps)
336 CFLAGS="$CFLAGS $pc_cflags"
337 CXXFLAGS="$CXXFLAGS $pc_cflags"
339 pc_ldflags=$(pkg-config --libs-only-L $deps)
340 LDFLAGS="$LDFLAGS $pc_ldflags"
342 pc_libs=$(pkg-config --libs-only-l $deps)
343 LIBS="$LIBS $pc_libs"
345 # Windows sockets are in libws2_32.
346 if test x$HOST = xwin32
348 LIBS="$LIBS -lws2_32"
354 # Find the game resources to install.
357 #data_files=$(echo $(find . -name "*.lua" \
360 #-o -name "yoinkrc"))
361 # FIXME: doesn't work yet
365 # Define version components needed by src/yoink.rc.
368 vmajor=$(echo $VERSION | cut -d. -f1)
369 vminor=$(echo $VERSION | cut -d. -f2)
370 vrevis=$(echo $VERSION | cut -d. -f3)
372 define "VERSION_MAJOR" "${vmajor:-0}"
373 define "VERSION_MINOR" "${vminor:-0}"
374 define "VERSION_REVISION" "${vrevis:-0}"
378 # Determine and define the git revision.
381 if githead=$(git log -n1 --date=short --pretty=format:"%h (%ad)")
383 define_string "YOINK_GITHEAD" "$githead"
388 # Finalize the compiler flags, linker flags, and library list.
391 define_string "PACKAGE" "$PACKAGE"
392 define_string "PACKAGE_NAME" "$PACKAGE"
393 define_string "VERSION" "$VERSION"
394 define_string "PACKAGE_VERSION" "$VERSION"
395 define_string "PACKAGE_STRING" "$PACKAGE $VERSION"
396 define_string "PACKAGE_BUGREPORT" "$BUGREPORT"
398 CFLAGS=$(echo $CFLAGS $cflags $defines)
399 CXXFLAGS=$(echo $CXXFLAGS $cflags $defines)
400 LDFLAGS=$(echo $LDFLAGS)
405 # All done; output the configuration file.
435 echo " Configuration complete! Review your configuration in \`config.mk
'":
437 cat config.mk | grep -e "^prefix" \
444 echo " To finish the installation, type:"
This page took 0.053174 seconds and 4 git commands to generate.