#undef CHUUKEI
#undef WORLD_SCORE
#undef USE_TRANSPARENCY
+#undef DEFAULT_PATH
--- /dev/null
+AC_DEFUN(MY_EXPAND_DIR, [
+ $1=$2
+ $1=`(
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
+ eval echo \""[$]$1"\"
+ )`
+])
+
AM_CONFIG_HEADER(src/autoconf.h)
+AM_INIT_AUTOMAKE(hengband, 1.0.9)
+
+AC_ARG_WITH(setgid,
+[ --with-setgid=NAME install hengband as group NAME],
+[case "${withval}" in
+ no) GAMEGROUP="";;
+ yes) AC_MSG_ERROR(missing argument for --with-setgid);;
+ *) GAMEGROUP="$withval";;
+esac])
+AC_SUBST(GAMEGROUP)
+AM_CONDITIONAL(SET_GID, test "$GAMEGROUP" != "")
+
AC_LANG_C
+dnl generate the installation path for the ./lib/ folder
+if test "$GAMEGROUP" != ""; then
+ MY_EXPAND_DIR(game_datadir, "$datadir/games/$PACKAGE/lib/")
+else
+ MY_EXPAND_DIR(game_datadir, "./lib/")
+ bindir=".."
+fi
+
+dnl overwrite the path with an user-specified value
+AC_ARG_WITH(libpath,
+[ --with-libpath=path specify the path to the Hengband lib folder],
+[game_datadir="$withval"])
+
+AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$game_datadir")
+DEFAULT_PATH="$game_datadir"
+AC_SUBST(DEFAULT_PATH)
+
dnl Checks for programs.
AC_PROG_CC
-AM_INIT_AUTOMAKE(hengband, 1.0.9)
-
AC_ARG_ENABLE(japanese,
[ --disable-japanese build english version], use_japanese=no, [AC_DEFINE(JP) AC_DEFINE(EUC)])
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
h_scores.raw readme.txt
+
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@apex
+
+angband_DATA = \
+ $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+ touch "$(DESTDIR)$(angbanddir)/scores.raw"
+ chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+ chmod -R g+w "$(DESTDIR)$(angbanddir)"
+endif
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@bone
+
+angband_DATA = \
+ $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+ chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+ chmod -R g+w "$(DESTDIR)$(angbanddir)"
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@data
+
+angband_DATA = \
+ $(angband_files)
+endif
+
+
+install-data-hook:
+if SET_GID
+ chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+ chmod g+w "$(DESTDIR)$(angbanddir)"
+endif
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
a_info_j.txt d_info_j.txt e_info_j.txt f_info_j.txt \
k_info_j.txt misc_j.txt \
q0000001_j.txt q0000002_j.txt q0000003_j.txt q0000004_j.txt \
t0000006_j.txt t_basic_j.txt t_info_j.txt t_lite_j.txt \
t_pref_j.txt v_info_j.txt w_info_j.txt \
m_info_j.txt s_info_j.txt
+
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@edit
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
a_cursed_j.txt a_high_j.txt a_low_j.txt a_med_j.txt \
aname_j.txt book-0_jp.txt chainswd_j.txt dead_j.txt \
death_j.txt elvish_j.txt error_j.txt mondeath_j.txt \
timenorm.txt w_cursed.txt w_high.txt w_low.txt\
w_med.txt
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@file
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
arena.txt attack.hlp attack.txt birth.hlp birth.txt \
bldg.txt command.hlp command.txt commdesc.hlp commdesc.txt \
dungeon.hlp dungeon.txt gambling.txt general.hlp general.txt \
jtang.txt jtown.hlp jtown.txt jversion.txt \
jversion.txt magic.hlp magic.txt option.hlp option.txt \
pref.hlp pref.txt readme.txt spoiler.hlp tang.txt version.txt
+
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@help
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@info
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
colors.prf \
font-ami.prf font-dos.prf font-ibm.prf font-mac.prf \
font-mon.prf font-win.prf font-x11.prf font-xxx.prf \
pref-x11.prf pref.prf proxy.prf spell-xx.prf \
user-win.prf user.prf xtra-gcu.prf \
xtra-new.prf xtra-xxx.prf
+
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@pref
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@save
+
+angband_DATA = \
+ $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+ chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+ chmod g+w "$(DESTDIR)$(angbanddir)"
+endif
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@script
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
+angband_files = \
+ delete.me
+
EXTRA_DIST = \
- delete.me
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@user
+
+angband_DATA = \
+ $(angband_files)
+endif
+
## Makefile.am -- Process this file with automake to process Makefile.in
-EXTRA_DIST = \
+angband_files = \
8x8.bmp
+
+EXTRA_DIST = \
+ $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@xtra/graf
+
+angband_DATA = \
+ $(angband_files)
+endif
+
main-dos.c main-ibm.c main-mac-carbon.c \
makefile.bcc makefile.std makefile.dos makefile.ibm \
readdib.c script.c wall.bmp
+
+install-exec-hook:
+if SET_GID
+ chgrp "@GAMEGROUP@" "$(DESTDIR)$(bindir)/hengband"
+ chmod g+s "$(DESTDIR)$(bindir)/hengband"
+endif