dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Netrek installation dnl to configure the system for the local environment. AC_INIT(name.c) AC_CANONICAL_SYSTEM AC_CONFIG_HEADER(config.h) AC_MSG_CHECKING(your key) AC_ARG_WITH(key, [ --with-key key definition file],KEYDEF=$withval,KEYDEF=sample_key.def) AC_SUBST(KEYDEF) AC_MSG_CHECKING(release type) AC_SUBST(stable) AC_ARG_ENABLE(stable, [ --enable-stable stable release], stable=yes) AC_ARG_ENABLE(unstable, [ --enable-unstable unstable release], unstable=yes) if test "x$stable" = xyes ; then if test "x$unstable" = xyes ; then AC_MSG_RESULT(inconsistent) echo "configure: --enable-stable is inconsistent with --enable-unstable" exit 1 fi fi if test "x$unstable" != xyes ; then if test "x$stable" = xyes ; then AC_MSG_RESULT(stable) AC_DEFINE(stable) else AC_MSG_RESULT(unstable) stable=nope fi else AC_MSG_RESULT(unstable) stable=nope fi AC_PROG_INSTALL # # autoconf assumes that we never cd to a subdirectory and then use the # install-sh that it has found in the current directory, so we hack around # this by testing for the particular case and modifying the variable directly. # # this may break with a future version of autoconf. to test this on a Linux # system, hide your /usr/bin/install, remove config.cache, and re-run the # autoconf generated configure script. # cameron@stl.dec.com # if test "$INSTALL" = "./install-sh -c"; then INSTALL="$PWD/install-sh -c" fi AC_PROG_CC AC_PROG_CPP AC_PROG_LN_S AC_AIX AC_C_INLINE #-------------------------------------------------------------------- # Include sys/select.h if it exists and if it supplies things # that appear to be useful. This appears to be true only on # the RS/6000 under AIX. Some systems like OSF/1 have a # sys/select.h that's of no use, and other systems like SCO # UNIX have a sys/select.h that's pernicious. If there isn't # a sys/select.h, then make sure that "fd_set" is defined in # sys/types.h. #-------------------------------------------------------------------- AC_MSG_CHECKING(if fd_set requires sys/select.h) AC_TRY_COMPILE( [#include ], [fd_set readMask, writeMask;], AC_MSG_RESULT(no) , AC_EGREP_HEADER(fd_set, sys/select.h, AC_DEFINE(NEED_SYS_SELECT_H) AC_MSG_RESULT(yes), AC_DEFINE(NO_FD_SET) AC_MSG_RESULT(fd_set missing))) #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h memory.h math.h stdlib.h) AC_CHECK_HEADERS(sys/timeb.h sys/ptyio.h sys/fcntl.h fcntl.h) AC_CHECK_HEADERS(ctype.h machine/endian.h sys/resource.h) AC_CHECK_HEADERS(sys/wait.h netinet/in.h netinet/tcp.h sys/filio.h) AC_FUNC_WAIT3 AC_TYPE_PID_T AC_TYPE_UID_T AC_TYPE_SIZE_T AC_FUNC_VFORK AC_STRUCT_TM AC_MSG_CHECKING(for itimer in time.h) AC_EGREP_HEADER(itimerval, time.h, AC_MSG_RESULT(yes) , AC_DEFINE(NEED_SYS_TIME_H) AC_MSG_RESULT(no)) AC_CHECK_SIZEOF(long) AC_MSG_CHECKING(for u_int in sys/types.h) AC_EGREP_HEADER(u_int, sys/types.h, AC_MSG_RESULT(yes) , AC_DEFINE(NO_U_INT) AC_MSG_RESULT(no)) AC_MSG_CHECKING(for PATH_MAX in limits.h) AC_EGREP_CPP(PATH_MAX, [ #include PATH_MAX ], AC_DEFINE(NO_PATH_MAX) AC_MSG_RESULT(no), AC_MSG_RESULT(yes)) AC_CHECK_FUNCS(strcmpi strncmpi) #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. #-------------------------------------------------------------------- AC_PATH_X # Checking for gnu-win32 Windows libraries AC_CHECK_LIB(gdi32, main, CYGWINOS="yes", CYGWINOS="") if test -z "$CYGWINOS"; then AC_DEFINE(HAVE_X11) NOWIN32="#" else # Fix some autodetect errors # AC_DEFINE(HAVE_STRCMPI) # AC_DEFINE(HAVE_STRNCMPI) # AC_DEFINE(SKIP_SOUND) if test -z "$no_x"; then AC_DEFINE(HAVE_X11) AC_DEFINE(HAVE_X11_XPM_H) NOWIN32="#" else AC_DEFINE(HAVE_WIN32) XLIBSWDIR="-L/lib/noX" XLIBSWLIB="-lwinmm -lgdi32 -luser32" XINCLUDES="-I/usr/include/noX" NOX11="#" fi fi if test -z "$NOX11" ; then if test -z "$x_libraries" ; then echo checking for X11 header files XINCLUDES="" AC_TRY_CPP([#include ], , XINCLUDES="nope") if test "$XINCLUDES" = nope; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include \ /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 \ /usr/openwin/include /usr/X11/include /pub/X11R5/include \ /usr/local/X11R5/include /usr/X11R6/include /usr/include/X11R6 \ /pub/X11R6/include /usr/local/X11R6/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then XINCLUDES=" -I$i" fi done fi if test "$XINCLUDES" = nope; then echo "Warning: couldn't find any X11 include files." XINCLUDES="" fi echo "checking for X11 library archive" AC_CHECK_LIB(X11, main, XLIBSWLIB="-lX11", XLIBSWLIB=nope) if test "$XLIBSWLIB" = nope; then dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib \ /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib \ /usr/X11/lib /pub/X11R5/lib /usr/local/X11R5/lib \ /usr/X11R6/lib /usr/lib/X11R6 /pub/X11R6/lib /usr/local/X11R6/lib" for i in $dirs ; do if test -r $i/libX11.a; then XLIBSWDIR="-L$i" XLIBSWLIB="-lX11" fi done fi if test "$XLIBSWLIB" = nope ; then AC_CHECK_LIB(Xwindow, main, XLIBSWLIB=-lXwindow) fi if test "$XLIBSWLIB" = nope ; then echo "Warning: couldn't find the X11 library archive. Using -lX11." XLIBSWLIB=-lX11 fi else XINCLUDES="-I$x_includes" XLIBSWDIR="-L$x_libraries" XLIBSWLIB="-lX11" fi fi AC_SUBST(NOX11) AC_SUBST(NOWIN32) SAVELIBS="$LIBS" LIBS="$LIBS $XLIBSWDIR $XLIBSWLIB" SAVEINCS="$INCS" INCS="$INCS $XINCLUDES" AC_CHECK_LIB(Xpm, main, [AC_DEFINE(HAVE_XPM) XPMLIBS="-lXpm"]) AC_CHECK_HEADERS(X11/xpm.h) LIBS="$SAVELIBS" INCS="$SAVEINCS" # Fix link order for Xpm XLIBSW="$XLIBSWDIR $XPMLIBS $XLIBSWLIB" INCS="$INCS $XINCLUDES" AC_SUBST(INCS) LIBS="$LIBS $XLIBSW" #-------------------------------------------------------------------- # Check for gmp and mp #-------------------------------------------------------------------- AC_ARG_WITH(gmp,[ --with-gmp GMP Dir], MPINC="-I$withval/include" MPLIB="-L$withval/lib -lgmp" search=false, MPINC=nope MPLIB=nope) if test "$MPINC" = nope; then AC_MSG_CHECKING(for mp.h) AC_EGREP_CPP(GNU_MP,[ #include __GNU_MP__ ], [gnu_mp_ok=yes], [gnu_mp_ok=no]) if test "x$gnu_mp_ok" = xyes; then MPINC=nope search=true AC_MSG_RESULT(yes) else MPINC="" search=false AC_MSG_RESULT(no) fi fi AC_MSG_CHECKING(for gmp.h) # if test "$MPINC" = nope; then # AC_TRY_CPP([#include ], [MPINC="-I/usr/include" search=false], MPINC=nope) # fi if test "$MPINC" = nope; then dirs="$srcdir/gmp-2.0.2 /usr/unsupported/include /usr/local/include \ /usr/gnu/include /usr/gnu/include/mp /usr/local/gnu/include \ /usr/local/gnu/include/mp /usr/include/gnu /usr/local/lib/gmp-2.0.2" for i in $dirs; do if test -r $i/gmp.h; then MPINC="-I$i" fi done fi if test "$MPINC" = nope; then # mp not supported with new mkkey. AC_TRY_CPP([#include ], MPINC=nope , MPINC=nope) if test "$MPINC" = nope; then MPINC="# -I." NORSA="#" AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) fi else AC_MSG_RESULT(yes) fi AC_SUBST(MPINC) # Checking for GMP 2 SAVEINCS="$INCS" INCS="$INCS $XINCLUDES" AC_EGREP_CPP("gmp=.*2", [ #include gmp=__GNU_MP__ ],AC_DEFINE(HAVE_GMP2_H)) INCS="$SAVEINCS" if test "$MPLIB" = nope; then if test "$search" = true; then MPLIB=nope else AC_CHECK_LIB(mp, main, MPLIB="-lmp", MPLIB=" ") AC_CHECK_LIB(gmp, main, MPLIB="$MPLIB -lgmp", MPLIB=nope) fi if test "$MPLIB" = nope; then dirs="$srcdir/gmp-2.0.2 /usr/unsupported/lib /usr/local/lib /usr/gnu/lib \ /usr/local/gnu/lib /usr/lib/gnu /usr/local/lib/gmp-2.0.2" for i in $dirs; do if test -r $i/libmp.a; then MPLIB="-L$i -lmp" fi if test -r $i/libgmp.a; then MPLIB="-L$i -lgmp" AC_MSG_RESULT(yes) fi done fi fi if test "$MPLIB" = nope; then AC_CHECK_LIB(mp, main, MPLIB=bsdmp, MPLIB=nope) if test "$MPLIB" = bsdmp; then echo "Sorry COW requires gmp not mp for RSA." MPLIB="# -L. -lmp -lgmp" NORSA="#" fi if test "$MPLIB" = nope; then echo Warning mp or gmp library not found, turning RSA off. MPLIB="# -L. -lmp -lgmp" NORSA="#" fi fi AC_SUBST(MPLIB) if test -r "$srcdir/mkkey.c"; then echo " RSA utilities for COW build found." else echo echo Warning RSA utilities for COW build not found, turning RSA off. NORSA="#" echo Check your favorite FTP site for a blessed client. echo If you cannot find one contact the team. echo fi AC_SUBST(RSAINC) AC_SUBST(RSALIB) AC_SUBST(NORSA) #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the # command line generated by Make. #-------------------------------------------------------------------- AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"]) # AC _CHECK_LIB(V3, main, [LIBS="$LIBS -lV3"]) # AC _CHECK_LIB(PW, main, [LIBS="$LIBS -lPW"]) AC_CHECK_LIB(socket, main, [LIBS="$LIBS -lsocket"]) AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]) AC_CHECK_LIB(seq, main, [LIBS="$LIBS -lseq"]) AC_CHECK_LIB(sun, main, [LIBS="$LIBS -lsun"]) #-------------------------------------------------------------------- # Check for type of signals #-------------------------------------------------------------------- AC_TYPE_SIGNAL AC_SYS_RESTARTABLE_SYSCALLS AC_CACHE_CHECK(for signals style,cow_cv_signals_type, AC_TRY_RUN([ #include #include test(){ } int main(){ int c; static struct itimerval udt; signal(SIGALRM,test); udt.it_interval.tv_sec = 1; udt.it_interval.tv_usec = 10; udt.it_value.tv_sec = 1; udt.it_value.tv_usec = 10; (void) setitimer(ITIMER_REAL, &udt, (struct itimerval *) 0); for (c=0; c<5; c++) pause(); exit(0);} ], cow_cv_signals_type=BSD, cow_cv_signals_type=SYSV_or_POSIX, cow_cv_signals_type=POSIX )) if test "x$cow_cv_signals_type" = xBSD; then AC_DEFINE(BSD_SIGNALS) else if test "x$cow_cv_signals_type" = xSYSV_or_POSIX; then AC_CHECK_FUNC(sigset, AC_DEFINE(SYSV_SIGNALS), AC_DEFINE(POSIX_SIGNALS)) else AC_DEFINE(POSIX_SIGNALS) fi fi # AC_CHECK_LIB(BSD, main, [LIBS="$LIBS -lBSD"]) # AC_CHECK_LIB(bsd, main, [LIBS="$LIBS -lbsd"]) AC_CHECK_FUNCS(usleep random setstate strftime ftime) AC_CHECK_LIB(m, main, [LIBS="$LIBS -lm"]) AC_CHECK_FUNCS(nint) AC_EGREP_HEADER(rint, math.h, , AC_DEFINE(NEED_RINT_DEC)) AC_REPLACE_FUNCS(usleep setstate strdup rint) #-------------------------------------------------------------------- # Check for system dependent programs #-------------------------------------------------------------------- #-------------------------------------------------------------------- # Check for SDL #-------------------------------------------------------------------- AM_PATH_SDL(1.2.4, AC_DEFINE(HAVE_SDL),[]) AM_CONDITIONAL(HAVE_SDL, [test x"$no_sdl" != x"yes"]) if test x$no_sdl != xyes; then have_SDLmixer=no AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, [have_SDLmixer=yes SDL_MIXER_LIBS="-lSDL_mixer"]) if test x$have_SDLmixer != xyes; then AC_MSG_ERROR([*** Can't find the SDL_mixer library Try: http://www.libsdl.org/projects/SDL_mixer/]) AC_SUBST(SDL_MIXER_LIBS) fi fi AC_OUTPUT(system.mk key.mk)