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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
dnl
dnl Configuration script for the IPP sample code.
dnl
dnl Copyright © 2014-2022 by the IEEE-ISTO Printer Working Group
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl
dnl ***********************************************************************
dnl
dnl Note: Using autoheader or automake on this project will break the build
dnl system. Use "autoconf -f" to regenerate the configure script if you
dnl make changes to this file.
dnl
dnl ***********************************************************************
dnl We need at least autoconf 2.70 for --runstatedir...
AC_PREREQ([2.70])
dnl Package name and version...
AC_INIT([IPPSAMPLE], [1.0b1], [https://github.com/istopwg/ippsample/issues], [ippsample], [http://istopwg.github.io/ippsample])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SUBDIRS([libcups])
IPPSAMPLE_VERSION="AC_PACKAGE_VERSION"
AC_SUBST([IPPSAMPLE_VERSION])
AC_DEFINE_UNQUOTED([IPPSAMPLE_VERSION], ["$IPPSAMPLE_VERSION"], [Version number])
dnl This line is provided to ensure that you don't run the autoheader program
dnl against this project. Doing so is completely unsupported and WILL cause
dnl problems!
AH_TOP([#error "Somebody ran autoheader on this project which is unsupported and WILL cause problems."])
dnl Get the build and host platforms and split the host_os value
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
[host_os_name="$(echo $host_os | sed -e '1,$s/[0-9.]*$//g')"]
[host_os_version="$(echo $host_os | sed -e '1,$s/^[^0-9.]*//g' | awk -F. '{print $1 $2}')"]
# Linux often does not yield an OS version we can use...
AS_IF([test "x$host_os_version" = x], [
host_os_version="0"
])
dnl Compiler options...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
LIBS="${LIBS:=}"
OPTIM="${OPTIM:=}"
AC_SUBST([OPTIM])
dnl Programs...
AC_PROG_CC
AC_PATH_PROGS([CODE_SIGN], [codesign true])
AC_PATH_PROG([MKDIR], [mkdir])
AC_PATH_PROG([RM], [rm])
AC_PATH_PROG([RMDIR], [rmdir])
AC_PATH_PROG([LN], [ln])
dnl PDF support
dnl Transform utility...
IPPTRANSFORM_BIN=""
IPPTRANSFORM_HTML=""
IPPTRANSFORM_MAN=""
AC_SUBST([IPPTRANSFORM_BIN])
AC_SUBST([IPPTRANSFORM_HTML])
AC_SUBST([IPPTRANSFORM_MAN])
AC_ARG_WITH([pdfrip], AS_HELP_STRING([--with-pdfrip=...], [set PDF RIP to use (auto, coregraphics, pdftoppm, none)]))
AS_IF([test "x$with_pdfrip" = x -o "x$with_pdfrip" = xauto], [
AS_CASE([$host_os_name], [darwin*], [
use_pdfrip=coregraphics
], [*], [
use_pdfrip=pdftoppm
])
], [
use_pdfrip="$with_pdfrip"
])
AS_CASE(["$use_pdfrip"], [coregraphics], [
SAVELIBS="$LIBS"
LIBS="-framework CoreGraphics -framework ImageIO $LIBS"
AC_CHECK_HEADER([CoreGraphics/CoreGraphics.h], [
AC_DEFINE([HAVE_COREGRAPHICS], [1], [CoreGraphics support])
IPPTRANSFORM_BIN="ipptransform"
IPPTRANSFORM_HTML="ipptransform.html"
IPPTRANSFORM_MAN="ipptransform.7"
], [
LIBS="$SAVELIBS"
AS_IF([test "x$with_pdfrip" = xcoregraphics], [
AC_MSG_ERROR([Unable to find CoreGraphic framework.])
])
])
], [pdftoppm], [
AC_PATH_PROG([PDFTOPPM], [pdftoppm])
AS_IF([test "x$PDFTOPPM" != x], [
AC_DEFINE_UNQUOTED([PDFTOPPM], ["$PDFTOPPM"], [pdftoppm path])
], [test "x$with_pdfrip" = xpdftoppm], [
AC_MSG_ERROR([Unable to find pdftoppm program.])
])
], [none], [
], [*], [
AC_MSG_ERROR([Unknown --with-pdfrip value.])
])
# 3D support
IPPTRANSFORM3D_BIN=""
IPPTRANSFORM3D_HTML=""
IPPTRANSFORM3D_MAN=""
AC_SUBST([IPPTRANSFORM3D_BIN])
AC_SUBST([IPPTRANSFORM3D_HTML])
AC_SUBST([IPPTRANSFORM3D_MAN])
SAVEPATH="$PATH"
PATH="$PATH:/Applications/Ultimaker Cura.app/Contents/MacOS"
AC_PATH_PROG([CURAENGINE], [CuraEngine])
PATH="$SAVEPATH"
AS_IF([test "x$CURAENGINE" != x], [
AC_DEFINE_UNQUOTED([CURAENGINE], ["$CURAENGINE"], [CuraEngine path])
])
dnl install-sh
AC_MSG_CHECKING([for install-sh script])
INSTALL="$(pwd)/install-sh"
AC_SUBST([INSTALL])
AC_MSG_RESULT([using $INSTALL])
dnl Check for pkg-config, which is used for some other tests later on...
AC_PATH_TOOL([PKGCONFIG], [pkg-config])
dnl String functions...
AC_CHECK_FUNCS([strlcpy])
dnl DNS-SD support...
AC_ARG_WITH([dnssd], AS_HELP_STRING([--with-dnssd=LIBRARY], [set DNS-SD library (auto, avahi, mdnsresponder)]))
AS_IF([test "x$with_dnssd" != xmdnsresponder -a "x$with_dnssd" != xno -a "x$PKGCONFIG" != x -a x$host_os_name != xdarwin], [
AC_MSG_CHECKING([for Avahi])
AS_IF([$PKGCONFIG --exists avahi-client], [
AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags avahi-client)"
LIBS="$LIBS $($PKGCONFIG --libs avahi-client)"
AC_DEFINE([HAVE_DNSSD], 1, [Have DNS-SD support?])
AC_DEFINE([HAVE_AVAHI], 1, [Have Avahi?])
], [
AC_MSG_RESULT([no])
AS_IF([test x$with_dnssd = xavahi],
AC_MSG_ERROR([libavahi-client-dev needed for --with-dnssd=avahi.]))
])
], [test x$with_dnssd = xavahi], [
AC_MSG_ERROR([pkgconfig and libavahi-client-dev needed for --with-dnssd=avahi.])
], [test x$with_dnssd != xavahi -a "x$with_dnssd" != xno], [
AC_CHECK_HEADER(dns_sd.h, [
AS_CASE(["$host_os_name"],
[darwin*], [
# Darwin and macOS...
AC_DEFINE([HAVE_DNSSD], 1, [Have DNS-SD support?])
AC_DEFINE([HAVE_MDNSRESPONDER], 1, [Have mDNSResponder?)])
LIBS="$LIBS -framework CoreFoundation -framework SystemConfiguration"
], [*], [
# All others...
AC_MSG_CHECKING(for current version of dns_sd library)
SAVELIBS="$LIBS"
LIBS="$LIBS -ldns_sd"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dns_sd.h>]], [[
int constant = kDNSServiceFlagsShareConnection;
unsigned char txtRecord[100];
uint8_t valueLen;
TXTRecordGetValuePtr(sizeof(txtRecord), txtRecord, "value", &valueLen);]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DNSSD], 1, [Have DNS-SD support?])
AC_DEFINE([HAVE_MDNSRESPONDER], 1, [Have mDNSResponder?)])
],[
AC_MSG_RESULT([no])
LIBS="$SAVELIBS"
AS_IF([test x$with_dnssd = xmdnsresponder],
AC_MSG_ERROR([mDNSResponder required for --with-dnssd=mdnsresponder.]))
])
])
])
])
dnl libjpeg...
AC_ARG_ENABLE([libjpeg], AS_HELP_STRING([--enable-libjpeg], [use libjpeg for JPEG printing, default=auto]))
AS_IF([test x$enable_libjpeg != xno], [
have_jpeg=no
AS_IF([test "x$PKGCONFIG" != x], [
AC_MSG_CHECKING([for libjpeg via pkg-config])
AS_IF([$PKGCONFIG --exists libjpeg], [
AC_MSG_RESULT([yes]);
AC_DEFINE([HAVE_LIBJPEG], 1, [Have JPEG library?])
CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libjpeg`"
LIBS="$LIBS `$PKGCONFIG --libs libjpeg`"
have_jpeg=yes
], [
AC_MSG_RESULT([no]);
])
])
AS_IF([test $have_jpeg = no], [
AC_SEARCH_LIBS(jpeg_start_decompress, turbojpeg jpeg, [
AC_DEFINE([HAVE_LIBJPEG], 1, [Have JPEG library?])
have_jpeg=yes
])
])
AS_IF([test x$enable_libjpeg = xyes -a $have_jpeg = no], [
AC_MSG_ERROR([libjpeg-dev 8 or later required for --enable-libjpeg.])
])
])
dnl libpng...
AC_ARG_ENABLE([libpng], AS_HELP_STRING([--enable-libpng], [use libpng for PNG printing, default=auto]))
PKGCONFIG_LIBPNG=""
AC_SUBST([PKGCONFIG_LIBPNG])
AS_IF([test "x$PKGCONFIG" != x -a x$enable_libpng != xno], [
AC_MSG_CHECKING([for libpng-1.6.x])
AS_IF([$PKGCONFIG --exists libpng16], [
AC_MSG_RESULT([yes]);
AC_DEFINE([HAVE_LIBPNG], 1, [Have PNG library?])
CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libpng16`"
LIBS="$LIBS `$PKGCONFIG --libs libpng16` -lz"
], [
AC_MSG_RESULT([no]);
AS_IF([test x$enable_libpng = xyes], [
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
])
])
], [test x$enable_libpng = xyes], [
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
])
dnl PAM support...
AC_ARG_ENABLE([pam], AS_HELP_STRING([--enable-libpam], [use libpam for authentication, default=auto]))
AS_IF([test x$enable_libpam != xno], [
dnl PAM needs dlopen...
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([pam], [pam_start], [
AC_DEFINE([HAVE_LIBPAM], 1, [Have PAM library?])
LIBS="$LIBS -lpam"
])
dnl PAM has two "standard" locations for its header...
AC_CHECK_HEADER(security/pam_appl.h, AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], 1, [Have <security/pam_appl.h> header?]))
AC_CHECK_HEADER(pam/pam_appl.h, AC_DEFINE([HAVE_PAM_PAM_APPL_H], 1, [Have <pam/pam_appl.h> header?]))
AS_IF([test x$ac_pam_start = xno -a x$enable_libpam = xyes], [
AC_MSG_ERROR([libpam-dev required for --enable-libpam.])
])
])
dnl Extra compiler options...
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging, default=no]))
AC_ARG_ENABLE([maintainer], AS_HELP_STRING([--enable-maintainer], [turn on maintainer mode, default=no]))
AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer], [build with AddressSanitizer, default=no]))
AS_IF([test x$enable_debug = xyes], [
OPTIM="$OPTIM -g"
CSFLAGS=""
], [
OPTIM="$OPTIM -g -Os"
CSFLAGS="-o runtime"
])
AC_SUBST([CSFLAGS])
WARNINGS=""
AC_SUBST([WARNINGS])
AS_IF([test -n "$GCC"], [
AS_IF([test x$enable_sanitizer = xyes], [
# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -fsanitize=address"
], [
# Otherwise use the Fortify enhancements to catch any unbounded
# string operations...
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
])
dnl Show all standard warnings + unused variables when compiling...
WARNINGS="-Wall -Wunused"
dnl Drop some not-useful/unreliable warnings...
for warning in char-subscripts format-truncation format-y2k switch unused-result; do
AC_MSG_CHECKING([whether compiler supports -Wno-$warning])
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-$warning -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
AC_MSG_RESULT(yes)
WARNINGS="$WARNINGS -Wno-$warning"
], [
AC_MSG_RESULT(no)
])
CFLAGS="$OLDCFLAGS"
done
dnl Maintainer mode enables -Werror...
AS_IF([test x$enable_maintainer = xyes], [
WARNINGS="$WARNINGS -Werror"
])
dnl See if PIE options are supported...
AC_MSG_CHECKING(whether compiler supports -fPIE)
OLDCFLAGS="$CFLAGS"
AS_CASE(["$host_os_name"],
[darwin*], [
CFLAGS="$CFLAGS -fPIC -fPIE -Wl,-pie"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[
OLDCFLAGS="-fPIC $OLDCFLAGS"
LDFLAGS="-fPIE -Wl,-pie $LDFLAGS"
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
], [*], [
CFLAGS="$CFLAGS -fPIC -fPIE -pie"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[
OLDCFLAGS="-fPIC $OLDCFLAGS"
LDFLAGS="-fPIE -pie $LDFLAGS"
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
])
CFLAGS="$OLDCFLAGS"
dnl OS-specific compiler options...
AS_CASE(["$host_os_name"], [linux*], [
CPPFLAGS="$CPPFLAGS -D__USE_MISC -D_GNU_SOURCE"
], [darwin*], [
AS_IF([test "$host_os_version" -ge 200 -a x$enable_debug != xyes], [
# macOS 11.0 and higher support the Apple Silicon (arm64) CPUs
OPTIM="$OPTIM -mmacosx-version-min=10.14 -arch x86_64 -arch arm64"
], [test x$enable_debug != xyes], [
OPTIM="$OPTIM -mmacosx-version-min=10.14 -arch x86_64"
])
])
])
dnl Extra linker options...
AC_ARG_WITH([ldflags], AS_HELP_STRING([--with-ldflags=...], [Specify additional LDFLAGS]), [
LDFLAGS="$withval $LDFLAGS"
])
dnl State and run directories for root servers...
AS_IF([test "$prefix" = NONE], [
# Default prefix isn't bound until AC_OUTPUT...
realprefix="/usr/local"
], [
realprefix="$prefix"
])
dnl Generate a bunch of files...
AC_CONFIG_FILES([
Makedefs
])
AC_OUTPUT
|