dnl -*-autoconf-*- dnl dnl Configuration script for `finally' dnl dnl (c) 2023 Mark Wooding dnl dnl----- Licensing notice --------------------------------------------------- dnl dnl This file is part of the `Finally' package. dnl dnl Finally is free software: you can redistribute it and/or modify it dnl under the terms of the GNU Library General Public License as published dnl by the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl Finally is distributed in the hope that it will be useful, but WITHOUT dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public dnl License for more details. dnl dnl You should have received a copy of the GNU Library General Public dnl License along with Finally. If not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, dnl USA. dnl-------------------------------------------------------------------------- dnl Initialization. AC_INIT([finally], [0.9], [mdw@distorted.org.uk]) AC_CONFIG_SRCDIR([finally.h]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) AC_REQUIRE_AUX_FILE([tap-driver.sh]) AM_SILENT_RULES([yes]) dnl-------------------------------------------------------------------------- dnl C programming environment. AC_PROG_CC AM_PROG_CC_C_O AC_SUBST(AM_CFLAGS) case $GCC in yes) AM_CFLAGS="$AM_CFLAGS -std=c89 -pedantic -Wall -Wextra -Werror" ;; esac dnl-------------------------------------------------------------------------- dnl C++ programming environment. AC_PROG_CXX AC_SUBST(AM_CXXFLAGS) case $GXX in yes) AM_CXXFLAGS="$AM_CXXFLAGS -std=c++11 -pedantic -Wall -Wextra -Werror" ;; esac AC_DEFUN([FINALLY_CXX14_PROGRAM], [AC_LANG_PROGRAM([], [ #if !defined(__cplusplus) || __cplusplus < 201103 choke me #endif ])]) AC_CACHE_CHECK([whether $CXX works at all], [finally_cv_cxx_works_p], [ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [finally_cv_cxx_works_p=yes], [finally_cv_cxx_works_p=no]) AC_LANG_POP([C++])]) case $finally_cv_cxx_works_p in yes) AC_CACHE_CHECK([whether $CC accepts \`-fexceptions'], [finally_cv_gcc_fexceptions_p], [ AC_LANG_PUSH([C]) finally_test_original_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -fexceptions" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [finally_cv_gcc_fexceptions_p=yes], [finally_cv_gcc_fexceptions_p=no]) CFLAGS=$finally_test_original_CFLAGS AC_LANG_POP([C])]) ;; no) finally_cv_gcc_fexceptions_p=no ;; esac case $finally_cv_cxx_works_p in yes) AC_CACHE_CHECK([whether $CXX supports C++11], [finally_cv_cxx14_p], [ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([FINALLY_CXX14_PROGRAM], [finally_cv_cxx14_p=yes], [finally_cv_cxx14_p=no]) AC_LANG_POP([C++])]) ;; *) finally_cv_cxx14_p=no CXX=\${CC} ;; esac dnl-------------------------------------------------------------------------- dnl Other tools. AC_CHECK_PROGS([autom4te]) AC_PROG_RANLIB dnl-------------------------------------------------------------------------- dnl Test configuration. finally_test_original_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $AM_CFLAGS" case $finally_cv_gcc_fexceptions_p in yes) CFLAGS="$CFLAGS -fexceptions" ;; esac FINALLY_CHECK CFLAGS=$finally_test_original_CFLAGS AM_CFLAGS="$AM_CFLAGS $FINALLY_CFLAGS" AM_CONDITIONAL([C], [test $finally_flavour != NIL]) AM_CONDITIONAL([CXX], [test $finally_cv_cxx_works_p = yes]) AM_CONDITIONAL([CXX14], [test $finally_cv_cxx14_p = yes]) case $finally_flavour,$finally_cv_cxx14_p in NIL,no) AC_MSG_ERROR([no suitable C or C++ compiler found: not going to space today]) ;; esac case $finally_flavour,$finally_cv_gcc_fexceptions_p,$finally_cv_cxx_works_p in NIL,*,no) finally_fexceptions_p=no ;; *,yes,*) AM_CFLAGS="$AM_CFLAGS -fexceptions"; finally_fexceptions_p=yes ;; *,yes) finally_fexceptions_p=yes ;; esac case $finally_fexceptions_p in yes) AC_DEFINE([HAVE_FEXCEPTIONS], [1]) ;; esac AM_CONDITIONAL([FEXCEPTIONS], [test $finally_fexceptions_p = yes]) dnl-------------------------------------------------------------------------- dnl Output. AC_CONFIG_FILES([Makefile]) AC_OUTPUT dnl----- That's all, folks --------------------------------------------------