1#!/bin/sh
2#
3# Script to configure and make CUPS with the standard build options.  When no
4# targets are specified, the "clean" and "check" targets are used.
5#
6# Usage:
7#
8#   makecups [configure option(s)] [make target(s)]
9#
10
11# Scan the command-line arguments...
12confopts=""
13makeopts=""
14archflags="-arch i386 -arch x86_64"
15ldarchflags="-arch i386 -arch x86_64"
16CC=/usr/bin/clang; export CC
17CXX=/usr/bin/clang++; export CXX
18
19while test $# -gt 0; do
20	opt="$1"
21	shift
22
23	case "$opt" in
24		--gcc)
25			CC=/usr/bin/gcc
26			CXX=/usr/bin/g++
27			;;
28		-l)
29			archflags=""
30			ldarchflags=""
31			;;
32		-*)
33			confopts="$confopts $opt"
34			;;
35		*)
36			makeopts="$makeopts $opt"
37			;;
38	esac
39done
40if test "x$makeopts" = x; then
41	makeopts="clean check"
42fi
43makeopts="-j`sysctl -n hw.activecpu` $makeopts"
44
45# Update the configure script...
46echo cd cups
47cd cups
48echo autoconf -f
49autoconf -f || exit 1
50
51# Run the configure script...
52echo ./configure ... $confopts
53./configure --enable-debug --enable-debug-guards --enable-debug-printfs \
54	--enable-unit-tests --enable-pie --with-pam-module=opendirectory \
55	--with-archflags="$archflags" \
56	--with-ldarchflags="$ldarchflags" \
57	--with-adminkey="system.print.admin" \
58	--with-operkey="system.print.operator" \
59	$confopts || exit 1
60
61# Build the software...
62echo make $makeopts
63make $makeopts
64