summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 4101df00036ec3d2652a9f6e8fc8d9854082319d (plain)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(cups-bjnp, 1.2, louis.lagendijk@gmail.com)

AC_CONFIG_SRCDIR([bjnp.c])
AM_INIT_AUTOMAKE
AC_LIBSOURCES([cups-bjnp.spec])

## Check for programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
##
## Library directories
##
SRCH_LIB="/usr/local/lib /usr/lib /opt/cups/lib /opt/lib"
ac_save_IFS=$IFS
IFS="${IFS}:"
## LIBRARY_DIRS comes from command line, SRCH_LIB s defined above.
for dir in $LIBRARY_DIRS $SRCH_LIB; do
  if test -d "$dir"; then
    LIBDIRS="$LIBDIRS -L$dir"
## else
##    AC_MSG_WARN([*** Library directory $dir does not exist.])
  fi
done
IFS=$ac_save_IFS

dnl Checks for required library functions.
AC_CHECK_FUNCS(ftime \
               getaddrinfo \
               getnameinfo \
               gethostname \
               inet_ntoa \
               inet_ntop \
               ntohl \
               ntohs \
               memset\
               select \
               socket \
               strcasecmp \
               strchr \
               strerror \
               strncasecmp \
               ,,AC_MSG_ERROR( required library function missing ))

dnl check for optional functions
AC_CHECK_FUNCS(getifaddrs)

dnl check for Werror

AC_ARG_ENABLE(Werror,
        AC_HELP_STRING([--disable-Werror], [don't use gcc's -Werror option when building]))

if test x"$enable_Werror" != xno
then
        EXTRA_CFLAGS="-Werror"
fi
AC_SUBST([EXTRA_CFLAGS])

dnl check for IPv6 (can be overriden by --enable-ipv6)
if test "$ac_cv_func_getnameinfo" = "yes" \
  && test "$ac_cv_func_getaddrinfo" = "yes" ; then
  BJNP_CHECK_IPV6
else
  ipv6="no"
fi

## find cups lib

AC_CHECK_LIB(cups, cupsDoRequest,, AC_MSG_ERROR(CUPS library not found),)

## determine cups backend directory

AC_ARG_WITH(cupsbackenddir,
  AC_HELP_STRING([--with-cupsbackenddir=DIR],
                 [ cups-backends directory (auto)]),
[
  cupsbackenddir="${withval}"
  AC_SUBST([cupsbackenddir])dnl
], [
    dirs="/usr/lib/cups/backend /usr/local/lib/cups/backend /opt/lib/cups/backend\
          /usr/local/libexec/cups/backend /usr/libexec/cups/backend"
    cupsbackenddir=""
    for dir in $dirs; do
      if test -d "$dir" -a -z "$cupsbackenddir"; then
        cupsbackenddir=$dir
      fi
    done
    if test -n "$cupsbackenddir"; then
      echo found Cups backend directory $cupsbackenddir
      AC_SUBST([cupsbackenddir])dnl
    else
      AC_MSG_ERROR([Cups backend directory not specified and auto-detection failed!])
    fi
])

## Check if we have rpmbuild, so we can build rpm's
AC_PATH_PROG([RPMBUILD],rpmbuild)
AC_ARG_VAR(RPMBUILD, rpmbuild command)
if test -n "$RPMBUILD"; then
  rpmtarget=$srcdir/conf/rpmbuild
else
  rpmtarget=$srcdir/conf/norpm
fi
AC_SUBST_FILE(rpmtarget)
AC_SUBST(RPMBUILD)

## header file that contains output from configure

AC_CONFIG_HEADERS([config.h])
## AC_USE_SYSTEM_EXTENSIONS
dnl Checks for programs.
AC_SEARCH_LIBS([strerror],[cposix])

## determine libraries that need to get linked

AC_SEARCH_LIBS([socket], [socket])

## Checks for header files.
AC_HEADER_STDC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_HEADERS(string.h \
                 fcntl.h \
                 arpa/inet.h \
                 netdb.h \
                 netinet/in.h \
                 sys/socket.h \
                 sys/time.h \
                 sys/timeb.h \
                 wchar.h \
                 cups/cups.h \
		 cups/backend.h \
                 cups/http.h \
                ,, AC_MSG_ERROR( required header file missing ))

AC_HEADER_RESOLV

AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

## dnl internationalization macros
## AM_GNU_GETTEXT
AM_MAINTAINER_MODE
## AC_CONFIG_FILES([Makefile])
AC_OUTPUT([Makefile])