1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(data.h)
3AC_PREFIX_DEFAULT(/usr/local/lib/xgalaga)
4
5test "$prefix" = NONE && prefix=/usr/local/lib/xgalaga
6test "$exec_prefix" = NONE && exec_prefix=/usr/local/bin
7
8AC_CANONICAL_HOST
9
10dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_CPP
13AC_PROG_INSTALL
14AC_PROG_LN_S
15AC_PROG_MAKE_SET
16AC_PROG_RANLIB
17
18AC_ARG_WITH(xpm-lib,[  --with-xpm-lib          Directory containing libXpm (may be autodetected)],xpm_lib=$withval)
19AC_ARG_WITH(sound,  [  --with-sound            Type of sound to use (native or nas)],sound_type=$withval)
20
21AC_PATH_XTRA
22if test -n "$no_x"; then
23  AC_MSG_ERROR([Can't find X, you need X!])
24else
25  INCS="$INCS -I$x_includes"
26  if test -n "$x_libraries"; then
27    LIBS="-L$x_libraries"
28  fi
29
30  if test -n "$xpm_lib"; then
31    LIBS="$LIBS -L$xpm_lib"
32  fi
33fi
34
35AC_MSG_NOTICE([host os is detected as $host_os ])
36if test -n "$sound-type"; then
37  case $host_os in
38    *linux*)
39      sound_type=native
40      ;;
41    *dragonfly*)
42      sound_type=native
43      ;;
44    *freebsd*)
45      sound_type=native
46      ;;
47    *netbsd*)
48      sound_type=native
49      ;;
50    *sunos*)
51      sound_type=native
52      ;;
53    *solaris*)
54      sound_type=native
55      ;;
56    *)
57      sound_type=none
58      ;;
59    esac
60fi
61
62AC_MSG_NOTICE([sound type choosen as $sound_type ])
63case $sound_type in
64  native)
65    case $host_os in
66      *linux*)
67        SOUNDSERVER=xgal.sndsrv.oss
68	AC_DEFINE([SOUNDDEV],["/dev/dsp"], [The sound device to use (E.G. /dev/dsp)])
69        SOUNDSRVDIR=""
70	AC_DEFINE([SOUND],[1], [Whether to compile with sound support or not])
71	;;
72      *freebsd* | *dragonfly*)
73        SOUNDSERVER=xgal.sndsrv.freebsd
74	AC_DEFINE(SOUNDDEV,"/dev/dsp")
75        SOUNDSRVDIR=""
76	AC_DEFINE(SOUND,1)
77	;;
78      *netbsd*)
79        SOUNDSERVER=xgal.sndsrv.linux
80        AC_DEFINE(SOUNDDEV, "/dev/audio")
81        SOUNDSRVDIR="/libexec"
82        AC_DEFINE(SOUND,1)
83        ;;
84      *sunos*)
85        SOUNDSERVER=xgal.sndsrv.sun.c
86	AC_DEFINE(SOUNDDEV,"/dev/audio")
87        SOUNDSRVDIR=""
88  	AC_DEFINE(SOUND,1)
89	;;
90      *solaris*)
91        SOUNDSERVER=xgal.sndsrv.sun.c
92	AC_DEFINE(SOUNDDEV,"/dev/audio")
93        SOUNDSRVDIR=""
94	AC_DEFINE(SOUND,1)
95	;;
96      *)
97        AC_MSG_WARN([Native sound selected but not supported for $host_os])
98	;;
99    esac
100    ;;
101  nas)
102    AC_DEFINE(SOUND,1)
103    AC_DEFINE(NAS_SOUND)
104    ;;
105  *)
106    AC_MSG_WARN([Sound type set to $sound_type for $host_os. Sound will not work])
107    ;;
108esac
109
110AC_DEFINE_UNQUOTED(SCOREFILE,"$prefix/scores")
111AC_DEFINE_UNQUOTED(SOUNDDIR,"$prefix/sounds/")
112CREDITSFILE="$prefix/CREDITS"
113AC_DEFINE_UNQUOTED(CREDITSFILE,"$CREDITSFILE")
114AC_DEFINE(IMAGEDIR,"images")
115AC_DEFINE_UNQUOTED(LEVELDIR,"$prefix/levels/")
116
117AC_CHECK_LIB(X11, main, LIBS="$LIBS -lX11")
118AC_CHECK_LIB(Xmu, main, LIBS="$LIBS -lXmu",,-lX11)
119AC_CHECK_LIB(Xt, main, LIBS="$LIBS -lXt",,-lX11)
120AC_CHECK_LIB(Xext, main, LIBS="$LIBS -lXext",,-lX11)
121AC_CHECK_LIB(XExExt, main, LIBS="$LIBS -lXExExt",,-lX11)
122AC_CHECK_LIB(Xpm, main, LIBS="$LIBS -lXpm",AC_MSG_ERROR(libXpm can't be found.  Get it from ftp://ftp.x.org/contrib/libraries or specify the location with --with-xpm-lib=DIR.),-lX11)
123
124dnl Checks for header files.
125AC_HEADER_STDC
126AC_CHECK_HEADERS(fcntl.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h)
127
128dnl Checks for typedefs, structures, and compiler characteristics.
129AC_C_CONST
130AC_HEADER_TIME
131
132dnl Checks for library functions.
133AC_PROG_GCC_TRADITIONAL
134AC_TYPE_SIGNAL
135AC_CHECK_FUNCS(gettimeofday select random lrand48)
136
137AC_SUBST(SOUNDSERVER)
138AC_SUBST(SOUNDSRVDIR)
139AC_SUBST(SOUNDDEV)
140AC_SUBST(SOUND)
141AC_SUBST(CREDITSFILE)
142
143AC_CONFIG_HEADERS([config.h])
144AC_CONFIG_FILES([Makefile libsprite/Makefile])
145AC_OUTPUT
146
147