]> git.saurik.com Git - wxWidgets.git/blame_incremental - configure.in
Slightly better style?
[wxWidgets.git] / configure.in
... / ...
CommitLineData
1dnl ////////////////////////////////////////////////////////////////////////
2dnl
3dnl Top-level configure.in for wxWindows by Robert Roebling, Wolfram Gloger
4dnl and Martin Sperl.
5dnl
6dnl This script is under the wxWindows licence.
7dnl $Id$
8dnl ////////////////////////////////////////////////////////////////////////
9
10
11dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
12dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
13dnl
14AC_DEFUN(AM_PATH_GTK,
15[dnl
16dnl Get the cflags and libraries from the gtk-config script
17dnl
18AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed],
19 gtk_config_prefix="$withval", gtk_config_prefix="")
20AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed],
21 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
22
23 if test x$gtk_config_exec_prefix != x ; then
24 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
25 if test x${GTK_CONFIG+set} != xset ; then
26 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
27 fi
28 fi
29 if test x$gtk_config_prefix != x ; then
30 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
31 if test x${GTK_CONFIG+set} != xset ; then
32 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
33 fi
34 fi
35
36 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
37 min_gtk_version=ifelse([$1], ,0.99.7,$1)
38 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
39 no_gtk=""
40 if test "$GTK_CONFIG" != "no" ; then
41 GTK_CFLAGS=`$GTK_CONFIG --cflags`
42 GTK_LIBS=`$GTK_CONFIG --libs`
43 ac_save_CFLAGS="$CFLAGS"
44 ac_save_LIBS="$LIBS"
45 CFLAGS="$CFLAGS $GTK_CFLAGS"
46 LIBS="$LIBS $GTK_LIBS"
47dnl
48dnl Now check if the installed GTK is sufficiently new. (Also sanity
49dnl checks the results of gtk-config to some extent
50dnl
51 AC_TRY_RUN([
52#include <gtk/gtk.h>
53#include <stdio.h>
54
55int
56main ()
57{
58 int major, minor, micro;
59
60 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
61 printf("%s, bad version string\n", "$min_gtk_version");
62 exit(1);
63 }
64
65 if (gtk_minor_version == 1) return FALSE;
66
67 return !((gtk_major_version > major) ||
68 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
69 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
70}
71],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
72 CFLAGS="$ac_save_CFLAGS"
73 LIBS="$ac_save_LIBS"
74 else
75 no_gtk=yes
76 fi
77 if test "x$no_gtk" = x ; then
78 AC_MSG_RESULT(yes)
79 ifelse([$2], , :, [$2])
80 else
81 AC_MSG_RESULT(no)
82 GTK_CFLAGS=""
83 GTK_LIBS=""
84 ifelse([$3], , :, [$3])
85 fi
86 AC_SUBST(GTK_CFLAGS)
87 AC_SUBST(GTK_LIBS)
88])
89
90dnl ------------------------------------------------------------------------
91dnl custom macros
92dnl ------------------------------------------------------------------------
93
94AC_DEFUN(AC_OVERRIDES_PREPARE,
95[
96rm -f ${OSTYPE}.system.cache.tmp
97touch ${OSTYPE}.system.cache.tmp
98touch ${OSTYPE}.system.cache
99])
100
101AC_DEFUN(AC_OVERRIDES_DONE,
102[
103mv ${OSTYPE}.system.cache.tmp ${OSTYPE}.system.cache
104])
105
106dnl package,message,helpmessage,variable
107AC_DEFUN(AC_OVERRIDES,
108[
109AC_MSG_CHECKING("for $2")
110AC_ARG_WITH($1,$3,
111[if test "x$with_$1" = xyes; then
112 ac_cv_use_$1='$4="1"'
113else
114 ac_cv_use_$1='$4="0"'
115fi],
116[
117 LINE=`grep "$4" ${OSTYPE}.system.cache`
118 if test "x$LINE" != x ; then
119 eval "DEFAULT_$LINE"
120 fi
121 ac_cv_use_$1='$4='$DEFAULT_$4
122])
123eval "$ac_cv_use_$1"
124echo $ac_cv_use_$1 >> ${OSTYPE}.system.cache.tmp
125if test "$$4" = 1; then
126 AC_MSG_RESULT(yes)
127else
128 AC_MSG_RESULT(no)
129fi
130])
131
132dnl package,message,helpmessage,variable
133AC_DEFUN(AC_OVERRIDES_OLD,
134[
135AC_MSG_CHECKING("for $2")
136AC_CACHE_VAL(ac_cv_use_$1,
137[
138AC_ARG_WITH($1,$3,
139[if test "x$with_$1" = xyes; then
140 ac_cv_use_$1='$4="1"'
141else
142 ac_cv_use_$1='$4="0"'
143fi],[ac_cv_use_$1='$4=$DEFAULT_$4'])
144])
145eval "$ac_cv_use_$1"
146
147if test "$$4" = 1; then
148 AC_MSG_RESULT(yes)
149else
150 AC_MSG_RESULT(no)
151fi
152])
153
154AC_DEFUN(AC_PATH_FIND_INCLUDES,
155[
156ac_find_includes=
157for ac_dir in $1;
158 do
159 if test -f "$ac_dir/$2"; then
160 ac_find_includes=$ac_dir
161 break
162 fi
163 done
164])
165
166AC_DEFUN(AC_PATH_FIND_LIBRARIES,
167[
168ac_find_libraries=
169for ac_dir in $1;
170 do
171 for ac_extension in a so sl; do
172 if test -f "$ac_dir/lib$2.$ac_extension"; then
173 ac_find_libraries=$ac_dir
174 break 2
175 fi
176 done
177 done
178])
179
180dnl Path to include, allready defined
181AC_DEFUN(AC_INCLUDE_PATH_EXIST,
182[
183 ac_path_to_include=$1
184 echo "$2" | grep "\-I$1" > /dev/null
185 result=$?
186 if test $result = 0; then
187 ac_path_to_include=""
188 else
189 ac_path_to_include="-I$1"
190 fi
191])
192
193dnl Path to link, allready defined
194AC_DEFUN(AC_LINK_PATH_EXIST,
195[
196 echo "$2" | grep "\-L$1" > /dev/null
197 result=$?
198 if test $result = 0; then
199 ac_path_to_link=""
200 else
201 ac_path_to_link="-L$1"
202 fi
203])
204
205dnl ------------------------------------------------------------------------
206dnl Process this file with autoconf to produce a configure script.
207dnl ------------------------------------------------------------------------
208
209AC_INIT(configure.in)
210
211dnl ------------------------------------------------------------------------
212dnl Check platform
213dnl ------------------------------------------------------------------------
214
215OS="${OSTYPE}"
216
217if test "x$OS" = "x"; then
218 UNAME=`uname`
219 AC_MSG_ERROR("The system variable OS has not been set"
220 "please set is everytime befor compiling on this system"
221 "A good example for this system would be:"
222 "setenv OSTYPE $UNAME for csh as a SHELL"
223 "EXPORT OSTYPE=$UNAME for sh as SHELL"
224 "please set this and restart again."
225 )
226fi
227
228dnl ------------------------------------------------------------------------
229dnl Set base directory
230dnl ------------------------------------------------------------------------
231
232WXBASEDIR=`pwd`
233AC_SUBST(WXBASEDIR)
234
235dnl ------------------------------------------------------------------------
236dnl search path for includes and libraries
237dnl ------------------------------------------------------------------------
238
239dnl VZ: added standard locations for Xm.h for Irix, HP-UX and SunOS (19.02.99)
240SEARCH_INCLUDE="\
241 /usr/Motif-1.2/include \
242 /usr/Motif-2.1/include \
243 \
244 /usr/include/Motif1.2 \
245 /opt/xpm/include/X11 \
246 \
247 /usr/Motif1.2/include \
248 /usr/dt/include \
249 /usr/include/Xm \
250 \
251 /usr/X11R6/include \
252 /usr/X11R5/include \
253 /usr/X11R4/include \
254 \
255 /usr/X11R6/lib \
256 /usr/X11R5/lib \
257 /usr/X11R4/lib \
258 \
259 /usr/include/X11R6 \
260 /usr/include/X11R5 \
261 /usr/include/X11R4 \
262 \
263 /usr/local/X11R6/include \
264 /usr/local/X11R5/include \
265 /usr/local/X11R4/include \
266 \
267 /usr/local/include/X11R6 \
268 /usr/local/include/X11R5 \
269 /usr/local/include/X11R4 \
270 \
271 /usr/X11/include \
272 /usr/include/X11 \
273 /usr/local/X11/include \
274 /usr/local/include/X11 \
275 \
276 /usr/X386/include \
277 /usr/x386/include \
278 /usr/XFree86/include/X11 \
279 \
280 /usr/include \
281 /usr/include/gtk \
282 /usr/include/gdk \
283 /usr/include/glib \
284 /usr/local/include \
285 /usr/unsupported/include \
286 /usr/athena/include \
287 /usr/local/x11r5/include \
288 /usr/lpp/Xamples/include \
289 \
290 /usr/local/include/gtk \
291 /usr/local/include/qt \
292 /usr/include/qt \
293 \
294 /usr/openwin/include \
295 /usr/openwin/share/include \
296 "
297
298SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` "
299
300dnl ------------------------------------------------------------------------
301dnl standard checks
302dnl ------------------------------------------------------------------------
303
304dnl ###################
305dnl # checks programs #
306dnl ###################
307
308dnl C-compiler checks
309dnl =================
310dnl use what compiler
311AC_PROG_CC
312dnl defines CC with the compiler to use
313dnl defines GCC with yes if using gcc
314dnl defines GCC empty if not using gcc
315dnl defines CFLAGS
316
317CFLAGS=`echo "$CFLAGS" | sed 's/-g//g'`
318
319dnl does compiler support -c and -o simultaniously
320AC_PROG_CC_C_O
321dnl defines NO_MINUS_C_MINUS_O if compiler does not accept
322dnl both switches simultaniously
323dnl what is the c-preprocessor
324AC_PROG_CPP
325dnl defines CPP with the c-preprocessor
326dnl is -traditional needed for correct compilations
327AC_PROG_GCC_TRADITIONAL
328dnl adds -traditional for gcc if needed
329
330AC_LANG_SAVE
331
332dnl C++-compiler checks
333dnl ===================
334dnl use what compiler
335AC_PROG_CXX
336dnl defines CXX with the compiler to use
337dnl defines GXX with yes if using gxx
338dnl defines GXX empty if not using gxx
339dnl defines CXXFLAGS
340dnl what is the C++-preprocessor
341AC_PROG_CXXCPP
342dnl defines CXXCPP with the C++-preprocessor
343
344CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//g'`
345
346AC_LANG_RESTORE
347
348dnl ranlib command
349dnl ==============
350AC_PROG_RANLIB
351dnl defines RANLIB with the appropriate command
352
353dnl ar command
354dnl ==========
355AC_CHECK_PROG(AR, ar, ar, ar)
356dnl defines AR with the appropriate command
357
358dnl install checks
359dnl ==============
360AC_PROG_INSTALL
361dnl defines INSTALL with the appropriate command
362
363dnl does ln -s works
364dnl ================
365AC_PROG_LN_S
366dnl defines LN_S with the appropriate command
367
368dnl awk command
369dnl ===========
370AC_PROG_AWK
371dnl defines AWK with the appropriate command
372
373dnl strip command
374dnl =============
375AC_CHECK_PROG(STRIP, strip, strip, true)
376dnl defines STRIP as strip or nothing if not found
377
378dnl ###############
379dnl # make checks #
380dnl ###############
381dnl check if VPATH works
382AC_MSG_CHECKING("make for VPATH support")
383dnl create Makefile
384cat - << EOF > confMake
385check : file
386 cp \$? \$@
387 cp \$? final_file
388EOF
389
390if test ! -d sub ; then
391 mkdir sub
392fi
393echo dummy > sub/file
394${MAKE-make} -f confMake VPATH=sub 2> config.log > /dev/null
395RESULT=$?
396rm -f sub/file check final_file confMake
397rmdir sub
398if test "$RESULT" = 0; then
399 AC_MSG_RESULT(yes)
400else
401 AC_MSG_RESULT(no)
402 AC_MSG_ERROR(
403You need a make-utility that is able to use the variable
404VPATH correctly.
405If your version of make does not support VPATH correctly,
406please install GNU-make (possibly as gmake), and start
407configure with the following command:
408export MAKE=gmake; ./configure for sh-type shells
409setenv MAKE gmake; ./configure for csh-type shells
410Also please do remember to use gmake in this case every time
411you are trying to compile.
412)
413fi
414
415dnl ####################
416dnl # checks libraries #
417dnl ####################
418
419dnl find the X11 include and library files
420AC_PATH_XTRA
421dnl defines x_includes and x_libraries
422
423dnl #######################
424dnl # checks header files #
425dnl #######################
426AC_HEADER_DIRENT
427dnl defines DIR
428dnl defines MACRO HAVE_DIRENT_H if dirent.h exists
429dnl defines MACRO HAVE_SYS_NDIR_H if sys/ndir.h exists
430dnl defines MACRO HAVE_SYS_DIR_H if sys/dir.h exists
431dnl defines MACRO HAVE_NDIR_H if ndir.h exists
432AC_HEADER_STDC
433dnl defines STDC_HEADERS if ANSI-C header
434AC_HEADER_SYS_WAIT
435dnl defines HAVE_SYS_WAIT_H if sys/wait.h exist and is POSIX.1
436AC_CHECK_HEADERS(fcntl.h)
437dnl defines HAVE_FCNTL_H
438AC_CHECK_HEADERS(limits.h)
439dnl defines HAVE_LIMITS_h
440AC_CHECK_HEADERS(sys/file.h)
441dnl defines HAVE_SYS_FILE_H
442AC_CHECK_HEADERS(sys/time.h)
443dnl defines HAVE_SYS_TIME_H
444AC_CHECK_HEADERS(unistd.h)
445dnl defines HAVE_UNISTD_H
446AC_CHECK_HEADERS(fnmatch.h)
447dnl defines HAVE_FNMATCH_H
448dnl As it needs Linux 2.1.x for the moment: check whether the file exists (GL).
449AC_CHECK_HEADERS(linux/joystick.h)
450GTK_JOYSTICK=""
451if test "$ac_cv_header_linux_joystick_h" = "yes"; then
452 GTK_JOYSTICK="gtk/joystick.cpp"
453fi
454AC_SUBST(GTK_JOYSTICK)
455
456dnl some systems (AIX) define some of string function in strings.h
457AC_CHECK_HEADERS(strings.h)
458
459dnl #######################
460dnl # check for functions #
461dnl #######################
462
463dnl check for vprintf/vsprintf() which are GNU extensions
464AC_FUNC_VPRINTF
465
466dnl check for vsnprintf() - a safe version of vsprintf()
467AC_CHECK_FUNCS(vsnprintf,
468 AC_DEFINE(HAVE_VSNPRINTF),
469 AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
470 )
471
472dnl check for vfork() (even if it's the same as fork() in modern Unices)
473AC_CHECK_FUNCS(vfork)
474
475POSIX4_LINK=
476AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), [
477 AC_CHECK_LIB(posix4, nanosleep, [
478 AC_DEFINE(HAVE_NANOSLEEP)
479 POSIX4_LINK="-lposix4"
480 ], [
481 AC_CHECK_FUNCS(usleep,
482 AC_DEFINE(HAVE_USLEEP),
483 AC_MSG_WARN(Sleep() function will not work))
484 ])
485])
486
487dnl check for uname (POSIX) and gethostname (BSD)
488AC_CHECK_FUNCS(uname gethostname, break)
489
490dnl ###################
491dnl # checks typedefs #
492dnl ###################
493AC_TYPE_GETGROUPS
494dnl defines GETGROUPS_T
495AC_TYPE_MODE_T
496dnl defines mode_t if not already defined
497AC_TYPE_OFF_T
498dnl defines off_t if not already defined
499AC_TYPE_PID_T
500dnl defines pid_t if not already defined
501AC_TYPE_SIGNAL
502dnl defines RETSIGTYPE for the correct return type of signal
503AC_TYPE_SIZE_T
504dnl defines size_t if not already defined
505AC_TYPE_UID_T
506dnl defines uid_t and gid_t if not already defined
507
508dnl #####################
509dnl # checks structures #
510dnl #####################
511
512AC_HEADER_STAT
513dnl defines STAT_MACROS_BROKEN if S_ISDIR and S_ISREG
514dnl do not work properly
515AC_HEADER_TIME
516dnl defines TIME_WITH_SYS_TIME if time.h and sys/time.h can
517dnl both be included
518AC_STRUCT_ST_BLKSIZE
519dnl defines HAVE_ST_BLKSIZE if struct stat contains st_blksize
520AC_STRUCT_ST_BLOCKS
521dnl defines HAVE_ST_BLOCKS if struct stat contains st_blocks
522AC_STRUCT_ST_RDEV
523dnl defines HAVE_ST_RDEV if struct stat contains st_rdev
524AC_STRUCT_TM
525dnl defines TM_IN_SYS_TIME if struct tm is not in time.h
526AC_STRUCT_TIMEZONE
527dnl defines HAVE_ST_BLKSIZE if struct tm contains tm_zone
528dnl otherwise
529dnl defines HAVE_TZNAME if external array tzname is found
530
531dnl ###################################
532dnl # checks compiler characteristics #
533dnl ###################################
534
535AC_C_CONST
536dnl defines const to be empty if c-compiler does not support const fully
537AC_C_INLINE
538dnl defines inline to a sensible value for the c-compiler
539AC_C_CHAR_UNSIGNED
540dnl defines __CHAR_UNSIGNED__ if char is unsigned
541AC_C_LONG_DOUBLE
542dnl defines HAVE_LONGDOUBLE if compiler supports long double
543
544AC_C_BIGENDIAN
545dnl defines WORDS_BIGENDIAN if system is big endian
546
547dnl give some default values for cross-compiling
548AC_CHECK_SIZEOF(int *, 4)
549AC_CHECK_SIZEOF(int, 4)
550AC_CHECK_SIZEOF(long, 4)
551AC_CHECK_SIZEOF(long long, 0)
552dnl defines the size of certain types of variables in SIZEOF_<TYPE>
553
554dnl ######################
555dnl # check C++ features #
556dnl ######################
557
558AC_LANG_SAVE
559AC_LANG_CPLUSPLUS
560
561dnl check for iostream (as opposed to iostream.h) standard header
562AC_CHECK_HEADERS(iostream)
563if test "x$HAVE_IOSTREAM" = "x" ; then
564 AC_DEFINE(wxUSE_IOSTREAMH)
565fi
566
567dnl Check for existence of builtin 'bool' data type
568dnl
569dnl do nothing for cross-compilation - assume bool is not defined
570AC_MSG_CHECKING(if C++ compiler supports bool)
571AC_TRY_RUN([
572
573int main()
574{
575 bool b = true;
576
577 return 0;
578}
579 ],
580 AC_DEFINE(HAVE_BOOL) AC_MSG_RESULT(yes),
581 AC_MSG_RESULT(no),
582 AC_MSG_RESULT(no assumed for cross-compilation))
583
584dnl Check whether overloading on size_t/int parameter works
585AC_MSG_CHECKING(if size_t and int are different types)
586AC_TRY_RUN([
587#include <stdlib.h>
588
589void wxFoo(int i) { }
590void wxFoo(size_t n) { }
591
592int main()
593{
594 int i;
595 size_t n;
596 wxFoo(0);
597 wxFoo(1);
598 wxFoo(0u);
599 wxFoo(i);
600 wxFoo(n);
601
602 return 0;
603}
604
605 ],
606 AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) AC_MSG_RESULT(yes),
607 AC_MSG_RESULT(no),
608 AC_MSG_RESULT(no assumed for cross-compilation))
609
610AC_LANG_RESTORE
611
612dnl ############################
613dnl # checks library functions #
614dnl ############################
615
616dnl ##########################
617dnl # checks system services #
618dnl ##########################
619
620
621AC_SYS_LONG_FILE_NAMES
622dnl defines HAVE_LONG_FILENAMES if filenames longer then
623dnl 14 chars are supported
624
625dnl AC_SYS_RESTARTABLE_SYSCALLS
626dnl defines HAVE_RESTARTABLE_SYSCALLS if the system restarts a
627dnl system call that is interrupted
628dnl by a signal
629
630dnl #################
631dnl # checks PARSER #
632dnl #################
633
634dnl YACC checks
635dnl ===========
636AC_PROG_YACC
637dnl defines YACC with the appropriate command
638
639dnl LEX checks
640dnl ==========
641AC_PROG_LEX
642dnl defines LEX with the appropriate command
643dnl defines LEXLIB with the appropriate library
644dnl what type is yytext
645AC_DECL_YYTEXT
646dnl defines YYTEXT_POINTER if yytext is char*
647dnl defines LEX_OUTPUT_ROOT as to the base of the
648dnl filename output by the lexer
649
650dnl ###################################
651dnl ## Check for dynamic load module #
652dnl ###################################
653
654DL_LIBRARY=
655AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
656[AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL) DL_LIBRARY="-ldl"],
657 [AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD) DL_LIBRARY="-ldld"],
658 [AC_CHECK_FUNCS(shl_load, AC_DEFINE(HAVE_SHL_LOAD) )]
659 )]
660 )]
661)
662AC_SUBST(DL_LIBRARY)
663
664AC_CACHE_CHECK([for underscore before symbols], libltdl_cv_uscore, [
665 echo "main(){int i=1;} fnord(){int i=23; int ltuae=42;}" > conftest.c
666 ${CC} -c conftest.c > /dev/null
667 if (nm conftest.o | grep _fnord) > /dev/null; then
668 libltdl_cv_uscore=yes
669 else
670 libltdl_cv_uscore=no
671 fi
672 rm -f conftest*
673])
674
675if test x"$libltdl_cv_uscore" = xyes; then
676 if test x"$ac_cv_func_dlopen" = xyes ||
677 test x"$ac_cv_lib_dl_dlopen" = xyes ; then
678 AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
679 libltdl_cv_need_uscore, [dnl
680 AC_TRY_RUN([
681#include <dlfcn.h>
682#include <stdio.h>
683fnord() { int i=42;}
684main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
685 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
686 if(ptr1 && !ptr2) exit(0); } exit(1); }
687], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
688 libltdl_cv_need_uscore=no
689)])
690 fi
691fi
692
693if test x"$libltdl_cv_need_uscore" = xyes; then
694 AC_DEFINE(NEED_USCORE)
695fi
696
697dnl ##########################################
698dnl ## Check for specific library functions #
699dnl ##########################################
700
701dnl Checks for library functions.
702AC_CHECK_FUNCS(strerror)
703
704dnl ------------------------------------------------------------------------
705dnl main includes
706dnl ------------------------------------------------------------------------
707
708CHECK_INCLUDE="-I/usr/include $X_CFLAGS"
709CHECK_LIB="-L/lib -L/usr/lib $X_LIBS"
710
711dnl ------------------------------------------------------------------------
712dnl host system
713dnl ------------------------------------------------------------------------
714
715AC_CANONICAL_HOST
716canonical=$host
717configuration=$host_alias
718
719dnl ------------------------------------------------------------------------
720dnl system settings
721dnl ------------------------------------------------------------------------
722
723USE_UNIX=1
724
725USE_LINUX=
726USE_SGI=
727USE_HPUX=
728USE_SYSV=
729USE_SVR4=
730USE_AIX=
731USE_SUN=
732USE_SOLARIS=
733USE_SUNOS=
734USE_ALPHA=
735USE_OSF=
736USE_BSD=
737USE_FREEBSD=
738USE_VMS=
739USE_ULTRIX=
740USE_DATA_GENERAL=
741
742AC_DEFINE(__UNIX__)
743case "${canonical}" in
744 *-hp-hpux* )
745 USE_HPUX=1
746 AC_DEFINE(__HPUX__)
747 ;;
748 *-*-linux* )
749 USE_LINUX=1
750 AC_DEFINE(__LINUX__)
751 TMP=`uname -m`
752 if test "x$TMP" = "xalpha"
753 then
754 USE_ALPHA=1
755 AC_DEFINE(__ALPHA__)
756 fi
757 ;;
758 *-*-irix5* | *-*-irix6* )
759 USE_SGI=1
760 USE_SVR4=1
761 AC_DEFINE(__SGI__)
762 AC_DEFINE(__SVR4__)
763 ;;
764 *-*-solaris2* )
765 USE_SUN=1
766 USE_SOLARIS=1
767 USE_SVR4=1
768 AC_DEFINE(__SUN__)
769 AC_DEFINE(__SOLARIS__)
770 AC_DEFINE(__SVR4__)
771 ;;
772 *-*-sunos4* )
773 USE_SUN=1
774 USE_SUNOS=1
775 USE_BSD=1
776 AC_DEFINE(__SUN__)
777 AC_DEFINE(__SUNOS__)
778 AC_DEFINE(__BSD__)
779 ;;
780 *-*-freebsd* | *-*-netbsd*)
781 USE_BSD=1
782 USE_FREEBSD=1
783 AC_DEFINE(__FREEBSD__)
784 AC_DEFINE(__BSD__)
785 ;;
786 *-*-osf* )
787 USE_ALPHA=1
788 USE_OSF=1
789 AC_DEFINE(__ALPHA__)
790 AC_DEFINE(__OSF__)
791 ;;
792 *-*-dgux5* )
793 USE_ALPHA=1
794 USE_SVR4=1
795 AC_DEFINE(__ALPHA__)
796 AC_DEFINE(__SVR4__)
797 ;;
798 *-*-sysv5* )
799 USE_SYSV=1
800 USE_SVR4=1
801 AC_DEFINE(__SYSV__)
802 AC_DEFINE(__SVR4__)
803 ;;
804 *-*-aix* )
805 USE_AIX=1
806 USE_SYSV=1
807 USE_SVR4=1
808 AC_DEFINE(__AIX__)
809 AC_DEFINE(__SYSV__)
810 AC_DEFINE(__SVR4__)
811 ;;
812 *)
813 AC_MSG_ERROR(I don't know your system type.)
814esac
815
816dnl ------------------------------------------------------------------------
817dnl defaults for command options
818dnl ------------------------------------------------------------------------
819
820AC_OVERRIDES_PREPARE
821
822DEFAULT_wxUSE_GTK=1
823DEFAULT_wxUSE_QT=0
824DEFAULT_wxUSE_MOTIF=0
825
826DEFAULT_wxUSE_THREADS=0
827
828DEFAULT_wxUSE_SHARED=1
829DEFAULT_wxUSE_OPTIMISE=1
830DEFAULT_wxUSE_PROFILE=0
831DEFAULT_wxUSE_DEBUG_FLAG=0
832DEFAULT_wxUSE_DEBUG_INFO=0
833DEFAULT_wxUSE_MEM_TRACING=0
834DEFAULT_wxUSE_DMALLOC=0
835DEFAULT_wxUSE_APPLE_IEEE=1
836DEFAULT_wxUSE_IOSTREAMH=1
837
838DEFAULT_wxUSE_ZLIB=1
839DEFAULT_wxUSE_LIBPNG=1
840DEFAULT_wxUSE_LIBJPEG=0
841DEFAULT_wxUSE_ODBC=1
842
843DEFAULT_wxUSE_TIMEDATE=1
844DEFAULT_wxUSE_INTL=1
845DEFAULT_wxUSE_CONFIG=1
846DEFAULT_wxUSE_STREAMS=1
847DEFAULT_wxUSE_SOCKETS=1
848DEFAULT_wxUSE_SERIAL=1
849DEFAULT_wxUSE_DYNLIB_CLASS=1
850
851DEFAULT_wxUSE_AFM_FOR_POSTSCRIPT=1
852DEFAULT_WX_NORMALIZED_PS_FONTS=1
853DEFAULT_wxUSE_POSTSCRIPT=1
854
855DEFAULT_wxUSE_IPC=1
856DEFAULT_wxUSE_RESOURCES=1
857DEFAULT_wxUSE_CLIPBOARD=1
858DEFAULT_wxUSE_TOOLTIPS=1
859DEFAULT_wxUSE_DRAG_AND_DROP=1
860
861DEFAULT_wxUSE_MDI_ARCHITECTURE=1
862DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=1
863DEFAULT_wxUSE_PRINTING_ARCHITECTURE=1
864
865DEFAULT_wxUSE_PROLOGIO=1
866DEFAULT_wxUSE_WX_RESOURCES=1
867DEFAULT_wxUSE_RPC=0
868DEFAULT_wxUSE_HELP=1
869
870DEFAULT_wxUSE_UNICODE=0
871DEFAULT_wxUSE_WCSRTOMBS=0
872
873dnl ----------------------------------------------------------------
874dnl toolkit options
875dnl ----------------------------------------------------------------
876
877AC_OVERRIDES(gtk,gtk,
878**--with-gtk use GTK,
879wxUSE_GTK)
880
881AC_OVERRIDES(qt,qt,
882**--with-qt use Qt,
883wxUSE_QT)
884
885AC_OVERRIDES(motif,motif,
886**--with-motif use Motif/Lesstif,
887wxUSE_MOTIF)
888
889dnl ----------------------------------------------------------------
890dnl compile options
891dnl ----------------------------------------------------------------
892
893AC_OVERRIDES(shared,shared,
894**--with-shared create shared libraries,
895wxUSE_SHARED)
896
897AC_OVERRIDES(optimise,optimise,
898**--with-optimise create optimised code,
899wxUSE_OPTIMISE)
900
901AC_OVERRIDES(debug_flag,debug_flag,
902**--with-debug_flag create code with WXDEBUG define set to 1,
903wxUSE_DEBUG_FLAG)
904
905AC_OVERRIDES(debug_info,debug_info,
906**--with-debug_info create code with debuging information,
907wxUSE_DEBUG_INFO)
908
909AC_OVERRIDES(debug_gdb,debug_gdb,
910**--with-debug_gdb create code with extra GDB debuging information,
911wxUSE_DEBUG_GDB)
912
913AC_OVERRIDES(mem_tracing,mem_tracing,
914**--with-mem_traing create code with memory tracing,
915wxUSE_MEM_TRACING)
916
917AC_OVERRIDES(dmalloc,dmalloc,
918**--with-dmalloc use dmalloc memory debug library (www.letters.com/dmalloc/),
919wxUSE_DMALLOC)
920
921AC_OVERRIDES(profile,profile,
922**--with-profile create code with profiling information,
923wxUSE_PROFILE)
924
925AC_OVERRIDES(apple_ieee, apple_ieee,
926**--with_apple_ieee use the Apple IEEE codec,
927wxUSE_APPLE_IEEE)
928
929AC_OVERRIDES(threads,threads,
930**--with-threads for enabling threads,
931wxUSE_THREADS)
932
933AC_OVERRIDES(dynlib,dynlib,
934**--with-dynlib to compile wxLibrary class,
935wxUSE_DYNLIB_CLASS)
936
937dnl ----------------------------------------------------------------
938dnl user options for libraries
939dnl ----------------------------------------------------------------
940
941AC_OVERRIDES(zlib,zlib,
942**--with-zlib use zlib for LZW comression,
943wxUSE_ZLIB)
944
945AC_OVERRIDES(libpng,libpng,
946**--with-libpng use libpng (PNG image format),
947wxUSE_LIBPNG)
948
949AC_OVERRIDES(libjpeg,libjpeg,
950**--with-libjpeg use libjpeg (JPEG image format),
951wxUSE_LIBJPEG)
952
953AC_OVERRIDES(odbc,odbc,
954**--with-odbc use iODBC and wxODBC classes,
955wxUSE_ODBC)
956
957dnl ----------------------------------------------------------------
958dnl user options for non-GUI classes
959dnl ----------------------------------------------------------------
960
961AC_OVERRIDES(timedate, timedate,
962**--with-timedate use wxTime and wxDate classes,
963wxUSE_TIMEDATE)
964
965AC_OVERRIDES(intl,intl,
966**--with-intl use internationalization system,
967wxUSE_INTL)
968
969AC_OVERRIDES(config,config,
970**--with-config use wxConfig class,
971wxUSE_CONFIG)
972
973AC_OVERRIDES(streams,streams,
974**--with-streams use wxStream etc classes,
975wxUSE_STREAMS)
976
977AC_OVERRIDES(serial,serial,
978**--with-serial use class serialization,
979wxUSE_SERIAL)
980
981AC_OVERRIDES(sockets,sockets,
982**--with-sockets use wxSocket etc classes,
983wxUSE_SOCKETS)
984
985dnl ----------------------------------------------------------------
986dnl user options for PostScript
987dnl ----------------------------------------------------------------
988
989AC_OVERRIDES(afmfonts,afmfonts,
990**--with-afmfonts use Adobe Font Metric Font table,
991wxUSE_AFM_FOR_POSTSCRIPT)
992
993AC_OVERRIDES(normalized, normalized,
994**--with-PS-normalized use normalized PS fonts,
995WX_NORMALIZED_PS_FONTS)
996
997AC_OVERRIDES(postscript, postscript,
998**--with-postscript use wxPostscriptDC device context,
999wxUSE_POSTSCRIPT)
1000
1001dnl ----------------------------------------------------------------
1002dnl user options for wxString and Unicode
1003dnl ----------------------------------------------------------------
1004
1005AC_OVERRIDES(unicode,unicode,
1006**--with-unicode compile wxString with Unicode support,
1007wxUSE_UNICODE)
1008
1009AC_OVERRIDES(wcsrtombs,wcsrtombs,
1010**--with-wcsrtombs use wcsrtombs instead of (buggy in GNU libc5) wcstombs,
1011wxUSE_WCSRTOMBS)
1012
1013dnl ----------------------------------------------------------------
1014dnl user options for Prolog and Resources
1015dnl ----------------------------------------------------------------
1016
1017AC_OVERRIDES(wxresources,wxresources,
1018**--with-wxresources use wxWindows's resources,
1019wxUSE_WX_RESOURCES)
1020
1021AC_OVERRIDES(prologio,prologio,
1022**--with-prologio use Prolog IO library,
1023wxUSE_PROLOGIO)
1024
1025AC_OVERRIDES(rpc,RPC,
1026**--with-rpc use Prolog's remote procedure calls,
1027wxUSE_RPC)
1028
1029dnl ----------------------------------------------------------------
1030dnl user options for misc stuff
1031dnl ----------------------------------------------------------------
1032
1033AC_OVERRIDES(ipc,IPC,
1034**--with-ipc use interprocess communication (wxSocket etc.),
1035wxUSE_IPC)
1036
1037AC_OVERRIDES(resources,resources,
1038**--with-resources use X resources for saving information,
1039wxUSE_RESOURCES)
1040
1041AC_OVERRIDES(clipboard,clipboard,
1042**--with-clipboard use wxClipboard classes,
1043wxUSE_CLIPBOARD)
1044
1045AC_OVERRIDES(tooltips,tooltips,
1046**--with-tooltips use tooltips,
1047wxUSE_TOOLTIPS)
1048
1049AC_OVERRIDES(dnd,dnd,
1050**--with-dnd use Drag'n'Drop classes,
1051wxUSE_DRAG_AND_DROP)
1052
1053dnl ----------------------------------------------------------------
1054dnl user options for architectures
1055dnl ----------------------------------------------------------------
1056
1057AC_OVERRIDES(mdi,mdi,
1058**--with-mdi use multiple document interface architecture,
1059wxUSE_MDI_ARCHITECTURE)
1060
1061AC_OVERRIDES(docview,docview,
1062**--with-docview use document view architecture,
1063wxUSE_DOC_VIEW_ARCHITECTURE)
1064
1065AC_OVERRIDES(printarch,printarch,
1066**--with-printarch use printing architecture,
1067wxUSE_PRINTING_ARCHITECTURE)
1068
1069AC_OVERRIDES(help,help,
1070**--with-help use help (using external browser at present),
1071wxUSE_HELP)
1072
1073dnl ----------------------------------------------------------------
1074dnl Unix, obviously
1075dnl ----------------------------------------------------------------
1076
1077if test "$wxUSE_UNIX" = 1 ; then
1078 AC_DEFINE(__UNIX__)
1079fi
1080
1081dnl ----------------------------------------------------------------
1082dnl Linux: test for libc5/glibc2: glibc2 has gettext() included
1083dnl ----------------------------------------------------------------
1084if test "$USE_LINUX" = 1; then
1085 AC_CHECK_LIB(c,gettext,AC_DEFINE(wxHAVE_GLIBC2))
1086fi
1087
1088dnl ----------------------------------------------------------------
1089dnl search for toolkit (widget sets)
1090dnl ----------------------------------------------------------------
1091
1092TOOLKIT=
1093TOOLKIT_DEF=
1094
1095GUI_TK_INCLUDE=
1096GUI_TK_LIBRARY=
1097GUI_TK_LINK=
1098
1099WX_LINK=
1100
1101MAKEINCLUDE=
1102
1103if test "$wxUSE_GTK" = 1; then
1104 AM_PATH_GTK(1.0.0, [
1105 GUI_TK_INCLUDE="$GTK_CFLAGS"
1106 GUI_TK_LIBRARY="$GTK_LIBS"
1107 ], AC_MSG_ERROR(Is gtk-config in path and GTK+ is version 1.2.X or 1.0.X?))
1108 TOOLKIT=GTK
1109 TOOLKIT_DEF=__WXGTK__
1110 WX_LINK=-lwx_gtk2
1111 MAKEINCLUDE=../gtk.inc
1112fi
1113
1114if test "$wxUSE_QT" = 1; then
1115 AC_MSG_CHECKING(for Qt includes)
1116 AC_PATH_FIND_INCLUDES($SEARCH_INCLUDE,qapp.h)
1117 if test "$ac_find_includes" != "" ; then
1118 AC_MSG_RESULT(found $ac_find_includes)
1119 AC_MSG_CHECKING(for Qt library)
1120 AC_PATH_FIND_LIBRARIES($SEARCH_LIB,qt)
1121 if test "$ac_find_libraries" != "" ; then
1122 AC_INCLUDE_PATH_EXIST($ac_find_includes,$CHECK_INCLUDE)
1123 AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
1124 CHECK_LINK="$CHECK_INCLUDE $ac_path_to_link"
1125 CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
1126 AC_MSG_RESULT(found Qt at $ac_find_libraries)
1127 else
1128 AC_MSG_ERROR(no)
1129 fi
1130 else
1131 AC_MSG_ERROR(no)
1132 fi
1133 GUI_TK_LINK="-lX11 -lqt -lm"
1134 TOOLKIT=QT
1135 TOOLKIT_DEF=__WXQT__
1136 WX_LINK=-lwx_qt
1137 MAKEINCLUDE=../qt.inc
1138fi
1139
1140if test "$wxUSE_MOTIF" = 1; then
1141 AC_MSG_CHECKING(for Motif/Lesstif includes)
1142 AC_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
1143 if test "$ac_find_includes" != "" ; then
1144 AC_MSG_RESULT(found $ac_find_includes)
1145 else
1146 AC_MSG_RESULT(no)
1147 AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
1148 fi
1149
1150 AC_MSG_CHECKING(for Motif/Lesstif library)
1151 AC_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
1152 if test "$ac_find_libraries" != "" ; then
1153 AC_INCLUDE_PATH_EXIST($ac_find_includes, $CHECK_INCLUDE)
1154 AC_LINK_PATH_EXIST($ac_find_libraries, $CHECK_LIB)
1155
1156 CHECK_LINK="$CHECK_LIB $ac_path_to_link"
1157 CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
1158 AC_MSG_RESULT(found at $ac_find_libraries)
1159 else
1160 AC_MSG_RESULT(no)
1161 AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
1162 fi
1163
1164 AC_MSG_CHECKING(for Xt library)
1165 AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
1166 if test "$ac_find_libraries" != "" ; then
1167 AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
1168 CHECK_LINK="$CHECK_LIB $ac_path_to_link"
1169 AC_MSG_RESULT(found at $ac_find_libraries)
1170 else
1171 AC_MSG_RESULT(no)
1172 AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
1173 fi
1174
1175 XPM_LINK=""
1176 AC_MSG_CHECKING(for Xpm library)
1177 AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
1178 if test "$ac_find_libraries" != "" ; then
1179 AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
1180 CHECK_LINK="$CHECK_LIB $ac_path_to_link"
1181 XPM_LINK="-lXpm "
1182 AC_DEFINE(wxHAVE_LIB_XPM)
1183 AC_MSG_RESULT(found at $ac_find_libraries)
1184 else
1185 AC_MSG_RESULT(no)
1186 AC_MSG_WARN(library will be compiled without support for images in XPM format)
1187 fi
1188
1189 GUI_TK_LINK="-lXm $(XPM_LINK)-lXmu -lXt -lX11 -lm"
1190 GUI_TK_LIBRARY="$CHECK_LIB $GUI_TK_LINK"
1191 TOOLKIT=MOTIF
1192 TOOLKIT_DEF=__WXMOTIF__
1193 WX_LINK=-lwx_motif2
1194 MAKEINCLUDE=../motif.inc
1195fi
1196
1197if test "$TOOLKIT" = ""; then
1198 AC_MSG_ERROR(You must specify a toolkit: --with-gtk --with-qt --with-motif)
1199fi
1200
1201AC_SUBST(GUI_TK_INCLUDE)
1202AC_SUBST(GUI_TK_LIBRARY)
1203AC_SUBST(GUI_TK_LINK)
1204
1205AC_SUBST(WX_LINK)
1206
1207AC_SUBST(TOOLKIT)
1208AC_SUBST(TOOLKIT_DEF)
1209
1210AC_SUBST(MAKEINCLUDE)
1211
1212dnl ----------------------------------------------------------------
1213dnl Register compile options for makefiles and setup.h
1214dnl ----------------------------------------------------------------
1215
1216EXTRA_LINK=
1217
1218WXDEBUG=
1219if test "$wxUSE_DEBUG_GDB" = 1 ; then
1220 wxUSE_DEBUG_INFO=1
1221 WXDEBUG="-ggdb"
1222fi
1223
1224if test "$wxUSE_DEBUG_INFO" = 1 ; then
1225 WXDEBUG="-g"
1226 wxUSE_OPTIMISE=0
1227fi
1228
1229AC_SUBST(WXDEBUG)
1230
1231if test "$wxUSE_DEBUG_FLAG" = 1 ; then
1232 AC_DEFINE_UNQUOTED(WXDEBUG,$wxUSE_DEBUG_FLAG)
1233 WXDEBUG_DEFINE="-D__WXDEBUG__"
1234 AC_SUBST(WXDEBUG_DEFINE)
1235else
1236 WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
1237 AC_SUBST(WXDEBUG_DEFINE)
1238fi
1239
1240if test "$wxUSE_MEM_TRACING" = 1 ; then
1241 AC_DEFINE_UNQUOTED(wxUSE_MEMORY_TRACING,$wxUSE_MEM_TRACING)
1242 AC_DEFINE_UNQUOTED(wxUSE_GLOBAL_MEMORY_OPERATORS,$wxUSE_MEM_TRACING)
1243fi
1244
1245if test "$wxUSE_DMALLOC" = 1 ; then
1246 EXTRA_LINK="$EXTRA_LINK -ldmalloc"
1247fi
1248AC_SUBST(EXTRA_LINK)
1249
1250PROFILE=
1251if test "$wxUSE_PROFILE" = 1 ; then
1252 PROFILE="-pg"
1253fi
1254AC_SUBST(PROFILE)
1255
1256CXXFLAGS=`echo "${CXXFLAGS}" | sed "s/\-O.//g" `
1257CFLAGS=`echo "${CFLAGS}" | sed "s/\-O.//g" `
1258if test "$wxUSE_OPTIMISE" = 0 ; then
1259 OPTIMISE=
1260else
1261 if test "$GCC" = yes ; then
1262 OPTIMISE="-O2"
1263 case "${canonical}" in
1264 i586-*-*|i686-*-* )
1265 OPTIMISE="${OPTIMISE} "
1266 ;;
1267 esac
1268 else
1269 OPTIMISE="-O"
1270 fi
1271fi
1272AC_SUBST(OPTIMISE)
1273
1274APPLE_IEEE=NONE
1275if test "$wxUSE_APPLE_IEEE" = 1 ; then
1276 APPLE_IEEE="APPLE_IEEE"
1277 AC_DEFINE_UNQUOTED(wxUSE_APPLE_IEEE,$wxUSE_APPLE_IEEE)
1278fi
1279
1280wxUSE_IOSTREAMH=$DEFAULT_wxUSE_IOSTREAMH
1281AC_DEFINE_UNQUOTED(wxUSE_IOSTREAMH,$wxUSE_IOSTREAMH)
1282
1283dnl ----------------------------------------------------------------
1284dnl Register library options for makefiles and setup.h
1285dnl ----------------------------------------------------------------
1286
1287if test "$wxUSE_ZLIB" = 1 ; then
1288 AC_DEFINE_UNQUOTED(wxUSE_ZLIB,$wxUSE_ZLIB)
1289 Z_C_SRC="\$(Z_C_SRC)"
1290fi
1291AC_SUBST(Z_C_SRC)
1292
1293if test "$wxUSE_LIBPNG" = 1 ; then
1294 AC_DEFINE_UNQUOTED(wxUSE_LIBPNG,$wxUSE_LIBPNG)
1295 PNG_C_SRC="\$(PNG_C_SRC)"
1296fi
1297AC_SUBST(PNG_C_SRC)
1298
1299JPEG_LINK=""
1300if test "$wxUSE_LIBJPEG" = 1 ; then
1301 AC_DEFINE_UNQUOTED(wxUSE_LIBJPEG,$wxUSE_LIBJPEG)
1302 AC_CHECK_LIB(jpeg,main,,AC_MSG_ERROR("libjpeg is not available."))
1303 JPEG_LINK="-ljpeg"
1304fi
1305AC_SUBST(JPEG_LINK)
1306
1307IODBC_C_SRC=""
1308if test "$wxUSE_ODBC" = 1 ; then
1309 AC_DEFINE_UNQUOTED(wxUSE_ODBC,$wxUSE_ODBC)
1310 IODBC_C_SRC="\$(IODBC_C_SRC)"
1311fi
1312AC_SUBST(IODBC_C_SRC)
1313
1314dnl ----------------------------------------------------------------
1315dnl Register non-GUI class options for makefiles and setup.h
1316dnl ----------------------------------------------------------------
1317
1318if test "$wxUSE_CONFIG" = 1 ; then
1319 AC_DEFINE_UNQUOTED(wxUSE_CONFIG,$wxUSE_CONFIG)
1320fi
1321
1322if test "$wxUSE_TIMEDATE" = 1 ; then
1323 AC_DEFINE_UNQUOTED(wxUSE_TIMEDATE,$wxUSE_TIMEDATE)
1324fi
1325
1326if test "$wxUSE_INTL" = 1 ; then
1327 AC_DEFINE_UNQUOTED(wxUSE_INTL,$wxUSE_INTL)
1328fi
1329
1330if test "$wxUSE_STREAMS" = 1 ; then
1331 AC_DEFINE_UNQUOTED(wxUSE_STREAMS,$wxUSE_STREAMS)
1332fi
1333
1334if test "$wxUSE_SOCKETS" = 1 ; then
1335 AC_DEFINE_UNQUOTED(wxUSE_SOCKETS,$wxUSE_SOCKETS)
1336fi
1337
1338if test "$wxUSE_SERIAL" = 1 ; then
1339 AC_DEFINE_UNQUOTED(wxUSE_SERIAL,$wxUSE_SERIAL)
1340fi
1341
1342dnl ------------------------------------------------------------------------
1343dnl wxSocket
1344dnl ------------------------------------------------------------------------
1345
1346if test "$wxUSE_SOCKETS" = "1"; then
1347 dnl determine the type of third argument for getsockname
1348 AC_MSG_CHECKING(the type of the third argument of getsockname)
1349 AC_TRY_COMPILE(
1350 [#include <sys/socket.h>],
1351 [size_t len; getsockname(0, NULL, &len);],
1352 AC_DEFINE(SOCKLEN_T, size_t) AC_MSG_RESULT(size_t),
1353 AC_TRY_COMPILE(
1354 [#include <sys/socket.h>],
1355 [int len; getsockname(0, NULL, &len);],
1356 AC_DEFINE(SOCKLEN_T, int) AC_MSG_RESULT(int),
1357 AC_MSG_RESULT(unknown)
1358 )
1359 )
1360fi
1361
1362dnl ------------------------------------------------------------------------
1363dnl wxLibrary class
1364dnl ------------------------------------------------------------------------
1365
1366HAVE_DL_FUNCS=0
1367if test "$wxUSE_DYNLIB_CLASS" = "1"; then
1368 dnl the test is a bit complicated because we check for dlopen() both with
1369 dnl and without -ldl
1370 AC_CHECK_FUNCS(dlopen,
1371 [AC_DEFINE(HAVE_DLOPEN) HAVE_DL_FUNCS=1],
1372 [AC_CHECK_LIB(dl, dlopen,
1373 [AC_DEFINE(HAVE_DLOPEN) HAVE_DL_FUNCS=1])])
1374 AC_CHECK_FUNCS(shl_load, [AC_DEFINE(HAVE_SHL_LOAD) HAVE_DL_FUNCS=1])
1375
1376 if test "$HAVE_DL_FUNCS" = 0; then
1377 AC_MSG_WARN("--with-dynlib will be disabled because no function was found to load a shared library on this platform")
1378
1379 wxUSE_DYNLIB_CLASS=0
1380 fi
1381fi
1382
1383if test "$wxUSE_DYNLIB_CLASS" = 1 ; then
1384 AC_DEFINE_UNQUOTED(wxUSE_DYNLIB_CLASS,$wxUSE_DYNLIB_CLASS)
1385fi
1386
1387dnl ----------------------------------------------------------------
1388dnl Register Prolog and Resources options for makefiles and setup.h
1389dnl ----------------------------------------------------------------
1390
1391if test "$wxUSE_RPC" = 1 ; then
1392 AC_DEFINE_UNQUOTED(wxUSE_RPC,$wxUSE_RPC)
1393fi
1394
1395if test "$wxUSE_WX_RESOURCES" = 1 ; then
1396 AC_DEFINE_UNQUOTED(wxUSE_WX_RESOURCES,$wxUSE_WX_RESOURCES)
1397fi
1398
1399if test "$wxUSE_PROLOGIO" = 1 ; then
1400 AC_DEFINE_UNQUOTED(wxUSE_PROLOGIO)
1401fi
1402
1403dnl ----------------------------------------------------------------
1404dnl Register PostScript options for makefiles and setup.h
1405dnl ----------------------------------------------------------------
1406
1407if test "$wxUSE_POSTSCRIPT" = 1 ; then
1408 AC_DEFINE_UNQUOTED(wxUSE_POSTSCRIPT)
1409fi
1410
1411AC_DEFINE_UNQUOTED(wxUSE_AFM_FOR_POSTSCRIPT,$wxUSE_AFM_FOR_POSTSCRIPT)
1412
1413AC_DEFINE_UNQUOTED(WX_NORMALIZED_PS_FONTS,$WX_NORMALIZED_PS_FONTS)
1414
1415dnl ----------------------------------------------------------------
1416dnl Register architecture options for makefiles and setup.h
1417dnl ----------------------------------------------------------------
1418
1419if test "$wxUSE_MDI_ARCHITECTURE" = 1 ; then
1420 AC_DEFINE_UNQUOTED(wxUSE_MDI_ARCHITECTURE,$wxUSE_MDI_ARCHITECTURE)
1421fi
1422
1423if test "$wxUSE_DOC_VIEW_ARCHITECTURE" = 1 ; then
1424 AC_DEFINE_UNQUOTED(wxUSE_DOC_VIEW_ARCHITECTURE,$wxUSE_DOC_VIEW_ARCHITECTURE)
1425fi
1426
1427if test "$wxUSE_PRINTING_ARCHITECTURE" = 1 ; then
1428 AC_DEFINE_UNQUOTED(wxUSE_PRINTING_ARCHITECTURE,$wxUSE_PRINTING_ARCHITECTURE)
1429fi
1430
1431dnl ----------------------------------------------------------------
1432dnl Register wxString options for makefiles and setup.h
1433dnl ----------------------------------------------------------------
1434
1435if test "$wxUSE_UNICODE" = 1 ; then
1436 AC_DEFINE_UNQUOTED(wxUSE_UNICODE)
1437fi
1438
1439if test "$wxUSE_WCSRTOMBS" = 1 ; then
1440 AC_DEFINE_UNQUOTED(wxUSE_WCSRTOMBS)
1441fi
1442
1443dnl ----------------------------------------------------------------
1444dnl Register misc options for makefiles and setup.h
1445dnl ----------------------------------------------------------------
1446
1447if test "$wxUSE_IPC" = 1 ; then
1448 AC_DEFINE_UNQUOTED(wxUSE_IPC)
1449fi
1450
1451if test "$wxUSE_RESOURCES" = 1 ; then
1452 AC_DEFINE_UNQUOTED(wxUSE_RESOURCES,$wxUSE_RESOURCES)
1453fi
1454
1455if test "$wxUSE_CLIPBOARD" = 1 ; then
1456 AC_DEFINE_UNQUOTED(wxUSE_CLIPBOARD,$wxUSE_CLIPBOARD)
1457fi
1458
1459if test "$wxUSE_TOOLTIPS" = 1 ; then
1460 if test "$wxUSE_MOTIF" = 1; then
1461 AC_MSG_WARN(tooltips are not supported yet under Motif, sorry)
1462 wxUSE_TOOLTIPS=0
1463 fi
1464
1465 AC_DEFINE_UNQUOTED(wxUSE_TOOLTIPS,$wxUSE_TOOLTIPS)
1466fi
1467
1468if test "$wxUSE_DRAG_AND_DROP" = 1 ; then
1469 AC_DEFINE_UNQUOTED(wxUSE_DRAG_AND_DROP,$wxUSE_DRAG_AND_DROP)
1470fi
1471
1472dnl ----------------------------------------------------------------
1473dnl No effect yet
1474dnl ----------------------------------------------------------------
1475
1476HELP=NONE
1477if test "$wxUSE_HELP" = 1 ; then
1478 HELP="HELP"
1479 AC_DEFINE_UNQUOTED(wxUSE_HELP,$wxUSE_HELP)
1480fi
1481AC_SUBST(HELP)
1482
1483dnl ----------------------------------------------------------------
1484dnl thread support
1485dnl ----------------------------------------------------------------
1486
1487dnl defines UNIX_THREAD it contains the source file to use for threads. (GL)
1488dnl defines THREADS_LINK it contains the thread library to link with. (GL)
1489dnl defines wxUSE_THREADS if thread support is activated. (GL)
1490
1491THREADS_LINK=""
1492UNIX_THREAD=""
1493
1494if test "$wxUSE_THREADS" = "1"; then
1495 dnl find if POSIX threads are available
1496
1497 dnl standard lib name is pthread
1498 dnl We no longer test for pthread-0.7 as it breaks compilation on some
1499 dnl glibc2 systems, especially for static linkage.
1500 AC_CHECK_LIB(pthread, pthread_create, [
1501 UNIX_THREAD="unix/threadpsx.cpp"
1502 THREADS_LINK="pthread"
1503 ], [
1504 dnl thread functions are in libc_r under FreeBSD
1505 AC_CHECK_LIB(c_r, pthread_create, [
1506 UNIX_THREAD="unix/threadpsx.cpp"
1507 THREADS_LINK="c_r"
1508 ], [
1509 dnl VZ: SGI threads are not supported currently
1510 AC_CHECK_HEADER(sys/prctl.h, [
1511 UNIX_THREAD="gtk/threadsgi.cpp"
1512 ])
1513 ])
1514 ])
1515 if test "$THREADS_LINK" != ""; then
1516 AC_DEFINE(wxUSE_THREADS)
1517 else
1518 AC_MSG_WARN(No thread support on this system)
1519 fi
1520fi
1521
1522if test -z "$UNIX_THREAD"; then
1523 wxUSE_THREADS=0
1524fi
1525
1526dnl do other tests only if we are using threads
1527if test "$wxUSE_THREADS" = "1"; then
1528
1529 dnl define autoconf macro to check for given function in both pthread and
1530 dnl posix4 libraries
1531 dnl usage: AC_FUNC_THREAD(FUNCTION_NAME)
1532 dnl VZ: TODO
1533 dnl AC_DEFUN(AC_FUNC_THREAD,
1534 dnl [
1535 dnl AC_CHECK_LIB($THREADS_LINK, $1,
1536 dnl AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
1537 dnl [AC_CHECK_LIB("posix4", $1,
1538 dnl [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
1539 dnl POSIX4_LINK="-lposix4"
1540 dnl ])
1541 dnl ])
1542 dnl ])
1543
1544 AC_CHECK_HEADERS(sched.h)
1545
1546 AC_CHECK_LIB($THREADS_LINK, sched_yield,
1547 AC_DEFINE(HAVE_SCHED_YIELD),
1548 [AC_CHECK_LIB("posix4", sched_yield,
1549 [AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK="-lposix4"],
1550 AC_MSG_WARN(wxThread::Yield() will not work properly)
1551 )]
1552 )
1553
1554 dnl VZ: we should be checking for all of the following functions instead:
1555 dnl 1. pthread_attr_getschedpolicy
1556 dnl 2. sched_get_priority_min and sched_get_priority_max
1557 dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam
1558 dnl but it seems that if the first one is there, the other ones are too (of
1559 dnl course the proper solution would be to implement AC_FUNC_THREAD above
1560 dnl and do test for them all - anyone?)
1561 AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
1562 AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS),
1563 [AC_CHECK_LIB("posix4", pthread_attr_getschedpolicy,
1564 [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) POSIX4_LINK="-lposix4"],
1565 AC_MSG_WARN(Setting thread priority will not work)
1566 )]
1567 )
1568
1569 AC_CHECK_LIB($THREADS_LINK, pthread_cancel,
1570 AC_DEFINE(HAVE_PTHREAD_CANCEL),
1571 AC_MSG_WARN(wxThread::Kill() will not work properly))
1572
1573 THREADS_LINK="-l$THREADS_LINK"
1574fi
1575
1576AC_SUBST(UNIX_THREAD)
1577AC_SUBST(THREADS_LINK)
1578AC_SUBST(POSIX4_LINK)
1579
1580dnl ------------------------------------------------------------------------
1581dnl compiler options for shared libs
1582dnl ------------------------------------------------------------------------
1583
1584PICFLAGS=
1585CREATE_SHARED=
1586case "${canonical}" in
1587 *-hp-hpux* )
1588 if test "$GCC" != "yes" ; then
1589 CXXFLAGS="${CXXFLAGS} +a1 -z -Aa -D_HPUX_SOURCE"
1590 CFLAGS="${CFLAGS} -z -D_HPUX_SOURCE"
1591 PICFLAGS="+z"
1592 else
1593 PICFLAGS="-fPIC"
1594 fi
1595 LDFLAGS="-Wl,+s"
1596 CREATE_SHARED=sharedHpux
1597 ;;
1598
1599 *-*-linux* )
1600 PICFLAGS=-fPIC
1601 CREATE_SHARED=sharedLinux
1602 ;;
1603
1604 *-*-irix5* | *-*-irix6* )
1605 # PICFLAGS can remain empty, as pic is the default
1606 LDFLAGS="-Wl,+s"
1607 CREATE_SHARED=sharedIrix
1608 AC_DEFINE(SVR4)
1609 ;;
1610
1611 *-*-solaris2* )
1612 if test "$GCC" != "yes" ; then
1613 PICFLAGS="-KPIC"
1614 else
1615 PICFLAGS="-fPIC"
1616 fi
1617 CREATE_SHARED=sharedSolaris2
1618 AC_DEFINE(SVR4)
1619 ;;
1620
1621 *-*-sunos4* )
1622 if test "$GCC" != "yes" ; then
1623 PICFLAGS="-PIC"
1624 else
1625 PICFLAGS="-fPIC"
1626 fi
1627 LDFLAGS="-Wl,+s"
1628 CREATE_SHARED=sharedSunos4
1629 AC_DEFINE(BSD)
1630 ;;
1631
1632 *-*-freebsd* | *-*-netbsd*)
1633 PICFLAGS=-fPIC
1634 CREATE_SHARED=sharedBsd
1635 AC_DEFINE(BSD)
1636 ;;
1637
1638 *-*-osf* )
1639 PICFLAGS="-fPIC"
1640 CREATE_SHARED=sharedOSF
1641 ;;
1642
1643 *-*-dgux5* )
1644 if test "$GCC" != "yes" ; then
1645 PICFLAGS="-K PIC"
1646 else
1647 PICFLAGS="-fPIC"
1648 fi
1649 CREATE_SHARED=sharedDgux
1650 AC_DEFINE(SVR4)
1651 ;;
1652
1653 *-*-sysv5* )
1654 if test "$GCC" != "yes" ; then
1655 PICFLAGS="-K PIC"
1656 else
1657 PICFLAGS="-fPIC"
1658 fi
1659 CREATE_SHARED=sharedSysV
1660 AC_DEFINE(SVR4)
1661 ;;
1662
1663 *-*-aix* )
1664 if test "$GCC" != "yes" ; then
1665 PICFLAGS="-bM\:SRE"
1666 else
1667 PICFLAGS="-fPIC -D__SYSV__"
1668 fi
1669 CREATE_SHARED=sharedAIX
1670 AC_DEFINE(SYSV)
1671 ;;
1672
1673 *)
1674 CREATE_SHARED=
1675 PICFLAGS=
1676esac
1677
1678if test "x$GCC" = xyes; then
1679 CFLAGS="${CFLAGS} -Wall -Wno-unused -Wno-uninitialized -D_REENTRANT -DLEX_SCANNER -DHAVE_LIBDL"
1680fi
1681
1682if test "x$GXX" = xyes; then
1683 if test "$wxUSE_MOTIF" = 1; then
1684 CXXFLAGS="${CXXFLAGS} -Wall -Wno-unused -D_REENTRANT"
1685 else
1686 CXXFLAGS="${CXXFLAGS} -Wall -D_REENTRANT"
1687 fi
1688fi
1689
1690if test "$wxUSE_SHARED" != 1; then
1691 CREATE_SHARED=
1692 PICFLAGS=
1693fi
1694
1695AC_SUBST(OS)
1696AC_SUBST(PICFLAGS)
1697AC_SUBST(CREATE_SHARED)
1698
1699dnl ------------------------------------------------------------------------
1700dnl finish and clean-up
1701dnl ------------------------------------------------------------------------
1702
1703dnl add OS to list of configured
1704echo $OS >> system.list
1705
1706TOOLKIT_DIR=`echo ${TOOLKIT} | tr "A-Z" "a-z"`
1707AC_CONFIG_HEADER(./include/wx/${TOOLKIT_DIR}/setup.h:./setup/setup.hin)
1708
1709AC_OUTPUT(./setup/substit ./wx-config:./wx-config.in,./setup/general/createall)
1710
1711AC_OVERRIDES_DONE
1712