dnl Process this file with autoconf to produce a configure script. dnl This makes sure it is actually in the source directory. AC_INIT(quirc.cc) dnl Set up Automake handling AM_INIT_AUTOMAKE(quirc,0.9.84) dnl Do the config.h stuff AM_CONFIG_HEADER(config.h) dnl Set the version information RPMREL=1 AC_DEFINE_UNQUOTED(VERSION,"$VERSION") AC_SUBST(VERSION) AC_SUBST(RPMREL) dnl Specify the location of the install script. I don't like how this works, dnl but I don't know any better way to do it. doinstall=1; AC_ARG_WITH(no-install, [ --with-no-install If you will not be installing QuIRC for use with multiple users, you can use this option to have QuIRC install the data files, destined for ~/.quirc/ directly from the source directory. In order for this to work properly, you must run ./quirc from where you compiled it, the first time, so that it can find the data files to install.], doinstall=0) if test "$doinstall" = "1"; then if test "$prefix" = "NONE"; then AC_DEFINE(DATADIR,"/usr/local/share/quirc",[Where QuIRC expects to find its data files]) else AC_DEFINE_UNQUOTED(DATADIR,"$prefix/share/quirc",[Where QuIRC expects to find its data files]) fi else AC_DEFINE_UNQUOTED(DATADIR,"$srcdir/data",[Where QuIRC expects to find its data files]) fi dnl Make it output LDFLAGS for use on HP/UX systems AC_SUBST(LDFLAGS) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL dnl Sets X_LIBS and X_CFLAGS AC_PATH_XTRA if test "" != "$no_x"; then AC_MSG_ERROR(The appropriate X libraries were not found. Please install X or check your X configuration.) fi LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRALIBS" CXXFLAGS="$CXXFLAGS $X_CFLAGS" dnl Add some convenient directories to LIBS LDFLAGS="$LDFLAGS -L/usr/local/lib -L. -L.. -L$HOME/lib" dnl Add some nice dirs to CPPFLAGS (-I. -I.. -IHOME/include ?) dnl $x_includes may have more than one dir in it. $X_CFLAGS could be used as dnl an alternative if such a case is discovered. CPPFLAGS="$CPPFLAGS -I/usr/local/include" dnl Back up the existing flags, then add the X includes on, for internal use. cppflags_backup="$CPPFLAGS" if test "$x_includes" != ""; then CPPFLAGS="$CPPFLAGS -I$x_includes" fi dnl Checks for libraries. Must be done in this order so the prerequisites for dnl later libraries are in place correctly. AC_CHECK_LIB(socket,connect) AC_CHECK_LIB(nsl,gethostbyname) AC_CHECK_LIB(dl,dlopen) AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(Could not find libm)) AC_CHECK_LIB(X11,XOpenDisplay,,AC_MSG_ERROR(Could not find libX11)) AC_CHECK_LIB(resolv,res_init) dnl Check to see if using std::string; is needed. store_cc=$CC CC=$CXX AC_MSG_CHECKING(if compiles without using std::string) AC_TRY_COMPILE([#include ],string test, AC_MSG_RESULT(yes), AC_DEFINE(USING_STD_STRING, [], [If we need to add using std::string]) AC_MSG_RESULT(no)) CC=$store_cc AC_ARG_WITH(socks, [ --with-socks[=DIR] This will enable socks5 support. If you specify a directory, it will be used as the lib directory for the socks5 library.], CXXFLAGS="$CXXFLAGS -DSOCKS"; CFLAGS="$CFLAGS -DSOCKS"; LIBS="$LIBS -lsocks5"; if test "$with_socks" != ""; then LDFLAGS="-L$with_socks $LDFLAGS"; fi) dnl Could add things like: dnl --with-more-flags=-DDMALLOC dnl --with-more-libs=-ldmalloc ../dmalloccc.o dnl Let's find out where wish is hiding. WISH="notfound" AC_ARG_WITH(wish, [ --with-wish=LOCATION The full location of the wish interpreter.], WISH="$with_wish", WISH="notfound") if test "$WISH" = "notfound"; then AC_PATH_PROGS(WISH, wish8.4 wish8.3 wish8.2 wish8.1 wish8.0 wish, notfound, \ $PATH:/usr/bin:/usr/local/bin) fi if test "$WISH" = "notfound"; then AC_MSG_ERROR(Could not find wish.); fi AC_SUBST(WISH) dnl The following section checks for the TCL and TK libraries and include files dnl and uses a variety of command line options. dnl Initialize variables TCL_LIB_DIR="" TK_LIB_DIR="" TCL_LIB="" TK_LIB="" TCL_INCLUDE_DIR="" TK_INCLUDE_DIR="" TCL_INCLUDE="" TK_INCLUDE="" TCL_VERSION="" dnl --with-tcl=DIRNAME dnl --with-tk=DIRNAME dnl TCL_LIB_DIR=DIRNAME/lib dnl TK_LIB_DIR=DIRNAME/lib dnl TCL_INCLUDE_DIR=DIRNAME/include dnl TK_INCLUDE_DIR=DIRNAME/include AC_ARG_WITH(tcl, [For the tcl/tk options that take directory arguments, if the tk files are in the same dir as the tcl files, you only need to specify the tcl dir, not both. --with-tcl=DIR The directory under which the \"include/\" dir, that contains the Tcl headers, and lib/libtcl8.x.* reside.], TCL_LIB_DIR="$with_tcl/lib"; TCL_INCLUDE_DIR="$with_tcl/include") AC_ARG_WITH(tk, [ --with-tk=DIR The directory under which the \"include/\" dir, that contains the Tk headers, and lib/libtk8.x.* reside.], TK_LIB_DIR="$with_tk/lib"; TK_INCLUDE_DIR="$with_tk/include") dnl --with-tcl-include-dir=DIRNAME dnl --with-tk-include-dir=DIRNAME dnl TCL_INCLUDE_DIR=DIRNAME dnl TK_INCLUDE_DIR=DIRNAME AC_ARG_WITH(tcl-include-dir, [ --with-tcl-include-dir=DIR The directory to check for Tcl headers.], TCL_INCLUDE_DIR="$with_tcl_include_dir") AC_ARG_WITH(tk-include-dir, [ --with-tk-include-dir=DIR The directory to check for Tk headers.], TK_INCLUDE_DIR="$with_tk_include_dir") dnl --with-tcl-include=PATHNAME dnl --with-tk-include=PATHNAME dnl TCL_INCLUDE=PATHNAME dnl TK_INCLUDE=PATHNAME AC_ARG_WITH(tcl-include, [ --with-tcl-include=[PATH/]FILE.h The Tcl header file with optional path.], TCL_INCLUDE="$with_tcl_include") AC_ARG_WITH(tk-include, [ --with-tk-include=[PATH/]FILE.h The Tk header file with optional path.], TK_INCLUDE="$with_tk_include") dnl --with-tcl-lib-dir=DIRNAME dnl --with-tk-lib-dir=DIRNAME dnl TCL_LIB_DIR=DIRNAME dnl TK_LIB_DIR=DIRNAME AC_ARG_WITH(tcl-lib-dir, [ --with-tcl-lib-dir=DIR The directory under which libtcl8.x.* resides.], TCL_LIB_DIR="$with_tcl_lib_dir") AC_ARG_WITH(tk-lib-dir, [ --with-tk-lib-dir=DIR The directory under which libtk8.x.* resides.], TK_LIB_DIR="$with_tk_lib_dir") dnl --with-tcl-lib=tcl8.0 dnl --with-tk-lib=tk8.0 dnl TCL_LIB=tcl8.0 dnl TK_LIB=tk8.0 AC_ARG_WITH(tcl-lib, [ --with-tcl-lib=LIB The Tcl library portion of -lLIB (ex. tcl8.0).], TCL_LIB="$with_tcl_lib") AC_ARG_WITH(tk-lib, [ --with-tk-lib=LIB The Tk library portion of -lLIB (ex. tk8.0).], TK_LIB="$with_tk_lib") dnl --with-tcl-version=8.0 dnl TCL_VERSION=8.0 AC_ARG_WITH(tcl-version, [ --with-tcl-version=8.x By default, the config script searches for the newest version of tcl first. You can set this to make it look for a particular version, for example, 8.0 or 8.2.], TCL_VERSION="$with_tcl_version") dnl Let's deal with the Tcl/Tk headers first. TCL_DONE=0 TK_DONE=0 TCL_HEADER=tcl.h TK_HEADER=tk.h if test "" != "$TCL_INCLUDE_DIR"; then CPPFLAGS="-I$TCL_INCLUDE_DIR $CPPFLAGS" cppflags_backup="-I$TCL_INCLUDE_DIR $cppflags_backup" fi if test "" != "$TK_INCLUDE_DIR"; then CPPFLAGS="-I$TK_INCLUDE_DIR $CPPFLAGS" cppflags_backup="-I$TK_INCLUDE_DIR $cppflags_backup" fi if test "" != "$TCL_INCLUDE"; then AC_CHECK_HEADER($TCL_INCLUDE,TCL_HEADER=$TCL_INCLUDE;TCL_DONE=1) fi if test "$TCL_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.4"; then AC_CHECK_HEADER(tcl8.4/tcl.h,TCL_HEADER=tcl8.4/tcl.h;ADD_TCL=tcl8.4;TCL_DONE=1) fi fi if test "$TCL_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.3"; then AC_CHECK_HEADER(tcl8.3/tcl.h,TCL_HEADER=tcl8.3/tcl.h;ADD_TCL=tcl8.3;TCL_DONE=1) fi fi if test "$TCL_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.2"; then AC_CHECK_HEADER(tcl8.2/tcl.h,TCL_HEADER=tcl8.2/tcl.h;ADD_TCL=tcl8.2;TCL_DONE=1) fi fi if test "$TCL_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.1"; then AC_CHECK_HEADER(tcl8.1/tcl.h,TCL_HEADER=tcl8.1/tcl.h;ADD_TCL=tcl8.1;TCL_DONE=1) fi fi if test "$TCL_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.0"; then AC_CHECK_HEADER(tcl8.0/tcl.h,TCL_HEADER=tcl8.0/tcl.h;ADD_TCL=tcl8.0;TCL_DONE=1) fi fi if test "$TCL_DONE" = "0"; then AC_CHECK_HEADER(tcl.h,TCL_HEADER=tcl.h;TCL_DONE=1) fi if test "$TCL_DONE" = "0"; then AC_MSG_ERROR([Could not find Tcl include file.]) fi dnl Kludge to attempt to compensate for cases where tk.h is looking for tcl.h dnl and tcl.h itself is in a special location. if test "$ADD_TCL" != ""; then CPPFLAGS="$CPPFLAGS -I/usr/local/include/$ADD_TCL -I/usr/include/$ADD_TCL -I$x_includes/$ADD_TCL" fi if test "$TK_INCLUDE" != ""; then AC_CHECK_HEADER($TK_INCLUDE,TK_HEADER=$TK_INCLUDE;TK_DONE=1) fi if test "$TK_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.4"; then AC_CHECK_HEADER(tcl8.4/tk.h,TK_HEADER=tcl8.4/tk.h;TK_DONE=1) if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk8.4/tk.h,TK_HEADER=tk8.4/tk.h;TK_DONE=1) fi fi fi if test "$TK_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.3"; then AC_CHECK_HEADER(tcl8.3/tk.h,TK_HEADER=tcl8.3/tk.h;TK_DONE=1) if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk8.3/tk.h,TK_HEADER=tk8.3/tk.h;TK_DONE=1) fi fi fi if test "$TK_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.2"; then AC_CHECK_HEADER(tcl8.2/tk.h,TK_HEADER=tcl8.2/tk.h;TK_DONE=1) if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk8.2/tk.h,TK_HEADER=tk8.2/tk.h;TK_DONE=1) fi fi fi if test "$TK_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.1"; then AC_CHECK_HEADER(tcl8.1/tk.h,TK_HEADER=tcl8.1/tk.h;TK_DONE=1) if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk8.1/tk.h,TK_HEADER=tk8.1/tk.h;TK_DONE=1) fi fi fi if test "$TK_DONE" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.0"; then AC_CHECK_HEADER(tcl8.0/tk.h,TK_HEADER=tcl8.0/tk.h;TK_DONE=1) if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk8.0/tk.h,TK_HEADER=tk8.0/tk.h;TK_DONE=1) fi fi fi if test "$TK_DONE" = "0"; then AC_CHECK_HEADER(tk.h,TK_HEADER=tk.h;TK_DONE=1) fi if test "TK_DONE" = "0"; then AC_MSG_ERROR(Could not find Tk include file.) fi # Restore CPPFLAGS settings CPPFLAGS="$cppflags_backup" AC_SUBST(TCL_HEADER) AC_SUBST(TK_HEADER) dnl Work Tcl/Tk library magic if test "" != "$TCL_LIB_DIR"; then LDFLAGS="-L$TCL_LIB_DIR $LDFLAGS" fi if test "" != "$TK_LIB_DIR"; then LDFLAGS="-L$TK_LIB_DIR $LDFLAGS" fi HAVETCL=0 HAVETK=0 if test "$TCL_LIB" != ""; then AC_CHECK_LIB($TCL_LIB, Tcl_Init, LIBS="-l$TCL_LIB $LIBS"; HAVETCL=1) fi if test "$HAVETCL" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.4"; then AC_CHECK_LIB(tcl8.4, Tcl_Init, LIBS="-ltcl8.4 $LIBS"; HAVETCL=1, AC_CHECK_LIB(tcl84, Tcl_Init, LIBS="-ltcl84 $LIBS"; HAVETCL=1,)) fi fi if test "$HAVETCL" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.3"; then AC_CHECK_LIB(tcl8.3, Tcl_Init, LIBS="-ltcl8.3 $LIBS"; HAVETCL=1, AC_CHECK_LIB(tcl83, Tcl_Init, LIBS="-ltcl83 $LIBS"; HAVETCL=1,)) fi fi if test "$HAVETCL" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.2"; then AC_CHECK_LIB(tcl8.2, Tcl_Init, LIBS="-ltcl8.2 $LIBS"; HAVETCL=1, AC_CHECK_LIB(tcl82, Tcl_Init, LIBS="-ltcl82 $LIBS"; HAVETCL=1,)) fi fi if test "$HAVETCL" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.1"; then AC_CHECK_LIB(tcl8.1, Tcl_Init, LIBS="-ltcl8.1 $LIBS"; HAVETCL=1, AC_CHECK_LIB(tcl81, Tcl_Init, LIBS="-ltcl81 $LIBS"; HAVETCL=1)) fi fi if test "$HAVETCL" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.0"; then AC_CHECK_LIB(tcl8.0, Tcl_Init, LIBS="-ltcl8.0 $LIBS"; HAVETCL=1, AC_CHECK_LIB(tcl80, Tcl_Init, LIBS="-ltcl80 $LIBS"; HAVETCL=1,)) fi fi if test "$TK_LIB" != ""; then AC_CHECK_LIB($TK_LIB, Tk_MainLoop,LIBS="-l$TK_LIB $LIBS"; HAVETK=1) fi if test "$HAVETK" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.4"; then AC_CHECK_LIB(tk8.4, Tk_MainLoop, LIBS="-ltk8.4 $LIBS"; HAVETK=1, AC_CHECK_LIB(tk84, Tk_MainLoop, LIBS="-ltk84 $LIBS"; HAVETK=1,)) fi fi if test "$HAVETK" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.3"; then AC_CHECK_LIB(tk8.3, Tk_MainLoop, LIBS="-ltk8.3 $LIBS"; HAVETK=1, AC_CHECK_LIB(tk83, Tk_MainLoop, LIBS="-ltk83 $LIBS"; HAVETK=1,)) fi fi if test "$HAVETK" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.2"; then AC_CHECK_LIB(tk8.2, Tk_MainLoop, LIBS="-ltk8.2 $LIBS"; HAVETK=1, AC_CHECK_LIB(tk82, Tk_MainLoop, LIBS="-ltk82 $LIBS"; HAVETK=1,)) fi fi if test "$HAVETK" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.1"; then AC_CHECK_LIB(tk8.1, Tk_MainLoop, LIBS="-ltk8.1 $LIBS"; HAVETK=1, AC_CHECK_LIB(tk81, Tk_MainLoop, LIBS="-ltk81 $LIBS"; HAVETK=1)) fi fi if test "$HAVETK" = "0"; then if test "$TCL_VERSION" = "" || test "$TCL_VERSION" = "8.0"; then AC_CHECK_LIB(tk8.0, Tk_MainLoop, LIBS="-ltk8.0 $LIBS"; HAVETK=1, AC_CHECK_LIB(tk80, Tk_MainLoop, LIBS="-ltk80 $LIBS"; HAVETK=1,)) fi fi if test "$HAVETCL" != "1"; then AC_MSG_ERROR(Could not find Tcl library.); fi if test "$HAVETK" != "1"; then AC_MSG_ERROR(Could not find Tk library.); fi dnl Make sure size_t is defined AC_TYPE_SIZE_T dnl Make sure u_int32_t is defined for arlib.c AC_CHECK_TYPE(u_int32_t,unsigned int) dnl Make sure socklen_t is defined AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE([ #include #include ],socklen_t test, AC_MSG_RESULT(yes), AC_DEFINE(socklen_t,int,[If socken_t is defined]) AC_MSG_RESULT(no)) dnl Check for replaceable library functions. AC_CHECK_FUNCS(strcasecmp strncasecmp htons) dnl Do the substitutions of the variables for the given files. AC_OUTPUT(Makefile doc/Makefile data/Makefile data/VERSION data/quedit data/fontsel tcltk.h) dnl Junk Storage dnl if test "" = "$CXXFLAGS"; then dnl CXXFLAGS="-Wall -g" dnl fi dnl AC_CHECK_HEADER(tcl.h,,AC_MSG_CHECKING(/usr/local/include/tcl8.0/tcl.h); if test -f /usr/local/include/tcl8.0/tcl.h; then AC_MSG_RESULT(yes); ln -sf /usr/local/include/tcl8.0/tcl.h tcl.h; else AC_MSG_ERROR(Unable to find tcl.h); fi dnl AC_CHECK_HEADER(tk.h,,AC_MSG_CHECKING(/usr/local/include/tcl8.0/tk.h); if test -f /usr/local/include/tk8.0/tk.h; then AC_MSG_RESULT(yes); ln -sf /usr/local/include/tk8.0/tk.h tk.h; else AC_MSG_ERROR(Unable to find tk.h); fi) dnl AC_CHECK_HEADERS(malloc.h) dnl Checks for header files. dnl AC_HEADER_STDC dnl AC_CHECK_HEADERS(strings.h sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_HEADER_TIME dnl Checks for library functions. dnl AC_TYPE_SIGNAL dnl AC_CHECK_FUNCS(select strdup strerror strstr) dnl $X_PRE_LIBS and/or $X_EXTRA_LIBS may need to be added, but I'm not sure. dnl echo "TCL_INCLUDE_DIR=$TCL_INCLUDE_DIR" dnl echo "TK_INCLUDE_DIR=$TK_INCLUDE_DIR" dnl echo "TCL_INCLUDE=$TCL_INCLUDE" dnl echo "TK_INCLUDE=$TK_INCLUDE" dnl echo "TCL_LIB_DIR=$TCL_LIB_DIR" dnl echo "TK_LIB_DIR=$TK_LIB_DIR" dnl echo "TCL_LIB=$TCL_LIB" dnl echo "TK_LIB=$TK_LIB" dnl At this point, any "" entries will be searched for automatically. dnl For the headers, check if they're tcl.h and tk.h. If they aren't, then dnl make symlinks to them in the current dir. dnl if test "" != "$TCL_INCLUDE"; then dnl if test ! -f $TCL_INCLUDE; then dnl AC_MSG_ERROR(Could not find $TCL_INCLUDE) dnl fi dnl TCL_HEADER=$TCL_INCLUDE dnl TCL_DONE=1 dnl fi dnl if test "" != "$TK_INCLUDE"; then dnl if test ! -f $TK_INCLUDE; then dnl AC_MSG_ERROR(Could not find $TK_INCLUDE) dnl fi dnl TK_HEADER=$TK_INCLUDE dnl TK_DONE=1 dnl fi dnl --with-tcltk=DIRNAME dnl AC_ARG_WITH(tcltk, dnl [ --with-tcltk=DIR The directory under which the \"include/\" dir, that dnl contains the Tcl/Tk headers, lib/libtcl8.x.*, and dnl lib/libtk8.x.* reside.], dnl TCL_LIB_DIR="$with_tcltk/lib"; dnl TCL_INCLUDE_DIR="$with_tcltk/include") dnl --with-tcltk-include-dir=DIRNAME dnl AC_ARG_WITH(tcltk-include-dir, dnl [ --with-tcltk-include-dir=DIR The directory to check for Tcl and Tk headers.], dnl TCL_INCLUDE_DIR="$with_tcltk_include_dir") dnl --with-tcltk-lib-dir=DIRNAME dnl AC_ARG_WITH(tcltk-lib-dir, dnl [ --with-tcltk-lib-dir=DIR The directory under which libtcl8.x.* and dnl libtk8.x.* reside.], dnl TCL_LIB_DIR="$with_tcltk_lib_dir")