1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
dnl Process this file with autoconf to produce a configure script.
dnl ---------------------------------------------------------------------------
dnl Copyright 2012-2022,2023 Thomas E. Dickey
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, distribute
dnl with modifications, sublicense, and/or sell copies of the Software, and to
dnl permit persons to whom the Software is furnished to do so, subject to the
dnl following conditions:
dnl
dnl The above copyright notice and this permission notice shall be included in
dnl all copies or substantial portions of the Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
dnl THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl
dnl Except as contained in this notice, the name(s) of the above copyright
dnl holders shall not be used in advertising or otherwise to promote the sale,
dnl use or other dealings in this Software without prior written authorization.
dnl ---------------------------------------------------------------------------
AC_REVISION($Revision: 1.25 $)
AC_PREREQ(2.25.20210509)
rm -f config.cache
dnl $Id: configure.in,v 1.25 2023/02/05 14:47:17 tom Exp $
AC_INIT(Cdk.xs)
AC_PREFIX_DEFAULT(/usr)
AC_MSG_CHECKING(for version used by Cdk.pm)
VERSION=`egrep '[[$]]VERSION[[ ]][[ ]]*=' $srcdir/Cdk.pm | sed -e 's/^[[^"]]*"//' -e 's/".*//'`
AC_MSG_RESULT($VERSION)
AC_SUBST(VERSION)
CF_PROG_CC
CF_PROG_AR
CF_PKG_CONFIG
AC_CHECK_TOOL(LD,ld,'$(CC)')
AC_PATH_TOOL(FULL_AR,ar,'$(AR)')
AC_PROG_RANLIB
CF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX)
AC_SUBST(DFT_LIB_SUFFIX)
CF_WITH_SCREEN_PDCURSES
CF_XOPEN_SOURCE
AC_CHECK_DECL(exit)
CF_ENABLE_WARNINGS
CF_DISABLE_LEAKS
AC_CHECK_PROGS(PERL,[perl perl5],none)
if test "$PERL" = none
then
AC_MSG_ERROR(no perl found)
fi
AC_MSG_CHECKING(if you want to use cdk5-config for C flags)
AC_ARG_WITH(cdk,
[ --with-cdk use cdk5-config for C flags],
[with_cdk=$withval],
[with_cdk=yes])
AC_MSG_RESULT($with_cdk)
test "$with_cdk" != no && with_cdk="cdk5-config"
if test "$with_cdk" = no
then
AC_MSG_CHECKING(if you want to use cdkw5-config for C flags)
AC_ARG_WITH(cdkw,
[ --with-cdkw use cdkw5-config for C flags],
[with_cdk=$withval],
[with_cdk=yes])
AC_MSG_RESULT($with_cdk)
test "$with_cdk" != no && with_cdk="cdkw5-config"
fi
if test $with_cdk = no
then
# before looking for Cdk, check for the curses library it will use
CF_WITH_CURSES_DIR
CF_CURSES_CHTYPE
CF_WITH_NCURSES_ETC
# now look for Cdk
cf_pkg_exists=no
if test "x${PKG_CONFIG:=none}" != xnone; then
for cf_pkg_name in cdk5 cdkw5
do
AC_MSG_CHECKING(pkg-config for $cf_pkg_name)
"$PKG_CONFIG" --exists $cf_pkg_name && cf_pkg_exists=yes
AC_MSG_RESULT($cf_pkg_exists)
test $cf_pkg_exists = yes && break
done
if test "$cf_pkg_exists" = yes; then
cf_pkg_cflags=`$PKG_CONFIG --cflags $cf_pkg_name`
cf_pkg_libs=`$PKG_CONFIG --libs $cf_pkg_name`
CF_ADD_CFLAGS($cf_pkg_cflags)
CF_ADD_LIBS($cf_pkg_libs)
fi
fi
if test "$cf_pkg_exists" = no; then
AC_CHECK_HEADER(cdk.h,,[
CPPFLAGS="$CPPFLAGS -I/usr/include/cdk"
AC_CHECK_HEADER(cdk/cdk.h,[
AC_DEFINE(HAVE_CDK_CDK_H)
],[
AC_MSG_ERROR(cannot find cdk header file)
])
])
AC_CHECK_LIB(cdk,initCDKScreen,[LIBS="-lcdk $LIBS"],[
AC_CHECK_LIB(cdkw,initCDKScreen,[LIBS="-lcdkw $LIBS"],[
AC_MSG_ERROR(cannot find cdk library)])])
fi
elif $with_cdk --version 2>/dev/null >/dev/null
then
CFLAGS=`$with_cdk --cflags`
LIBS=`$with_cdk --libs`
else
AC_MSG_ERROR(cannot use $cdk_config script)
fi
AC_SUBST(LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
### output makefile script
AC_OUTPUT(Makefile.PL,[
# move confdefs.h aside while using perl, since it gets confused
test -f "confdefs.h" && mv confdefs.h confdefs.hdr
$PERL Makefile.PL
test -f "confdefs.hdr" && mv confdefs.hdr confdefs.h
# add to the distclean rule to cleanup files created by the configure script
cat >>Makefile <<CF_EOF
distclean ::
rm -f Makefile.PL config.status config.cache config.log
CF_EOF
# Perl's MakeMaker treats $(PREFIX) and $(DESTDIR) inconsistently. One easy
# workaround for test-builds and packaging is to make it work with our variable
# $(BUILDDIR)
if fgrep '$(BUILDDIR)' Makefile
then
echo '?? name-pollution interference'
else
sed \
-e 's%^\(INSTALLDIRS = \).*$%\1vendor%' \
-e 's%^\(VENDORLIBEXP = \)/%\1$(BUILDDIR)/%' \
-e 's%^\(VENDORARCHEXP = \)/%\1$(BUILDDIR)/%' \
-e 's%^\(PERL_LIB = \)/%\1$(BUILDDIR)/%' \
-e 's%\($(PERL_ARCHLIB)/\)%$(BUILDDIR)\1%' \
-e '/^UNINSTALL = /s,Command::MM,Install,' \
-e '/^UNINSTALL = /s,uninstall,uninstall(shift @ARGV),' \
-e '/^test ::/s,^,check ,' \
-e '/$(MV) $(FIRST_MAKEFILE)/d' \
Makefile >Makefile.old
echo "** updated Makefile to allow in-tree test-builds"
diff Makefile Makefile.old
mv Makefile.old Makefile
fi
],[
PERL="$PERL"
])
|