cpp revisited: look for a cpp binary in various locations for use at runtime
[oweals/cde.git] / cde / configure.ac
1 AC_INIT([cde-desktop], [2.3.1], [jon@radscan.com])
2 AC_CONFIG_HEADERS([include/autotools_config.h])
3 AC_CONFIG_MACRO_DIRS([m4])
4 AM_INIT_AUTOMAKE([foreign subdir-objects])
5 LT_INIT
6 AC_PREFIX_DEFAULT(/usr/dt)
7
8 AC_ENABLE_STATIC([no])
9
10 PKG_PROG_PKG_CONFIG
11
12 dnl todo: determine what version of autoconf we depend on
13 dnl AC_PREREQ()
14
15 AC_CANONICAL_HOST
16 AC_CANONICAL_BUILD
17
18 dnl global CDE versioning
19
20 CDE_VERSION_MAJOR=2
21 CDE_VERSION_MINOR=3
22 CDE_VERSION_MICRO=0
23
24 AC_SUBST(CDE_VERSION_MAJOR)
25 AC_SUBST(CDE_VERSION_MINOR)
26 AC_SUBST(CDE_VERSION_MICRO)
27
28 dnl SOURCE_DEFINES - start with CDE project default
29 SOURCE_CPP_DEFINES="-DANSICPP -DMULTIBYTE -DNLS16"
30
31 dnl CPP_COMPILER_FLAGS - CPP/C/C++ compiler flags
32 CPP_COMPILER_FLAGS=""
33
34 dnl CXX_COMPILER_FLAGS - C++ compiler flags
35 CXX_COMPILER_FLAGS=""
36
37 dnl C_COMPILER_FLAGS - C compiler flags
38 C_COMPILER_FLAGS=""
39
40
41 dnl These OS version checks are deprecated and should be replaced with
42 dnl feature checks where appropriate
43
44 build_linux=no
45 bsd=no
46 build_freebsd=no
47 build_openbsd=no
48 build_netbsd=no
49 build_solaris=no
50 build_hpux=no
51 build_aix=no
52
53 dnl For now, we need to fake the OSMAJORVERSION, OSMINORVERSION.  In Linux
54 dnl this never mattered anyway as it was always the kernel version.  We will
55 dnl choose defaults here.  These need to be removed in the code in favor
56 dnl of actual checks for functionality. So this should be considered
57 dnl temporary.
58
59 OSMAJORVERSION=4
60 OSMINORVERSION=15
61
62 case "${host_os}" in
63         linux*)
64                 build_linux=yes
65                 OSMAJORVERSION=4
66                 OSMINORVERSION=15
67                 SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -D_POSIX_SOURCE \
68 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE"
69                 CPP_COMPILER_FLAGS="-fno-strict-aliasing -Wno-write-strings \
70 -Wno-unused-result"
71                  ;;
72         freebsd*)
73                 build_freebsd=yes
74                 bsd=yes
75                 OSMAJORVERSION=10
76                 OSMINORVERSION=0
77                 ;;
78         openbsd*)
79                 build_openbsd=yes
80                 bsd=yes
81                 OSMAJORVERSION=6
82                 OSMINORVERSION=2
83                 ;;
84         netbsd*)
85                 build_netbsd=yes
86                 bsd=yes
87                 OSMAJORVERSION=8
88                 OSMINORVERSION=0
89                 ;;
90         solaris*|sun*)
91                 build_solaris=yes
92                 OSMAJORVERSION=5
93                 OSMINORVERSION=10
94                 ;;
95         aix*)
96                 build_aix=yes
97                 ;;
98         hpux*)
99                 build_hpux=yes
100                 ;;
101 esac
102
103 AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
104 AM_CONDITIONAL([BSD], [test "$build_bsd" = "yes"])
105 AM_CONDITIONAL([FREEBSD], [test "$build_freebsd" = "yes"])
106 AM_CONDITIONAL([OPENBSD], [test "$build_openbsd" = "yes"])
107 AM_CONDITIONAL([NETBSD], [test "$build_netbsd" = "yes"])
108 AM_CONDITIONAL([SOLARIS], [test "$build_solaris" = "yes"])
109 AM_CONDITIONAL([AIX], [test "$build_aix" = "yes"])
110 AM_CONDITIONAL([HPUX], [test "$build_hpux" = "yes"])
111
112 dnl Add osmajor/minor version to cppflags.
113 OSVERSION="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION"
114
115 dnl set CSRG_BASED define for the BSD's
116 if test "$build_bsd" = "yes"
117 then
118         SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DCSRG_BASED"
119 fi
120
121 is_x86_64=no
122 is_i386=no
123 is_sparc=no
124 is_mips=no
125 is_arm=no
126 is_ppc=no
127
128 case "${host_cpu}" in
129         i[3456]86*)
130                 is_i386=yes
131                 ;;
132         x86_64* | amd64*)
133                 is_x86_64=yes
134                 ;;
135         arm*)
136                 is_arm=yes
137                 ;;
138         mips*)
139                 is_mips=yes
140                 ;;
141         sparc*)
142                 is_sparc=yes
143                 ;;
144         ppc* | powerpc*)
145                 is_ppc=yes
146                 ;;
147 esac
148
149 AM_CONDITIONAL([I386], [test "$is_i386" = yes])
150 AM_CONDITIONAL([X86_64], [test "$is_x86_64" = yes])
151 AM_CONDITIONAL([ARM], [test "$is_arm" = yes])
152 AM_CONDITIONAL([SPARC], [test "$is_sparc" = yes])
153 AM_CONDITIONAL([MIPS], [test "is_mips" = yes])
154 AM_CONDITIONAL([PPC], [test "is_ppc" = yes])
155
156 dnl our main libraries
157 dnl we use single quotes so that $top_buildir is evaluated in the makefiles,
158 dnl not here.
159 AC_SUBST(LIBTT, '$(top_builddir)/lib/tt/lib/libtt.la')
160 AC_SUBST(LIBXIN, '$(top_builddir)/lib/DtXinerama/libDtXinerama.la')
161 AC_SUBST(LIBWIDGET, '$(top_builddir)/lib/DtWidget/libDtWidget.la')
162 AC_SUBST(LIBTERM, '$(top_builddir)/lib/DtTerm/libDtTerm.la')
163 AC_SUBST(LIBSVC, '$(top_builddir)/lib/DtSvc/libDtSvc.la')
164 AC_SUBST(LIBSEARCH, '$(top_builddir)/lib/DtSearch/lbiDtSearch.la')
165 AC_SUBST(LIBPRINT, '$(top_builddir)/lib/DtPrint/libDtPrint.la')
166 AC_SUBST(LIBMRM, '$(top_builddir)/lib/DtMrm/libDtMrm.la')
167 AC_SUBST(LIBMMDB, '$(top_builddir)/lib/DtMmdb/libDtMmdb.la')
168 AC_SUBST(LIBHELP, '$(top_builddir)/lib/DtHelp/libDtHelp.la')
169 AC_SUBST(LIBCSA, '$(top_builddir)/lib/csa/libcsa.la')
170
171 AC_SUBST(DTCLIENTLIBS, '$(LIBPRINT) $(LIBHELP) $(LIBWIDGET) $(LIBSVC) \
172 $(LIBTT) $(LIBXIN)')
173
174 dnl set up come convenience replacements for global include dirs
175 AC_SUBST(DT_INCDIR, '-I$(top_builddir)/include/Dt')
176 AC_SUBST(DTI_INCDIR, '-I$(top_builddir)/include/DtI')
177 AC_SUBST(TT_INCDIR, '-I$(top_builddir)/include/Tt')
178 AC_SUBST(XM_INCDIR, '-I$(top_builddir)/include/Xm')
179 AC_SUBST(CSA_INCDIR, '-I$(top_builddir)/include/csa')
180 AC_SUBST(SPC_INCDIR, '-I$(top_builddir)/include/SPC')
181
182 AC_ARG_ENABLE(japanese, [--build-japanese    Build Japanese (default=no)])
183 AM_CONDITIONAL([JAPANESE], [test "build_japanese" = "yes"])
184
185 AC_ARG_ENABLE(german, [--build-german    Build German    (default=no)])
186 AM_CONDITIONAL([GERMAN], [test "build_german" = "yes"])
187
188 AC_ARG_ENABLE(italian, [--build-italian    Build Italian    (default=no)])
189 AM_CONDITIONAL([ITALIAN], [test "build_italian" = "yes"])
190
191 AC_ARG_ENABLE(french, [--build-french    Build French    (default=no)])
192 AM_CONDITIONAL([FRENCH], [test "build_french" = "yes"])
193
194 AC_ARG_ENABLE(spanish, --build-spanish    Build Spanish    (default=no)])
195 AM_CONDITIONAL([SPANISH], [test "build_spanish" = "yes"])
196
197 dnl hmmm...
198 RM="rm -f"
199 AC_SUBST(RM)
200 CP="cp -f"
201 AC_SUBST(CP)
202
203 dnl these should be configurable someday...
204 CDE_INSTALLATION_TOP="$ac_default_prefix"
205 CDE_LOGFILES_TOP=/var/dt
206 CDE_CONFIGURATION_TOP=/etc/dt
207 CDE_USER_TOP=.dt
208
209 AC_SUBST(CDE_INSTALLATION_TOP)
210 AC_SUBST(CDE_CONFIGURATION_TOP)
211 AC_SUBST(CDE_LOGFILES_TOP)
212 AC_SUBST(CDE_USER_TOP)
213
214 AC_PROG_CC
215 AC_PROG_CXX
216
217 AC_PROG_CPP
218
219 dnl we need a real preprocessor, not gcc -E.  We will call it GENCPP.
220 dnl We will go with BSD's tradcpp here...  This is used for
221 dnl pre-processing during building of CDE - in the way imake used to
222 dnl do.  This is not a replacement for cpp, used at runtime by
223 dnl software such as tt_type_comp.
224 AC_SUBST(GENCPP, '$(top_builddir)/util/tradcpp/tradcpp')
225
226 AM_PROG_LIBTOOL
227 AC_PROG_YACC
228 AM_PROG_LEX
229 AC_PROG_INSTALL
230 AC_PROG_LN_S
231 AC_PROG_MAKE_SET
232 AC_PROG_SED
233 AC_PROG_AWK
234 AC_PROG_GREP
235
236 dnl AC_PROG_AR
237 AC_PROG_RANLIB
238
239 AC_C_CONST
240 AC_C_BIGENDIAN
241 AC_C_INLINE
242 AC_C_CHAR_UNSIGNED
243 AC_C_STRINGIZE
244 AC_C_FLEXIBLE_ARRAY_MEMBER
245 AC_SYS_POSIX_TERMIOS
246
247 AX_PTHREAD
248
249 AC_PROG_CC_C99
250
251 AC_PATH_X
252 AC_PATH_XTRA
253
254 AC_FUNC_FORK
255
256 dnl programs with full paths
257
258 AC_PATH_PROG(KSH, ksh)
259 AC_PATH_PROG(XRDB, xrdb)
260 dnl we need to use cpp for some things, like tooltalk and other
261 dnl runtime uses.  So look for the system's cpp.  NOTE: this is NOT
262 dnl the CPP (gcc -E) set by AC_PROG_CPP.  At this point I don't know
263 dnl if we should even bother looking for that as we can't really use
264 dnl it.
265 AC_PATH_PROG(CPP_PROGRAM, cpp, ,
266        [/lib:/usr/bin:/usr/ccs/lib/:/usr/lib:/usr/libexec:/opt/langtools/lbin:$PATH])
267
268 dnl programs
269 AC_CHECK_PROGS(BDFTOPCF, bdftopcf)
270 AC_CHECK_PROGS(MKFONTDIR, mkfontdir)
271 AC_CHECK_PROGS(GZIP, gzip)
272 AC_CHECK_PROGS(M4, m4)
273 AC_CHECK_PROGS(RPCGEN, rpcgen)
274 AC_CHECK_PROGS(GENCAT, gencat)
275
276 dnl headers
277 AC_HEADER_STDC
278 AC_CHECK_HEADERS([locale.h])
279
280 dnl libraries
281 AC_CHECK_LIB(m, cosf)
282 AC_CHECK_LIB(crypt, crypt)
283 dnl this should be configurable, for now it is required
284 AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
285                 [SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DUSE_XINERAMA"],
286                 [AC_MSG_ERROR([libXinerama not found])])
287
288 dnl Special check for tirpc...
289 AC_CHECK_LIB(tirpc, svc_register,
290       [CFLAGS="${CFLAGS} -DOPT_TIRPC -I/usr/include/tirpc";
291        CXXFLAGS="${CXXFLAGS} -DOPT_TIRPC -I/usr/include/tirpc";
292        TIRPCLIB=-ltirpc])
293 AC_SUBST(TIRPCLIB)
294
295 dnl Setup XTOOLLIB - we do it in this specific order to avoid ordering
296 dnl issues
297 XTOOLLIB="$X_LIBS"
298 AC_CHECK_LIB(X11, XOpenDisplay, [XTOOLLIB="-lX11"])
299 AC_CHECK_LIB(Xau, XauReadAuth, [XTOOLLIB="-lXau ${XTOOLLIB}"])
300 AC_CHECK_LIB(Xt, XtInitialize, [XTOOLLIB="-lXt ${XTOOLLIB}"])
301 AC_CHECK_LIB(ICE, IceCloseConnection, [XTOOLLIB="-lICE ${XTOOLLIB}"])
302 AC_CHECK_LIB(SM, SmcOpenConnection, [XTOOLLIB="-lSM ${XTOOLLIB}"])
303 AC_CHECK_LIB(Xm, XmTextSetString, [XTOOLLIB="-lXm ${XTOOLLIB}"])
304 AC_SUBST([XTOOLLIB])
305
306 dnl set CPPFLAGS, CFLAGS, and CXXFLAGS.
307 dnl The Autoconf manual says that these are user variables and
308 dnl shouldn't be modified.  It suggests that you create a special
309 dnl variable and presumably add those to your Makefile.am files.  We
310 dnl have 192 of these currently, so... The user will just have to
311 dnl deal, or modify them here directly.
312 CPPFLAGS="${CPPFLAGS} ${SOURCE_CPP_DEFINES} ${CPP_COMPILER_FLAGS} ${OSVERSION}"
313 CFLAGS="${CFLAGS} ${C_COMPILER_FLAGS} ${PTHREAD_CFLAGS}"
314 CXXFLAGS="${CXXFLAGS} ${CXX_COMPILER_FLAGS} ${PTHREAD_CFLAGS}"
315 LIBS="${LIBS} ${PTHREAD_LIBS}"
316
317 dnl All of the makefiles we need to generate go here...
318 AC_CONFIG_FILES([
319 Makefile
320
321 util/Makefile
322 util/tradcpp/Makefile
323
324 lib/Makefile
325
326 lib/DtXinerama/Makefile
327
328 lib/tt/Makefile
329 lib/tt/mini_isam/Makefile
330 lib/tt/slib/Makefile
331 lib/tt/lib/Makefile
332 lib/tt/lib/api/Makefile
333 lib/tt/lib/api/dnd/Makefile
334 lib/tt/lib/api/c/Makefile
335 lib/tt/lib/tttk/Makefile
336 lib/tt/lib/db/Makefile
337 lib/tt/lib/mp/Makefile
338 lib/tt/lib/util/Makefile
339 lib/tt/bin/Makefile
340 lib/tt/bin/shell/Makefile
341 lib/tt/bin/ttauth/Makefile
342 lib/tt/bin/scripts/Makefile
343 lib/tt/bin/tttar/Makefile
344 lib/tt/bin/tt_type_comp/Makefile
345 lib/tt/bin/tttrace/Makefile
346 lib/tt/bin/dbck/Makefile
347 lib/tt/bin/ttdbserverd/Makefile
348 lib/tt/bin/ttsession/Makefile
349
350 lib/DtSvc/Makefile
351
352 lib/DtSearch/Makefile
353 lib/DtSearch/raima/Makefile
354
355 lib/DtWidget/Makefile
356
357 lib/DtHelp/Makefile
358 lib/DtHelp/il/Makefile
359
360 lib/DtPrint/Makefile
361
362 lib/DtTerm/Term/Makefile
363 lib/DtTerm/Makefile
364 lib/DtTerm/TermView/Makefile
365 lib/DtTerm/util/Makefile
366 lib/DtTerm/TermPrim/Makefile
367
368 lib/DtMrm/Makefile
369
370 lib/csa/Makefile
371
372 programs/Makefile
373
374 programs/backdrops/Makefile
375
376 programs/palettes/Makefile
377
378 programs/icons/Makefile
379
380 programs/dthelp/Makefile
381 programs/dthelp/dthelpgen/Makefile
382 programs/dthelp/dthelpprint/Makefile
383 programs/dthelp/parser/pass1/helptag/Makefile
384 programs/dthelp/parser/pass1/Makefile
385 programs/dthelp/parser/pass1/eltdef/Makefile
386 programs/dthelp/parser/pass1/build/Makefile
387 programs/dthelp/parser/Makefile
388 programs/dthelp/parser/canon1/Makefile
389 programs/dthelp/parser/pass2/Makefile
390 programs/dthelp/dthelpview/Makefile
391
392 programs/dsdm/Makefile
393
394 programs/dtmail/Makefile
395 programs/dtmail/dtmail/Makefile
396 programs/dtmail/MotifApp/Makefile
397 programs/dtmail/dtmailpr/Makefile
398 programs/dtmail/libDtMail/Makefile
399 programs/dtmail/libDtMail/RFC/Makefile
400 programs/dtmail/libDtMail/Common/Makefile
401
402 programs/dtpad/Makefile
403
404 programs/dtfile/Makefile
405 programs/dtfile/dtcopy/Makefile
406
407 programs/dtwm/Makefile
408
409 programs/dtlogin/Makefile
410 programs/dtlogin/config/Makefile
411
412 programs/dtsession/Makefile
413
414 programs/dthello/Makefile
415
416 programs/dtstyle/Makefile
417
418 programs/dtexec/Makefile
419
420 programs/dtdbcache/Makefile
421
422 programs/dticon/Makefile
423
424 programs/dtterm/Makefile
425
426 programs/dtcalc/Makefile
427
428 programs/dtaction/Makefile
429
430 programs/dtspcd/Makefile
431
432 programs/dtscreen/Makefile
433
434 programs/dtcm/Makefile
435 programs/dtcm/libDtCmP/Makefile
436 programs/dtcm/server/Makefile
437 programs/dtcm/dtcm/Makefile
438
439 programs/dtsearchpath/Makefile
440 programs/dtsearchpath/libCliSrv/Makefile
441 programs/dtsearchpath/dtsp/Makefile
442 programs/dtsearchpath/dtappg/Makefile
443
444 programs/dtappintegrate/Makefile
445
446 programs/dtprintegrate/Makefile
447
448 programs/dtconfig/Makefile
449 programs/dtconfig/sun/Makefile
450
451 programs/dtcreate/Makefile
452
453 programs/dtprintinfo/Makefile
454
455 programs/fontaliases/Makefile
456 programs/fontaliases/bdf/Makefile
457 programs/fontaliases/linux/Makefile
458 programs/fontaliases/linux/C/Makefile
459 programs/fontaliases/linux/en_US.UTF-8/Makefile
460 programs/fontaliases/sun/Makefile
461 programs/fontaliases/sun/C/Makefile
462 programs/fontaliases/netbsd/Makefile
463 programs/fontaliases/netbsd/C/Makefile
464 programs/fontaliases/openbsd/Makefile
465 programs/fontaliases/openbsd/C/Makefile
466 programs/fontaliases/freebsd/Makefile
467 programs/fontaliases/freebsd/C/Makefile
468
469 programs/dtdspmsg/Makefile
470
471 programs/dtimsstart/Makefile
472
473 programs/dtpdm/Makefile
474
475 programs/dtsr/Makefile
476
477 programs/dtpdmd/Makefile
478
479 programs/types/Makefile
480
481 programs/tttypes/Makefile
482
483 programs/util/Makefile
484 programs/util/dttypes/Makefile
485
486 programs/dtopen/Makefile
487
488 programs/localized/Makefile
489 programs/localized/util/Makefile
490 programs/localized/C/Makefile
491 programs/localized/C/app-defaults/Makefile
492 programs/localized/C/config/Makefile
493 programs/localized/C/backdrops/Makefile
494 programs/localized/C/types/Makefile
495 programs/localized/C/palettes/Makefile
496 programs/localized/C/msg/Makefile
497 programs/localized/de_DE.UTF-8/Makefile
498 programs/localized/de_DE.UTF-8/app-defaults/Makefile
499 programs/localized/de_DE.UTF-8/config/Makefile
500 programs/localized/de_DE.UTF-8/backdrops/Makefile
501 programs/localized/de_DE.UTF-8/types/Makefile
502 programs/localized/de_DE.UTF-8/palettes/Makefile
503 programs/localized/de_DE.UTF-8/msg/Makefile
504 programs/localized/fr_FR.UTF-8/Makefile
505 programs/localized/fr_FR.UTF-8/app-defaults/Makefile
506 programs/localized/fr_FR.UTF-8/config/Makefile
507 programs/localized/fr_FR.UTF-8/backdrops/Makefile
508 programs/localized/fr_FR.UTF-8/types/Makefile
509 programs/localized/fr_FR.UTF-8/palettes/Makefile
510 programs/localized/fr_FR.UTF-8/msg/Makefile
511 programs/localized/it_IT.UTF-8/Makefile
512 programs/localized/it_IT.UTF-8/app-defaults/Makefile
513 programs/localized/it_IT.UTF-8/config/Makefile
514 programs/localized/it_IT.UTF-8/backdrops/Makefile
515 programs/localized/it_IT.UTF-8/types/Makefile
516 programs/localized/it_IT.UTF-8/palettes/Makefile
517 programs/localized/it_IT.UTF-8/msg/Makefile
518 programs/localized/es_ES.UTF-8/Makefile
519 programs/localized/es_ES.UTF-8/app-defaults/Makefile
520 programs/localized/es_ES.UTF-8/config/Makefile
521 programs/localized/es_ES.UTF-8/backdrops/Makefile
522 programs/localized/es_ES.UTF-8/types/Makefile
523 programs/localized/es_ES.UTF-8/palettes/Makefile
524 programs/localized/es_ES.UTF-8/msg/Makefile
525
526 ])
527
528 AC_OUTPUT
529