Skip to content

Commit

Permalink
Add support for old cups-config script.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 13, 2023
1 parent 0062819 commit 01b471e
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: update build environment
run: sudo apt-get update --fix-missing -y
- name: install prerequisites
run: sudo apt-get install -y cppcheck libfltk1.3-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev
run: sudo apt-get install -y cppcheck libfltk1.3-dev libcups2-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev
- name: configure
env:
CC: /usr/bin/gcc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: sudo apt-get update --fix-missing -y

- name: Install prerequisites
run: sudo apt-get install -y libfltk1.3-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev
run: sudo apt-get install -y libfltk1.3-dev libcups2-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: update build environment
run: sudo apt-get update --fix-missing -y
- name: install prerequisites
run: sudo apt-get install -y libfltk1.3-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev
run: sudo apt-get install -y libfltk1.3-dev libcups2-dev libgnutls28-dev libjpeg-dev libpng-dev zlib1g-dev
- name: Download Coverity Build Tool
run: |
wget -q https://scan.coverity.com/download/linux64 --post-data token="$TOKEN&project=$GITHUB_REPOSITORY" -O cov-analysis-linux64.tar.gz
Expand Down
151 changes: 142 additions & 9 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
WARNINGS
POST
CUPSCONFIG
LARGEFILE
ARFLAGS
PKGCONFIG
Expand Down Expand Up @@ -5031,21 +5032,153 @@ then :
fi


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libcups" >&5
printf %s "checking for libcups... " >&6; }
if $PKGCONFIG --exists cups
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cups-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}cups-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_CUPSCONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $CUPSCONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_CUPSCONFIG="$CUPSCONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_CUPSCONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
CUPSCONFIG=$ac_cv_path_CUPSCONFIG
if test -n "$CUPSCONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CUPSCONFIG" >&5
printf "%s\n" "$CUPSCONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; };
CPPFLAGS="$($PKGCONFIG --cflags cups) $CPPFLAGS"
LIBS="$($PKGCONFIG --libs cups) $LIBS"

fi
if test -z "$ac_cv_path_CUPSCONFIG"; then
ac_pt_CUPSCONFIG=$CUPSCONFIG
# Extract the first word of "cups-config", so it can be a program name with args.
set dummy cups-config; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_ac_pt_CUPSCONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $ac_pt_CUPSCONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_CUPSCONFIG="$ac_pt_CUPSCONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_CUPSCONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
ac_pt_CUPSCONFIG=$ac_cv_path_ac_pt_CUPSCONFIG
if test -n "$ac_pt_CUPSCONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CUPSCONFIG" >&5
printf "%s\n" "$ac_pt_CUPSCONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi

if test "x$ac_pt_CUPSCONFIG" = x; then
CUPSCONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CUPSCONFIG=$ac_pt_CUPSCONFIG
fi
else
CUPSCONFIG="$ac_cv_path_CUPSCONFIG"
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CUPS library v2.2 or higher" >&5
printf %s "checking for CUPS library v2.2 or higher... " >&6; }
if $PKGCONFIG --exists cups
then :

CUPS_VERSION="$($PKGCONFIG --modversion cups)"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, v$CUPS_VERSION" >&5
printf "%s\n" "yes, v$CUPS_VERSION" >&6; }

CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags cups)"
LIBS="$LIBS $($PKGCONFIG --libs cups)"

elif test "x$CUPSCONFIG" = x
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; };
as_fn_error $? "HTMLDOC requires the CUPS libraries for HTTP/HTTPS support." "$LINENO" 5
printf "%s\n" "no" >&6; }
as_fn_error $? "Sorry, this software requires libcups-dev." "$LINENO" 5

else $as_nop

CUPS_VERSION="$($CUPSCONFIG --api-version)"
case "$CUPS_VERSION" in #(
1.* | 2.0 | 2.1) :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
as_fn_error $? "Sorry, you need CUPS 2.2.0 or higher." "$LINENO" 5
;; #(
*) :
;;
esac

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, v$CUPS_VERSION" >&5
printf "%s\n" "yes, v$CUPS_VERSION" >&6; }

CPPFLAGS="$CPPFLAGS $($CUPSCONFIG --cflags)"
LDFLAGS="$LDFLAGS $($CUPSCONFIG --ldflags)"
LIBS="$LIBS $($CUPSCONFIG --libs)"

fi

Expand Down
28 changes: 22 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,30 @@ AS_IF([test $ac_cv_c_long_long = yes], [
AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))

dnl Check for CUPS libraries...
AC_MSG_CHECKING([for libcups])
AC_PATH_TOOL([CUPSCONFIG], [cups-config])
AC_MSG_CHECKING([for CUPS library v2.2 or higher])
AS_IF([$PKGCONFIG --exists cups], [
AC_MSG_RESULT([yes]);
CPPFLAGS="$($PKGCONFIG --cflags cups) $CPPFLAGS"
LIBS="$($PKGCONFIG --libs cups) $LIBS"
CUPS_VERSION="$($PKGCONFIG --modversion cups)"
AC_MSG_RESULT([yes, v$CUPS_VERSION])
CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags cups)"
LIBS="$LIBS $($PKGCONFIG --libs cups)"
], [test "x$CUPSCONFIG" = x], [
AC_MSG_RESULT(no)
AC_MSG_ERROR([Sorry, this software requires libcups-dev.])
], [
AC_MSG_RESULT([no]);
AC_MSG_ERROR([HTMLDOC requires the CUPS libraries for HTTP/HTTPS support.])
CUPS_VERSION="$($CUPSCONFIG --api-version)"
AS_CASE(["$CUPS_VERSION"],
[1.* | 2.0 | 2.1], [
AC_MSG_RESULT(no)
AC_MSG_ERROR([Sorry, you need CUPS 2.2.0 or higher.])
])
AC_MSG_RESULT([yes, v$CUPS_VERSION])
CPPFLAGS="$CPPFLAGS $($CUPSCONFIG --cflags)"
LDFLAGS="$LDFLAGS $($CUPSCONFIG --ldflags)"
LIBS="$LIBS $($CUPSCONFIG --libs)"
])

dnl Check for GUI libraries...
Expand Down

0 comments on commit 01b471e

Please sign in to comment.