Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoconf and configure.exe on Windows

I'm trying to build a Linux-developed library on Windows. This library requires glib and one of the gdk libraries. While I can find 32-bit Windows binaries for most of the dependent libraries, I'd much rather compile everything myself.

I have very little C/C++ experience on Linux, but I already figured out that ./configure is required to get most of the compilation errors that are caused by platform incompatibilities. Unfortunately, all the packages have a configure shell script that can't really run on Windows.

I've installed autoconf for Windows, hoping to create a Windows configure script from configure.ac, but the Windows autoconf is also a bunch of shell scripts that can't really run on Windows.

What should I do? Must I install Cygwin?

like image 450
zmbq Avatar asked Dec 12 '12 09:12

zmbq


People also ask

How do I set up autoconf?

To create a configure script with Autoconf, you need to write an Autoconf input file `configure.in' and run autoconf on it. If you write your own feature tests to supplement those that come with Autoconf, you might also write files called `aclocal.

How do I install AutoMake on Windows?

Installation and UsageThe default installation directory is C:\Progra~1\AutoMake. AutoMake can be installed in another directory, but then you must change in all scripts the reference to "c:/progra~1/automake" accordingly.

What is an autoconf file?

Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention.

How does Autoconf work?

Autoconf essentially runs the preprocessor on your script to produce a portable shell script which will perform all the requisite tests, produce handy log files, preprocess template files, for example to generate Makefile from Makefile.in and and take a standard set of command line arguments.


1 Answers

EDIT (2022):

It's been more than 9 years since I wrote the original answer, and at this moment I would provide a different opinion.

In 2022, Linux is now mainstream platform for development, and less and less people are using Windows to build things that are closely related to Linux. Those software engineers who are forced to use Windows often use dual boot, or VM, or SSH access to a build machine, or Docker. Now, Visual Studio also supports remote Linux target, and even WSL. Crazy.

So, my suggestion as of 2022 is: if you really, really need to build Linux code on the same Windows machine, I'd had a look at these two options:

  • WSL and mingw-w64
  • Docker (this one, for example)

ORIGINAL ANSWER (2012):

I see two options here:

  • emulate Unix environment on Windows
  • cross-compile from Unix/Linux to Windows target platform

While second option might decrease headaches building in native environment, I found it uncomfortable if you are working primarily on Windows, since this requires transferring resulting binaries to Windows machine. Let's have a look at first option instead - emulate Unix environment and build GNU software on Windows.

While some packages might have support for building on Windows without preparing environment, these might be custom solutions done with CMake, Visual Studio, and other non-typical ways of building GNU open-source stuff.

There are two popular options for Unix environment emulation on Windows, Cygwin and Msys. Both of options have they pros and cons and this is a widely discussed topic, I'm not going to dive into that.

BTW, personally I'm using Msys, and never had any problems with that, apart from typical Windows incompatibility issues for some packages.

like image 164
Andrejs Cainikovs Avatar answered Sep 20 '22 15:09

Andrejs Cainikovs