-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
138 lines (114 loc) · 4.12 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
dnl Process this file with autoconf to produce a configure script.
dnl Initialize autoconf - look for the existance of a file to make sure
dnl the source distribution is installed correctly.
AC_INIT(src/main.c)
dnl write the resulting #defines into a header file
AM_CONFIG_HEADER(src/autoconf.h)
AM_INIT_AUTOMAKE(angband, 2.9.3)
AC_ARG_WITH(setgid,
[ --with-setgid=NAME install angband 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 Angband 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
dnl -fno-strength-reduce prevents a bug in some versions of gcc
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fno-strength-reduce"
fi
dnl Checks for libraries.
dnl SGI (IRIX) may need -lsun for the NIS version of getpwnam
AC_CHECK_LIB(sun, getpwnam)
dnl Check for ncurses, curses, or termcap
dnl Try -lncurses, -lcurses, -lcurses -ltermcap, and finally plain -ltermcap
use_ncurses=no
AC_CHECK_LIB(ncurses, initscr,
[AC_CHECK_HEADER(ncurses.h, use_ncurses=yes,
[AC_CHECK_HEADER(/usr/include/ncurses/ncurses.h,
[CFLAGS="-I/usr/include/ncurses $CFLAGS" use_ncurses=yes])])])
if test "$use_ncurses" = yes; then
AC_DEFINE(USE_GCU) AC_DEFINE(USE_NCURSES)
LIBS="-lncurses $LIBS"
else
AC_CHECK_LIB(curses, initscr,
[AC_DEFINE(USE_GCU) LIBS="-lcurses $LIBS"],
[AC_CHECK_LIB(curses, endwin,
[AC_DEFINE(USE_GCU) LIBS="-lcurses -ltermcap $LIBS"],
[AC_CHECK_LIB(termcap, tgetent,
[AC_DEFINE(USE_CAP) LIBS="-ltermcap $LIBS"])],
-ltermcap)])
fi
dnl Checks for header files.
AC_PATH_XTRA
if test "$no_x" != "yes"; then
AC_DEFINE(USE_X11)
AC_DEFINE(USE_XPJ)
AC_DEFINE(USE_TRANSPARENCY)
ANGBAND_OBJS="maid-x11.o"
AC_SUBST(ANGBAND_OBJS)
LIBS="-lX11 $X_EXTRA_LIBS $LIBS"
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
dnl X_PRE_LIBS is prepended to LIBS below.
dnl Check for the Athena widget set
dnl
dnl Does anyone know if it is OK to put '-lXmu -lXt' *before* X_PRE_LIBS?
dnl If so this code can be simplified by inserting X_PRE_LIBS in LIBS above.
dnl Today libraries come in the same sequence as in the old src/Makefile.std,
dnl since that is presumably the way which has been tested most.
x_more_libs="$X_PRE_LIBS -lXt"
AC_CHECK_LIB(Xmu, main, x_more_libs="$X_PRE_LIBS -lXmu -lXt", , $x_more_libs)
AC_CHECK_LIB(Xext, main, x_more_libs="-lXext $x_more_libs", , $x_more_libs)
AC_CHECK_LIB(Xaw, XawInitializeWidgetSet,
[AC_DEFINE(USE_XAW)
LIBS="-lXaw $x_more_libs $LIBS"],
LIBS="$X_PRE_LIBS $LIBS",
$x_more_libs)
fi
AC_CYGWIN
AC_MINGW32
AC_EXEEXT
if test "$CYGWIN" = "yes"; then
AC_DEFINE(WINDOWS)
AC_DEFINE(USE_TRANSPARENCY)
LIBS="$LIBS -lwinmm"
LDFLAGS="$LDFLAGS -s -mwindows -e _mainCRTStartup"
AM_CONDITIONAL(CYGWIN, test "$CYGWIN" = "yes")
ANGBAND_OBJS="readdib.o angband.res"
AC_SUBST(ANGBAND_OBJS)
fi
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h sys/ioctl.h \
sys/time.h termio.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname mkdir select strstr strtol usleep mkstemp setegid)
AC_OUTPUT(Makefile src/Makefile lib/Makefile lib/apex/Makefile lib/bone/Makefile lib/data/Makefile lib/edit/Makefile lib/file/Makefile lib/help/Makefile lib/info/Makefile lib/pref/Makefile lib/save/Makefile lib/user/Makefile lib/xtra/Makefile)