1AC_INIT
2AC_GNU_SOURCE
3AC_CONFIG_SRCDIR([gtklp/gtklp.c])
4AM_INIT_AUTOMAKE(gtklp, 1.3.4)
5
6AC_CONFIG_HEADERS([config.h])
7
8
9AC_CONFIG_MACRO_DIR([m4])
10AM_GNU_GETTEXT([external])
11
12dnl Extra params
13CUPSCONFIGPATH=""
14AC_ARG_WITH(cups-config,[  --with-cups-config=CUPS-CONFIG   set full path to cups-config], CUPSCONFIGPATH=$withval)
15AC_ARG_ENABLE(ssl, [  --enable-ssl            turn on SSL/TLS support ,enabled by default])
16AC_ARG_ENABLE(forte, [  --enable-forte          dont use -Wall, but use -lX11, to compile with suns forte, disabled by default])
17AC_ARG_ENABLE(oldfile, [  --enable-oldfile        dont use the new file selection dialog])
18AC_ARG_WITH(maxprinters, [  --with-maxprinters=n    set the maximum number of supported printers, defaults to 150], MAX_PRT=$withval)
19
20dnl Checks for programs
21AC_PROG_CC
22AC_ISC_POSIX
23AC_PROG_LIBTOOL
24
25
26dnl Checks for libraries
27XLIBS="-lX11"
28AC_SUBST(XLIBS)
29
30
31dnl Checks for header files
32
33dnl internationalization macros
34AM_GNU_GETTEXT
35
36
37# Forte Compiler ############################################################
38FORTE_LDFLAGS=""
39FORTE_CCFLAGS="-Wall"
40if test x$enable_forte = xyes; then
41	FORTE_LDFLAGS="-lX11"
42	FORTE_CCFLAGS=""
43fi
44AC_SUBST(FORTE_LDFLAGS)
45AC_SUBST(FORTE_CCFLAGS)
46
47# old file dialog ###########################################################
48OLDDIALOG=""
49if test x$enable_oldfile = xyes; then
50	OLDDIALOG="-DOLDDIALOG"
51fi
52AC_SUBST(OLDDIALOG)
53
54# gtk #######################################################################
55PKG_CHECK_MODULES(GTK2, gtk+-2.0)
56AC_SUBST(GTK2_CFLAGS)
57AC_SUBST(GTK2_LIBS)
58GTKVER="-DHAVE_GTK2"
59
60AC_SUBST(GTKVER)
61
62# cups ######################################################################
63FOUNDCUPSCONFIG=0
64if test "${CUPSCONFIGPATH}" != ""; then
65	if test "${CUPSCONFIGPATH}" = "no"; then
66		AC_MSG_RESULT([ ************************************************* ])
67		AC_MSG_RESULT([ * Not to use cups-config is unsafe. Be warned ! * ])
68		AC_MSG_RESULT([ ************************************************* ])
69	else
70		AC_MSG_CHECKING([for cups-config])
71		if test -x "${CUPSCONFIGPATH}"; then
72			FOUNDCUPSCONFIG=1
73			CUPS_CONFIG="${CUPSCONFIGPATH}"
74			AC_MSG_RESULT([${CUPSCONFIGPATH}])
75		else
76			AC_MSG_RESULT([no])
77			AC_MSG_ERROR([${CUPSCONFIGPATH} not found or not executable !])
78		fi
79	fi
80else
81	AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
82	if test x${CUPS_CONFIG} != xno; then
83		FOUNDCUPSCONFIG=1
84	else
85		AC_MSG_ERROR([cups-config not found !])
86	fi
87fi
88
89if test ${FOUNDCUPSCONFIG} != 0; then
90	CUPS_CFLAGS="`${CUPS_CONFIG} --cflags`"
91	CUPS_LIBS="`${CUPS_CONFIG} --libs`"
92	CUPS_LDFLAGS="`${CUPS_CONFIG} --ldflags`"
93	if test x$enable_ssl != xno; then
94		CUPS_CFLAGS="${CUPS_CFLAGS} -DHAVE_LIBSSL"
95	fi
96	AC_SUBST(CUPS_CFLAGS)
97	AC_SUBST(CUPS_LIBS)
98	AC_SUBST(CUPS_LDFLAGS)
99else
100	CUPS_CFLAGS=""
101	CUPS_LIBS="-lcups -lssl -lcrypto -lnsl"
102	CUPS_LDFLAGS=""
103	if test x$enable_ssl != xno; then
104		CUPS_CFLAGS="${CUPS_CFLAGS} -DHAVE_LIBSSL"
105	fi
106	AC_SUBST(CUPS_CFLAGS)
107	AC_SUBST(CUPS_LIBS)
108	AC_SUBST(CUPS_FLAGS)
109fi
110
111# MAX_PRT #################################################################
112MAXPRT="150"
113if test "${MAX_PRT}" != ""; then
114	if test "${MAX_PRT}" != "no"; then
115		MAXPRT=${MAX_PRT}
116	fi
117fi
118
119AC_MSG_RESULT([ *** Setting maximum number of printers to ${MAXPRT} *** ])
120AC_SUBST(MAXPRT)
121
122############################################################################
123
124
125AC_CONFIG_FILES([Makefile po/Makefile.in po/Makefile libgtklp/Makefile gtklp/Makefile gtklpq/Makefile man/Makefile m4/Makefile   ])
126AC_OUTPUT
127
128
129  AC_MSG_RESULT([     *********************************** ])
130
131if test x$enable_forte = xyes; then
132	AC_MSG_RESULT([     forte support:       yes])
133else
134	AC_MSG_RESULT([     forte support:       no])
135fi
136
137if test x$enable_gtk1 = xyes; then
138	AC_MSG_RESULT([     use gtk1:            yes])
139else
140	AC_MSG_RESULT([     use gtk1:            no])
141fi
142
143if test "${OLDDIALOG}" != ""; then
144	AC_MSG_RESULT([     use old file dialog: yes])
145else
146	AC_MSG_RESULT([     use old file dialog: no])
147fi
148
149if test "${CUPSCONFIGPATH}" != ""; then
150	AC_MSG_RESULT([     cups config:         ${CUPSCONFIGPATH}])
151else
152	AC_MSG_RESULT([     cups config:         <default>])
153fi
154
155if test "${MAX_PRT}" != ""; then
156	AC_MSG_RESULT([     Max Printer:         ${MAX_PRT}])
157else
158	AC_MSG_RESULT([     Max Printer:         <default>])
159fi
160
161  AC_MSG_RESULT([     *********************************** ])
162
163AC_MSG_RESULT([ Ready. ])
164AC_MSG_RESULT([ Now use "make" to built the package and "make install" afterwards.])
165AC_MSG_RESULT([ If compilation fails, try "make clean" before "make"])
166AC_MSG_RESULT([ or fiddle around with "--enable-gtk1" and "--enable-oldfile"])
167
168
169