| 1 | AC_DEFUN(AC_CHECK_C_COMPILER, |
| 2 | [ |
| 3 | AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], |
| 4 | [ |
| 5 | if test $enableval = "no"; dnl |
| 6 | then |
| 7 | kde_use_debug_code="no" |
| 8 | kde_use_debug_define=yes |
| 9 | else |
| 10 | kde_use_debug_code="yes" |
| 11 | kde_use_debug_define=no |
| 12 | fi |
| 13 | ], |
| 14 | [kde_use_debug_code="no" |
| 15 | kde_use_debug_define=no |
| 16 | ]) |
| 17 | |
| 18 | dnl Just for configure --help |
| 19 | AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) |
| 20 | |
| 21 | AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], |
| 22 | [ |
| 23 | if test $enableval = "no"; then |
| 24 | kde_use_strict_options="no" |
| 25 | else |
| 26 | kde_use_strict_options="yes" |
| 27 | fi |
| 28 | ], [kde_use_strict_options="no"]) |
| 29 | |
| 30 | AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], |
| 31 | [kde_use_profiling=$enableval], |
| 32 | [kde_use_profiling="no"] |
| 33 | ) |
| 34 | |
| 35 | dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS |
| 36 | CFLAGS=" $CFLAGS" |
| 37 | |
| 38 | AC_PROG_CC |
| 39 | |
| 40 | if test "$GCC" = "yes"; then |
| 41 | if test "$kde_use_debug_code" = "yes"; then |
| 42 | CFLAGS="-g -O2 $CFLAGS" |
| 43 | case $host in |
| 44 | *-*-linux-gnu) |
| 45 | CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" |
| 46 | ;; |
| 47 | esac |
| 48 | else |
| 49 | CFLAGS="-O2 $CFLAGS" |
| 50 | fi |
| 51 | fi |
| 52 | |
| 53 | if test "$kde_use_debug_define" = "yes"; then |
| 54 | CFLAGS="-DNDEBUG $CFLAGS" |
| 55 | fi |
| 56 | |
| 57 | case "$host" in |
| 58 | *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; |
| 59 | *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; |
| 60 | esac |
| 61 | |
| 62 | if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then |
| 63 | LDFLAGS="" |
| 64 | fi |
| 65 | |
| 66 | if test "$kde_use_profiling" = "yes"; then |
| 67 | KDE_CHECK_COMPILER_FLAG(pg, |
| 68 | [ |
| 69 | CFLAGS="-pg $CFLAGS" |
| 70 | ]) |
| 71 | fi |
| 72 | |
| 73 | USE_EXCEPTIONS= |
| 74 | AC_SUBST(USE_EXCEPTIONS) |
| 75 | dnl obsolete macro - provided to keep things going |
| 76 | USE_RTTI= |
| 77 | AC_SUBST(USE_RTTI) |
| 78 | |
| 79 | AC_PROG_CPP |
| 80 | |
| 81 | # the following is to allow programs, that are known to |
| 82 | # have problems when compiled with -O2 |
| 83 | if test -n "$CFLAGS"; then |
| 84 | kde_safe_IFS=$IFS |
| 85 | IFS=" " |
| 86 | NOOPT_CFLAGS="" |
| 87 | for i in $CFLAGS; do |
| 88 | case $i in |
| 89 | -O*) |
| 90 | ;; |
| 91 | *) |
| 92 | NOOPT_CFLAGS="$NOOPT_CFLAGS $i" |
| 93 | ;; |
| 94 | esac |
| 95 | done |
| 96 | IFS=$kde_safe_IFS |
| 97 | fi |
| 98 | |
| 99 | AC_SUBST(NOOPT_CFLAGS) |
| 100 | |
| 101 | KDE_CHECK_FINAL |
| 102 | |
| 103 | ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDEV_ADD_DEPENDENCIES]), []) |
| 104 | |
| 105 | KDE_CXXFLAGS= |
| 106 | AC_SUBST(KDE_CXXFLAGS) |
| 107 | ]) |
| 108 | |
| 109 | AC_DEFUN(KDEV_ADD_DEPENDENCIES, |
| 110 | [ |
| 111 | [A]M_DEPENDENCIES(CC) |
| 112 | ]) |
| 113 | |
| 114 | |
| 115 | dnl just a wrapper to clean up configure.in only for c projects |
| 116 | AC_DEFUN(KDEV_PROG_LIBTOOL, |
| 117 | [ |
| 118 | AC_REQUIRE([AC_CHECK_C_COMPILER]) |
| 119 | AC_REQUIRE([AC_ENABLE_SHARED]) |
| 120 | AC_REQUIRE([AC_ENABLE_STATIC]) |
| 121 | |
| 122 | AC_REQUIRE([AC_LIBTOOL_DLOPEN]) |
| 123 | |
| 124 | AC_LANG_SAVE |
| 125 | AC_LANG_C |
| 126 | AC_OBJEXT |
| 127 | AC_EXEEXT |
| 128 | AC_LANG_RESTORE |
| 129 | |
| 130 | AM_PROG_LIBTOOL |
| 131 | AC_LIBTOOL_SETUP |
| 132 | |
| 133 | LIBTOOL_SHELL="/bin/sh ./libtool" |
| 134 | # LIBTOOL="$LIBTOOL --silent" |
| 135 | ]) |
| 136 | |