| 1 |
# Copyright 2022 Jeffrey Kegler |
| 2 |
# Permission is hereby granted, free of charge, to any person obtaining a |
| 3 |
# copy of this software and associated documentation files (the "Software"), |
| 4 |
# to deal in the Software without restriction, including without limitation |
| 5 |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 6 |
# and/or sell copies of the Software, and to permit persons to whom the |
| 7 |
# Software is furnished to do so, subject to the following conditions: |
| 8 |
# |
| 9 |
# The above copyright notice and this permission notice shall be included |
| 10 |
# in all copies or substantial portions of the Software. |
| 11 |
# |
| 12 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 13 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 14 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 15 |
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 16 |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 17 |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 18 |
# OTHER DEALINGS IN THE SOFTWARE. |
| 19 |
|
| 20 |
dnl Process this file with autoconf to produce a configure script. |
| 21 |
|
| 22 |
AC_PREREQ([2.68]) |
| 23 |
|
| 24 |
dnl *********************************** |
| 25 |
dnl *** include special marpa macros *** |
| 26 |
dnl *********************************** |
| 27 |
|
| 28 |
m4_define(marpa_configure_in) |
| 29 |
|
| 30 |
m4_include(version.m4) |
| 31 |
m4_define([marpa_version], |
| 32 |
[marpa_major_version.marpa_minor_version.marpa_micro_version]) |
| 33 |
|
| 34 |
AC_INIT([libmarpa],[marpa_version],[http://rt.cpan.org/NoAuth/Bugs.html?Dist=Marpa]) |
| 35 |
AM_MAINTAINER_MODE([enable]) |
| 36 |
|
| 37 |
# The safety check of the next line is as suggested by autoscan |
| 38 |
AC_CONFIG_SRCDIR([marpa_ami.h]) |
| 39 |
|
| 40 |
AC_CONFIG_MACRO_DIR([m4]) |
| 41 |
|
| 42 |
AM_INIT_AUTOMAKE([]) |
| 43 |
|
| 44 |
# Specify a configuration file |
| 45 |
AC_CONFIG_HEADERS([config.h]) |
| 46 |
|
| 47 |
LT_INIT() |
| 48 |
|
| 49 |
# Checks for programs. |
| 50 |
# The following were suggested by autoscan |
| 51 |
AC_PROG_AWK |
| 52 |
AC_PROG_CC |
| 53 |
AC_PROG_CPP |
| 54 |
AC_PROG_INSTALL |
| 55 |
AC_PROG_LN_S |
| 56 |
AC_PROG_MAKE_SET |
| 57 |
|
| 58 |
# Checks for libraries. |
| 59 |
|
| 60 |
# Checks for header files. |
| 61 |
# The following were suggested by autoscan |
| 62 |
AC_CHECK_HEADERS([stddef.h stdlib.h]) |
| 63 |
|
| 64 |
# Checks for typedefs, structures, and compiler characteristics. |
| 65 |
AC_C_INLINE |
| 66 |
AC_TYPE_SIZE_T |
| 67 |
|
| 68 |
if test x"$GCC" = xyes; then |
| 69 |
|
| 70 |
marpa_save_CFLAGS="$CFLAGS" |
| 71 |
CFLAGS="$marpa_save_CFLAGS -Wextra" |
| 72 |
AC_CACHE_CHECK([whether GCC handles -Wextra], |
| 73 |
[marpa_cv_prog_gcc_wextra], |
| 74 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], |
| 75 |
[marpa_cv_prog_gcc_wextra=-Wextra], |
| 76 |
[marpa_cv_prog_gcc_wextra=])]) |
| 77 |
CFLAGS="$marpa_save_CFLAGS -Wdeclaration-after-statement" |
| 78 |
AC_CACHE_CHECK([whether GCC handles -Wdeclaration-after-statement], |
| 79 |
[marpa_cv_prog_gcc_wdas], |
| 80 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], |
| 81 |
[marpa_cv_prog_gcc_wdas=-Wdeclaration-after-statement], |
| 82 |
[marpa_cv_prog_gcc_wdas=])]) |
| 83 |
CFLAGS="$marpa_save_CFLAGS" |
| 84 |
|
| 85 |
dnl -Winline eliminated because it was too noisy |
| 86 |
dnl One to a line to make these easy to edit |
| 87 |
WARNING_CFLAGS="-Wall \ |
| 88 |
$marpa_cv_prog_gcc_wextra \ |
| 89 |
$marpa_cv_prog_gcc_wdas \ |
| 90 |
-Wpointer-arith \ |
| 91 |
-Wstrict-prototypes \ |
| 92 |
-Wwrite-strings \ |
| 93 |
-Wshadow \ |
| 94 |
-Wmissing-declarations \ |
| 95 |
-Wconversion \ |
| 96 |
-ansi -pedantic" |
| 97 |
|
| 98 |
WARNING_CPPFLAGS=" \ |
| 99 |
-Wundef \ |
| 100 |
-Wendif-labels" |
| 101 |
|
| 102 |
fi |
| 103 |
|
| 104 |
if test x"$MARPA_DEBUG_FLAG" = x; then |
| 105 |
MARPA_DEBUG_FLAG= |
| 106 |
fi |
| 107 |
|
| 108 |
AC_SUBST(WARNING_CFLAGS) |
| 109 |
AC_SUBST(WARNING_CPPFLAGS) |
| 110 |
|
| 111 |
# There are two sets of version numbers, one that travels as |
| 112 |
# a define with the public headers, and this one, which is compiled |
| 113 |
# into the library. Both *should* be the same. |
| 114 |
# We use these duplicate headers to make sure applications match the |
| 115 |
# right headers to the right library, and also for some sanity checking |
| 116 |
# at build and development time. |
| 117 |
AC_SUBST(MARPA_LIB_MAJOR_VERSION, [marpa_major_version]) |
| 118 |
AC_SUBST(MARPA_LIB_MINOR_VERSION, [marpa_minor_version]) |
| 119 |
AC_SUBST(MARPA_LIB_MICRO_VERSION, [marpa_micro_version]) |
| 120 |
AC_DEFINE([MARPA_LIB_MAJOR_VERSION], [marpa_major_version], [Marpa major version.]) |
| 121 |
AC_DEFINE([MARPA_LIB_MINOR_VERSION], [marpa_minor_version], [Marpa minor version.]) |
| 122 |
AC_DEFINE([MARPA_LIB_MICRO_VERSION], [marpa_micro_version], [Marpa micro version.]) |
| 123 |
AC_ARG_VAR(MARPA_DEBUG_FLAG,[Marpa debugging]) |
| 124 |
|
| 125 |
AC_CHECK_SIZEOF([int]) |
| 126 |
if test "$ac_cv_sizeof_int" -lt 4; then |
| 127 |
AC_MSG_ERROR( |
| 128 |
[Marpa requires that int be at least 32 bits -- on this system that is not the case]) |
| 129 |
fi |
| 130 |
|
| 131 |
# This was to prepare for 64-bit pseudo-UTF8 characters (which full Perl-style |
| 132 |
# Unicode support would require) in the SLIF. This approach needs to be re-thought |
| 133 |
# |
| 134 |
# AC_TYPE_UNSIGNED_LONG_LONG_INT |
| 135 |
# if test x"$ac_cv_type_unsigned_long_long_int" != xyes; then |
| 136 |
# AC_MSG_ERROR( |
| 137 |
# [Marpa requires an unsigned long long type -- this compiler does not have one]) |
| 138 |
# fi |
| 139 |
|
| 140 |
# Checks for library functions. |
| 141 |
# The following were suggested by autoscan |
| 142 |
AC_CHECK_FUNCS([memset]) |
| 143 |
|
| 144 |
AC_CONFIG_FILES( [Makefile libmarpa.pc]) |
| 145 |
AC_OUTPUT |
| 146 |
|
| 147 |
# vim: expandtab shiftwidth=4: |