diff --git a/.gitignore b/.gitignore
index 1cfcecf..b457cc0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ dist
*.o
*.pak
starfighter
+src/starfighter
# Autoconf / Automake
aclocal.m4
@@ -23,18 +24,6 @@ config.h.in~
src/Makefile
src/Makefile.in
src/.deps
-data/Makefile
-data/Makefile.in
-data/.deps
-gfx/Makefile
-gfx/Makefile.in
-gfx/.deps
-music/Makefile
-music/Makefile.in
-music/.deps
-sound/Makefile
-sound/Makefile.in
-sound/.deps
# Mac OS X
*.DS_Store
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..0e2193d
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+SUBDIRS = src
+
+dist_doc_DATA = README.txt COPYING LICENSES
+nobase_dist_doc_DATA = docs/*
+
+nobase_pkgdata_DATA = data/* gfx/* music/* sound/*
diff --git a/Makefile b/Makefile.old
similarity index 100%
rename from Makefile
rename to Makefile.old
diff --git a/README.txt b/README.txt
index bbd9fb2..310ab61 100644
--- a/README.txt
+++ b/README.txt
@@ -55,14 +55,15 @@ Project: Starfighter depends on the following libraries to build:
* SDL2_image
* SDL2_mixer
-Once you have all dependencies installed, simply run:
+Once you have all dependencies installed, you can do the following:
+ ./configure
make
-
-And optionally (as root):
-
make install
-If this doesn't work, you may need to tweak the makefile.
+Run "./configure --help" to see more options.
-To play, simply run the starfighter binary.
\ No newline at end of file
+The third step ("make install") is technically optional, but highly
+recommended.
+
+To play, simply run the starfighter binary.
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..e03bbb5
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,48 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+AC_PREREQ([2.69])
+AC_INIT([Project: Starfighter], [1.7-dev], [onpon4@riseup.net], [starfighter])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AC_CONFIG_SRCDIR([src/Starfighter.cpp])
+AC_CONFIG_HEADERS([config.h])
+PKG_PROG_PKG_CONFIG
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_INSTALL
+
+STARFIGHTER_CFLAGS="-DVERSION=\\\"$PACKAGE_VERSION\\\""
+
+# Checks for libraries.
+PKG_CHECK_EXISTS([SDL2_mixer], [
+ PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_mixer])
+], [
+ PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image])
+ STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DNOSOUND"
+ echo "Note: SDL_mixer not found; audio will not be supported."
+])
+
+AC_SUBST([STARFIGHTER_CFLAGS])
+
+# Checks for header files.
+AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h string.h time.h math.h pwd.h sys/stat.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([atexit mkdir])
+
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+])
+AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..ddfcd60
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,7 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+nobase_pkgdata_DATA = \
+ credits.txt
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 0000000..9f17e71
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1,18 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+nobase_dist_doc_DATA = \
+ arrowNorthEast.png \
+ COPYING \
+ dollar.png \
+ heart.png \
+ index.html \
+ plasmaAmmo.png \
+ plasmaDamage.png \
+ plasmaRate.png \
+ rocket.png \
+ rocketAmmo.png \
+ sflogo.png \
+ superCharge.png
diff --git a/gfx/Makefile.am b/gfx/Makefile.am
new file mode 100644
index 0000000..15d2669
--- /dev/null
+++ b/gfx/Makefile.am
@@ -0,0 +1,195 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+nobase_pkgdata_DATA = \
+ aimFighter1.png \
+ aimFighter2.png \
+ alienDevice.png \
+ arrowEast.png \
+ arrowNorth.png \
+ arrowNorthEast.png \
+ arrowNorthWest.png \
+ arrowSouth.png \
+ arrowSouthEast.png \
+ arrowSouthWest.png \
+ arrowWest.png \
+ asteroid1.png \
+ asteroid2.png \
+ asteroid3.png \
+ barrier.png \
+ buyIcon.png \
+ cargo1.png \
+ chainLink.png \
+ cloakShip1.png \
+ cloakShip2.png \
+ credits.jpg \
+ cursor.png \
+ dollar.png \
+ drone1.png \
+ drone2.png \
+ dualFighter1.png \
+ dualFighter2.png \
+ elec1.png \
+ elec2.png \
+ elec3.png \
+ elec4.png \
+ eliteFighter1.png \
+ eliteFighter2.png \
+ escort1.png \
+ escort2.png \
+ evilUrsula1.png \
+ evilUrsula2.png \
+ execTrans1.png \
+ execTrans2.png \
+ explode1.png \
+ explode2.png \
+ explode3.png \
+ explode4.png \
+ explode05.png \
+ explode06.png \
+ explode07.png \
+ explode08.png \
+ explode9.png \
+ explode10.png \
+ explode11.png \
+ explode12.png \
+ explode13.png \
+ explode14.png \
+ explode15.png \
+ explode16.png \
+ eyananth.jpg \
+ face_chris.png \
+ face_crew.png \
+ face_kline.png \
+ face_krass.png \
+ face_phoebe.png \
+ face_sid.png \
+ face_ursula.png \
+ firefly1.png \
+ firefly2.png \
+ firefly-big.png \
+ friendArrowEast.png \
+ friendArrowNorth.png \
+ friendArrowNorthEast.png \
+ friendArrowNorthWest.png \
+ friendArrowSouth.png \
+ friendArrowSouthEast.png \
+ friendArrowSouthWest.png \
+ friendArrowWest.png \
+ frigateBody1.png \
+ frigateBody2.png \
+ frigateGun11.png \
+ frigateGun12.png \
+ frigateGun21.png \
+ frigateGun22.png \
+ gameover.png \
+ goodTrans1.png \
+ goodTrans2.png \
+ greenDir.png \
+ heart.png \
+ icon1.png \
+ icon2.png \
+ icon3.png \
+ icon4.png \
+ icon5.png \
+ icon6.png \
+ icon7.png \
+ icon8.png \
+ icon9.png \
+ icon10.png \
+ icon11.png \
+ icon12.png \
+ icon13.png \
+ icon14.png \
+ icon15.png \
+ icon16.png \
+ icon17.png \
+ icon18.png \
+ icon19.png \
+ icon20.png \
+ icon21.png \
+ icon22.png \
+ icon23.png \
+ icon24.png \
+ icon25.png \
+ icon26.png \
+ iconBase.png \
+ kline11.png \
+ kline12.png \
+ klineText.png \
+ merc1.png \
+ merc2.png \
+ mine.png \
+ mineBoss1.png \
+ mineBoss2.png \
+ mineBossWing11.png \
+ mineBossWing12.png \
+ mineBossWing21.png \
+ mineBossWing22.png \
+ mineBossWing31.png \
+ mineBossWing32.png \
+ mineBossWing41.png \
+ mineBossWing42.png \
+ miner1.png \
+ miner2.png \
+ missileBoat1.png \
+ missileBoat2.png \
+ mobileCannon1.png \
+ mobileCannon2.png \
+ mobileShield1.png \
+ mobileShield2.png \
+ mordor.jpg \
+ ore1.png \
+ ore2.png \
+ ore3.png \
+ phoebeText.png \
+ planet_blue.png \
+ planet_green.png \
+ planet_orange.png \
+ planet_red.png \
+ planet_sun.png \
+ plasmaAmmo.png \
+ plasmaDamage.png \
+ plasmaGreen.png \
+ plasmaRate.png \
+ plasmaRed.png \
+ plutoBoss1.png \
+ plutoBoss2.png \
+ pod.png \
+ prlogo.png \
+ rebelCarrier1.png \
+ rebelCarrier2.png \
+ redDir.png \
+ rocket.png \
+ rocket1.png \
+ rocket2.png \
+ rocketAmmo.png \
+ sellIcon.png \
+ sflogo.png \
+ sid1.png \
+ sid2.png \
+ sidText.png \
+ slaveTrans1.png \
+ slaveTrans2.png \
+ smallFont.png \
+ sol.jpg \
+ spirit.jpg \
+ splitBoss11.png \
+ splitBoss12.png \
+ splitBoss21.png \
+ splitBoss22.png \
+ splitBoss31.png \
+ splitBoss32.png \
+ startUp.jpg \
+ stunBolt.png \
+ superCharge.png \
+ targetText.png \
+ transport1.png \
+ transport2.png \
+ tug1.png \
+ tug2.png \
+ ursulaText.png \
+ wingmate1.png \
+ wingmate2.png
diff --git a/music/Makefile.am b/music/Makefile.am
new file mode 100644
index 0000000..c6afa55
--- /dev/null
+++ b/music/Makefile.am
@@ -0,0 +1,17 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+nobase_pkgdata_DATA = \
+ death.ogg \
+ frozen_jam.ogg \
+ last_cyber_dance.ogg \
+ orbital_colossus.ogg \
+ railjet_short.ogg \
+ RE.ogg \
+ rise_of_spirit.ogg \
+ sound_and_silence.ogg \
+ space_dimensions.ogg \
+ through_space.ogg \
+ walking_among_androids.ogg
diff --git a/sound/Makefile.am b/sound/Makefile.am
new file mode 100644
index 0000000..eb515a1
--- /dev/null
+++ b/sound/Makefile.am
@@ -0,0 +1,24 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+nobase_pkgdata_DATA = \
+ beamLaser.ogg \
+ cloak.ogg \
+ clock.ogg \
+ explode.ogg \
+ explode2.ogg \
+ explode3.ogg \
+ explode4.ogg \
+ flyby.ogg \
+ hyperSpace.ogg \
+ item.ogg \
+ laser.ogg \
+ maledeath.ogg \
+ missile.ogg \
+ missile2.ogg \
+ plasma.ogg \
+ plasma2.ogg \
+ plasma3.ogg \
+ shield.ogg
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..7b44d3b
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,65 @@
+# This file has been dedicated to the public domain, to the extent
+# possible under applicable law, via CC0. See
+# http://creativecommons.org/publicdomain/zero/1.0/ for more
+# information. This file is offered as-is, without any warranty.
+
+bin_PROGRAMS = starfighter
+
+starfighter_CPPFLAGS = $(STARFIGHTER_CFLAGS) -Wall -O2 -DDATADIR=\"$(pkgdatadir)\"
+starfighter_CXXFLAGS = $(SDL_CFLAGS)
+starfighter_LDADD = $(SDL_LIBS)
+
+starfighter_SOURCES = \
+ Starfighter.cpp \
+ alien.cpp \
+ alien.h \
+ audio.cpp \
+ audio.h \
+ bullet.cpp \
+ bullet.h \
+ cargo.cpp \
+ cargo.h \
+ collectable.cpp \
+ collectable.h \
+ colors.cpp \
+ colors.h \
+ cutscene.cpp \
+ cutscene.h \
+ defs.h \
+ engine.cpp \
+ engine.h \
+ event.cpp \
+ event.h \
+ explosion.cpp \
+ explosion.h \
+ game.cpp \
+ game.h \
+ gfx.cpp \
+ gfx.h \
+ info.cpp \
+ info.h \
+ intermission.cpp \
+ intermission.h \
+ mission.cpp \
+ mission.h \
+ player.cpp \
+ player.h \
+ radio.cpp \
+ radio.h \
+ renderer.cpp \
+ renderer.h \
+ save.cpp \
+ save.h \
+ screen.cpp \
+ screen.h \
+ ship.cpp \
+ ship.h \
+ shop.cpp \
+ shop.h \
+ structs.h \
+ title.cpp \
+ title.h \
+ weapons.cpp \
+ weapons.h \
+ window.cpp \
+ window.h