| 1 |
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, |
| 2 |
# 2010, 2013, 2014, 2015, 2019, 2020, 2022 Free Software Foundation, Inc. |
| 3 |
# |
| 4 |
# This file is free software; as a special exception the author gives |
| 5 |
# unlimited permission to copy and/or distribute it, with or without |
| 6 |
# modifications, as long as this notice is preserved. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, but |
| 9 |
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the |
| 10 |
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 |
|
| 12 |
AC_INIT([GNU MDK],[1.3.1],[[email protected]],[mdk]) |
| 13 |
AC_CONFIG_SRCDIR([mixlib/mix.h]) |
| 14 |
AM_INIT_AUTOMAKE |
| 15 |
|
| 16 |
AM_CONFIG_HEADER(config.h) |
| 17 |
|
| 18 |
AM_MAINTAINER_MODE |
| 19 |
|
| 20 |
AC_SEARCH_LIBS([strerror],[cposix]) |
| 21 |
AC_PROG_CC |
| 22 |
dnl AM_PROG_CC_STDC |
| 23 |
dnl m4_warn([obsolete], |
| 24 |
dnl [The preprocessor macro `STDC_HEADERS' is obsolete. |
| 25 |
dnl Except in unusual embedded environments, you can safely include all |
| 26 |
dnl ISO C90 headers unconditionally.])dnl |
| 27 |
dnl # Autoupdate added the next two lines to ensure that your configure |
| 28 |
dnl # script's behavior did not change. They are probably safe to remove. |
| 29 |
dnl AC_CHECK_INCLUDES_DEFAULT |
| 30 |
dnl AC_PROG_EGREP |
| 31 |
|
| 32 |
|
| 33 |
AM_PROG_LEX |
| 34 |
AC_PROG_RANLIB |
| 35 |
|
| 36 |
dnl additional c flags |
| 37 |
AM_CFLAGS="$AM_CFLAGS -Wall -fno-strict-aliasing" |
| 38 |
AC_ARG_WITH(werror, |
| 39 |
[ --with-werror treat compilation warnings as errors], |
| 40 |
[case "${withval}" in |
| 41 |
yes) werr=true ;; |
| 42 |
no) werr=false ;; |
| 43 |
*) AC_MSG_ERROR(bad value ${withval} for --with-werror) ;; |
| 44 |
esac], [werr=false]) |
| 45 |
|
| 46 |
if test x$werr = xtrue; then |
| 47 |
AM_CFLAGS="$AM_CFLAGS -Werror" |
| 48 |
fi |
| 49 |
|
| 50 |
dnl i18n stuff |
| 51 |
AM_GNU_GETTEXT_VERSION(0.14) |
| 52 |
AM_GNU_GETTEXT |
| 53 |
IT_PROG_INTLTOOL([0.37],[no-xml]) |
| 54 |
|
| 55 |
GETTEXT_PACKAGE=mdk |
| 56 |
AC_SUBST(GETTEXT_PACKAGE) |
| 57 |
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Package Name for Gettext]) |
| 58 |
|
| 59 |
test "x$prefix" = xNONE && prefix=$ac_default_prefix |
| 60 |
|
| 61 |
AH_TEMPLATE(LOCALEDIR,[locale directory]) |
| 62 |
AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/share/locale") |
| 63 |
|
| 64 |
dnl Check for readline and history |
| 65 |
AC_ARG_WITH(readline, |
| 66 |
[ --without-readline build mixvm without readline support], |
| 67 |
[case "${withval}" in |
| 68 |
yes) readl=true ;; |
| 69 |
no) readl=false ;; |
| 70 |
*) AC_MSG_ERROR(bad value ${withval} for --with-readline) ;; |
| 71 |
esac], [readl=true]) |
| 72 |
|
| 73 |
if test x$readl = xtrue; then |
| 74 |
AC_CHECK_LIB(ncurses, initscr, , |
| 75 |
[AC_MSG_WARN(Cannot find ncurses lib); readl=false]) |
| 76 |
fi |
| 77 |
|
| 78 |
if test x$readl = xtrue; then |
| 79 |
AC_CHECK_LIB(readline, readline, , |
| 80 |
[AC_MSG_WARN(Cannot find GNU readline lib); readl=false]) |
| 81 |
fi |
| 82 |
|
| 83 |
if test x$readl = xtrue; then |
| 84 |
AC_CHECK_LIB(history, add_history, , |
| 85 |
[AC_MSG_WARN(Cannot find GNU history lib); readl=false]) |
| 86 |
dnl old versions of readline use completion_matches instead |
| 87 |
dnl of rl_completion_matches |
| 88 |
AC_CHECK_FUNCS(rl_completion_matches,,) |
| 89 |
fi |
| 90 |
|
| 91 |
dnl Check for glib |
| 92 |
PKG_CHECK_MODULES(GLIB,glib-2.0 >= 2.0) |
| 93 |
|
| 94 |
dnl Check for guile |
| 95 |
AC_ARG_WITH(guile, |
| 96 |
[ --without-guile build MDK without Guile support], |
| 97 |
[case "${withval}" in |
| 98 |
yes) wguile=true ;; |
| 99 |
no) wguile=false ;; |
| 100 |
*) AC_MSG_ERROR(bad value ${withval} for --with-guile) ;; |
| 101 |
esac], [wguile=true]) |
| 102 |
|
| 103 |
if test x$wguile = xtrue; then |
| 104 |
PKG_CHECK_MODULES(GUILE,guile-3.0 >= 3.0,[wguile=true],[wguile=false]) |
| 105 |
if test x$wguile = xfalse; then |
| 106 |
PKG_CHECK_MODULES(GUILE,guile-2.2 >= 2.2,[wguile=true],[wguile=false]) |
| 107 |
if test x$wguile = xfalse; then |
| 108 |
PKG_CHECK_MODULES(GUILE,guile-2.0 >= 2.0,[wguile=true],[wguile=false]) |
| 109 |
fi |
| 110 |
fi |
| 111 |
fi |
| 112 |
|
| 113 |
if test x$wguile = xtrue; then |
| 114 |
LIBS="$LIBS $GUILE_LIBS" |
| 115 |
AM_CFLAGS="$AM_CFLAGS $GUILE_CFLAGS" |
| 116 |
AC_SUBST(MAKE_GUILE) |
| 117 |
fi |
| 118 |
|
| 119 |
AM_CONDITIONAL(MAKE_GUILE, test x$wguile = xtrue) |
| 120 |
|
| 121 |
LIBS="$LIBS $GLIB_LIBS" |
| 122 |
AM_CFLAGS="$AM_CFLAGS $GLIB_CFLAGS -DG_DISABLE_DEPRECATED" |
| 123 |
|
| 124 |
dnl Check if the gtk gui is required |
| 125 |
AC_ARG_ENABLE(gui, |
| 126 |
[ --disable-gui do not build the GTK+ GUI for mixvm (gmixvm)], |
| 127 |
[case "${enableval}" in |
| 128 |
yes) gui=true ;; |
| 129 |
no) gui=false ;; |
| 130 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gui) ;; |
| 131 |
esac],[gui=true]) |
| 132 |
|
| 133 |
dnl Check for gtk+ |
| 134 |
if test x$gui = xtrue; then |
| 135 |
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.14 pango >= 1.4, |
| 136 |
[LIBS="$LIBS $GTK_LIBS" AM_CFLAGS="$AM_CFLAGS $GTK_CFLAGS"], |
| 137 |
[AC_MSG_WARN(Cannot find GTK+/Glade/Pango: the GUI shall not be built) |
| 138 |
gui=false]) |
| 139 |
fi |
| 140 |
|
| 141 |
if test x$gui = xtrue; then |
| 142 |
AM_CFLAGS="$AM_CFLAGS -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED" |
| 143 |
fi |
| 144 |
|
| 145 |
dnl Are we in a darwin system? |
| 146 |
case "${host_os}" in |
| 147 |
darwin*) darwin_system=true;; |
| 148 |
*) darwin_system=false; |
| 149 |
esac |
| 150 |
|
| 151 |
AM_CONDITIONAL(MAKE_GUI, test x$gui = xtrue) |
| 152 |
AM_CONDITIONAL(DARWIN_SYSTEM, test x$darwin_system = xtrue) |
| 153 |
|
| 154 |
dnl use the provided getopt if gnu getopt is not available |
| 155 |
AC_REPLACE_FUNCS(getopt_long) |
| 156 |
|
| 157 |
AC_SUBST(AM_CFLAGS) |
| 158 |
|
| 159 |
AC_CONFIG_FILES([ |
| 160 |
Makefile |
| 161 |
doc/Makefile |
| 162 |
doc/img/Makefile |
| 163 |
mixlib/Makefile |
| 164 |
mixlib/testsuite/Makefile |
| 165 |
mixguile/Makefile |
| 166 |
mixutils/Makefile |
| 167 |
mixgtk/Makefile |
| 168 |
lib/Makefile |
| 169 |
misc/Makefile |
| 170 |
samples/Makefile |
| 171 |
samples/tests/Makefile |
| 172 |
po/Makefile.in |
| 173 |
intl/Makefile |
| 174 |
]) |
| 175 |
|
| 176 |
AC_OUTPUT |
| 177 |
|
| 178 |
if test x$readl = xtrue; then |
| 179 |
rlinfo=", with readline support" |
| 180 |
fi |
| 181 |
|
| 182 |
if test x$wguile = xtrue; then |
| 183 |
guileinfo=", with guile support" |
| 184 |
fi |
| 185 |
|
| 186 |
echo |
| 187 |
echo "*** $PACKAGE_NAME $VERSION has been successfully configured. ***" |
| 188 |
echo |
| 189 |
echo "Type 'make' to build the following utilities:" |
| 190 |
echo " - mixasm (MIX assembler)" |
| 191 |
echo " - mixvm (MIX virtual machine${rlinfo}${guileinfo})" |
| 192 |
if test x$gui = xtrue; then |
| 193 |
echo " - gmixvm (mixvm GTK+ GUI${guileinfo})" |
| 194 |
fi |
| 195 |
if test x$wguile = xtrue; then |
| 196 |
echo " - mixguile (the mixvm guile shell)" |
| 197 |
fi |
| 198 |
echo |