dnl $Id: configure.in,v 1.13 2015/07/10 11:07:03 mwesdorp Exp $ dnl dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl dnl configure.in script to configure sqsh build environment dnl AC_INIT(src/sqsh_main.c) AC_CONFIG_HEADER(src/config.h) AC_CONFIG_AUX_DIR(autoconf) AC_CANONICAL_HOST dnl dnl Define the possible configure options dnl AC_ARG_WITH([gcc], [ --with-gcc Use gcc, regardless of path], [], [with_gcc="yes"]) AC_ARG_WITH([debug], [ --with-debug Enable sqsh debugging options], [], [with_debug="no"]) AC_ARG_WITH([readline], [ --with-readline support fancy command line editing], [], [with_readline="yes"]) AC_ARG_WITH([old-readline], [ --with-old-readline Force readline backwards compatibilty], [], [with_old_readline="no"]) AC_ARG_WITH([static], [ --with-static Statically link in Sybase libraries], [], [with_static="no"]) AC_ARG_WITH([devlib], [ --with-devlib Compile against Open Client devlibs], [], [with_devlib="no"]) AC_ARG_WITH([x], [], [], [with_x="no"]) AC_ARG_WITH([motif], [ --with-motif support X11/Motif widgets], [ if test "$with_motif" != "no"; then if test "$with_motif" != "yes"; then MOTIF_PATH=$with_motif with_motif="yes" MOTIF_INCDIR="-I$MOTIF_PATH/include/X11" MOTIF_LIBDIR="-L$MOTIF_PATH/lib" else MOTIF_INCDIR="# -I/usr/X11/include" MOTIF_LIBDIR="# -L/usr/X11/lib" fi with_x="yes" DEF_MOTIF="-DUSE_MOTIF" fi ],[ with_motif="no" DEF_MOTIF="# -DUSE_MOTIF" ]) if test "$with_debug" != "no"; then DEF_DEBUG="-DDEBUG" fi AC_SUBST(with_gcc) AC_SUBST(with_debug) AC_SUBST(with_readline) AC_SUBST(with_old_readline) AC_SUBST(with_static) AC_SUBST(with_devlib) AC_SUBST(with_x) AC_SUBST(with_motif) AC_SUBST(DEF_DEBUG) AC_SUBST(DEF_MOTIF) AC_SUBST(MOTIF_PATH) AC_SUBST(MOTIF_INCDIR) AC_SUBST(MOTIF_LIBDIR) dnl dnl Check Compiler characteristics, typedefs and structures dnl AC_PROG_CC AC_PROG_CPP AC_ISC_POSIX AC_VOLATILE AC_C_CONST AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_UID_T AC_BIT_MODE if test "${ISC}" = "yes"; then DEF_POSIX="-D_POSIX_SOURCE" AC_SUBST(DEF_POSIX) fi dnl dnl Set flags and variables depending on host_os dnl case "$host_os" in aix*) DEF_AIX_FIX="-DUSE_AIX_FIX" AC_SUBST(DEF_AIX_FIX) OBJMODE="-X32_64" AC_SUBST(OBJMODE) ;; *) ;; esac dnl dnl Check SYBASE/FreeTDS libraries dnl AC_SYBASE_ASE dnl dnl Check READLINE environment dnl if test "$with_old_readline" = "yes"; then with_readline="yes" fi if test "$with_readline" = "no"; then DEF_READLINE="# -DUSE_READLINE" READLINE_INCDIR="# -I/usr/local/include" READLINE_LIBDIR="# -L/usr/local/lib" READLINE_LIBS="# -lreadline -lcurses" else DEF_READLINE="-DUSE_READLINE" AC_CHECK_LIB(readline, [readline], [ READLINE_LIBS=-lreadline inc_search=/usr/include]) if [[ "$with_old_readline" = "yes" ]]; then DEF_READLINE="${DEF_READLINE} -DOLD_READLINE" else ORIG_LDFLAGS=${LDFLAGS} if test "$READLINE_LIBDIR" != ""; then LDFLAGS="${LDFLAGS} -L${READLINE_LIBDIR}" fi AC_CHECK_LIB(readline, rl_completion_matches,:,DEF_READLINE="${DEF_READLINE} -DOLD_READLINE") LDFLAGS=${ORIG_LDFLAGS} fi if [[ "$with_readline" = "yes" ]]; then SQSH_PARSE_LIB="sqsh_parser/sqsh_parser.a" else SQSH_PARSE_LIB="" fi fi AC_SUBST(DEF_READLINE) AC_SUBST(READLINE_INCDIR) AC_SUBST(READLINE_LIBDIR) AC_SUBST(READLINE_LIBS) AC_SUBST(SQSH_PARSE_LIB) dnl dnl Check X/Motif settings dnl if test "$with_x" != "no"; then if test "$with_motif" != "no"; then MOTIF_LIBS=-lXm ATHENA_LIBS= else MOTIF_LIBS= ATHENA_LIBS=-lXaw fi DEF_X11="-DUSE_X11" # The AC PATH EXTRA macro uses xmkmf to figure out where to # find the X include directory and X lib directories, so lets # make sure that it can find the xmkmf executable. AC_PATH_PROG(xmkmfpath, xmkmf) # When complete, the following macro should define x_includes, # x_libraries, X_CFLAGS, X_LIBS, X_EXTRA_LIBS, and X_PRE_LIBS. AC_PATH_X # On some systems the X include directory may be found but not # the library directory. In these cases we attempt to guess # the lib directory. if test -d "${x_includes}" -a ! -d "${x_libraries}"; then x_libraries=`echo ${x_includes} | sed -e 's,include,lib,g'` fi # Reverse the test above to see if the lib directory has been # defined but not the include directory. if test -d "${x_libraries}" -a ! -d "${x_includes}"; then x_includes=`echo "${x_libraries}" | sed -e 's,lib,include,g'` fi # If we found the include directory in the standard /usr/include, then # don't bother to add it to our cpp line..it'll be found anyway. If # it wasn't found then we'll assume /usr/X11R6/include. if test "${x_includes}" != ""; then if test "${x_includes}" != "/usr/include"; then X_INCDIR="-I${x_includes}" else X_INCDIR="# -I${x_includes}" fi else X_INCDIR="# -I/usr/X11R6/include" fi # Repeat pretty much the same thing for the library directory. If # it was found in /usr/lib or /lib, then comment it out, or if # it wasn't found then assume /usr/X11R6/lib. if test "${x_libraries}" != ""; then if test "${x_libraries}" != "/usr/lib" -a "${x_libraries}" != "/lib"; then X_LIBDIR="-L${x_libraries}" else X_LIBDIR="# -L${x_libraries}" fi else X_LIBDIR="# -L/usr/X11R6/lib" fi # This link line may product more libraries than actually needed # but hopefuly it'll work for most systems; besides the linker # should clean things up for us. # Yeah, let's not link against X libs we're not using, thanks. # there's no guarantee they're even available at build-time! -srl 20110903 X_LIBS="${X_WIDGETLIB} ${X_PRE_LIBS} ${X_EXTRA_LIBS}" else DEF_X11="# ${DEF_X11}" X_LIBS="# -lXaw -lXt -lXext -lXmu -lX11" X_INCDIR="# -I/usr/X11R6/include" X_LIBDIR="# -L/usr/X11R6/lib" fi AC_SUBST(DEF_X11) AC_SUBST(X_LIBS) AC_SUBST(X_INCDIR) AC_SUBST(X_LIBDIR) AC_SUBST(MOTIF_LIBS) AC_SUBST(ATHENA_LIBS) dnl dnl Checks for header files. dnl AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stropts.h memory.h stdlib.h time.h sys/time.h sys/types.h string.h strings.h fcntl.h unistd.h errno.h limits.h sys/param.h crypt.h shadow.h locale.h readline/history.h) dnl dnl Check for crypt, pthread and iconv libraries dnl AC_CHECK_LIB(crypt, [encrypt], [LIBS="${LIBS} -lcrypt"]) if test "$with_static" = "yes"; then AC_CHECK_LIB(pthread, [pthread_create], [LIBS="${LIBS} -lpthread"]) fi if test "$SYBASE_VERSION" = "FreeTDS"; then AC_CHECK_LIB(iconv, [iconv], [LIBS="${LIBS} -liconv"]) fi dnl dnl Checks for library functions. dnl AC_CHECK_FUNCS(sigaction strcasecmp strerror cftime strftime memcpy memmove localtime timelocal strchr gettimeofday get_process_stats crypt poll localeconv setlocale) dnl dnl Checks function behaviour dnl AC_TYPE_SIGNAL AC_SIGSETJMP AC_SYSV_SIGNALS AC_PROG_INSTALL dnl dnl Produce the required output files dnl AC_OUTPUT(Makefile src/Makefile src/sqsh_parser/Makefile scripts/install.sh scripts/make_wrapper.sh) dnl dnl Output some final messages dnl case "${host_os}" in *cygwin) if test "$SYBASE_VERSION" != "FreeTDS"; then AC_MSG_NOTICE([Cygwin/Sybase target detected: Please make sure you have local user]) AC_MSG_NOTICE([environment variables defined for SYBASE and SYBASE_OCS.]) AC_MSG_NOTICE([See cygwin/README for more information.]) fi ;; *) ;; esac AC_MSG_NOTICE([Completed successfully. Please run 'make clean && make' to build sqsh.])